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/formtabconfig/index.jsx |   49 ++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 44 insertions(+), 5 deletions(-)

diff --git a/src/templates/formtabconfig/index.jsx b/src/templates/formtabconfig/index.jsx
index 1d89f85..27bb489 100644
--- a/src/templates/formtabconfig/index.jsx
+++ b/src/templates/formtabconfig/index.jsx
@@ -36,6 +36,7 @@
 class ComTableConfig extends Component {
   static propTpyes = {
     menu: PropTypes.any,
+    optionLibs: PropTypes.any,
     btnTab: PropTypes.object,
     config: PropTypes.any,
     handleView: PropTypes.func
@@ -64,7 +65,8 @@
     tabviews: [],            // 鎵�鏈夋爣绛鹃〉
     profileVisible: false,   // 楠岃瘉淇℃伅妯℃�佹
     editgroup: null,         // 褰撳墠缂栬緫缁�
-    groupVisible: false      // 缂栬緫缁勬ā鎬佹
+    groupVisible: false,     // 缂栬緫缁勬ā鎬佹
+    optionLibs: null         // 鑷畾涔変笅鎷夐�夐」搴�
   }
 
   /**
@@ -73,7 +75,7 @@
    * 2銆佽缃搷浣滅被鍨嬨�佸師濮嬭彍鍗曚俊鎭紙姣忔淇濆瓨鍚庨噸缃級銆佸凡浣跨敤琛ㄥ強鍩烘湰淇℃伅琛ㄥ崟
    */
   UNSAFE_componentWillMount () {
-    const { menu, btnTab, config } = this.props
+    const { menu, btnTab, config, optionLibs } = this.props
 
     let _config = ''
     let columns = []
@@ -86,6 +88,24 @@
       }
     } else {
       _config = config
+
+      _config.groups.forEach(group => {
+        group.sublist.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: btnTab.label,
+              type: 'Modal',
+              options: item.options
+            })
+          }
+        })
+      })
     }
 
     if (menu && menu.LongParam && menu.LongParam.columns) {
@@ -94,6 +114,7 @@
 
     this.setState({
       config: _config,
+      optionLibs: optionLibs,
       columns: columns,
       originMenu: JSON.parse(JSON.stringify(_config)),
       selectedTables: _config.tables,
@@ -247,6 +268,7 @@
     let _tabview = menu ? menu.LongParam.Template : ''
     let param = {
       editMenu: menu,
+      optionLibs: this.state.optionLibs,
       editTab: null,
       tabConfig: null,
       editSubTab: null,
@@ -493,10 +515,24 @@
    * 3銆佹坊鍔犳垨缂栬緫鍒楋紝淇濆瓨鏃讹紝濡傛寜閽綅缃缃负琛ㄦ牸锛屽垯淇敼鎿嶄綔鍒楁樉绀虹姸鎬�
    */
   handleSubmit = () => {
-    const { config, modaltype } = this.state
+    const { btnTab } = this.props
+    const { config, modaltype, optionLibs } = this.state
 
     if (modaltype === 'search') {
       this.modalFormRef.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: btnTab.label,
+            type: 'Modal',
+            options: res.options
+          })
+        }
         let _groups = config.groups.map(group => {
           group.sublist = group.sublist.map(item => {
             if (item.uuid === res.uuid) {
@@ -513,6 +549,7 @@
 
         this.setState({
           config: {...config, groups: _groups},
+          optionLibs: optionLibs,
           modaltype: ''
         })
       })
@@ -882,7 +919,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,
@@ -1730,7 +1767,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 = {
@@ -1783,6 +1820,7 @@
 
           let param = {
             editMenu: menu,
+            optionLibs: this.state.optionLibs,
             editTab: btn,
             tabConfig: null,
             editSubTab: null,
@@ -2205,6 +2243,7 @@
             dict={this.state.dict}
             card={this.state.card}
             formlist={this.state.formlist}
+            optionLibs={this.state.optionLibs}
             wrappedComponentRef={(inst) => this.modalFormRef = inst}
           />
         </Modal>

--
Gitblit v1.8.0