From 5354b648a9765d8c9ca3f8c7ce065b58c3d55716 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 10 十月 2022 18:47:36 +0800
Subject: [PATCH] 2022-10-10

---
 src/tabviews/custom/components/interfaces/interItem/index.jsx |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/src/tabviews/custom/components/interfaces/interItem/index.jsx b/src/tabviews/custom/components/interfaces/interItem/index.jsx
index 1cf8c19..9253bd9 100644
--- a/src/tabviews/custom/components/interfaces/interItem/index.jsx
+++ b/src/tabviews/custom/components/interfaces/interItem/index.jsx
@@ -15,6 +15,8 @@
     config: PropTypes.object,  // 閰嶇疆淇℃伅
   }
 
+  loading = false
+  
   state = {}
 
   componentDidMount () {
@@ -27,6 +29,8 @@
     setTimeout(() => {
       this.loadData()
     }, config.setting.delay)
+
+    MKEmitter.addListener('reloadData', this.reloadData)
   }
 
   shouldComponentUpdate (nextProps, nextState) { return false }
@@ -39,15 +43,27 @@
       return
     }
     this.timer && this.timer.stop()
+    MKEmitter.removeListener('reloadData', this.reloadData)
+  }
+
+  reloadData = (publicId) => {
+    if (this.props.config.uuid !== publicId) return
+
+    this.loadData()
   }
 
   async loadData () {
     const { config, BID } = this.props
 
+    if (this.loading) return
+
+    this.loading = true
+
     let param = UtilsDM.getQueryDataParams(config.setting, config.columns.map(col => col.field).join(','), [], config.setting.order, 1, 1, BID)
 
     let result = await Api.genericInterface(param)
     if (result.status) {
+      this.loading = false
       let _data = { $$empty: true }
 
       if (result.data && result.data[0]) {
@@ -56,8 +72,11 @@
       
       _data.$$loaded = true
 
+      window.GLOB.CacheData.set(config.uuid, _data)
+
       MKEmitter.emit('mkPublicData', config.uuid, _data)
     } else {
+      this.loading = false
       this.timer && this.timer.stop()
       notification.error({
         top: 92,

--
Gitblit v1.8.0