From 482efd9ee971fe7d799a015dc288340c85b8805c Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期四, 29 九月 2022 11:24:17 +0800
Subject: [PATCH] 1.新增  提交类按钮只能提交一次的控制2.关联类的按钮  接口返回成功后显示对话框

---
 src/views/jcsz/wldw.vue |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/views/jcsz/wldw.vue b/src/views/jcsz/wldw.vue
index 0e47aee..31b1ed2 100644
--- a/src/views/jcsz/wldw.vue
+++ b/src/views/jcsz/wldw.vue
@@ -248,7 +248,12 @@
       <span slot="footer" class="dialog-footer">
         <div class="footerButton">
           <el-button @click="dialogVisibleCancel">鍙� 娑�</el-button>
-          <el-button type="primary" @click="dialogVisibleConfirm">纭� 瀹�</el-button>
+          <el-button
+            type="primary"
+            :loading="$store.state.app.buttonIsDisabled"
+            :disabled="$store.state.app.buttonIsDisabled"
+            @click="dialogVisibleConfirm"
+          >纭� 瀹�</el-button>
         </div>
       </span>
     </el-dialog>
@@ -505,6 +510,7 @@
     dialogVisibleConfirm() {
       this.$refs.dialogForm.validate(valid => {
         if (valid) {
+          this.$store.state.app.buttonIsDisabled = true
           let mtypecode = null // 澶栬喘缂栫爜
           let btypecode = null // 澶栧崗缂栫爜
           let htypecode = null // 瀹㈡埛缂栫爜
@@ -530,14 +536,16 @@
             description: this.dialogForm.description,
             OperType: this.operation === 'add' ? 'Add' : 'Update'
           }
-          // console.log(data, 2)
+
           AddUpdateCurrentUnit(data).then(res => {
             if (res.code === '200') {
-              this.$message.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�')
               this.dialogVisible = false
+              this.$message.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�')
               this.getCurrentUnitSearch()
+              this.$store.state.app.buttonIsDisabled = false
             } else {
               this.$message.error(this.operation === 'add' ? '娣诲姞澶辫触锛�' : '淇敼澶辫触锛�')
+              this.$store.state.app.buttonIsDisabled = false
             }
           })
         }

--
Gitblit v1.9.3