From 1da6506bf58270bacc2a4345002c6b082835580e Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 21 十月 2021 23:17:08 +0800
Subject: [PATCH] 2021-10-21

---
 src/tabviews/zshare/actionList/excelInbutton/index.jsx |   50 ++++++++++++++++++++++----------------------------
 1 files changed, 22 insertions(+), 28 deletions(-)

diff --git a/src/tabviews/zshare/actionList/excelInbutton/index.jsx b/src/tabviews/zshare/actionList/excelInbutton/index.jsx
index e943949..3d91349 100644
--- a/src/tabviews/zshare/actionList/excelInbutton/index.jsx
+++ b/src/tabviews/zshare/actionList/excelInbutton/index.jsx
@@ -52,11 +52,7 @@
   }
 
   componentDidMount () {
-    const { position } = this.props
-
-    if (position === 'toolbar') {
-      MKEmitter.addListener('triggerBtnId', this.actionTrigger)
-    }
+    MKEmitter.addListener('triggerBtnId', this.actionTrigger)
   }
 
   UNSAFE_componentWillReceiveProps (nextProps) {
@@ -83,30 +79,15 @@
     }
     MKEmitter.removeListener('triggerBtnId', this.actionTrigger)
   }
-
-  /**
-   * @description 鎸夐挳鐘舵�佹敼鍙�
-   */
-  updateStatus = (type) => {
-    if (type === 'start') {
-      this.setState({
-        loading: true
-      })
-    } else if (type === 'over') {
-      this.setState({
-        loading: false
-      })
-    }
-  }
   
   /**
    * @description 瑙﹀彂鎸夐挳鎿嶄綔
    */
-  actionTrigger = (triggerId, record) => {
+  actionTrigger = (triggerId, record, type) => {
     const { setting, Tab, BID, btn, selectedData } = this.props
-    const { loading } = this.state
+    const { loading, disabled } = this.state
 
-    if ((triggerId && btn.uuid !== triggerId) || loading) return
+    if ((triggerId && btn.uuid !== triggerId) || loading || disabled) return
 
     if (((Tab && Tab.supMenu) || setting.supModule) && !BID) {
       notification.warning({
@@ -115,6 +96,10 @@
         duration: 5
       })
       return
+    } else if (type === 'linkbtn' && selectedData && selectedData.length === 1) {
+      if (record[0].$Index !== selectedData[0].$Index) {
+        return
+      }
     }
 
     let data = record || selectedData || []
@@ -184,6 +169,11 @@
     if (btn.execSuccess !== 'never') {
       MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execSuccess, btn)
     }
+    if (btn.switchTab && btn.switchTab.length > 0) {
+      let id = btn.switchTab[btn.switchTab.length - 1]
+      let node = document.getElementById('tab' + id)
+      node && node.click()
+    }
   }
 
   /**
@@ -252,7 +242,7 @@
         })
       }
 
-      this.updateStatus('over')
+      this.setState({ loading: false })
       return
     }
 
@@ -262,7 +252,7 @@
         message: '鏈幏鍙栧埌宸ヤ綔琛ㄣ��' + sheetName + '銆嬫暟鎹紒',
         duration: 5
       })
-      this.updateStatus('over')
+      this.setState({ loading: false })
       return
     } else if (data.length * btn.verify.columns.length > 30000) {
       notification.warning({
@@ -280,7 +270,7 @@
         message: result.errors,
         duration: 5
       })
-      this.updateStatus('over')
+      this.setState({ loading: false })
       return
     }
 
@@ -317,6 +307,10 @@
       }
 
       param.menuname = btn.logLabel
+
+      if (window.GLOB.probation) {
+        param.s_debug_type = 'Y'
+      }
 
       Api.genericInterface(param).then((res) => {
         if (res.status) {
@@ -453,7 +447,7 @@
           className={'mk-btn mk-' + btn.class}
           onClick={() => {this.actionTrigger()}}
         >{btn.label}</Button>
-        <ExcelIn btn={btn} triggerExcelIn={() => this.updateStatus('start')} returndata={this.getexceldata} ref="excelIn" />
+        <ExcelIn btn={btn} triggerExcelIn={() => this.setState({ loading: true })} returndata={this.getexceldata} ref="excelIn" />
       </div>
     } else { // icon銆乼ext銆� all 鍗$墖
       let label = ''
@@ -482,7 +476,7 @@
           icon={icon}
           onClick={() => {this.actionTrigger()}}
         >{label}</Button>
-        <ExcelIn btn={btn} triggerExcelIn={() => this.updateStatus('start')} returndata={this.getexceldata} ref="excelIn" />
+        <ExcelIn btn={btn} triggerExcelIn={() => this.setState({ loading: true })} returndata={this.getexceldata} ref="excelIn" />
       </div>
     }
   }

--
Gitblit v1.8.0