Переглянути джерело

feature(工单): 保存时加loading,防止数据重复提交

lk 2 роки тому
батько
коміт
27901d2be1

+ 5 - 1
src/views/work/deliver/components/Edit.vue

@@ -52,7 +52,7 @@
     </el-form>
     <template #footer>
       <el-button @click="close">取 消</el-button>
-      <el-button v-if="!form.id" type="primary" @click="save">确 定</el-button>
+      <el-button v-if="!form.id" :loading="loading" type="primary" @click="save">确 定</el-button>
     </template>
 
     <!-- 选择支持人员弹窗 -->
@@ -82,6 +82,7 @@
     },
     data() {
       return {
+        loading: false,
         form: {
           nboId: undefined,
           nboName: undefined,
@@ -219,6 +220,7 @@
         }
       },
       showEdit(row) {
+        this.loading = false
         this.getBusinessList()
         if (!row) {
           this.title = '添加'
@@ -295,7 +297,9 @@
               })
             }
             this.form.formData = items
+            this.loading = true
             const { msg } = await deliverApi.addDeliverOrder(this.form)
+            this.loading = false
             this.$baseMessage(msg, 'success', 'vab-hey-message-success')
             this.$emit('fetch-data')
             this.close()

+ 5 - 1
src/views/work/order/components/Edit.vue

@@ -50,7 +50,7 @@
     </el-form>
     <template #footer>
       <el-button @click="close">取 消</el-button>
-      <el-button v-if="!form.id" type="primary" @click="save">确 定</el-button>
+      <el-button v-if="!form.id" :loading="loading" type="primary" @click="save">确 定</el-button>
     </template>
 
     <!-- 选择支持人员弹窗 -->
@@ -78,6 +78,7 @@
     },
     data() {
       return {
+        loading: false,
         form: {
           nboId: undefined,
           nboName: undefined,
@@ -178,6 +179,7 @@
         }
       },
       showEdit(row) {
+        this.loading = false
         if (!row) {
           this.title = '添加'
         } else {
@@ -257,7 +259,9 @@
               })
             }
             this.form.formData = items
+            this.loading = true
             const { msg } = await workApi.doAdd(this.form)
+            this.loading = false
             this.$baseMessage(msg, 'success', 'vab-hey-message-success')
             this.$emit('fetch-data')
             this.close()