From d441fa1e1cc80f4ea462a750a42a2b25c1f2b202 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 04 十二月 2020 15:17:51 +0800
Subject: [PATCH] 2020-12-04

---
 src/tabviews/commontable/index.jsx |   49 ++++++++++++++-----------------------------------
 1 files changed, 14 insertions(+), 35 deletions(-)

diff --git a/src/tabviews/commontable/index.jsx b/src/tabviews/commontable/index.jsx
index 8d087d5..038a092 100644
--- a/src/tabviews/commontable/index.jsx
+++ b/src/tabviews/commontable/index.jsx
@@ -68,7 +68,8 @@
     tabActive: null,      // 鏍囩椤靛睍寮�鎺у埗
     chartId: '',          // 灞曞紑鍥捐〃ID
     statFields: [],       // 鍚堣瀛楁
-    statFValue: []        // 鍚堣鍊�
+    statFValue: [],       // 鍚堣鍊�
+    debug: sessionStorage.getItem('debug') === 'true'
   }
 
   /**
@@ -138,20 +139,12 @@
       // 鍘婚櫎绌鸿鏍囩
       config.tabgroups = config.tabgroups.filter(group => group.sublist.length > 0)
 
+      let roleId = sessionStorage.getItem('role_id') || '' // 瑙掕壊ID
       // 瑙嗗浘鏉冮檺
       config.charts = config.charts.filter(item => {
         if (item.Hide === 'true') return false
         if (!item.blacklist || item.blacklist.length === 0) return true
-
-        let _black = item.blacklist.filter(v => {
-          return this.props.permRoles.indexOf(v) !== -1
-        })
-
-        if (_black.length > 0 || item.Hide === 'true') {
-          return false
-        } else {
-          return true
-        }
+        return item.blacklist.filter(v => roleId.indexOf(v) > -1).length === 0
       })
 
       if (config.charts.length <= 1) {
@@ -173,12 +166,7 @@
         }
 
         if (!item.blacklist || item.blacklist.length === 0) return item
-
-        let _black = item.blacklist.filter(v => {
-          return this.props.permRoles.indexOf(v) !== -1
-        })
-
-        if (_black.length > 0) {
+        if (item.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) {
           item.Hide = 'true'
         }
 
@@ -186,13 +174,8 @@
       })
 
       config.columns = config.columns.map(col => {
-        if (!col.field || !col.blacklist || col.blacklist.length === 0 || config.setting.primaryKey === col.field) return col
-
-        let _black = col.blacklist.filter(v => {
-          return this.props.permRoles.indexOf(v) !== -1
-        })
-
-        if (_black.length > 0) {
+        if (!col.field || !col.blacklist || col.blacklist.length === 0) return col
+        if (col.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) {
           col.Hide = 'true'
         }
 
@@ -228,7 +211,7 @@
           config.setting.dataresource = '(' + config.setting.dataresource + ') tb'
         }
   
-        if (this.props.dataManager) { // 鏁版嵁鏉冮檺
+        if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺
           config.setting.dataresource = config.setting.dataresource.replace(/\$@/ig, '/*')
           config.setting.dataresource = config.setting.dataresource.replace(/@\$/ig, '*/')
           config.setting.customScript = config.setting.customScript.replace(/\$@/ig, '/*')
@@ -512,7 +495,7 @@
     })
 
     let _orderBy = orderBy || setting.order
-    let param = UtilsDM.getQueryDataParams(setting, arr_field, search, _orderBy, pageIndex, pageSize, BID, this.props.menuType, this.props.dataManager)
+    let param = UtilsDM.getQueryDataParams(setting, arr_field, search, _orderBy, pageIndex, pageSize, BID, this.props.menuType)
 
     if (param.func === 'sPC_Get_TableData') {
       param.menuname = this.props.MenuName || ''
@@ -552,7 +535,7 @@
     })
 
     let _orderBy = orderBy || setting.order
-    let param = UtilsDM.getQueryDataParams(setting, arr_field, search, _orderBy, pageIndex, pageSize, BID, this.props.menuType, this.props.dataManager, id)
+    let param = UtilsDM.getQueryDataParams(setting, arr_field, search, _orderBy, pageIndex, pageSize, BID, this.props.menuType, id)
 
     if (param.func === 'sPC_Get_TableData') {
       param.menuname = this.props.MenuName || ''
@@ -608,7 +591,7 @@
     }
 
     let _orderBy = orderBy || setting.order
-    let param = UtilsDM.getStatQueryDataParams(setting, statFields, search, _orderBy, BID, this.props.menuType, this.props.dataManager)
+    let param = UtilsDM.getStatQueryDataParams(setting, statFields, search, _orderBy, BID, this.props.menuType)
 
     if (param.func === 'sPC_Get_TableData') {
       param.menuname = this.props.MenuName || ''
@@ -930,7 +913,7 @@
 
   render() {
     const { menuType, MenuName } = this.props
-    const { BID, setting, searchlist, pageSize, actions, columns, loadingview, viewlost, pickup, config, userConfig, tabActive, chartId, search, selectedData } = this.state
+    const { debug, BID, setting, searchlist, pageSize, actions, columns, loadingview, viewlost, pickup, config, userConfig, tabActive, chartId, search, selectedData } = this.state
 
     return (
       <div className="commontable" id={this.state.ContainerId}>
@@ -941,7 +924,6 @@
             dict={this.state.dict}
             searchlist={searchlist}
             menuType={this.props.menuType}
-            dataManager={this.props.dataManager}
             refreshdata={this.refreshbysearch}
           /> : null
         }
@@ -982,7 +964,6 @@
                       dict={this.state.dict}
                       MenuID={this.props.MenuID}
                       permAction={this.props.permAction}
-                      permRoles={this.props.permRoles}
                       userConfig={this.state.userConfig}
                       reloadview={this.reloadview}
                     /> : null}
@@ -1079,7 +1060,7 @@
             </Tabs>)
           )
         }
-        {options.sysType !== 'cloud' && menuType !== 'HS' ? <Button
+        {debug && options.sysType !== 'cloud' && menuType !== 'HS' ? <Button
           icon="copy"
           shape="circle"
           className="common-table-copy"
@@ -1116,9 +1097,7 @@
     menuType: state.editLevel,
     tabviews: state.tabviews,
     permAction: state.permAction,
-    permMenus: state.permMenus,
-    permRoles: state.permRoles,
-    dataManager: state.dataManager
+    permMenus: state.permMenus
   }
 }
 

--
Gitblit v1.8.0