From 342d3498191f1683059fe586209ec920545e0bf9 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 28 九月 2021 13:38:09 +0800
Subject: [PATCH] 2021-09-28

---
 src/tabviews/zshare/actionList/normalbutton/index.jsx |   60 +++++++++++++++++++++++-------------------------------------
 1 files changed, 23 insertions(+), 37 deletions(-)

diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx
index 0bf6a30..1282c98 100644
--- a/src/tabviews/zshare/actionList/normalbutton/index.jsx
+++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx
@@ -109,9 +109,7 @@
 
     if (btn.uuid !== res.menuId) return
 
-    this.setState({
-      loading: true
-    })
+    this.setState({ loading: true })
 
     this.execSubmit(this.state.tabledata, () => {}, res.form)
   }
@@ -127,17 +125,12 @@
   /**
    * @description 鎸夐挳鐘舵�佹敼鍙�
    */
-  updateStatus = (type) => {
-    if (type === 'start') {
-      this.setState({
-        loading: true
-      })
-    } else if (type === 'over') {
-      this.setState({
-        loading: false,
-        visible: false
-      })
-    }
+  updateStatus = () => {
+    this.setState({
+      loading: false,
+      visible: false,
+      confirmLoading: false
+    })
   }
   
   /**
@@ -242,7 +235,7 @@
       MKEmitter.emit('mkFormSubmit', btn.uuid)
       return
     } else if (btn.OpenType === 'prompt') {
-      this.updateStatus('start')
+      this.setState({loading: true})
       confirm({
         title: this.state.dict['main.action.confirm.tip'],
         onOk() {
@@ -251,21 +244,20 @@
           })
         },
         onCancel() {
-          _this.updateStatus('over')
+          _this.setState({loading: false})
         }
       })
     } else if (btn.OpenType === 'exec') {
-      this.updateStatus('start')
+      this.setState({loading: true})
       this.execSubmit(data, () => { this.setState({loading: false})})
     } else if (btn.OpenType === 'pop') {
-      this.updateStatus('start')
-
       let modal = this.state.btnconfig
       if (!modal && btn.modal) {
         modal = this.handleModelConfig(btn.modal)
       }
 
       this.setState({
+        loading: true,
         tabledata: data,
         btnconfig: modal
       }, () => {
@@ -712,7 +704,7 @@
                 }
                 resolve(res)
               }, () => {
-                this.updateStatus('over')
+                this.updateStatus()
                 _resolve()
               })
             }, 100 * i)
@@ -867,7 +859,7 @@
                 }
                 resolve()
               }, () => {
-                _this.updateStatus('over')
+                _this.updateStatus()
                 resolve()
                 _resolve()
               })
@@ -884,7 +876,7 @@
         _resolve()
       }
     }, () => {
-      this.updateStatus('over')
+      this.updateStatus()
       _resolve()
     })
   }
@@ -1136,7 +1128,7 @@
         _resolve()
       }
     }, () => {
-      this.updateStatus('over')
+      this.updateStatus()
       _resolve()
     })
   }
@@ -1189,7 +1181,7 @@
         _resolve()
       }
     }, () => {
-      this.updateStatus('over')
+      this.updateStatus()
       _resolve()
     })
   }
@@ -1242,7 +1234,7 @@
             _resolve()
           }
         }, () => {
-          this.updateStatus('over')
+          this.updateStatus()
           _resolve()
         })
       } else {
@@ -1680,14 +1672,14 @@
             message: res.message,
             duration: 5
           })
-          this.updateStatus('over')
+          this.setState({ loading: false })
         } else if (!_LongParam || (btn.OpenType === 'pop' && _LongParam.type !== 'Modal')) {
           notification.warning({
             top: 92,
             message: '鏈幏鍙栧埌鎸夐挳閰嶇疆淇℃伅锛�',
             duration: 5
           })
-          this.updateStatus('over')
+          this.setState({ loading: false })
         } else {
           _LongParam = updateForm(_LongParam)
           _LongParam = this.handleModelConfig(_LongParam)
@@ -1713,15 +1705,9 @@
    */
   handleOk = () => {
     this.formRef.handleConfirm().then(res => {
-      this.setState({
-        confirmLoading: true
-      })
+      this.setState({ confirmLoading: true })
 
-      this.execSubmit(this.state.tabledata, () => {
-        this.setState({
-          confirmLoading: false
-        })
-      }, res)
+      this.execSubmit(this.state.tabledata, () => { this.setState({ confirmLoading: false }) }, res)
     })
   }
 
@@ -1730,10 +1716,10 @@
    */
   handleCancel = () => {
     this.setState({
+      loading: false,
       visible: false,
       confirmLoading: false
     })
-    this.updateStatus('over')
   }
 
   modelconfirm = () => {
@@ -1799,7 +1785,7 @@
         })
       },
       onCancel() {
-        _this.updateStatus('over')
+        _this.setState({ loading: false })
       }
     })
   }

--
Gitblit v1.8.0