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/comtableconfig/index.jsx |   47 +++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 41 insertions(+), 6 deletions(-)

diff --git a/src/templates/comtableconfig/index.jsx b/src/templates/comtableconfig/index.jsx
index 5f01667..5c221c9 100644
--- a/src/templates/comtableconfig/index.jsx
+++ b/src/templates/comtableconfig/index.jsx
@@ -40,6 +40,7 @@
 class ComTableConfig extends Component {
   static propTpyes = {
     menu: PropTypes.any,
+    optionLibs: PropTypes.any,
     supMenuList: PropTypes.array,
     reloadmenu: PropTypes.func,
     handleView: PropTypes.func
@@ -70,7 +71,8 @@
     funcLoading: false,      // 瀛樺偍杩囩▼鍒涘缓涓�
     showColumnName: false,   // 鏄剧ず鍒楀瓧娈靛悕鎺у埗
     tabviews: [],            // 鎵�鏈夋爣绛鹃〉
-    profileVisible: false    // 楠岃瘉淇℃伅妯℃�佹
+    profileVisible: false,   // 楠岃瘉淇℃伅妯℃�佹
+    optionLibs: null         // 鑷畾涔変笅鎷夐�夐」搴�
   }
 
   /**
@@ -79,7 +81,7 @@
    * 2銆佽缃搷浣滅被鍨嬨�佸師濮嬭彍鍗曚俊鎭紙姣忔淇濆瓨鍚庨噸缃級銆佸凡浣跨敤琛ㄥ強鍩烘湰淇℃伅琛ㄥ崟
    */
   UNSAFE_componentWillMount () {
-    const { menu } = this.props
+    const { menu, optionLibs } = this.props
 
     let _LongParam = menu.LongParam
     let _config = ''
@@ -92,6 +94,21 @@
       _config.isAdd = true
     } else {
       _config = _LongParam
+      _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: menu.MenuName,
+            type: 'search',
+            options: item.options
+          })
+        }
+      })
     }
 
     // 閰嶇疆榛樿鍊硷紝鍏煎
@@ -135,6 +152,7 @@
 
     this.setState({
       config: _config,
+      optionLibs: optionLibs,
       originActions: _oriActions,
       originMenu: JSON.parse(JSON.stringify(menu)),
       selectedTables: _config.tables || [],
@@ -521,10 +539,24 @@
    */
   handleSubmit = () => {
     const { menu } = this.props
-    const { config, card, modaltype } = this.state
+    const { config, card, 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: menu.MenuName,
+            type: 'search',
+            options: res.options
+          })
+        }
+
         let _search = config.search.map(item => {
           if (item.uuid === res.uuid) {
             return res
@@ -536,6 +568,7 @@
 
         this.setState({
           config: {...config, search: _search},
+          optionLibs: optionLibs,
           modaltype: ''
         })
       })
@@ -1126,7 +1159,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,
@@ -2301,7 +2334,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 = {
@@ -2329,7 +2362,7 @@
    */
   setSubConfig = (item, type) => {
     const { menu } = this.props
-    const { config, originMenu } = this.state
+    const { config, originMenu, optionLibs } = this.state
 
     if (!originMenu.MenuID) { // menuID涓嶅瓨鍦ㄦ椂锛屼负鏂板缓鑿滃崟锛屾彁绀鸿彍鍗曞皻鏈繚瀛�
       notification.warning({
@@ -2381,6 +2414,7 @@
         }
 
         let param = {
+          optionLibs: optionLibs,
           editMenu: _originMenu,
           editTab: !isbutton ? item : '',
           tabConfig: null,
@@ -2815,6 +2849,7 @@
           <SearchForm
             dict={this.state.dict}
             card={this.state.card}
+            optionLibs={this.state.optionLibs}
             formlist={this.state.formlist}
             wrappedComponentRef={(inst) => this.searchFormRef = inst}
           />

--
Gitblit v1.8.0