From c51f5e007a3e03c9d6731ab7f28f0080de009990 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 17 十一月 2021 18:38:32 +0800
Subject: [PATCH] 2021-11-17

---
 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 4685368..0961633 100644
--- a/src/tabviews/zshare/actionList/excelInbutton/index.jsx
+++ b/src/tabviews/zshare/actionList/excelInbutton/index.jsx
@@ -12,7 +12,7 @@
 import zhCN from '@/locales/zh-CN/main.js'
 import enUS from '@/locales/en-US/main.js'
 import MKEmitter from '@/utils/events.js'
-import './index.scss'
+// import './index.scss'
 
 class ExcelInButton extends Component {
   static propTpyes = {
@@ -28,7 +28,9 @@
   state = {
     dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
     loading: false,
+    selines: null,
     disabled: false,
+    hidden: false,
     primaryId: '',
   }
 
@@ -43,7 +45,7 @@
           disabled = true
         }
       })
-      this.setState({disabled})
+      this.setState({disabled, hidden: disabled && btn.control === 'hidden'})
     }
   }
 
@@ -69,7 +71,7 @@
           }
         })
       }
-      this.setState({disabled})
+      this.setState({disabled, hidden: disabled && btn.control === 'hidden'})
     }
   }
 
@@ -79,30 +81,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, 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({
@@ -142,6 +129,7 @@
     }
 
     this.setState({
+      selines: data,
       primaryId: primaryId
     }, () => {
       this.refs.excelIn.exceltrigger()
@@ -182,7 +170,7 @@
     })
 
     if (btn.execSuccess !== 'never') {
-      MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execSuccess, btn)
+      MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execSuccess, btn, '', this.state.selines)
     }
     if (btn.switchTab && btn.switchTab.length > 0) {
       let id = btn.switchTab[btn.switchTab.length - 1]
@@ -226,7 +214,7 @@
     })
 
     if (btn.execError !== 'never') {
-      MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execError, btn)
+      MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execError, btn, '', this.state.selines)
     }
   }
 
@@ -257,7 +245,7 @@
         })
       }
 
-      this.updateStatus('over')
+      this.setState({ loading: false })
       return
     }
 
@@ -267,7 +255,7 @@
         message: '鏈幏鍙栧埌宸ヤ綔琛ㄣ��' + sheetName + '銆嬫暟鎹紒',
         duration: 5
       })
-      this.updateStatus('over')
+      this.setState({ loading: false })
       return
     } else if (data.length * btn.verify.columns.length > 30000) {
       notification.warning({
@@ -285,7 +273,7 @@
         message: result.errors,
         duration: 5
       })
-      this.updateStatus('over')
+      this.setState({ loading: false })
       return
     }
 
@@ -322,6 +310,10 @@
       }
 
       param.menuname = btn.logLabel
+
+      if (window.GLOB.probation) {
+        param.s_debug_type = 'Y'
+      }
 
       Api.genericInterface(param).then((res) => {
         if (res.status) {
@@ -447,7 +439,9 @@
 
   render() {
     const { btn, show } = this.props
-    const { loading, disabled } = this.state
+    const { loading, disabled, hidden } = this.state
+
+    if (hidden) return null
 
     if (show === 'actionList') {
       return <div style={{display: 'inline-block'}} onClick={(e) => e.stopPropagation()}>
@@ -458,7 +452,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 = ''
@@ -487,7 +481,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