| | |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Input, Select, InputNumber, Radio } from 'antd' |
| | | import { formRule } from '@/utils/option.js' |
| | | import './index.scss' |
| | | // import './index.scss' |
| | | |
| | | class MainSearch extends Component { |
| | | static propTpyes = { |
| | | dict: PropTypes.object, // 字典项 |
| | | card: PropTypes.any, |
| | | inputSubmit: PropTypes.any // 回车提交事件 |
| | | } |
| | |
| | | { |
| | | type: 'text', |
| | | key: 'label', |
| | | label: this.props.dict['header.form.name'], |
| | | label: '名称', |
| | | initVal: this.props.card.label, |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'select', |
| | | type: 'radio', |
| | | key: 'Align', |
| | | label: this.props.dict['header.form.align'], |
| | | label: '对齐方式', |
| | | initVal: this.props.card.Align, |
| | | required: true, |
| | | options: [{ |
| | | MenuID: 'left', |
| | | text: this.props.dict['header.form.alignLeft'] |
| | | text: '左对齐' |
| | | }, { |
| | | MenuID: 'right', |
| | | text: this.props.dict['header.form.alignRight'] |
| | | text: '右对齐' |
| | | }, { |
| | | MenuID: 'center', |
| | | text: this.props.dict['header.form.alignCenter'] |
| | | text: '居中' |
| | | }] |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'Width', |
| | | decimal: 0, |
| | | label: this.props.dict['header.form.columnWidth'], |
| | | label: '列宽', |
| | | initVal: this.props.card.Width, |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'style', |
| | | label: this.props.dict['header.form.style'], |
| | | initVal: this.props.card.style, |
| | | type: 'radio', |
| | | key: 'position', |
| | | label: '显示位置', |
| | | initVal: this.props.card.position || 'right', |
| | | required: true, |
| | | options: [{ |
| | | MenuID: 'button', |
| | | text: this.props.dict['header.form.button'] |
| | | MenuID: 'left', |
| | | text: '左侧' |
| | | }, { |
| | | MenuID: 'text', |
| | | text: this.props.dict['header.form.text'] |
| | | }] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'show', |
| | | label: this.props.dict['header.form.order'], |
| | | initVal: this.props.card.show, |
| | | required: true, |
| | | options: [{ |
| | | MenuID: 'horizontal', |
| | | text: this.props.dict['header.form.horizontal'] |
| | | }, { |
| | | MenuID: 'vertical', |
| | | text: this.props.dict['header.form.vertical'] |
| | | MenuID: 'right', |
| | | text: '右侧' |
| | | }] |
| | | } |
| | | ] |
| | |
| | | const { getFieldDecorator } = this.props.form |
| | | const fields = [] |
| | | this.state.formlist.forEach((item, index) => { |
| | | if (item.type === 'text') { // 文本搜索 |
| | | if (item.type === 'text') { |
| | | fields.push( |
| | | <Col span={12} key={index}> |
| | | <Form.Item label={item.label}> |
| | |
| | | rules: [ |
| | | { |
| | | required: !!item.required, |
| | | message: this.props.dict['form.required.input'] + item.label + '!' |
| | | message: '请输入' + item.label + '!' |
| | | }, |
| | | { |
| | | max: formRule.input.max, |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'number') { // 文本搜索 |
| | | } else if (item.type === 'number') { |
| | | fields.push( |
| | | <Col span={12} key={index}> |
| | | <Form.Item label={item.label}> |
| | |
| | | rules: [ |
| | | { |
| | | required: !!item.required, |
| | | message: this.props.dict['form.required.input'] + item.label + '!' |
| | | message: '请输入' + item.label + '!' |
| | | } |
| | | ] |
| | | })(<InputNumber min={1} max={1000} precision={item.decimal} />)} |
| | |
| | | rules: [ |
| | | { |
| | | required: !!item.required, |
| | | message: this.props.dict['form.required.select'] + item.label + '!' |
| | | message: '请选择' + item.label + '!' |
| | | } |
| | | ] |
| | | })( |
| | |
| | | rules: [ |
| | | { |
| | | required: !!item.required, |
| | | message: this.props.dict['form.required.select'] + item.label + '!' |
| | | message: '请选择' + item.label + '!' |
| | | } |
| | | ] |
| | | })( |
| | |
| | | } |
| | | } |
| | | return ( |
| | | <Form {...formItemLayout} className="commontable-gridbtn-column-form" id="gridbtncolumnwinter"> |
| | | <Form {...formItemLayout} style={{minHeight: '190px'}} id="gridbtncolumnwinter"> |
| | | <Row gutter={24}>{this.getFields()}</Row> |
| | | </Form> |
| | | ) |