From c95918fb0fffb61b1117fbf4cd429e291b9594d0 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 17 九月 2021 01:02:34 +0800
Subject: [PATCH] 2021-09-17

---
 src/tabviews/zshare/actionList/tabbutton/index.jsx |   37 +++++--------------------------------
 1 files changed, 5 insertions(+), 32 deletions(-)

diff --git a/src/tabviews/zshare/actionList/tabbutton/index.jsx b/src/tabviews/zshare/actionList/tabbutton/index.jsx
index b500308..4b352b6 100644
--- a/src/tabviews/zshare/actionList/tabbutton/index.jsx
+++ b/src/tabviews/zshare/actionList/tabbutton/index.jsx
@@ -4,7 +4,6 @@
 import { is, fromJS } from 'immutable'
 import { Button, notification, Icon } from 'antd'
 
-import { modifyTabview } from '@/store/action'
 import zhCN from '@/locales/zh-CN/main.js'
 import enUS from '@/locales/en-US/main.js'
 import MKEmitter from '@/utils/events.js'
@@ -78,7 +77,7 @@
    * @description 瑙﹀彂鎸夐挳鎿嶄綔
    */
   actionTrigger = (triggerId, record, type) => {
-    const { setting, btn, tabviews, MenuID, selectedData } = this.props
+    const { setting, btn, selectedData } = this.props
 
     if (triggerId && btn.uuid !== triggerId) return
 
@@ -122,7 +121,6 @@
           primaryId: primaryId
         }
       }
-    // } else if (btn.tabTemplate === 'ThdMenu') {
     } else {
       let menu = null
 
@@ -156,32 +154,10 @@
       }
     }
 
-    let index = 0
-    let tabs = tabviews.filter((tab, i) => {
-      tab.selected = false
-
-      if (tab.MenuID === MenuID) {
-        index = i
-      }
-
-      return tab.MenuID !== newtab.MenuID
-    })
-
     if (['linkage_navigation', 'linkage', 'menu_board'].includes(window.GLOB.navBar)) {
-      this.props.modifyTabview([newtab])
+      MKEmitter.emit('modifyTabs', newtab, 'replace')
     } else {
-      if (tabviews.length !== tabs.length) {
-        this.props.modifyTabview(fromJS(tabs).toJS())
-      }
-  
-      this.setState({}, () => {
-        if (MenuID) {
-          tabs.splice(index + 1, 0, newtab)
-        } else {
-          tabs.push(newtab)
-        }
-        this.props.modifyTabview(tabs)
-      })
+      MKEmitter.emit('modifyTabs', newtab, 'plus')
     }
 
     MKEmitter.emit('openNewTab')
@@ -236,15 +212,12 @@
 
 const mapStateToProps = (state) => {
   return {
-    tabviews: state.tabviews,
     permMenus: state.permMenus,
   }
 }
 
-const mapDispatchToProps = (dispatch) => {
-  return {
-    modifyTabview: (tabviews) => dispatch(modifyTabview(tabviews))
-  }
+const mapDispatchToProps = () => {
+  return {}
 }
 
 export default connect(mapStateToProps, mapDispatchToProps)(TabButton)
\ No newline at end of file

--
Gitblit v1.8.0