From 78eed586f6a0d15162c89878c53a301e7b142a8a Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 10 十月 2022 00:07:06 +0800
Subject: [PATCH] Merge branch 'master' into positec

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

diff --git a/src/tabviews/custom/components/card/prop-card/index.jsx b/src/tabviews/custom/components/card/prop-card/index.jsx
index 71a8068..4f4c46c 100644
--- a/src/tabviews/custom/components/card/prop-card/index.jsx
+++ b/src/tabviews/custom/components/card/prop-card/index.jsx
@@ -51,7 +51,7 @@
       BID = BData.$BID || ''
     }
     
-    if (_config.wrap.datatype !== 'static') {
+    if (_config.wrap.datatype === 'dynamic') {
       _sync = _config.setting.sync === 'true'
 
       if (_sync && data) {
@@ -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 || ''
@@ -122,10 +125,16 @@
       config: _config,
       arr_field: _config.columns.map(col => col.field).join(','),
     }, () => {
-      if (_config.wrap.datatype !== 'static' && _config.setting.sync !== 'true' && _config.setting.onload === 'true') {
+      if (_config.wrap.datatype === 'dynamic' && _config.setting.sync !== 'true' && _config.setting.onload === 'true') {
         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,7 +151,11 @@
     MKEmitter.addListener('queryModuleParam', this.queryModuleParam)
     MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult)
 
-    if (config.timer) {
+    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