File was renamed from src/components/sidemenu/comtableconfig/menuform/index.jsx |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | // import { is, fromJS } from 'immutable' |
| | | import { Form, Row, Col, Input, Select, Icon, Radio } from 'antd' |
| | | import moment from 'moment' |
| | | import EditTable from '../editable' |
| | |
| | | class MainSearch extends Component { |
| | | static propTpyes = { |
| | | dict: PropTypes.object, // 字典项 |
| | | formlist: PropTypes.array |
| | | formlist: PropTypes.any |
| | | } |
| | | |
| | | state = { |
| | | card: null, |
| | | inputType: 'text', |
| | | selectType: 0, |
| | | options: null |
| | | options: null, |
| | | formlist: null |
| | | } |
| | | |
| | | openTypeChange = (key, value) => { |
| | |
| | | showSearch |
| | | filterOption={(input, option) => option.props.children[2].toLowerCase().indexOf(input.toLowerCase()) >= 0} |
| | | onChange={(value) => {this.openTypeChange(item.key, value)}} |
| | | getPopupContainer={() => document.getElementById('form-box')} |
| | | getPopupContainer={() => document.getElementById('commontable-search-form-box')} |
| | | > |
| | | {item.options.map(option => |
| | | <Select.Option id={option.MenuID} title={option.text} key={option.MenuID} value={option.MenuID}> |
| | |
| | | <Col span={18} offset={6} key={'table' + index}> |
| | | <Form.Item className="text-area"> |
| | | {getFieldDecorator('datasource', { |
| | | initialValue: '', |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: this.props.dict['form.required.input'] + 'datasource !' |
| | | } |
| | | ] |
| | | initialValue: '' |
| | | })(<TextArea rows={4} />)} |
| | | </Form.Item> |
| | | </Col> |
| | |
| | | } |
| | | values.id = this.state.card.id |
| | | values.uuid = this.state.card.uuid |
| | | resolve(values) |
| | | resolve({ |
| | | type: 'search', |
| | | values |
| | | }) |
| | | } else { |
| | | reject(err) |
| | | } |
| | |
| | | }) |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | let _item = this.props.formlist.filter(cell => cell.key === 'type')[0] |
| | | resetForm = (formlist) => { |
| | | if (!formlist) return |
| | | let _item = formlist.filter(cell => cell.key === 'type')[0] |
| | | if (_item.initVal === 'select') { |
| | | this.setState({ |
| | | inputType: 'select', |
| | |
| | | } |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | this.resetForm(this.props.formlist) |
| | | } |
| | | |
| | | render() { |
| | | const formItemLayout = { |
| | | labelCol: { |
| | |
| | | } |
| | | } |
| | | return ( |
| | | <Form {...formItemLayout} className="ant-advanced-search-form commontable-form" id="form-box"> |
| | | <Form {...formItemLayout} className="ant-advanced-search-form commontable-search-form" id="commontable-search-form-box"> |
| | | <Row gutter={24}>{this.getFields()}</Row> |
| | | </Form> |
| | | ) |