From 5046d0d13dc6a8563b8e54e31913bc44cfa1072f Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 26 四月 2022 19:23:18 +0800
Subject: [PATCH] 2022-04-26

---
 src/tabviews/custom/components/card/balcony/index.jsx |   65 ++++++++++++++++++++------------
 1 files changed, 40 insertions(+), 25 deletions(-)

diff --git a/src/tabviews/custom/components/card/balcony/index.jsx b/src/tabviews/custom/components/card/balcony/index.jsx
index 72ad28f..c92528f 100644
--- a/src/tabviews/custom/components/card/balcony/index.jsx
+++ b/src/tabviews/custom/components/card/balcony/index.jsx
@@ -35,9 +35,8 @@
   }
 
   UNSAFE_componentWillMount () {
-    const { data, BID } = this.props
+    const { data, BID, initdata } = this.props
     let _config = fromJS(this.props.config).toJS()
-    let _cols = new Map()
 
     let _data = { $$empty: true }
     let _sync = false
@@ -51,6 +50,12 @@
           _data = _data[0] || {}
         }
         _sync = false
+      } else if (_sync && initdata) {
+        _data = initdata
+        if (Array.isArray(_data)) {
+          _data = _data[0] || {$$empty: true}
+        }
+        _sync = false
       }
     }
 
@@ -58,12 +63,8 @@
       _data.$$BID = BID || ''
     }
 
-    _config.columns.forEach(item => {
-      _cols.set(item.field, item)
-    })
-
-    if (_config.wrap.position === 'fixed') {
-      _config.style.position = 'fixed'
+    if (_config.wrap.position === 'fixed' || _config.wrap.position === 'absolute') {
+      _config.style.position = _config.wrap.position
       _config.style.zIndex = 2
       _config.style.left = _config.wrap.left || ''
       _config.style.right = _config.wrap.right || ''
@@ -71,6 +72,12 @@
       _config.style.bottom = _config.wrap.bottom || ''
       _config.style.transform = _config.wrap.transform || ''
       _config.style.width = _config.wrap.realwidth || ''
+    } else {
+      _config.style.zIndex = 2
+      _config.style.left = _config.wrap.left || ''
+      _config.style.right = _config.wrap.right || ''
+      _config.style.top = _config.wrap.top || ''
+      _config.style.bottom = _config.wrap.bottom || ''
     }
 
     let show = true
@@ -101,7 +108,9 @@
       arr_field: _config.columns.map(col => col.field).join(','),
     }, () => {
       if (_config.wrap.datatype !== 'static' && _config.setting && _config.setting.sync !== 'true') {
-        this.loadData()
+        setTimeout(() => {
+          this.loadData()
+        }, _config.setting.delay || 0)
       }
     })
   }
@@ -208,30 +217,35 @@
    * @param {*} position   // 鍒锋柊浣嶇疆
    * @param {*} btn        // 鎵ц鐨勬寜閽�
    */
-  refreshByButtonResult = (menuId, position, btn) => {
+  refreshByButtonResult = (menuId, position, btn, id, lines) => {
     const { config, BID, syncConfig } = this.state
 
     if (config.uuid !== menuId) return
 
-    this.loadData()                                                            // 鏁版嵁鍒锋柊
-
-    let supModule = config.wrap.supModule
-
     if (syncConfig) {
-      supModule = syncConfig.setting.supModule
+      MKEmitter.emit('refreshByButtonResult', syncConfig.uuid, position, btn, id, lines)
 
-      MKEmitter.emit('refreshByButtonResult', syncConfig.uuid, position, btn)
-    }
+      this.loadData()
+    } else {
+      let supModule = config.wrap.supModule
 
-    if (btn.syncComponentId && btn.syncComponentId !== config.uuid && btn.syncComponentId !== supModule) {
-      MKEmitter.emit('reloadData', btn.syncComponentId)                        // 鍚岀骇鏍囩鍒锋柊
-    }
+      btn.syncComponentId && MKEmitter.emit('reloadData', btn.syncComponentId)
 
-    if (position === 'mainline' && supModule) {                                // 涓昏〃琛屽埛鏂�
-      MKEmitter.emit('reloadData', supModule, (BID || 'empty'))
-    } else if (position === 'popclose') {                                      // 鏍囩鍏抽棴鍒锋柊
-      supModule && MKEmitter.emit('reloadData', supModule, (BID || 'empty'))
-      btn.$tabId && MKEmitter.emit('refreshPopButton', btn.$tabId)
+      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 === 'popclose') {                                      // 鏍囩鍏抽棴鍒锋柊
+        btn.$tabId && MKEmitter.emit('refreshPopButton', btn.$tabId)
+      }
     }
   }
 
@@ -316,6 +330,7 @@
 
       _data.$$BID = BID || ''
       _data.$$BData = BData
+      _data.$$uuid = _data[config.setting.primaryKey] || ''
 
       this.setState({
         data: _data,

--
Gitblit v1.8.0