From 592ff0aa0f2d45d143872b672a1468e268d3157f Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期六, 22 二月 2020 17:25:20 +0800 Subject: [PATCH] 2020-02-22 --- src/templates/subtableconfig/index.jsx | 46 +++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 41 insertions(+), 5 deletions(-) diff --git a/src/templates/subtableconfig/index.jsx b/src/templates/subtableconfig/index.jsx index d649cfb..1b37f90 100644 --- a/src/templates/subtableconfig/index.jsx +++ b/src/templates/subtableconfig/index.jsx @@ -38,6 +38,7 @@ class SubTableConfig extends Component { static propTpyes = { menu: PropTypes.any, + optionLibs: PropTypes.any, editTab: PropTypes.any, tabConfig: PropTypes.any, editSubTab: PropTypes.any, @@ -75,7 +76,8 @@ funcLoading: false, // 瀛樺偍杩囩▼鍒涘缓涓� showColumnName: false, // 鏄剧ず鍒楀瓧娈靛悕鎺у埗 tabviews: [], // 鎵�鏈夋爣绛鹃〉 - profileVisible: false // 楠岃瘉淇℃伅妯℃�佹 + profileVisible: false, // 楠岃瘉淇℃伅妯℃�佹 + optionLibs: null // 鑷畾涔変笅鎷夐�夐」搴� } /** @@ -84,7 +86,7 @@ * 2銆佽缃搷浣滅被鍨嬨�佸師濮嬭彍鍗曚俊鎭紙姣忔淇濆瓨鍚庨噸缃級銆佸凡浣跨敤琛ㄥ強鍩烘湰淇℃伅琛ㄥ崟 */ UNSAFE_componentWillMount () { - const { config, editTab, editSubTab } = this.props + const { config, editTab, editSubTab, optionLibs } = this.props let _config = null @@ -95,6 +97,22 @@ _config.isAdd = true } else { _config = JSON.parse(JSON.stringify(config)) + + _config.search.forEach(item => { + if ( + (item.type === 'select' || item.type === 'multiselect' || item.type === 'link') && + item.resourceType === '0' && + item.options && item.options.length > 0 + ) { + optionLibs.set(item.uuid, { + uuid: item.uuid, + label: item.label, + parname: _config.tabName, + type: 'search', + options: item.options + }) + } + }) } let _oriActions = [] @@ -117,6 +135,7 @@ this.setState({ originActions: _oriActions, + optionLibs: optionLibs, config: _config, originConfig: _config, selectedTables: _config.tables || [], @@ -293,6 +312,7 @@ let param = { editMenu: menu, + optionLibs: this.state.optionLibs, editTab: editSubTab ? editTab : null, tabConfig: null, editSubTab: null, @@ -390,10 +410,24 @@ * 3銆佹坊鍔犳垨缂栬緫鍒楋紝淇濆瓨鏃讹紝濡傛寜閽綅缃缃负琛ㄦ牸锛屽垯淇敼鎿嶄綔鍒楁樉绀虹姸鎬� */ handleSubmit = () => { - const { card, config, modaltype } = this.state + const { card, config, modaltype, optionLibs } = this.state if (modaltype === 'search') { this.searchFormRef.handleConfirm().then(res => { + if ( // 鏇存柊涓嬫媺瀛楀吀 + (res.type === 'select' || res.type === 'multiselect' || res.type === 'link') && + res.resourceType === '0' && + res.options && res.options.length > 0 + ) { + optionLibs.set(res.uuid, { + uuid: res.uuid, + label: res.label, + parname: config.tabName, + type: 'search', + options: res.options + }) + } + let _search = config.search.map(item => { if (item.uuid === res.uuid) { return res @@ -405,6 +439,7 @@ this.setState({ config: {...config, search: _search}, + optionLibs: optionLibs, modaltype: '' }) }) @@ -900,7 +935,7 @@ return } - if (setting.dataresource.length > 50 && config.setting.dataresource !== setting.dataresource) { + if (/[^\s]+\s+[^\s]+/ig.test(setting.dataresource) && config.setting.dataresource !== setting.dataresource) { let param = { func: 's_DataSrc_Save', LText: setting.dataresource, @@ -1859,7 +1894,7 @@ if ( res.interType === 'inner' && !res.innerFunc && - res.dataresource.length > 50 && + /[^\s]+\s+[^\s]+/ig.test(res.dataresource) && config.setting.dataresource !== res.dataresource ) { let param = { @@ -1923,6 +1958,7 @@ let param = { editMenu: menu, + optionLibs: this.state.optionLibs, editTab: editTab, tabConfig: editSubTab ? tabConfig : originConfig, editSubTab: _subtab, -- Gitblit v1.8.0