| | |
| | | item.initval = data[item.field] |
| | | } |
| | | |
| | | if (item.supvalue) { |
| | | item.supvalue = item.supvalue.split(',') |
| | | } |
| | | |
| | | _formlist.push(item) |
| | | |
| | | return item |
| | |
| | | |
| | | subfields.push(item) |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | return group |
| | |
| | | |
| | | formlist.forEach((item, index) => { |
| | | if (item.hidden === 'true') return |
| | | |
| | | if (item.supField && !item.supvalue.includes(this.props.form.getFieldValue(item.supField))) return |
| | | |
| | | if (item.type === 'text') { |
| | | fields.push( |
| | |
| | | item.initval = this.props.data[item.field] |
| | | } |
| | | |
| | | if (item.supvalue) { |
| | | item.supvalue = item.supvalue.split(',') |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | |
| | |
| | | |
| | | this.state.formlist.forEach((item, index) => { |
| | | if ((!item.field && item.type !== 'title') || item.hidden === 'true') return |
| | | |
| | | if (item.supField && !item.supvalue.includes(this.props.form.getFieldValue(item.supField))) return |
| | | |
| | | if (item.type === 'title') { |
| | | fields.push( |
| | |
| | | const { config } = this.state |
| | | let _inputfields = [] |
| | | let _linkableFields = [] |
| | | let _linksupFields = [{ |
| | | value: '', |
| | | text: '空' |
| | | }] |
| | | let _formfields = [] |
| | | |
| | | // 设置下拉菜单可关联字段 |
| | |
| | | } |
| | | |
| | | let uniq = new Map() |
| | | uniq.set(card.field, true) |
| | | |
| | | _formfields.forEach(item => { |
| | | if (item.field && !uniq.has(item.field)) { |
| | | uniq.set(item.field, true) |
| | |
| | | _linkableFields.push({ |
| | | value: item.field, |
| | | text: item.label + ' (表单)' |
| | | }) |
| | | _linksupFields.push({ |
| | | value: item.field, |
| | | text: item.label |
| | | }) |
| | | } |
| | | }) |
| | |
| | | this.setState({ |
| | | modaltype: 'search', |
| | | card: card, |
| | | formlist: getModalForm(card, _inputfields, _linkableFields) |
| | | formlist: getModalForm(card, _inputfields, _linkableFields, _linksupFields) |
| | | }) |
| | | } |
| | | |
| | |
| | | const { config } = this.state |
| | | let _inputfields = [] |
| | | let _linkableFields = [] |
| | | let _linksupFields = [{ |
| | | value: '', |
| | | text: '空' |
| | | }] |
| | | let _formfields = [] |
| | | |
| | | // 设置下拉菜单可关联字段(上级与下级) |
| | |
| | | } |
| | | |
| | | let uniq = new Map() |
| | | uniq.set(card.field, true) |
| | | _formfields.forEach(item => { |
| | | if (item.field && !uniq.has(item.field)) { |
| | | uniq.set(item.field, true) |
| | |
| | | _linkableFields.push({ |
| | | value: item.field, |
| | | text: item.label + ' (表单)' |
| | | }) |
| | | _linksupFields.push({ |
| | | value: item.field, |
| | | text: item.label |
| | | }) |
| | | } |
| | | }) |
| | |
| | | visible: true, |
| | | modalType: type, |
| | | card: card, |
| | | formlist: getModalForm(card, _inputfields, _linkableFields, !!this.props.editTab) |
| | | formlist: getModalForm(card, _inputfields, _linkableFields, _linksupFields, !!this.props.editTab) |
| | | }) |
| | | } |
| | | |
| | |
| | | * @param {*} card |
| | | * @param {*} inputfields |
| | | */ |
| | | export function getModalForm (card, inputfields, linkableFields, subtable = false) { |
| | | export function getModalForm (card, inputfields, linkableFields, linksupFields, subtable = false) { |
| | | let _openType = [] |
| | | let _fieldlength = 50 |
| | | |
| | |
| | | }] |
| | | }, |
| | | { |
| | | type: 'multiselect', |
| | | key: 'linkSubField', |
| | | label: Formdict['header.form.linkForm'], |
| | | initVal: card.linkSubField || [], |
| | | options: inputfields |
| | | type: 'number', |
| | | key: 'maxRows', |
| | | label: Formdict['header.form.maxRows'], |
| | | initVal: card.maxRows || 6, |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'supField', |
| | | label: '上级表单', |
| | | tooltip: '上级表单为下拉选择或关联菜单,设置上级表单后,该表单受控于上级菜单,注:受控关系在该表单隐藏时失效。', |
| | | initVal: card.supField || '', |
| | | required: false, |
| | | readonly: false, |
| | | options: linksupFields |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'supvalue', |
| | | label: '显示值', |
| | | tooltip: '选择上级表单后,填写显示值,只有上级表单值与显示值相同时,该表单才会显示,注:多个值用逗号分隔。', |
| | | initVal: card.supvalue || '', |
| | | required: true, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'select', |
| | |
| | | options: [] |
| | | }, |
| | | { |
| | | type: 'number', |
| | | key: 'maxRows', |
| | | label: Formdict['header.form.maxRows'], |
| | | initVal: card.maxRows || 6, |
| | | required: false |
| | | type: 'multiselect', |
| | | key: 'linkSubField', |
| | | label: Formdict['header.form.linkForm'], |
| | | initVal: card.linkSubField || [], |
| | | options: inputfields |
| | | } |
| | | ] |
| | | } |
| | |
| | | state = { |
| | | openType: null, |
| | | resourceType: null, |
| | | supField: '', |
| | | formlist: null, |
| | | linkSubFields: null |
| | | } |
| | |
| | | |
| | | let type = '' |
| | | let resourceType = '' |
| | | let supField = '' |
| | | let linkSubFields = [] |
| | | |
| | | formlist.forEach(cell => { |
| | |
| | | return false |
| | | } |
| | | }) |
| | | } else if (cell.key === 'supField') { |
| | | supField = cell.initVal |
| | | } |
| | | }) |
| | | |
| | |
| | | _options = ['label', 'field', 'type', 'readonly', 'required', 'hidden', 'fieldlength'] |
| | | } |
| | | |
| | | if (type !== 'funcvar' && type !== 'linkMain') { |
| | | if (supField) { |
| | | _options.push('supField', 'supvalue') |
| | | } else { |
| | | _options.push('supField') |
| | | } |
| | | } |
| | | |
| | | this.setState({ |
| | | openType: type, |
| | | supField: supField, |
| | | resourceType: resourceType, |
| | | linkSubFields: linkSubFields, |
| | | formlist: formlist.map(form => { |
| | |
| | | } else if (value === 'linkMain') { |
| | | _options = ['label', 'field', 'type', 'readonly', 'required', 'hidden', 'fieldlength'] |
| | | } |
| | | |
| | | if (value !== 'funcvar' && value !== 'linkMain') { |
| | | if (this.state.supField) { |
| | | _options.push('supField', 'supvalue') |
| | | } else { |
| | | _options.push('supField') |
| | | } |
| | | } |
| | | |
| | | this.setState({ |
| | | openType: value, |
| | |
| | | formlist: this.state.formlist.map(form => { |
| | | if (form.key === 'options') { |
| | | form.initVal = option.options |
| | | } |
| | | |
| | | return form |
| | | }) |
| | | }) |
| | | } else if (key === 'supField') { |
| | | this.setState({ |
| | | supField: value, |
| | | formlist: this.state.formlist.map(form => { |
| | | if (form.key === 'supvalue' && value) { |
| | | form.show = true |
| | | } else if (form.key === 'supvalue' && !value) { |
| | | form.show = false |
| | | } |
| | | |
| | | return form |
| | |
| | | } else if (item.type === 'select') { // 下拉搜索 |
| | | fields.push( |
| | | <Col span={12} key={index}> |
| | | <Form.Item label={item.label}> |
| | | <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: [ |