From c66c7b65432af8cdab430b7ac079a4fd75c3d60f Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 10 九月 2021 19:20:58 +0800
Subject: [PATCH] 2021-09-10

---
 src/tabviews/custom/index.jsx |   22 +++++++++++-----------
 1 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx
index 572dc3e..521c756 100644
--- a/src/tabviews/custom/index.jsx
+++ b/src/tabviews/custom/index.jsx
@@ -132,7 +132,8 @@
       // 鏉冮檺杩囨护
       let roleId = sessionStorage.getItem('role_id') || '' // 瑙掕壊ID
       let balMap = new Map()
-      config.components = this.filterComponent(config.components, roleId, permAction, permMenus, balMap)
+      let skip = config.permission === 'false' || this.props.menuType === 'HS'
+      config.components = this.filterComponent(config.components, roleId, permAction, permMenus, balMap, skip)
       
       // 鑾峰彇涓绘悳绱㈡潯浠�
       let mainSearch = []
@@ -445,7 +446,7 @@
     })
   }
 
-  filterComponent = (components, roleId, permAction, permMenus, balMap) => {
+  filterComponent = (components, roleId, permAction, permMenus, balMap, skip) => {
     return components.filter(item => {
       
       if (item.style && item.style.boxShadow) {
@@ -476,7 +477,7 @@
         })
 
         item.subtabs = item.subtabs.map(tab => {
-          tab.components = this.filterComponent(tab.components, roleId, permAction, permMenus, balMap)
+          tab.components = this.filterComponent(tab.components, roleId, permAction, permMenus, balMap, skip)
           return tab
         })
 
@@ -499,7 +500,7 @@
           return false
         }
 
-        item.components = this.filterComponent(item.components, roleId, permAction, permMenus, balMap)
+        item.components = this.filterComponent(item.components, roleId, permAction, permMenus, balMap, skip)
       } else if (['pie', 'bar', 'line', 'dashboard', 'scatter'].includes(item.type)) {
         if (
           item.plot.blacklist && item.plot.blacklist.length > 0 &&
@@ -562,7 +563,6 @@
       }
 
       // 鏉冮檺杩囨护
-      let isHS = this.props.menuType === 'HS'
       let tabId = this.props.Tab ? this.props.Tab.uuid : '' // 寮圭獥鏍囩鎸夐挳Id
       if (item.action && item.action.length > 0) {
         item.action = item.action.filter(cell => {
@@ -584,7 +584,7 @@
             cell.style = {...cell.style, ...cell.btnstyle}
           }
 
-          return isHS || permAction[cell.uuid]
+          return skip || permAction[cell.uuid]
         })
       }
 
@@ -622,7 +622,7 @@
               cell.innerHeight = 'auto'
             }
 
-            return cell.eleType !== 'button' || isHS || permAction[cell.uuid]
+            return cell.eleType !== 'button' || skip || permAction[cell.uuid]
           })
           card.backElements = card.backElements.filter(cell => {
             if (cell.eleType === 'button') {
@@ -646,7 +646,7 @@
             } else if (['text', 'number', 'link'].includes(cell.eleType) && !cell.height && _hasheight) {
               cell.innerHeight = 'auto'
             }
-            return cell.eleType !== 'button' || isHS || permAction[cell.uuid]
+            return cell.eleType !== 'button' || skip || permAction[cell.uuid]
           })
         })
       } else if (item.type === 'balcony') {
@@ -672,7 +672,7 @@
             cell.innerHeight = 'auto'
           }
 
-          return cell.eleType !== 'button' || isHS || permAction[cell.uuid]
+          return cell.eleType !== 'button' || skip || permAction[cell.uuid]
         })
       } else if ((item.type === 'table' && item.subtype === 'tablecard') || item.type === 'carousel') {
         item.subcards && item.subcards.forEach(card => {
@@ -700,7 +700,7 @@
             } else if (['text', 'number', 'link'].includes(cell.eleType) && !cell.height && _hasheight) {
               cell.innerHeight = 'auto'
             }
-            return cell.eleType !== 'button' || isHS || permAction[cell.uuid]
+            return cell.eleType !== 'button' || skip || permAction[cell.uuid]
           })
         })
       } else if (item.type === 'table' && item.subtype === 'normaltable') {
@@ -726,7 +726,7 @@
               cell.style = {...cell.style, ...cell.btnstyle}
             }
 
-            return isHS || permAction[cell.uuid]
+            return skip || permAction[cell.uuid]
           })
           return col.elements.length !== 0
         })

--
Gitblit v1.8.0