From b9a0e8541f0959db5d848f7b893c8838851ce411 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 09 四月 2020 13:29:49 +0800
Subject: [PATCH] 2020-04-09

---
 src/tabviews/subtable/index.jsx |   50 +++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 45 insertions(+), 5 deletions(-)

diff --git a/src/tabviews/subtable/index.jsx b/src/tabviews/subtable/index.jsx
index d6fe48c..d73ae6f 100644
--- a/src/tabviews/subtable/index.jsx
+++ b/src/tabviews/subtable/index.jsx
@@ -10,6 +10,7 @@
 import enUS from '@/locales/en-US/main.js'
 import Utils from '@/utils/utils.js'
 import options from '@/store/options.js'
+import { modifyTabview } from '@/store/action'
 
 import SubTable from '@/tabviews/zshare/normalTable'
 import SubSearch from '@/tabviews/zshare/topSearch'
@@ -88,7 +89,7 @@
    * @description 鑾峰彇椤甸潰閰嶇疆淇℃伅
    */
   async loadconfig () {
-    const { permAction, Tab, BID, userConfig } = this.props
+    const { permAction, permMenus, Tab, BID, userConfig } = this.props
 
     let param = {
       func: 'sPC_Get_LongParam',
@@ -207,8 +208,14 @@
       })
 
       // 鐢熸垚鏄剧ず鍒楋紝澶勭悊鍚堝苟鍒椾腑鐨勫瓧娈�
-      config.columns.forEach(col => {
+      config.columns.forEach((col, index) => {
         if (_hideCol.includes(col.uuid)) return
+
+        if (col.linkThdMenu && !permMenus[col.linkThdMenu.MenuID]) {
+          col.linkThdMenu = ''
+        }
+
+        col.sort = index
 
         if (col.type === 'colspan' && col.sublist) {
           let _col = JSON.parse(JSON.stringify(col))
@@ -733,6 +740,34 @@
     })
   }
 
+  linkTrigger = (menu) => {
+    const { tabviews, SupMenuID } = this.props
+    
+    menu.selected = true
+
+    let index = 0
+    let isexit = false
+    let tabs = tabviews.map((tab, i) => {
+      tab.selected = false
+
+      if (tab.MenuID === SupMenuID) {
+        index = i
+      } else if (tab.MenuID === menu.MenuID) {
+        tab.param = menu.param
+        tab.selected = true
+        isexit = true
+      }
+
+      return tab
+    })
+
+    if (!isexit) {
+      tabs.splice(index + 1, 0, menu)
+    }
+
+    this.props.modifyTabview(tabs)
+  }
+
   popclose = () => {
     this.setState({
       visible: false
@@ -812,6 +847,7 @@
               loading={this.state.loading}
               refreshdata={this.refreshbytable}
               buttonTrigger={this.buttonTrigger}
+              linkTrigger={this.linkTrigger}
               handleTableId={this.handleTableId}
             />
           </div> : null
@@ -847,13 +883,17 @@
 
 const mapStateToProps = (state) => {
   return {
+    tabviews: state.tabviews,
     permAction: state.permAction,
-    permRoles: state.permRoles
+    permRoles: state.permRoles,
+    permMenus: state.permMenus
   }
 }
 
-const mapDispatchToProps = () => {
-  return {}
+const mapDispatchToProps = (dispatch) => {
+  return {
+    modifyTabview: (tabviews) => dispatch(modifyTabview(tabviews))
+  }
 }
 
 export default connect(mapStateToProps, mapDispatchToProps)(SubTabViewTable)
\ No newline at end of file

--
Gitblit v1.8.0