From cdd5b449130ea4d7223fde4f414a11a7d0c33d6d Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 07 三月 2024 17:52:16 +0800
Subject: [PATCH] 2024-03-07

---
 src/tabviews/custom/components/table/normal-table/index.jsx |   33 +++++++++++++++++++++++++++++++--
 1 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/src/tabviews/custom/components/table/normal-table/index.jsx b/src/tabviews/custom/components/table/normal-table/index.jsx
index a1492a3..92c7018 100644
--- a/src/tabviews/custom/components/table/normal-table/index.jsx
+++ b/src/tabviews/custom/components/table/normal-table/index.jsx
@@ -199,6 +199,8 @@
     }
 
     this.initExec()
+
+    this.autoExec()
   }
 
   /**
@@ -301,6 +303,25 @@
     }
   }
 
+  autoExec = (times) => {
+    const { config } = this.state
+
+    if (!config.wrap.autoExec) return
+
+    let btn = document.getElementById('button' + config.wrap.autoExec)
+
+    this.autoTimer && clearTimeout(this.autoTimer)
+
+    if (btn) {
+      MKEmitter.emit('triggerBtnId', config.wrap.autoExec, [])
+    } else if (!times || times < 20) {
+      times = times ? times + 1 : 1
+      this.autoTimer = setTimeout(() => {
+        this.autoExec(times)
+      }, 1000)
+    }
+  }
+
   transferSyncData = (syncId) => {
     const { config } = this.state
 
@@ -369,6 +390,7 @@
       this.setState({
         data: [],
         selectedData: [],
+        loading: false,
         total: 0
       })
       
@@ -379,6 +401,7 @@
       }
 
       this.loaded = true
+      this.requestId = ''
       return
     }
 
@@ -406,8 +429,12 @@
     let _orderBy = orderBy || setting.order
     let param = UtilsDM.getQueryDataParams(setting, searches, _orderBy, pageIndex, pageSize, BID)
 
-    let result = await Api.genericInterface(param)
+    this.requestId = config.uuid + new Date().getTime()
+
+    let result = await Api.genericInterface(param, '', '', this.requestId)
     if (result.status) {
+      if (result.$requestId && this.requestId !== result.$requestId) return
+      
       this.loaded = true
       if (config.$cache && type === 'init') {
         Api.writeCacheConfig(config.uuid, result.data || [], BID)
@@ -763,7 +790,9 @@
         BID: id,
         BData: data
       }, () => {
-        this.loadmaindata(true, 'true')
+        if (!setting.checkBid) {
+          this.loadmaindata(true, 'true')
+        }
       })
     }
   }

--
Gitblit v1.8.0