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/subtabtable/index.jsx |   64 +++++++++++++------------------
 1 files changed, 27 insertions(+), 37 deletions(-)

diff --git a/src/tabviews/subtabtable/index.jsx b/src/tabviews/subtabtable/index.jsx
index 6f760fb..302c278 100644
--- a/src/tabviews/subtabtable/index.jsx
+++ b/src/tabviews/subtabtable/index.jsx
@@ -26,15 +26,12 @@
 
 class SubTabModalTable extends Component {
   static propTpyes = {
-    type: PropTypes.any,             // 绫诲瀷锛宑alendar闇�鐗规畩澶勭悊
     Tab: PropTypes.any,              // 鏃ュ巻鏍囩淇℃伅鎴栨爣绛炬寜閽俊鎭�
     BID: PropTypes.string,           // 涓婄骇鏁版嵁ID
     BData: PropTypes.any,            // 涓婄骇鏁版嵁
     MenuID: PropTypes.string,        // 鑿滃崟Id
     mainSearch: PropTypes.any,       // 涓昏〃鎼滅储鏉′欢
     SupMenuID: PropTypes.string,     // 涓婄骇鑿滃崟Id
-    refreshSupView: PropTypes.any,   // 鍒锋柊涓婄骇鑿滃崟
-    closeModalView: PropTypes.any    // 鍏抽棴妯℃�佹
   }
 
   state = {
@@ -66,7 +63,7 @@
    * @description 鑾峰彇椤甸潰閰嶇疆淇℃伅
    */
   async loadconfig () {
-    const { permAction, type, Tab } = this.props
+    const { permAction, Tab } = this.props
 
     let param = {
       func: 'sPC_Get_LongParam',
@@ -112,26 +109,15 @@
       // 鐗堟湰鍏煎
       config = UtilsUpdate.updateSubTable(config)
 
-      // 浠呮敮鎸乪xec銆乸rompt銆乸op 涓夌绫诲瀷鎸夐挳
+      // 涓嶆敮鎸乫uncbutton銆乸opview 绫诲瀷鎸夐挳
       let labels = []
-      if (type === 'calendar') {
-        config.action = config.action.filter(item => {
-          if (['exec', 'prompt', 'pop', 'tab', 'excelIn', 'excelOut'].includes(item.OpenType)) return true
+      config.action = config.action.filter(item => {
+        if (['exec', 'prompt', 'pop', 'tab', 'excelIn', 'excelOut', 'innerpage'].includes(item.OpenType)) return true
 
-          labels.push(item.label)
+        labels.push(item.label)
 
-          return false
-        })
-        
-      } else {
-        config.action = config.action.filter(item => {
-          if (['exec', 'prompt', 'pop'].includes(item.OpenType)) return true
-
-          labels.push(item.label)
-
-          return false
-        })
-      }
+        return false
+      })
 
       if (window.GLOB.systemType !== 'production' && labels.length > 0) {
         notification.warning({
@@ -370,6 +356,9 @@
             })
           }
           item.key = index
+          item.$$uuid = item[setting.primaryKey] || ''
+          item.$$BID = BID || ''
+
           return item
         }),
         total: result.total,
@@ -510,18 +499,6 @@
   }
 
   /**
-   * @description 鎸夐挳鎿嶄綔瀹屾垚鍚庯紙鎴愬姛鎴栧け璐ワ級锛岄〉闈㈠埛鏂帮紝閲嶇疆椤电爜鍙婇�夋嫨椤�
-   */
-  refreshbyaction = (position, btn) => {
-    if (position === 'grid' || position === 'view' || position === 'maingrid') {
-      this.reloadtable(btn)
-      this.props.refreshSupView()
-    } else if (position === 'trigger') { // 鏃ュ巻瀛愯〃瑙﹀彂鏍囩鐐瑰嚮浜嬩欢
-      this.props.closeModalView && this.props.closeModalView()
-    }
-  }
-
-  /**
    * @description 瀵煎嚭Excel鏃讹紝鑾峰彇椤甸潰鎼滅储鎺掑簭绛夊弬鏁�
    */
   getexceloutparam = (menuId, btnId) => {
@@ -544,6 +521,21 @@
   }
 
   /**
+   * @description 鎸夐挳鎵ц瀹屾垚鍚庨〉闈㈠埛鏂�
+   * @param {*} menuId     // 鑿滃崟Id
+   * @param {*} position   // 鍒锋柊浣嶇疆
+   * @param {*} btn        // 鎵ц鐨勬寜閽�
+   */
+  refreshByButtonResult = (menuId, position, btn) => {
+    const { MenuID } = this.props
+
+    if (MenuID !== menuId) return
+
+    this.reloadtable(btn)
+    MKEmitter.emit('refreshPopButton', this.props.Tab.uuid)
+  }
+
+  /**
    * @description 鍥捐〃瑙嗗浘鍒囨崲
    */
   changeChart = (uuid) => {
@@ -561,6 +553,7 @@
 
   componentDidMount () {
     MKEmitter.addListener('getexceloutparam', this.getexceloutparam)
+    MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult)
   }
 
   /**
@@ -571,6 +564,7 @@
       return
     }
     MKEmitter.removeListener('getexceloutparam', this.getexceloutparam)
+    MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult)
   }
 
   render() {
@@ -606,7 +600,6 @@
                       BData={this.props.BData}
                       selectedData={selectedData}
                       MenuID={this.props.SupMenuID}
-                      refreshdata={this.refreshbyaction}
                     />
                   </div>
                   <SubTable
@@ -614,7 +607,6 @@
                     setting={setting}
                     columns={columns}
                     pageSize={pageSize}
-                    BID={this.props.BID}
                     data={this.state.data}
                     dict={this.state.dict}
                     BData={this.props.BData}
@@ -623,7 +615,6 @@
                     loading={this.state.loading}
                     refreshdata={this.refreshbytable}
                     statFValue={this.state.statFValue}
-                    refreshbyaction={this.refreshbyaction}
                     chgSelectData={this.changeSelectedData}
                     handleTableId={() => {}}
                   />
@@ -641,7 +632,6 @@
                     data={this.state.data}
                     BData={this.props.BData}
                     loading={this.state.loading}
-                    refreshdata={this.refreshbyaction}
                     handleTableId={() => {}}
                   />
                 </Col>

--
Gitblit v1.8.0