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/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 9982fb4..f290ca9 100644
--- a/src/templates/modalconfig/index.jsx
+++ b/src/templates/modalconfig/index.jsx
@@ -31,6 +31,7 @@
 class ComTableConfig extends Component {
   static propTpyes = {
     menu: PropTypes.any,
+    optionLibs: PropTypes.any,
     editTab: PropTypes.any,
     editSubTab: PropTypes.any,
     tabConfig: PropTypes.any,
@@ -61,7 +62,8 @@
     selectedTables: [],    // 宸查�夎〃鍚�
     originConfig: null,    // 鍘熷鑿滃崟
     groupVisible: false,   // 鍏ㄥ眬閰嶇疆妯℃�佹
-    curgroup: null         // 褰撳墠缁勶紝鏂板缓鎴栫紪杈�
+    curgroup: null,        // 褰撳墠缁勶紝鏂板缓鎴栫紪杈�
+    optionLibs: null       // 鑷畾涔変笅鎷夐�夐」搴�
   }
 
   /**
@@ -72,7 +74,7 @@
    * 4銆佽缃寜閽熀鏈俊鎭�
    */
   UNSAFE_componentWillMount () {
-    const {menu, editAction, tabConfig, subTabConfig, subConfig} = this.props
+    const {menu, editAction, tabConfig, subTabConfig, subConfig, optionLibs} = this.props
 
     let _config = ''
     let _tab = subTabConfig ? subTabConfig : tabConfig
@@ -87,6 +89,42 @@
 
     if (subConfig) {
       _config = subConfig
+
+      if (_config.groups.length > 0) {
+        _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: editAction.label,
+                type: 'Modal',
+                options: item.options
+              })
+            }
+          })
+        })
+      } else {
+        _config.fields.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: editAction.label,
+              type: 'Modal',
+              options: item.options
+            })
+          }
+        })
+      }
     } else {
       _config = JSON.parse(JSON.stringify((Source.baseConfig)))
     }
@@ -100,6 +138,7 @@
 
     this.setState({
       menu: _menu,
+      optionLibs: optionLibs,
       config: _config,
       selectedTables: _config.tables || [],
       originConfig: JSON.parse(JSON.stringify(_config)),
@@ -231,6 +270,7 @@
     
     let param = {
       editMenu: menu,
+      optionLibs: this.state.optionLibs,
       editTab: editTab,
       tabConfig: tabConfig,
       editSubTab: editSubTab,
@@ -364,8 +404,23 @@
    * 3銆侀�氳繃loading鍒锋柊
    */
   handleSubmit = () => {
+    const {editAction, optionLibs} = this.props
     this.formRef.handleConfirm().then(res => {
       let _config = JSON.parse(JSON.stringify(this.state.config))
+
+      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: editAction.label,
+          type: 'Modal',
+          options: res.options
+        })
+      }
 
       if (_config.groups.length > 0) {
         _config.groups.forEach(group => {
@@ -391,6 +446,7 @@
 
       this.setState({
         config: _config,
+        optionLibs: optionLibs,
         visible: false
       })
     })
@@ -1050,6 +1106,7 @@
             dict={this.state.dict}
             card={this.state.card}
             formlist={this.state.formlist}
+            optionLibs={this.state.optionLibs}
             wrappedComponentRef={(inst) => this.formRef = inst}
           />}
         </Modal>

--
Gitblit v1.8.0