From 60dee3dc4dc6869231d6adb0c94c47e36114ca91 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 21 四月 2022 09:11:34 +0800
Subject: [PATCH] 2022-04-21

---
 src/tabviews/custom/components/chart/custom-chart/index.jsx |   34 +++++++++++++++++++++++++---------
 1 files changed, 25 insertions(+), 9 deletions(-)

diff --git a/src/tabviews/custom/components/chart/custom-chart/index.jsx b/src/tabviews/custom/components/chart/custom-chart/index.jsx
index d72aae8..41cc2ac 100644
--- a/src/tabviews/custom/components/chart/custom-chart/index.jsx
+++ b/src/tabviews/custom/components/chart/custom-chart/index.jsx
@@ -61,7 +61,9 @@
       search: Utils.initMainSearch(config.search)
     }, () => {
       if (config.setting.sync !== 'true' && config.setting.onload === 'true') {
-        this.loadData()
+        setTimeout(() => {
+          this.loadData()
+        }, _config.setting.delay || 0)
       } else if (config.setting.sync === 'true' && _data) {
         this.handleData()
       }
@@ -177,16 +179,23 @@
 
     if (config.uuid !== menuId) return
 
-    this.loadData()                                                            // 鏁版嵁鍒锋柊
+    let supModule = config.setting.supModule
 
-    if (btn.syncComponentId && btn.syncComponentId !== config.uuid && btn.syncComponentId !== config.setting.supModule) {
-      MKEmitter.emit('reloadData', btn.syncComponentId)                        // 鍚岀骇鏍囩鍒锋柊
+    btn.syncComponentId && MKEmitter.emit('reloadData', btn.syncComponentId)
+
+    if (!btn.syncComponentId || btn.syncComponentId !== supModule) {
+      if (position === 'mainline' || position === 'popclose') { // 鍒锋柊婧愮粍浠舵椂锛岄檮甯﹀埛鏂颁笂绾ц涓庡綋鍓嶇粍浠�
+        if (supModule && BID) {
+          MKEmitter.emit('reloadData', supModule, BID)
+        } else {
+          this.loadData()
+        }
+      } else {
+        this.loadData()
+      }
     }
 
-    if (position === 'mainline' && config.setting.supModule) {                 // 涓昏〃琛屽埛鏂�
-      MKEmitter.emit('reloadData', config.setting.supModule, (BID || 'empty'))
-    } else if (position === 'popclose') {                                      // 鏍囩鍏抽棴鍒锋柊
-      config.setting.supModule && MKEmitter.emit('reloadData', config.setting.supModule, (BID || 'empty'))
+    if (position === 'popclose') { // 鎵ц鍚姩寮圭獥鐨勬寜閽墍閫夋嫨鐨勫埛鏂伴」
       btn.$tabId && MKEmitter.emit('refreshPopButton', btn.$tabId)
     }
   }
@@ -203,7 +212,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 }, () => {
         this.loadData()
       })
@@ -279,11 +288,18 @@
 
     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,
         empty: result.data.length === 0
       }, () => {
+        if (!reset) return
         this.handleData()
       })
     } else {

--
Gitblit v1.8.0