From 822bc67061448c6e3a1eb77d39be4ad2b84b416a Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 27 二月 2020 09:36:34 +0800 Subject: [PATCH] 2020-02-27 --- src/templates/modalconfig/index.jsx | 61 +++++++++++++++++++++++++++++- 1 files changed, 59 insertions(+), 2 deletions(-) diff --git a/src/templates/modalconfig/index.jsx b/src/templates/modalconfig/index.jsx index 716b5bc..36a5db4 100644 --- a/src/templates/modalconfig/index.jsx +++ b/src/templates/modalconfig/index.jsx @@ -373,18 +373,75 @@ * 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)) @@ -393,7 +450,7 @@ this.setState({ visible: true, card: card, - formlist: getModalForm(card, _inputfields, !!this.props.editTab) + formlist: getModalForm(card, _inputfields, _linkableFields, !!this.props.editTab) }) } -- Gitblit v1.8.0