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/verupmanage/actionList/index.jsx |   70 +++++++++++++++++++++--------------
 1 files changed, 42 insertions(+), 28 deletions(-)

diff --git a/src/tabviews/verupmanage/actionList/index.jsx b/src/tabviews/verupmanage/actionList/index.jsx
index db069e1..7e5ae84 100644
--- a/src/tabviews/verupmanage/actionList/index.jsx
+++ b/src/tabviews/verupmanage/actionList/index.jsx
@@ -33,7 +33,8 @@
     confirmLoading: false,
     execAction: null,
     loadingUuid: '',
-    configMap: {}
+    configMap: {},
+    loadingNumber: ''
   }
 
   refreshdata = (item, type) => {
@@ -92,6 +93,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)
           })
@@ -365,7 +370,7 @@
       }
 
       // 寰幆璋冪敤澶栭儴鎺ュ彛锛堝寘鎷唴閮ㄥ強鍥炶皟鍑芥暟锛�
-      this.outerLoopRequest(_params, btn, _resolve)
+      this.outerLoopRequest(_params, btn, _resolve, _params.length > 20)
     }
   }
 
@@ -376,6 +381,10 @@
     if (!params && params.length === 0) return
 
     let param = params.shift()
+
+    this.setState({
+      loadingNumber: params.length || ''
+    })
 
     Api.genericInterface(param).then(res => {
       if (res.status) {
@@ -395,12 +404,18 @@
   /**
    * @description 澶栭儴璇锋眰寰幆鎵ц
    */
-  outerLoopRequest = (params, btn, _resolve) => {
+  outerLoopRequest = (params, btn, _resolve, widthNumber) => {
     if (!params && params.length === 0) return
 
     let param = params.shift()
     let _outParam = null
     let _localParam = null
+
+    if (widthNumber) {
+      this.setState({
+        loadingNumber: params.length || ''
+      })
+    }
 
     new Promise(resolve => {
       // 鍐呴儴璇锋眰
@@ -476,7 +491,7 @@
             this.execSuccess(btn, response)
             _resolve()
           } else {
-            this.outerLoopRequest(params, btn, _resolve)
+            this.outerLoopRequest(params, btn, _resolve, widthNumber)
           }
         } else {
           this.execError(response, btn)
@@ -494,7 +509,7 @@
           this.execSuccess(btn, res)
           _resolve()
         } else {
-          this.outerLoopRequest(params, btn, _resolve)
+          this.outerLoopRequest(params, btn, _resolve, widthNumber)
         }
       } else {
         this.execError(res, btn)
@@ -508,7 +523,7 @@
           this.execSuccess(btn, res)
           _resolve()
         } else {
-          this.outerLoopRequest(params, btn, _resolve)
+          this.outerLoopRequest(params, btn, _resolve, widthNumber)
         }
       } else {
         this.execError(res, btn)
@@ -547,7 +562,8 @@
     }
 
     this.setState({
-      loadingUuid: ''
+      loadingUuid: '',
+      loadingNumber: ''
     })
 
     this.refreshdata(btn, 'success')
@@ -582,7 +598,8 @@
     }
     
     this.setState({
-      loadingUuid: ''
+      loadingUuid: '',
+      loadingNumber: ''
     })
     
     this.refreshdata(btn, 'error')
@@ -636,6 +653,10 @@
     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)
         })
@@ -728,31 +749,24 @@
   }
 
   render() {
-    const { loadingUuid } = this.state
+    const { loadingUuid, loadingNumber } = this.state
 
     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()}
       </div>

--
Gitblit v1.8.0