From cc87fc060c30597ec2efe38d0c3efe62f4957fd5 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 14 七月 2023 11:20:02 +0800
Subject: [PATCH] 2023-07-14

---
 src/tabviews/basetable/index.jsx |   76 ++++++++++++++++++++++++++++++--------
 1 files changed, 60 insertions(+), 16 deletions(-)

diff --git a/src/tabviews/basetable/index.jsx b/src/tabviews/basetable/index.jsx
index c479441..ccc4b1c 100644
--- a/src/tabviews/basetable/index.jsx
+++ b/src/tabviews/basetable/index.jsx
@@ -25,7 +25,6 @@
     param: PropTypes.any,        // 鍏朵粬椤甸潰浼犻�掔殑鍙傛暟
     Tab: PropTypes.string,       // 寮圭獥鏍囩
     MenuID: PropTypes.string,    // 鑿滃崟Id
-    MenuNo: PropTypes.string,    // 鑿滃崟鍙傛暟
     MenuName: PropTypes.string,  // 鑿滃崟鍚嶇О
     changeTemp: PropTypes.func
   }
@@ -51,12 +50,17 @@
    * @description 鑾峰彇椤甸潰閰嶇疆淇℃伅
    */
   async loadconfig () {
-    const { MenuID } = this.props
+    const { MenuID, MenuName } = this.props
 
     let _param = {
       func: 'sPC_Get_LongParam',
       MenuID: MenuID
     }
+
+    if (window.GLOB.mkHS) {
+      _param.appkey = '20191106103859640976D6E924E464D029CF0'
+    }
+    
     let result = await Api.getCacheConfig(_param)
 
     if (result.status) {
@@ -67,6 +71,8 @@
         config = window.decodeURIComponent(window.atob(result.LongParam))
         config = config.replace(/@mywebsite@\//ig, window.GLOB.baseurl)
         config = JSON.parse(config)
+        config.MenuID = MenuID
+        config.MenuName = MenuName || config.MenuName
       } catch (e) {
         console.warn('Parse Failure')
         config = ''
@@ -156,7 +162,7 @@
         })
       }
 
-      config.components = this.filterComponent(config.components, roleId, window.GLOB.mkActions, skip, param, MenuID)
+      config.components = this.filterComponent(config.components, roleId, window.GLOB.mkActions, skip, param, MenuID, config.MenuName)
 
       let autoMatic = null
       if (config.autoMatic && config.autoMatic.enable === 'true') {
@@ -191,7 +197,7 @@
 
       let BID = param.$BID || ''
 
-      config.components = this.formatSetting(config.components, mainSearch, regs)
+      config.components = this.formatSetting(config.components, regs)
 
       this.setState({
         BID: BID,
@@ -263,11 +269,11 @@
     }
   }
 
-  filterComponent = (components, roleId, permAction, skip, urlparam, pageId) => {
+  filterComponent = (components, roleId, permAction, skip, urlparam, pageId, MenuName) => {
     return components.filter(item => {
       item.$pageId = pageId
 
-      item.$menuname = (this.props.MenuName || '') + '-' + (item.name || '涓昏〃')
+      item.$menuname = (MenuName || '') + '-' + (item.name || '涓昏〃')
 
       if (item.type === 'tabs') {
         item.subtabs = item.subtabs.filter(tab => {
@@ -286,13 +292,13 @@
           if (tab.permission !== 'true') { // 鏉冮檺鏈紑鍚笉鍋氭潈闄愭帶鍒�
             skip = true
           }
-          tab.components = this.filterComponent(tab.components, roleId, permAction, skip, urlparam, pageId)
+          tab.components = this.filterComponent(tab.components, roleId, permAction, skip, urlparam, pageId, MenuName)
           return tab
         })
 
         return true
       } else {
-        item.name = (this.props.MenuName || '')
+        item.name = (MenuName || '')
       }
 
       // 鎼滅储鏉′欢鍒濆鍖�
@@ -348,10 +354,29 @@
                 cell.$MenuID = this.props.MenuID
                 cell.$view = 'popview'
 
-                if (cell.syncComponentId && cell.syncComponentId === item.setting.supModule) {
-                  cell.syncComponentId = ''
-                  if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') {
-                    cell.execSuccess = 'mainline'
+                if (cell.syncComponentId) {
+                  if (cell.syncComponentId === item.setting.supModule) {
+                    cell.syncComponentId = ''
+                    if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') {
+                      cell.execSuccess = 'mainline'
+                    }
+                  } else if (cell.syncComponentId === 'multiComponent') {
+                    let ids = cell.syncComponents.map(m => {
+                      return m.syncComId.pop() || ''
+                    })
+            
+                    if (item.setting.supModule && ids.includes(item.setting.supModule)) {
+                      if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') {
+                        cell.execSuccess = 'mainline'
+                      }
+                      ids = ids.filter(id => id !== item.setting.supModule)
+                    }
+                    
+                    if (ids.length === 0) {
+                      cell.syncComponentId = ''
+                    } else {
+                      cell.syncComponentIds = ids
+                    }
                   }
                 }
 
@@ -414,10 +439,29 @@
           cell.$view = 'popview'
           cell.$toolbtn = true
 
-          if (cell.syncComponentId && cell.syncComponentId === item.setting.supModule) {
-            cell.syncComponentId = ''
-            if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') {
-              cell.execSuccess = 'mainline'
+          if (cell.syncComponentId) {
+            if (cell.syncComponentId === item.setting.supModule) {
+              cell.syncComponentId = ''
+              if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') {
+                cell.execSuccess = 'mainline'
+              }
+            } else if (cell.syncComponentId === 'multiComponent') {
+              let ids = cell.syncComponents.map(m => {
+                return m.syncComId.pop() || ''
+              })
+      
+              if (item.setting.supModule && ids.includes(item.setting.supModule)) {
+                if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') {
+                  cell.execSuccess = 'mainline'
+                }
+                ids = ids.filter(id => id !== item.setting.supModule)
+              }
+              
+              if (ids.length === 0) {
+                cell.syncComponentId = ''
+              } else {
+                cell.syncComponentIds = ids
+              }
             }
           }
 

--
Gitblit v1.8.0