From 1da6506bf58270bacc2a4345002c6b082835580e Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 21 十月 2021 23:17:08 +0800
Subject: [PATCH] 2021-10-21

---
 src/tabviews/custom/components/chart/antv-pie/index.jsx |   41 ++++++++++++++++-------------------------
 1 files changed, 16 insertions(+), 25 deletions(-)

diff --git a/src/tabviews/custom/components/chart/antv-pie/index.jsx b/src/tabviews/custom/components/chart/antv-pie/index.jsx
index 145efac..a660890 100644
--- a/src/tabviews/custom/components/chart/antv-pie/index.jsx
+++ b/src/tabviews/custom/components/chart/antv-pie/index.jsx
@@ -9,15 +9,11 @@
 
 import Api from '@/api'
 import Utils from '@/utils/utils.js'
-import { modifyTabview } from '@/store/action'
 import { chartColors } from '@/utils/option.js'
-// import asyncComponent from '@/utils/asyncComponent'
 import UtilsDM from '@/utils/utils-datamanage.js'
 import MKEmitter from '@/utils/events.js'
 import NormalHeader from '@/tabviews/custom/components/share/normalheader'
 import './index.scss'
-
-// const NormalHeader = asyncComponent(() => import('@/tabviews/custom/components/share/normalheader'))
 
 class PieChart extends Component {
   static propTpyes = {
@@ -134,7 +130,7 @@
 
     if (!config.timer) return
 
-    const _change = { '15s': 15000, '30s': 30000, '1min': 60000, '5min': 300000, '10min': 600000, '15min': 900000, '30min': 1800000, '1hour': 3600000 }
+    const _change = { '5s': 5000, '15s': 15000, '30s': 30000, '1min': 60000, '5min': 300000, '10min': 600000, '15min': 900000, '30min': 1800000, '1hour': 3600000 }
 
     let timer = _change[config.timer]
 
@@ -252,10 +248,17 @@
 
     let result = await Api.genericInterface(param)
     if (result.status) {
+      let reset = true
+
+      if (hastimer && is(fromJS(result.data), fromJS(this.state.data))) {
+        reset = false
+      }
+
       this.setState({
         data: result.data,
         loading: false
       }, () => {
+        if (!reset) return
         this.handleData()
       })
     } else {
@@ -965,26 +968,17 @@
 
           let newtab = {
             ...menu,
-            selected: true,
             param: {
               $BID: primaryId
             }
           }
-  
-          let tabs = this.props.tabviews.filter(tab => {
-            tab.selected = false
-            return tab.MenuID !== newtab.MenuID
-          })
-  
-          if (this.props.tabviews.length > tabs.length) {
-            this.props.modifyTabview(fromJS(tabs).toJS())
+
+          if (['linkage_navigation', 'linkage', 'menu_board'].includes(window.GLOB.navBar)) {
+            MKEmitter.emit('modifyTabs', newtab, 'replace')
+          } else {
+            MKEmitter.emit('modifyTabs', newtab, 'plus', true)
           }
-  
-          this.setState({}, () => {
-            tabs.push(newtab)
-            this.props.modifyTabview(tabs)
-          })
-        } catch {
+        } catch (e) {
           console.warn('鑿滃崟鎵撳紑澶辫触锛�')
         }
       })
@@ -1026,15 +1020,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)(PieChart)
\ No newline at end of file

--
Gitblit v1.8.0