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/custom/components/card/cardItem/index.jsx |   26 +++++---------------------
 1 files changed, 5 insertions(+), 21 deletions(-)

diff --git a/src/tabviews/custom/components/card/cardItem/index.jsx b/src/tabviews/custom/components/card/cardItem/index.jsx
index 881b053..e8e0d52 100644
--- a/src/tabviews/custom/components/card/cardItem/index.jsx
+++ b/src/tabviews/custom/components/card/cardItem/index.jsx
@@ -5,7 +5,6 @@
 import { notification } from 'antd'
 
 import asyncComponent from '@/utils/asyncComponent'
-import { modifyTabview } from '@/store/action'
 import MKEmitter from '@/utils/events.js'
 import './index.scss'
 
@@ -80,21 +79,9 @@
       }
 
       if (['linkage_navigation', 'linkage', 'menu_board'].includes(window.GLOB.navBar)) {
-        this.props.modifyTabview([newtab])
+        MKEmitter.emit('modifyTabs', newtab, 'replace')
       } else {
-        let tabs = this.props.tabviews.filter((tab, i) => {
-          tab.selected = false
-          return tab.MenuID !== newtab.MenuID
-        })
-
-        if (this.props.tabviews.length > tabs.length) {
-          this.props.modifyTabview(fromJS(tabs).toJS())
-        }
-
-        this.setState({}, () => {
-          tabs.push(newtab)
-          this.props.modifyTabview(tabs)
-        })
+        MKEmitter.emit('modifyTabs', newtab, 'plus')
       }
     } else if (card.setting.click === 'link') {
       let src = card.setting.linkurl
@@ -137,15 +124,12 @@
 
 const mapStateToProps = (state) => {
   return {
-    permMenus: state.permMenus,
-    tabviews: state.tabviews,
+    permMenus: state.permMenus
   }
 }
 
-const mapDispatchToProps = (dispatch) => {
-  return {
-    modifyTabview: (tabviews) => dispatch(modifyTabview(tabviews))
-  }
+const mapDispatchToProps = () => {
+  return {}
 }
 
 export default connect(mapStateToProps, mapDispatchToProps)(CardBoxComponent)
\ No newline at end of file

--
Gitblit v1.8.0