ソースを参照

创建工单 连续点2次,同一时间建了2单

linwenxin 1 年間 前
コミット
2cca9b04b1

+ 7 - 1
src/views/workOrder/workOrderPool/detailModule/workOrderInfo/buttons/abnormal.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="withinLine">
-    <el-button @click="abnormal" type="primary" size="mini">设为异常</el-button>
+    <el-button @click="abnormal" :disabled="disabled" type="primary" size="mini">设为异常</el-button>
   </div>
 </template>
 
@@ -12,12 +12,14 @@ export default {
   mixins: [buttonMixin],
   methods: {
     abnormal() {
+      this.lockBtn()
       MessageBox.confirm('是否确定将此单设置为异常单,请谨慎操作', '设为异常确认', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
         type: 'warning'
       }).then(() => {
         orderBaseFlag({ flag: true, orderBaseId: this.orderInfo.id, orderFlagEnum: "YI_CHANGE" }).then(res => {
+          this.unlockBtn()
           // 编辑保存后不跳转列表,刷新数据
           this.acquireVerify(this, 'getorderDetail')()
           // 刷新操作记录
@@ -26,7 +28,11 @@ export default {
             type: 'success',
             message: '设置成功!'
           })
+        }).catch(() => {
+          this.unlockBtn()
         })
+      }).catch(() => {
+        this.unlockBtn()
       })
     }
   }

+ 15 - 1
src/views/workOrder/workOrderPool/detailModule/workOrderInfo/buttons/button_mixin.js

@@ -9,6 +9,11 @@ export default {
       default: null
     },
   },
+  data(){
+    return {
+      disabled: false
+    }
+  },
   methods:{
     acquireVerify(v, name) {
       if (v.$parent[name]) {
@@ -16,6 +21,15 @@ export default {
       } else {
         return this.acquireVerify(v.$parent, name)
       }
-    }
+    },
+    lockBtn(){
+      this.disabled = true
+      setTimeout(()=>{
+        this.disabled = false
+      }, 5000)
+    },
+    unlockBtn(){
+      this.disabled = false
+    },
   }
 }

+ 6 - 1
src/views/workOrder/workOrderPool/detailModule/workOrderInfo/buttons/cancelOrder.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="withinLine">
-    <el-button @click="abnormal" type="primary" size="mini">取消工单</el-button>
+    <el-button @click="abnormal" :disabled="disabled" type="primary" size="mini">取消工单</el-button>
   </div>
 </template>
 
@@ -12,6 +12,7 @@ export default {
   mixins: [buttonMixin],
   methods: {
     abnormal() {
+      this.lockBtn()
       MessageBox.confirm('是否确定取消此单,请谨慎操作', '取消工单', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
@@ -28,7 +29,11 @@ export default {
             type: 'success',
             message: '取消成功!'
           })
+        }).catch(() => {
+          this.unlockBtn()
         })
+      }).catch(() => {
+        this.unlockBtn()
       })
     }
   }

+ 5 - 1
src/views/workOrder/workOrderPool/detailModule/workOrderInfo/buttons/commitSave.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="withinLine">
-    <el-button type="primary" size="mini" @click="save">
+    <el-button type="primary" :disabled="disabled" size="mini" @click="save">
       {{ orderInfo.id ? '保存' : '下派工单' }}
     </el-button>
   </div>
@@ -16,6 +16,7 @@ export default {
     save() {
       this.acquireVerify(this, 'allVerify')((v) => {
         if (v) {
+          this.lockBtn()
           orderBaseSave(this.orderInfo).then(res => {
             if (this.orderInfo.id) {
               // 编辑保存后不跳转列表,刷新数据
@@ -30,6 +31,9 @@ export default {
               // 创建保存后跳转列表
               EventBus.$emit('handleOrderClone')
             }
+            this.unlockBtn()
+          }).catch(() => {
+            this.unlockBtn()
           })
         }
       })

+ 5 - 1
src/views/workOrder/workOrderPool/detailModule/workOrderInfo/buttons/processFeedback.vue

@@ -10,7 +10,7 @@
       </zj-form-container>
       <div slot="footer" class="dialog-footer">
         <el-button size="mini" @click="formCancel">取 消</el-button>
-        <el-button size="mini" @click="formConfirm" type="primary">确 定</el-button>
+        <el-button size="mini" :disabled="disabled" @click="formConfirm" type="primary">确 定</el-button>
       </div>
     </el-dialog>
   </div>
@@ -136,10 +136,12 @@ export default {
     formConfirm() {
       this.$refs.formRef.validate(valid => {
         if (valid) {
+          this.lockBtn()
           orderBaseLogAdd({
             ...this.formData,
             imgSrc: this.formData.imgSrc.map(item => item.url).join(",")
           }).then(res => {
+            this.unlockBtn()
             // 编辑保存后不跳转列表,刷新数据
             this.acquireVerify(this, 'getorderDetail')()
             // 刷新操作记录
@@ -149,6 +151,8 @@ export default {
               message: '反馈成功'
             })
             this.formCancel()
+          }).catch(() => {
+            this.unlockBtn()
           })
         }
       })

+ 7 - 1
src/views/workOrder/workOrderPool/detailModule/workOrderInfo/buttons/unurgent.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="withinLine">
-    <el-button @click="urgent" type="primary" size="mini">不加急</el-button>
+    <el-button @click="urgent" :disabled="disabled" type="primary" size="mini">不加急</el-button>
   </div>
 </template>
 
@@ -12,12 +12,14 @@ export default {
   mixins: [buttonMixin],
   methods: {
     urgent() {
+      this.lockBtn()
       MessageBox.confirm('取消加急操作,会消息通知所有订单相关人员,请谨慎操作', '取消加急确认', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
         type: 'warning'
       }).then(() => {
         orderBaseFlag({ flag: false, orderBaseId: this.orderInfo.id, orderFlagEnum: "JIA_JI" }).then(res => {
+          this.unlockBtn()
           // 编辑保存后不跳转列表,刷新数据
           this.acquireVerify(this, 'getorderDetail')()
           // 刷新操作记录
@@ -26,7 +28,11 @@ export default {
             type: 'success',
             message: '取消加急成功!'
           })
+        }).catch(() => {
+          this.unlockBtn()
         })
+      }).catch(() => {
+        this.unlockBtn()
       })
     }
   }

+ 7 - 1
src/views/workOrder/workOrderPool/detailModule/workOrderInfo/buttons/urgent.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="withinLine">
-    <el-button @click="urgent" type="primary" size="mini">加急</el-button>
+    <el-button @click="urgent" :disabled="disabled" type="primary" size="mini">加急</el-button>
   </div>
 </template>
 
@@ -12,12 +12,14 @@ export default {
   mixins: [buttonMixin],
   methods: {
     urgent() {
+      this.lockBtn()
       MessageBox.confirm('加急操作,会消息通知所有订单相关人员,请谨慎操作', '加急确认', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
         type: 'warning'
       }).then(() => {
         orderBaseFlag({ flag: true, orderBaseId: this.orderInfo.id, orderFlagEnum: "JIA_JI" }).then(res => {
+          this.unlockBtn()
           // 编辑保存后不跳转列表,刷新数据
           this.acquireVerify(this, 'getorderDetail')()
           // 刷新操作记录
@@ -26,7 +28,11 @@ export default {
             type: 'success',
             message: '加急成功!'
           })
+        }).catch(() => {
+          this.unlockBtn()
         })
+      }).catch(() => {
+        this.unlockBtn()
       })
     }
   }