From b9a0e8541f0959db5d848f7b893c8838851ce411 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 09 四月 2020 13:29:49 +0800
Subject: [PATCH] 2020-04-09

---
 src/tabviews/zshare/actionList/index.jsx |  113 +++++++++++++++++++++++++++++++++-----------------------
 1 files changed, 66 insertions(+), 47 deletions(-)

diff --git a/src/tabviews/zshare/actionList/index.jsx b/src/tabviews/zshare/actionList/index.jsx
index 1368487..78abe49 100644
--- a/src/tabviews/zshare/actionList/index.jsx
+++ b/src/tabviews/zshare/actionList/index.jsx
@@ -44,7 +44,8 @@
     loadingUuid: '',
     btnloading: false,
     configMap: {},
-    running: false
+    running: false,
+    loadingNumber: ''
   }
 
   /**
@@ -73,6 +74,15 @@
    */
   actionTrigger = (item, record) => {
     const { setting, type, Tab, BID } = this.props
+
+    if (this.state.loadingUuid || this.state.visible || this.state.running) {
+      notification.warning({
+        top: 92,
+        message: '浠诲姟鎵ц涓紝璇风◢鍚庯紒',
+        duration: 5
+      })
+      return
+    }
 
     if (type === 'sub' && Tab && Tab.supMenu && !BID) {
       notification.warning({
@@ -123,6 +133,10 @@
       confirm({
         title: this.props.dict['main.action.confirm.tip'],
         onOk() {
+          _this.setState({
+            loadingUuid: item.uuid
+          })
+
           return new Promise(resolve => {
             _this.execSubmit(item, data, resolve)
           })
@@ -1333,7 +1347,7 @@
       }
 
       // 寰幆璋冪敤澶栭儴鎺ュ彛锛堝寘鎷唴閮ㄥ強鍥炶皟鍑芥暟锛�
-      this.outerLoopRequest(_params, btn, _resolve)
+      this.outerLoopRequest(_params, btn, _resolve, _params.length > 20)
       
     } else {
       this.actionSettingError()
@@ -1349,6 +1363,10 @@
     if (!params && params.length === 0) return
 
     let param = params.shift()
+
+    this.setState({
+      loadingNumber: params.length || ''
+    })
 
     Api.genericInterface(param).then(res => {
       if (res.status) {
@@ -1368,11 +1386,17 @@
   /**
    * @description 澶栭儴璇锋眰寰幆鎵ц
    */
-  outerLoopRequest = (params, btn, _resolve) => {
+  outerLoopRequest = (params, btn, _resolve, widthNumber) => {
     if (!params && params.length === 0) return
 
     let param = params.shift()
     let _outParam = null
+
+    if (widthNumber) {
+      this.setState({
+        loadingNumber: params.length || ''
+      })
+    }
 
     new Promise(resolve => {
       // 鍐呴儴璇锋眰
@@ -1449,7 +1473,7 @@
             this.execSuccess(btn, response)
             _resolve()
           } else {
-            this.outerLoopRequest(params, btn, _resolve)
+            this.outerLoopRequest(params, btn, _resolve, widthNumber)
           }
         } else {
           this.execError(response, btn)
@@ -1464,7 +1488,7 @@
           this.execSuccess(btn, res)
           _resolve()
         } else {
-          this.outerLoopRequest(params, btn, _resolve)
+          this.outerLoopRequest(params, btn, _resolve, widthNumber)
         }
       } else {
         this.execError(res, btn)
@@ -1504,7 +1528,8 @@
 
     this.setState({
       loadingUuid: '',
-      running: false
+      running: false,
+      loadingNumber: ''
     })
 
     this.refreshdata(btn, 'success')
@@ -1540,7 +1565,8 @@
     
     this.setState({
       loadingUuid: '',
-      running: false
+      running: false,
+      loadingNumber: ''
     })
     
     this.refreshdata(btn, 'error')
@@ -2425,13 +2451,18 @@
         value: _initval
       }
     })
-    this.setState({
+
+    _this.setState({
       running: true
     })
 
     confirm({
       title: this.props.dict['main.action.confirm.tip'],
       onOk() {
+        _this.setState({
+          loadingUuid: execAction.uuid
+        })
+
         return new Promise(resolve => {
           _this.execSubmit(execAction, tabledata, resolve, result)
         })
@@ -2502,33 +2533,27 @@
   }
 
   render() {
-    const { loadingUuid, btnloading } = this.state
+    const { loadingUuid, btnloading, loadingNumber } = this.state
 
     if (this.props.setting.actionfixed && this.props.type === 'main') { // 鎸夐挳鏄惁鍥哄畾鍦ㄥご閮�
       return (
         <Affix offsetTop={48}>
           <div className="button-list toolbar-button" id={this.props.MenuID + 'mainaction'}>
             {this.props.actions.map((item, index) => {
-              if (loadingUuid === item.uuid) {
-                return (
-                  <Button
-                    className={'mk-btn mk-' + item.class}
-                    icon={item.icon}
-                    key={'action' + index}
-                    onClick={() => {this.actionTrigger(item)}}
-                    loading
-                  >{item.label}</Button>
-                )
-              } else {
-                return (
-                  <Button
-                    className={'mk-btn mk-' + item.class}
-                    icon={item.icon}
-                    key={'action' + index}
-                    onClick={() => {this.actionTrigger(item)}}
-                  >{item.label}</Button>
-                )
+              let label = item.label
+              if (loadingUuid === item.uuid && loadingNumber !== '') {
+                label = label + '(' + loadingNumber + ')'
               }
+
+              return (
+                <Button
+                  className={'mk-btn mk-' + item.class}
+                  icon={item.icon}
+                  key={'action' + index}
+                  onClick={() => {this.actionTrigger(item)}}
+                  loading={loadingUuid === item.uuid}
+                >{label}</Button>
+              )
             })}
             {this.getModels()}
             {btnloading && <Spin size="large" />}
@@ -2540,26 +2565,20 @@
       return (
         <div className="button-list toolbar-button">
           {this.props.actions.map((item, index) => {
-            if (loadingUuid === item.uuid) {
-              return (
-                <Button
-                  className={'mk-btn mk-' + item.class}
-                  icon={item.icon}
-                  key={'action' + index}
-                  onClick={() => {this.actionTrigger(item)}}
-                  loading
-                >{item.label}</Button>
-              )
-            } else {
-              return (
-                <Button
-                  className={'mk-btn mk-' + item.class}
-                  icon={item.icon}
-                  key={'action' + index}
-                  onClick={() => {this.actionTrigger(item)}}
-                >{item.label}</Button>
-              )
+            let label = item.label
+            if (loadingUuid === item.uuid && loadingNumber !== '') {
+              label = label + '(' + loadingNumber + ')'
             }
+
+            return (
+              <Button
+                className={'mk-btn mk-' + item.class}
+                icon={item.icon}
+                key={'action' + index}
+                onClick={() => {this.actionTrigger(item)}}
+                loading={loadingUuid === item.uuid}
+              >{label}</Button>
+            )
           })}
           {this.getModels()}
           {btnloading && <Spin size="large" />}

--
Gitblit v1.8.0