From 57da72c823fab94a3ec6fadab2bc75173c8a03b1 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 01 十二月 2020 13:45:25 +0800
Subject: [PATCH] 2020-12-01

---
 src/templates/comtableconfig/index.jsx |  148 ++++++++++++++++++++++++-------------------------
 1 files changed, 72 insertions(+), 76 deletions(-)

diff --git a/src/templates/comtableconfig/index.jsx b/src/templates/comtableconfig/index.jsx
index d637149..e7643b1 100644
--- a/src/templates/comtableconfig/index.jsx
+++ b/src/templates/comtableconfig/index.jsx
@@ -205,19 +205,20 @@
 
   getFuncNames = (data, funcNames, tableNames) => {
     data.forEach(item => {
-      if (item.subfuncs) {
-        this.getFuncNames(item.subfuncs, funcNames, tableNames)
-      } else {
-        if (item.tableName) {
-          tableNames.push(item.tableName)
-        }
-        if (item.innerFunc) {
-          funcNames.push({func: item.innerFunc, label: item.label || ''})
-        }
+      // if (item.subfuncs) {
+      //   this.getFuncNames(item.subfuncs, funcNames, tableNames)
+      //   return
+      // }
+      
+      if (item.tableName) {
+        tableNames.push(item.tableName)
+      }
+      if (item.innerFunc) {
+        funcNames.push({func: item.innerFunc, label: item.label || ''})
+      }
 
-        if (item.callbackFunc) {
-          funcNames.push({func: item.callbackFunc, label: item.label || ''})
-        }
+      if (item.callbackFunc) {
+        funcNames.push({func: item.callbackFunc, label: item.label || ''})
       }
     })
 
@@ -355,46 +356,47 @@
     }
 
     new Promise(resolve => {
-      let deffers = []
-      _config.funcs.forEach(item => {
-        if (item.type === 'tab') {
-          let deffer = new Promise(resolve => {
-            Api.getSystemConfig({
-              func: 'sPC_Get_LongParam',
-              MenuID: item.linkTab
-            }).then(result => {
-              if (result.status && result.LongParam) {
-                let _LongParam = ''
+      // let deffers = []
+      // _config.funcs.forEach(item => {
+      //   if (item.type === 'tab') {
+      //     let deffer = new Promise(resolve => {
+      //       Api.getSystemConfig({
+      //         func: 'sPC_Get_LongParam',
+      //         MenuID: item.linkTab
+      //       }).then(result => {
+      //         if (result.status && result.LongParam) {
+      //           let _LongParam = ''
       
-                if (result.LongParam) {
-                  try {
-                    _LongParam = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam)))
-                  } catch (e) {
-                    console.warn('Parse Failure')
-                    _LongParam = ''
-                  }
-                }
+      //           if (result.LongParam) {
+      //             try {
+      //               _LongParam = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam)))
+      //             } catch (e) {
+      //               console.warn('Parse Failure')
+      //               _LongParam = ''
+      //             }
+      //           }
     
-                if (_LongParam) {
-                  item.menuNo = _LongParam.tabNo || ''
-                  item.subfuncs = _LongParam.funcs || []
-                }
-              }
-              resolve()
-            })
-          })
+      //           if (_LongParam) {
+      //             item.menuNo = _LongParam.tabNo || ''
+      //             item.subfuncs = _LongParam.funcs || []
+      //           }
+      //         }
+      //         resolve()
+      //       })
+      //     })
 
-          deffers.push(deffer)
-        }
-      })
+      //     deffers.push(deffer)
+      //   }
+      // })
 
-      if (deffers.length === 0) {
-        resolve()
-      } else {
-        Promise.all(deffers).then(() => {
-          resolve()
-        })
-      }
+      // if (deffers.length === 0) {
+      //   resolve()
+      // } else {
+      //   Promise.all(deffers).then(() => {
+      //     resolve()
+      //   })
+      // }
+      resolve()
     }).then(() => {
       // 淇濆瓨鏃跺垹闄ら厤缃被鍨嬶紝system 銆乽ser
       delete _config.type
@@ -623,10 +625,6 @@
               originMenu: fromJS(_config).toJS()
             })
 
-            this.props.reloadmenu()
-            
-            this.submitAction(btnParam, tabParam)
-
             localParam.func = 'sPC_TrdMenu_AddUpt_For_Local'
             delete localParam.LongParam
             delete localParam.PageParam
@@ -635,7 +633,7 @@
             delete localParam.EasyCode
             delete localParam.open_edition
 
-            Api.getLocalConfig(localParam)
+            this.submitAction(btnParam, tabParam, localParam)
           } else {
             this.setState({
               menuloading: false,
@@ -655,7 +653,7 @@
   /**
    * @description 淇濆瓨鎴栦慨鏀硅彍鍗曟寜閽泦
    */
-  submitAction = (btnParam, tabParam) => {
+  submitAction = (btnParam, tabParam, localParam) => {
     const { config } = this.state
 
     new Promise(resolve => {
@@ -682,29 +680,25 @@
         deffers.push(defer)
       }
 
-      if (deffers.length === 0) {
-        resolve(true)
-      } else {
-        Promise.all(deffers).then(result => {
-          let error = false
-          result.forEach(res => {
-            if (!res.status) {
-              error = res
-            }
-          })
-
-          if (error) {
-            notification.warning({
-              top: 92,
-              message: error.message,
-              duration: 5
-            })
-            resolve(false)
-          } else {
-            resolve(true)
+      Promise.all(deffers).then(result => {
+        let error = false
+        result.forEach(res => {
+          if (!res.status) {
+            error = res
           }
         })
-      }
+
+        if (error) {
+          notification.warning({
+            top: 92,
+            message: error.message,
+            duration: 5
+          })
+          resolve(false)
+        } else {
+          resolve(true)
+        }
+      })
     }).then(response => {
       if (response === false) return response
 
@@ -822,6 +816,8 @@
             menucloseloading: false
           })
         }
+        this.props.reloadmenu()
+        Api.getLocalConfig(localParam)
       } else {
         this.setState({
           menuloading: false,
@@ -1194,7 +1190,7 @@
     const { menu } = this.props
     const { activeKey, config, chartview } = this.state
 
-    const confActions = config.action.filter(_action => !_action.origin && ['pop', 'popview', 'blank', 'tab'].includes(_action.OpenType))
+    const confActions = config.action.filter(_action => !_action.origin && (['pop', 'popview', 'blank'].includes(_action.OpenType) || (_action.OpenType === 'tab' && _action.tabTemplate === 'FormTab')))
 
     let configTabs = []
     config.tabgroups.forEach(group => {

--
Gitblit v1.8.0