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/zshare/actionList/popupbutton/index.jsx |   53 ++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 40 insertions(+), 13 deletions(-)

diff --git a/src/tabviews/zshare/actionList/popupbutton/index.jsx b/src/tabviews/zshare/actionList/popupbutton/index.jsx
index 2a5c6fa..84db3ce 100644
--- a/src/tabviews/zshare/actionList/popupbutton/index.jsx
+++ b/src/tabviews/zshare/actionList/popupbutton/index.jsx
@@ -24,7 +24,6 @@
     MenuID: PropTypes.string,         // 鑿滃崟ID
     btn: PropTypes.object,            // 鎸夐挳
     setting: PropTypes.any,           // 椤甸潰閫氱敤璁剧疆
-    updateStatus: PropTypes.func,     // 鎸夐挳鐘舵�佹洿鏂�
   }
 
   state = {
@@ -45,15 +44,47 @@
     if (position === 'toolbar') {
       MKEmitter.addListener('triggerBtnId', this.actionTrigger)
     }
+    MKEmitter.addListener('openNewTab', this.openNewTab)
+    MKEmitter.addListener('refreshPopButton', this.refreshPopButton)
   }
 
   componentWillUnmount () {
     this.setState = () => {
       return
     }
+    MKEmitter.removeListener('openNewTab', this.openNewTab)
     MKEmitter.removeListener('triggerBtnId', this.actionTrigger)
+    MKEmitter.removeListener('refreshPopButton', this.refreshPopButton)
   }
   
+  /**
+   * @description 鎵撳紑鏂版爣绛炬椂锛屽叧闂脊绐楁爣绛鹃〉
+   */
+  openNewTab = () => {
+    this.setState({
+      visible: false,
+      loading: false
+    })
+  }
+
+  /**
+   * @description 寮圭獥鏍囩椤靛埛鏂�
+   */
+  refreshPopButton = (tabId) => {
+    const { btn } = this.props
+
+    if (btn.uuid !== tabId) return
+
+    if (btn.$type === 'CustomPage') {
+      if (btn.popClose !== 'never') {
+        MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.popClose, btn)
+      }
+    } else {
+      let position = btn.popClose !== 'never' ? btn.popClose : 'grid'
+      MKEmitter.emit('refreshByButtonResult', btn.$menuId, position, btn)
+    }
+  }
+
   /**
    * @description 瑙﹀彂鎸夐挳鎿嶄綔
    */
@@ -115,12 +146,6 @@
     })
   }
 
-  // 鎿嶄綔鍚庡埛鏂颁富琛�
-  reloadtable = () => {
-    const { btn } = this.props
-    this.props.updateStatus('refresh', 'grid', btn)
-  }
-
   /**
    * @description 寮圭獥鍏抽棴
    */
@@ -132,7 +157,9 @@
       loading: false
     })
 
-    this.props.updateStatus('refresh', btn.popClose, btn)
+    if (btn.popClose !== 'never') {
+      MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.popClose, btn)
+    }
   }
 
   render() {
@@ -149,13 +176,14 @@
         >{btn.label}</Button> : null}
         {show !== 'actionList' ? <Button
           type="link"
+          title={show === 'icon' ? btn.label : ''}
           loading={loading}
           style={btn.btnstyle}
           icon={show === 'text' ? '' : (btn.icon || '')}
           onClick={() => {this.actionTrigger()}}
         >{show === 'icon' && btn.icon ? '' : btn.label}</Button> : null}
         <Modal
-          className={'popview-modal ' + (btn.$menuId ? 'custom-popview' : '')}
+          className={'popview-modal ' + (btn.$type === 'CustomPage' ? 'custom-popview' : '')}
           title={btn.label}
           width={'80vw'}
           maskClosable={false}
@@ -166,15 +194,14 @@
           ]}
           destroyOnClose
         >
-          {!btn.$menuId ? <SubTabTable
+          {btn.$type !== 'CustomPage' ? <SubTabTable
             Tab={btn}
             MenuID={btn.linkTab}
+            SupMenuID={this.props.MenuID}
             BID={popData ? primaryId : this.props.BID}
             BData={popData || this.props.BData}
-            SupMenuID={this.props.MenuID}
-            refreshSupView={this.reloadtable}
           /> : null}
-          {btn.$menuId ? <CustomPage MenuID={btn.uuid} param={{BID: (popData ? primaryId : this.props.BID), data: (popData || this.props.BData)}} /> : null}
+          {btn.$type === 'CustomPage' ? <CustomPage Tab={btn} MenuID={btn.uuid} param={{BID: (popData ? primaryId : this.props.BID), data: (popData || this.props.BData)}} /> : null}
         </Modal>
       </div>
     )

--
Gitblit v1.8.0