From 2f54651464414059b224181d713af2980e76d095 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期日, 09 十月 2022 19:35:39 +0800
Subject: [PATCH] 2020-10-09

---
 src/tabviews/custom/components/card/prop-card/index.jsx |   36 +++++++++++++++++++++++++++++++++++-
 1 files changed, 35 insertions(+), 1 deletions(-)

diff --git a/src/tabviews/custom/components/card/prop-card/index.jsx b/src/tabviews/custom/components/card/prop-card/index.jsx
index b40f01e..4f4c46c 100644
--- a/src/tabviews/custom/components/card/prop-card/index.jsx
+++ b/src/tabviews/custom/components/card/prop-card/index.jsx
@@ -67,6 +67,9 @@
         }
         _sync = false
       }
+    } else if (_config.wrap.datatype === 'public' && window.GLOB.CacheData.get(_config.wrap.publicId)) {
+      _data = window.GLOB.CacheData.get(_config.wrap.publicId)
+      _data = fromJS(_data).toJS()
     }
 
     _data.$$BID = BID || ''
@@ -126,6 +129,12 @@
         setTimeout(() => {
           this.loadData()
         }, _config.setting.delay || 0)
+      } else if (_config.wrap.datatype === 'public') {
+        if (_data.$$loaded && selected !== 'false') {
+          setTimeout(() => {
+            this.checkTopLine()
+          }, 200)
+        }
       } else if (!_sync && selected !== 'false') {
         setTimeout(() => {
           this.checkTopLine()
@@ -142,6 +151,10 @@
     MKEmitter.addListener('queryModuleParam', this.queryModuleParam)
     MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult)
 
+    if (config.wrap.datatype === 'public') {
+      MKEmitter.addListener('mkPublicData', this.mkPublicData)
+    }
+
     if (config.timer && config.wrap.datatype === 'dynamic') {
       this.timer = new TimerTask()
       this.timer.init(config.uuid, config.timer, config.timerRepeats, () => {this.loadData(true)})
@@ -157,6 +170,7 @@
       return
     }
     MKEmitter.removeListener('reloadData', this.reloadData)
+    MKEmitter.removeListener('mkPublicData', this.mkPublicData)
     MKEmitter.removeListener('resetSelectLine', this.resetParentParam)
     MKEmitter.removeListener('queryModuleParam', this.queryModuleParam)
     MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult)
@@ -190,13 +204,33 @@
           }, 200)
         }
       })
-    } else if ( config.setting.syncRefresh && nextProps.mainSearch && !is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) {
+    } else if (config.setting.syncRefresh && nextProps.mainSearch && !is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) {
       this.setState({}, () => {
         this.loadData()
       })
     }
   }
 
+  mkPublicData = (publicId, data) => {
+    const { config, selected, BID, BData } = this.state
+
+    if (config.wrap.datatype === 'public' && config.wrap.publicId === publicId) {
+      let _data = fromJS(data).toJS()
+
+      _data.$$BID = BID || ''
+      _data.$$BData = BData || ''
+      _data.$$uuid = _data[config.setting.primaryKey] || ''
+
+      this.setState({data: _data}, () => {
+        if (selected !== 'false') {
+          setTimeout(() => {
+            this.checkTopLine()
+          }, 200)
+        }
+      })
+    }
+  }
+
   checkTopLine = () => {
     const { config, data, selected } = this.state
 

--
Gitblit v1.8.0