| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Input, Select, Icon } from 'antd' |
| | | import { Form, Row, Col, Input, Select } from 'antd' |
| | | |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import './index.scss' |
| | | |
| | | const MkEditIcon = asyncComponent(() => import('@/components/mkIcon')) |
| | | |
| | | class MainSearch extends Component { |
| | | static propTpyes = { |
| | |
| | | const { getFieldDecorator } = this.props.form |
| | | const fields = [] |
| | | this.props.formlist.forEach((item, index) => { |
| | | if (item.type === 'text') { // 文本搜索 |
| | | if (item.type === 'text') { |
| | | fields.push( |
| | | <Col span={24} key={index}> |
| | | <Form.Item label={item.label}> |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'select') { // 下拉搜索 |
| | | } else if (item.type === 'select') { |
| | | fields.push( |
| | | <Col span={24} key={index}> |
| | | <Form.Item label={item.label}> |
| | |
| | | > |
| | | {item.options.map(option => |
| | | <Select.Option id={option.MenuID} key={option.MenuID} value={option.MenuID}> |
| | | {item.key === 'icon' && <Icon type={option.text} />} {option.text || option.MenuName} |
| | | {option.text || option.MenuName} |
| | | </Select.Option> |
| | | )} |
| | | </Select> |
| | |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'icon') { |
| | | fields.push( |
| | | <Col span={24} key={index}> |
| | | <Form.Item label={item.label}> |
| | | {getFieldDecorator(item.key, { |
| | | initialValue: item.initVal || '', |
| | | rules: [ |
| | | { |
| | | required: !!item.required, |
| | | message: this.props.dict['form.required.select'] + item.label + '!' |
| | | } |
| | | ] |
| | | })( |
| | | <MkEditIcon options={['normal', 'data', 'direction', 'edit', 'hint']} /> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } |
| | | }) |
| | | return fields |