| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Input, Select, Icon, Tooltip, Radio } from 'antd' |
| | | import { Form, Row, Col, Input, Select, Icon, Tooltip, Radio, InputNumber } from 'antd' |
| | | import { formRule } from '@/utils/option.js' |
| | | import Utils from '@/utils/utils.js' |
| | | import './index.scss' |
| | |
| | | tabs: PropTypes.array, // 可关联标签集 |
| | | dict: PropTypes.object, // 字典项 |
| | | formlist: PropTypes.any, // 表单 |
| | | levels: PropTypes.any, // 标签显示级别 |
| | | card: PropTypes.object, // 标签页信息 |
| | | inputSubmit: PropTypes.any // 回车提交事件 |
| | | } |
| | |
| | | ..._tabs |
| | | ] |
| | | item.initVal = '' |
| | | item.hidden = true |
| | | } |
| | | return item |
| | | }) |
| | | }, () => { |
| | | this.setState({ |
| | | formlist: this.state.formlist.map(item => { |
| | | if (item.key === 'linkTab') { |
| | | item.hidden = false |
| | | } |
| | | return item |
| | | }) |
| | | }) |
| | | if (this.props.form.getFieldValue('linkTab') !== undefined) { |
| | | this.props.form.setFieldsValue({linkTab: ''}) |
| | | } |
| | | }) |
| | | } else if (key === 'supMenu' && this.props.levels) { |
| | | |
| | | if (value && value !== 'mainTable') { |
| | | this.props.form.setFieldsValue({level: this.props.levels[value]}) |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | this.state.formlist.forEach((item, index) => { |
| | | if (item.hidden || item.forbid) return |
| | | |
| | | if (item.type === 'text') { // 文本搜索 |
| | | if (item.type === 'text') { |
| | | let rules = [] |
| | | |
| | | if (item.key === 'foreignKey') { |
| | |
| | | ...rules |
| | | ] |
| | | })(<Input placeholder="" autoComplete="off" disabled={item.readonly} onPressEnter={this.handleSubmit} />)} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'number') { |
| | | fields.push( |
| | | <Col span={12} key={index}> |
| | | <Form.Item label={ |
| | | item.tooltip ? |
| | | <Tooltip placement="topLeft" title={item.tooltip}> |
| | | <Icon type="question-circle" /> |
| | | {item.label} |
| | | </Tooltip> : item.label |
| | | }> |
| | | {getFieldDecorator(item.key, { |
| | | initialValue: item.initVal, |
| | | rules: [ |
| | | { |
| | | required: !!item.required, |
| | | message: this.props.dict['form.required.input'] + item.label + '!' |
| | | } |
| | | ] |
| | | })(<InputNumber disabled={item.readonly} min={item.min} max={item.max} precision={0} />)} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | |
| | | } |
| | | } |
| | | return ( |
| | | <Form {...formItemLayout} className="ant-advanced-search-form commontable-tab-form"> |
| | | <Form {...formItemLayout} className="model-tab-form"> |
| | | <Row gutter={24}>{this.getFields()}</Row> |
| | | </Form> |
| | | ) |