From da7068bd48791cdee966c786ce0dfd46f6e03df9 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 08 一月 2021 19:02:24 +0800
Subject: [PATCH] 2021-01-08

---
 src/tabviews/custom/components/table/normal-table/index.jsx |   45 ++++++++++++++++++++++++++++-----------------
 1 files changed, 28 insertions(+), 17 deletions(-)

diff --git a/src/tabviews/custom/components/table/normal-table/index.jsx b/src/tabviews/custom/components/table/normal-table/index.jsx
index 24367ee..516709b 100644
--- a/src/tabviews/custom/components/table/normal-table/index.jsx
+++ b/src/tabviews/custom/components/table/normal-table/index.jsx
@@ -399,15 +399,6 @@
   }
 
   /**
-   * @description 鎸夐挳鎿嶄綔瀹屾垚鍚庯紙鎴愬姛鎴栧け璐ワ級锛岄〉闈㈠埛鏂帮紝閲嶇疆椤电爜鍙婇�夋嫨椤�
-   */
-  refreshbyaction = (position, btn) => {
-    if (position === 'grid' || position === 'view') {
-      this.reloadtable(btn)
-    }
-  }
-
-  /**
    * @description 瀵煎嚭Excel鏃讹紝鑾峰彇椤甸潰鎼滅储鎺掑簭绛夊弬鏁�
    */
   getexceloutparam = (menuId, btnId) => {
@@ -434,17 +425,12 @@
     })
   }
 
-  reloadData = (menuId, id, btn) => {
+  reloadData = (menuId, id) => {
     const { config } = this.state
 
     if (config.uuid !== menuId) return
     if (id === 'empty') return
 
-    if (id === 'formtab') { // 琛ㄥ崟鏍囩椤靛埛鏂�
-      this.reloadtable(btn)
-      return
-    }
-    
     if (!id) {
       this.reloadtable()
     } else {
@@ -465,6 +451,31 @@
         this.loadmaindata(true, 'true')
         this.getStatFieldsValue()
       })
+    }
+  }
+
+  /**
+   * @description 鎸夐挳鎵ц瀹屾垚鍚庨〉闈㈠埛鏂�
+   * @param {*} menuId     // 鑿滃崟Id
+   * @param {*} position   // 鍒锋柊浣嶇疆
+   * @param {*} btn        // 鎵ц鐨勬寜閽�
+   */
+  refreshByButtonResult = (menuId, position, btn) => {
+    const { config, BID } = this.state
+
+    if (config.uuid !== menuId) return
+
+    this.reloadtable(btn)                                                      // 鏁版嵁鍒锋柊
+
+    if (btn.syncComponentId && btn.syncComponentId !== config.uuid && btn.syncComponentId !== config.setting.supModule) {
+      MKEmitter.emit('reloadData', btn.syncComponentId)                        // 鍚岀骇鏍囩鍒锋柊
+    }
+
+    if (position === 'mainline' && config.setting.supModule) {                 // 涓昏〃琛屽埛鏂�
+      MKEmitter.emit('reloadData', config.setting.supModule, (BID || 'empty'))
+    } else if (position === 'popclose') {                                      // 鏍囩鍏抽棴鍒锋柊
+      config.setting.supModule && MKEmitter.emit('reloadData', config.setting.supModule, (BID || 'empty'))
+      btn.$tabId && MKEmitter.emit('refreshPopButton', btn.$tabId)
     }
   }
 
@@ -501,6 +512,7 @@
     MKEmitter.addListener('reloadData', this.reloadData)
     MKEmitter.addListener('resetSelectLine', this.resetParentParam)
     MKEmitter.addListener('getexceloutparam', this.getexceloutparam)
+    MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult)
   }
 
   /**
@@ -513,6 +525,7 @@
     MKEmitter.removeListener('reloadData', this.reloadData)
     MKEmitter.removeListener('resetSelectLine', this.resetParentParam)
     MKEmitter.removeListener('getexceloutparam', this.getexceloutparam)
+    MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult)
   }
 
   render() {
@@ -531,7 +544,6 @@
           BData={this.state.BData}
           columns={config.columns}
           selectedData={selectedData}
-          refreshdata={this.refreshbyaction}
         />
         <div className={'main-table-box ' + (!actions || actions.length === 0 ? 'no-action' : '')}>
           <MainTable
@@ -545,7 +557,6 @@
             loading={this.state.loading}
             refreshdata={this.refreshbytable}
             statFValue={this.state.statFValue}
-            refreshbyaction={this.refreshbyaction}
             chgSelectData={(selects) => this.setState({selectedData: selects})}
           />
         </div>

--
Gitblit v1.8.0