Browse Source

页面按钮操作补充防止重复提交

oyq28 3 years ago
parent
commit
da9f84073f

+ 6 - 4
imcs-ui/src/views/zuihou/dispatchMgr/exception/Index.vue

@@ -124,7 +124,7 @@
         :label="$t('dispatch.table.exception.operation')"
         width="300px"  align="center">
         <template slot-scope="{ row }">
-          <el-button v-if="row.taskNodeId" plain type="primary" size="medium" @click.native="resend(row)">
+          <el-button v-if="row.taskNodeId"  :disabled="confirmDisabled"  plain type="primary" size="medium" @click.native="resend(row)">
 	        {{ $t("dispatch.button.resend") }}
 	       </el-button>
 	        <!--<el-button plain type="primary" size="medium" @click.native="marked(row)">
@@ -177,6 +177,7 @@ export default {
       selection: [],
       tableKey: 0,
       loading: false,
+      confirmDisabled: false,
       tableData: {
         total: 0,
       },
@@ -220,6 +221,7 @@ export default {
       this.search();
     },
     resend(row){
+      this.confirmDisabled = true
       warnLogApi.resend({id: row.id}).then(response => {
 			const res = response.data
 			if (res.isSuccess) {
@@ -229,11 +231,11 @@ export default {
 				})
 				this.fetch()
 			}
+     }).finally(()=>{
+       this.confirmDisabled = false
      })
     },
-    marked(row){
-      console.log(row);
-      console.log(row.id);
+    marked(row){      
      warnLogApi.complete({id: row.id}).then(response => {
 			const res = response.data
 			if (res.isSuccess) {

+ 7 - 3
imcs-ui/src/views/zuihou/machiningClient/touchScreen/Index.vue

@@ -419,9 +419,13 @@ export default {
       this.view2Visible = false
       this.view3Visible = false
     },
-    editSuccess(item){
-      this.getStation()
-      this.taskData.shift();
+    editSuccess(){
+      //this.getStation()
+      //this.taskData.shift();
+      this.$nextTick(() => {
+         this.getStation()
+      });
+
     },
     setPercentage(time, left) {
       return this.formatGap(time, left)[0] > 100

+ 15 - 2
imcs-ui/src/views/zuihou/machiningClient/touchScreen/components/View1.vue

@@ -154,7 +154,7 @@ export default {
 	  	currentRow: null, // 当前选择的行
 
 	  	spanArr: [],  // 【组序】合并单元格
-	    spanArr2: [],  // 【优先级】合并单元格
+	    spanArr2: [],  // 【优先级】合并单元格	    
     }
   },
   // 实例已经在内存中创建好,此时data和methods已将ok,如果要操作data中的数据或是调用methods中的方法,最早只能在created中操作
@@ -193,6 +193,17 @@ export default {
   	submitForm(){
       // 更新改任务的开始时间
       // TODO 写入rfid内容,工件信息、原材料R
+	  this.confirmDisabled = true	  
+      let valid = this.uniqueCode!=''? true: false;
+	  if(!valid){
+          this.$message({
+	          message: "零件编码" + this.$t("rules.require"),
+	          type: "warning"
+	      })
+		  this.confirmDisabled = false
+		  return false
+	  }
+
       taskMgrApi.updateTaskStatus({ "id" : this.tenant.id,"meterialId":this.tenant.meterialId, "uniqueCode":this.uniqueCode, "updateType" : "end", "processType" : "1", "updateUser" : this.$store.state.account.user.id}).then((res) => {
           res = res.data;
           if (res.isSuccess) {
@@ -201,7 +212,9 @@ export default {
               // 通知列表-并关闭弹出框
               this.$emit("close");
           }
-      });
+      }).finally(()=>{
+		  this.confirmDisabled = false
+	  });
   	},
   	// table的当前行值变化后
   	handleCurrentChange(val) {

+ 3 - 0
imcs-ui/src/views/zuihou/machiningClient/touchScreen/components/View2.vue

@@ -135,6 +135,7 @@ export default {
   },
   methods: {
   	submitForm(){
+      this.confirmDisabled = true
       taskMgrApi.updateTaskStatus({ "id" : this.tenant.id, "updateType" : "end", "processType" : "2","updateUser" : this.$store.state.account.user.id}).then((res) => {
           res = res.data;
           if (res.isSuccess) {
@@ -143,6 +144,8 @@ export default {
               // 通知列表-并关闭弹出框
               this.$emit("close");
           }
+      }).finally(()=>{
+        this.confirmDisabled = false
       });
   	},
   	// table的当前行值变

+ 4 - 1
imcs-ui/src/views/zuihou/machiningClient/touchScreen/components/View3.vue

@@ -173,6 +173,7 @@ export default {
       }
 	},
   	submitForm(){
+        this.confirmDisabled = true
         taskMgrApi.updateTaskStatus({ "id" : this.tenant.id, "updateType" : "end","processType" : "3","updateUser" : this.$store.state.account.user.id}).then((res) => {
             res = res.data;
             if (res.isSuccess) {
@@ -181,7 +182,9 @@ export default {
                 // 通知列表-并关闭弹出框
                 this.$emit("close");
             }
-        });
+        }).finally(()=>{
+        this.confirmDisabled = false
+      });
   	},
     initWidth () {
       this.screenWidth = document.body.clientWidth