From 04031b86d12c54dad59ebca8819f03479e87924f Mon Sep 17 00:00:00 2001
From: zhoucong <123456>
Date: 星期五, 22 四月 2022 15:25:56 +0800
Subject: [PATCH] fix

---
 src/views/safetyproduction/review.vue |   52 ++++++++++++++++++++++++++++++++--------------------
 1 files changed, 32 insertions(+), 20 deletions(-)

diff --git a/src/views/safetyproduction/review.vue b/src/views/safetyproduction/review.vue
index cf0222f..ddf24d8 100644
--- a/src/views/safetyproduction/review.vue
+++ b/src/views/safetyproduction/review.vue
@@ -237,6 +237,8 @@
       id: "",
       form: {},
       list: {},
+      point:"",
+      pointDel:""
     };
   },
   created() {
@@ -247,28 +249,38 @@
     itemInfo(id) {
       safetySelfInspectionItemInfo({id:id}).then((res) => {
         this.list = res.data.result;
+        this.point=res.data.result.point
+        this.pointDel=res.data.result.point
       });
     },
     modItem() {
       if(this.list.safetyInspectionItemResult!=null){
-        console.log(this.list)
-      safetySelfInspectionModItemInfo(this.list).then((res) => {
-        if (res.data.code == 200) {
-          this.$notify({
-            type: "success",
-            duration: 2000,
-            message: "提交成功",
-            title: "成功",
-          });
-          this.$router.push({
-            path: "/gojudging",
-              query:{
-          id:this.id
+          let pointFlag = this.pointDel
+        for(var i=0;i<this.list.selfDeductionList.length;i++){
+            pointFlag=pointFlag-this.list.selfDeductionList[i].point
         }
-          });
-        }
-      });
-      }else{
+          if(pointFlag>=0){
+              safetySelfInspectionModItemInfo(this.list).then((res) => {
+                  if (res.data.code == 200) {
+                      this.$notify({
+                          type: "success",
+                          duration: 2000,
+                          message: "提交成功",
+                          title: "成功",
+                      });
+                      this.$router.push({
+                          path: "/gojudging",
+                          query: {
+                              id: this.id
+                          }
+                      });
+                  }
+                  })
+          }else{
+              alert(`扣分不得超过总分${this.point}`)
+          }
+      }
+      else{
           this.$confirm('是否否决项未选择','提示', {
             confirmButtonText: '确认',
             cancelButtonText: '取消',
@@ -290,15 +302,15 @@
         this.form=JSON.parse(JSON.stringify(data));
     },
     addC(){
-       if(this.form.point<=50){
+       if(this.form.point<=this.point){
         for(let i = 0;i<this.list.selfDeductionList.length;i++){
-            if (this.form.id==this.list.selfDeductionList[i].id){
+            if (this.form.safetyInspectionItemDeductionId==this.list.selfDeductionList[i].safetyInspectionItemDeductionId){
                 this.list.selfDeductionList[i].point = this.form.point
                 this.list.selfDeductionList[i].remark = this.form.remark
             }
         }
         }else{
-                alert("扣分不得超过总分50")
+                alert(`扣分不得超过总分${this.point}`)
               }
       this.dialogVisible = false;
     },

--
Gitblit v1.9.2