From c98e45bfac25e9110ad0383faac54a54d98ea9d5 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 18 十一月 2021 20:47:04 +0800
Subject: [PATCH] 2021-11-18

---
 src/tabviews/custom/components/card/table-card/index.jsx |   37 +++++++++++--------------------------
 1 files changed, 11 insertions(+), 26 deletions(-)

diff --git a/src/tabviews/custom/components/card/table-card/index.jsx b/src/tabviews/custom/components/card/table-card/index.jsx
index 8008410..14107bf 100644
--- a/src/tabviews/custom/components/card/table-card/index.jsx
+++ b/src/tabviews/custom/components/card/table-card/index.jsx
@@ -8,7 +8,6 @@
 import Utils from '@/utils/utils.js'
 import asyncComponent from '@/utils/asyncComponent'
 import UtilsDM from '@/utils/utils-datamanage.js'
-import { modifyTabview } from '@/store/action'
 import MKEmitter from '@/utils/events.js'
 import './index.scss'
 
@@ -33,7 +32,7 @@
     total: 0,                  // 鎬绘暟
     sync: false,               // 鏄惁缁熶竴璇锋眰鏁版嵁
     data: null,                // 鏁版嵁
-    BData: null
+    BData: ''
   }
 
   /**
@@ -41,7 +40,7 @@
    * 1銆� initdata 涓烘墦鍗版椂浣跨敤鐨勬暟鎹泦
    */
   UNSAFE_componentWillMount () {
-    const { data, initdata, BID } = this.props
+    const { data, initdata, BID, BData } = this.props
     let _config = fromJS(this.props.config).toJS()
     let _cols = new Map()
 
@@ -93,6 +92,7 @@
     this.setState({
       sync: _sync,
       BID: BID || '',
+      BData: BData || '',
       data: _data,
       config: _config,
       search: Utils.initMainSearch(_config.search),
@@ -129,7 +129,7 @@
    * @description 鍥捐〃鏁版嵁鏇存柊锛屽埛鏂板唴瀹�
    */
   UNSAFE_componentWillReceiveProps (nextProps) {
-    const { sync, config, BID } = this.state
+    const { sync, config, BID, BData } = this.state
 
     if (sync && !is(fromJS(this.props.data), fromJS(nextProps.data))) {
       let _data = []
@@ -141,6 +141,7 @@
         item.key = index
         item.$$uuid = item[config.setting.primaryKey] || ''
         item.$$BID = BID || ''
+        item.$$BData = BData || ''
         item.$Index = index + 1 + ''
         return item
       })
@@ -182,7 +183,7 @@
     const { config } = this.state
 
     if (!config.setting.supModule || config.setting.supModule !== MenuID) return
-    if (id !== this.state.BID) {
+    if (id !== this.state.BID || id !== '') {
       this.setState({ BID: id, BData: data, pageIndex: 1 }, () => {
         this.loadData()
       })
@@ -324,7 +325,6 @@
 
       let newtab = {
         ...menu,
-        selected: true,
         param: {}
       }
 
@@ -333,21 +333,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', true)
       }
     } else if (card.setting.click === 'link') {
       let src = card.setting.linkurl
@@ -364,7 +352,7 @@
 
       window.open(src)
     } else if (card.setting.click === 'button' && card.setting.linkbtn) {
-      MKEmitter.emit('triggerBtnId', card.setting.linkbtn, [data])
+      MKEmitter.emit('triggerBtnId', card.setting.linkbtn, [data], 'linkbtn')
     }
   }
 
@@ -444,14 +432,11 @@
 const mapStateToProps = (state) => {
   return {
     permMenus: state.permMenus,
-    tabviews: state.tabviews,
   }
 }
 
-const mapDispatchToProps = (dispatch) => {
-  return {
-    modifyTabview: (tabviews) => dispatch(modifyTabview(tabviews))
-  }
+const mapDispatchToProps = () => {
+  return {}
 }
 
 export default connect(mapStateToProps, mapDispatchToProps)(TableCard)
\ No newline at end of file

--
Gitblit v1.8.0