| | |
| | | * 3、设置编辑参数项-formlist |
| | | */ |
| | | handleForm = (card) => { |
| | | const {menu, tabConfig, subTabConfig} = this.props |
| | | |
| | | const { config } = this.state |
| | | let _inputfields = [] |
| | | let _linkableFields = [] |
| | | let _formfields = [] |
| | | |
| | | // 设置下拉菜单可关联字段 |
| | | // 设置下拉菜单可关联字段(上级与下级) |
| | | if (config.groups.length > 0) { |
| | | config.groups.forEach(group => { |
| | | let sublist = group.sublist.filter(item => item.type === 'text' || item.type === 'number') |
| | | _inputfields = [..._inputfields, ...sublist] |
| | | |
| | | let suplist = group.sublist.filter(item => item.type === 'select' || item.type === 'link') |
| | | _formfields = [..._formfields, ...suplist] |
| | | }) |
| | | } else { |
| | | _inputfields = config.fields.filter(item => item.type === 'text' || item.type === 'number') |
| | | |
| | | _formfields = config.fields.filter(item => item.type === 'select' || item.type === 'link') |
| | | } |
| | | |
| | | let uniq = new Map() |
| | | _formfields.forEach(item => { |
| | | if (item.field && !uniq.has(item.field)) { |
| | | uniq.set(item.field, true) |
| | | |
| | | _linkableFields.push({ |
| | | value: item.field, |
| | | text: item.label + ' (表单)' |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | if (subTabConfig) { |
| | | subTabConfig.columns.forEach(col => { |
| | | if (col.field && !uniq.has(col.field)) { |
| | | uniq.set(col.field, true) |
| | | |
| | | _linkableFields.push({ |
| | | value: col.field, |
| | | text: col.label + ' (显示列)' |
| | | }) |
| | | } |
| | | }) |
| | | } else if (tabConfig) { |
| | | tabConfig.columns.forEach(col => { |
| | | if (col.field && !uniq.has(col.field)) { |
| | | uniq.set(col.field, true) |
| | | |
| | | _linkableFields.push({ |
| | | value: col.field, |
| | | text: col.label + ' (显示列)' |
| | | }) |
| | | } |
| | | }) |
| | | } else if (menu.LongParam) { |
| | | menu.LongParam.columns.forEach(col => { |
| | | if (col.field && !uniq.has(col.field)) { |
| | | uniq.set(col.field, true) |
| | | |
| | | _linkableFields.push({ |
| | | value: col.field, |
| | | text: col.label + ' (显示列)' |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | if (card.linkSubField && card.linkSubField.length > 0) { |
| | | let fields = _inputfields.map(item => item.field) |
| | | card.linkSubField = card.linkSubField.filter(item => fields.includes(item)) |
| | |
| | | this.setState({ |
| | | visible: true, |
| | | card: card, |
| | | formlist: getModalForm(card, _inputfields, !!this.props.editTab) |
| | | formlist: getModalForm(card, _inputfields, _linkableFields, !!this.props.editTab) |
| | | }) |
| | | } |
| | | |