| | |
| | | } |
| | | } |
| | | |
| | | handleEmpty = () => { |
| | | let field = this.props.form.getFieldValue('valueField') |
| | | |
| | | if (!field) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '请填写值·字段。', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | let text = this.props.form.getFieldValue('valueText') |
| | | |
| | | if (!text) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '请填写文本·字段。', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | let resource = this.props.form.getFieldValue('dataSource') || '' |
| | | |
| | | resource = `select '' as ${field},'全部' as ${text} union all \n${resource}` |
| | | |
| | | this.props.form.setFieldsValue({dataSource: resource}) |
| | | } |
| | | |
| | | getFields() { |
| | | const { getFieldDecorator } = this.props.form |
| | | const { dict } = this.props |
| | |
| | | let rules = [] |
| | | let className = '' |
| | | let content = null |
| | | let extra = null |
| | | let initVal = item.initVal || '' |
| | | |
| | | if (item.type === 'text') { |
| | |
| | | span = 24 |
| | | className = 'text-area' |
| | | |
| | | if (this.record.type === 'select' || this.record.type === 'link') { |
| | | extra = <span className="add-row-empty" onClick={this.handleEmpty}>空</span> |
| | | } |
| | | |
| | | content = <CodeMirror /> |
| | | } else if (item.type === 'textarea') { |
| | | span = 24 |
| | |
| | | if (type === 'radio' && this.record.linkField) { |
| | | type = 'link' |
| | | } |
| | | content = <EditTable type={type} transfield={transfield} linkSubFields={linkSubFields} onChange={this.changeOptions}/> |
| | | content = <EditTable type={type} module="form" transfield={transfield} linkSubFields={linkSubFields} onChange={this.changeOptions}/> |
| | | } else { |
| | | if (this.record.multiple === 'true') { |
| | | linkSubFields = [] |
| | |
| | | |
| | | fields.push( |
| | | <Col span={span} key={index}> |
| | | <Form.Item className={className} label={item.tooltip ? |
| | | <Form.Item className={className} extra={extra} label={item.tooltip ? |
| | | <Tooltip placement="topLeft" title={item.tooltip}> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | {item.label} |