From 5c8860f3cd8921e7eb0da7749628e9dc669b3203 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 17 三月 2020 10:19:16 +0800
Subject: [PATCH] 2020-03-17

---
 src/tabviews/commontable/index.jsx |   57 +++++++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 45 insertions(+), 12 deletions(-)

diff --git a/src/tabviews/commontable/index.jsx b/src/tabviews/commontable/index.jsx
index 1d30b9b..5fb9c5f 100644
--- a/src/tabviews/commontable/index.jsx
+++ b/src/tabviews/commontable/index.jsx
@@ -9,17 +9,18 @@
 import zhCN from '@/locales/zh-CN/main.js'
 import enUS from '@/locales/en-US/main.js'
 import Utils from '@/utils/utils.js'
-import asyncComponent from '@/utils/asyncComponent'
+// import asyncComponent from '@/utils/asyncComponent'
 import asyncLoadComponent from '@/utils/asyncLoadComponent'
 import {refreshTabView, modifyTabview} from '@/store/action'
 
 import MainTable from './mainTable'
+import MainAction from '@/tabviews/tableshare/actionList'
 import VerifyCard from '@/tabviews/tableshare/verifycard'
 import MainSearch from '@/tabviews/tableshare/topSearch'
 import NotFount from '@/components/404'
 import './index.scss'
 
-const MainAction = asyncComponent(() => import('@/tabviews/tableshare/actionList'))
+// const MainAction = asyncComponent(() => import('@/tabviews/tableshare/actionList'))
 const SubTable = asyncLoadComponent(() => import('@/tabviews/subtable'))
 const SubTabTable = asyncLoadComponent(() => import('@/tabviews/subtabtable'))
 const FormTab = asyncLoadComponent(() => import('@/tabviews/formtab'))
@@ -80,6 +81,7 @@
       MenuID: this.props.MenuID
     }
     let result = await Api.getSystemCacheConfig(param)
+
     if (result.status) {
       let config = ''
       let userConfig = ''
@@ -127,6 +129,35 @@
         config[group] = config[group].filter(tab => permAction[tab.linkTab])
       })
 
+      // 瀛楁鏉冮檺榛戝悕鍗�
+      config.search = config.search.filter(item => {
+        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) {
+          return false
+        } else {
+          return true
+        }
+      })
+
+      config.columns = config.columns.filter(col => {
+        if (!col.field || !col.blacklist || col.blacklist.length === 0) return true
+
+        let _black = col.blacklist.filter(v => {
+          return this.props.permRoles.indexOf(v) !== -1
+        })
+
+        if (_black.length > 0) {
+          return false
+        } else {
+          return true
+        }
+      })
+
       if (userConfig) {
         config.setting = {...config.setting, ...userConfig.setting}
         let _actions = {}
@@ -149,8 +180,8 @@
       let _hideCol = []      // 闅愯棌鍙婂悎骞跺垪涓瓧娈电殑uuid闆�
       let colMap = new Map() // 鐢ㄤ簬瀛楁杩囨护
 
-      let _actions = []     // 宸ュ叿鏍忔寜閽�
-      let _operations = []  // 鎿嶄綔鍒楁寜閽紙瀛樺湪鏃讹級
+      let _actions = []      // 宸ュ叿鏍忔寜閽�
+      let _operations = []   // 鎿嶄綔鍒楁寜閽紙瀛樺湪鏃讹級
 
       config.action.forEach(item => {
         if (item.execMode) {
@@ -176,10 +207,6 @@
       config.columns.forEach(col => {
         if (col.field) {
           _arrField.push(col.field)
-
-          // if () { // 鏉冮檺榛戝悕鍗�
-          //   col.Hide = 'true'
-          // }
 
           _logcolumns.push(col)
         }
@@ -262,11 +289,12 @@
       
       let istrigger = false
       actions.forEach(item => {
-        if (!item.shortcut || istrigger) return
+        if (!item.shortcut || typeof(item.shortcut) !== 'object' || istrigger) return
 
-        if (preKey === item.shortcut && keyCode === item.shortcutkey) {
+        if (preKey === item.shortcut[0] && keyCode === item.shortcut[1]) {
           e.preventDefault()
           istrigger = true
+
           this.refs.mainButton.actionTrigger(item)
         }
       })
@@ -897,6 +925,9 @@
         this.setState({
           settingVisible: false,
           confirmLoading: false
+        }, () => {
+          window.GLOB.CacheMap = new Map()
+          this.reloadview()
         })
       })
     })
@@ -946,7 +977,7 @@
             /> : null
           }
           {actions && setting.onload !== 'false' ?
-            <div style={{minHeight: '45px'}}>
+            <div style={{minHeight: '25px'}}>
               <MainAction
                 ref="mainButton"
                 BID=""
@@ -956,6 +987,7 @@
                 actions={actions}
                 dict={this.state.dict}
                 MenuID={this.props.MenuID}
+                permRoles={this.props.permRoles}
                 logcolumns={this.state.logcolumns}
                 ContainerId={this.state.ContainerId}
                 refreshdata={this.refreshbyaction}
@@ -1101,7 +1133,8 @@
   return {
     tabviews: state.tabviews,
     refreshTab: state.refreshTab,
-    permAction: state.permAction
+    permAction: state.permAction,
+    permRoles: state.permRoles
   }
 }
 

--
Gitblit v1.8.0