From e520d6f233851374356bb49c4cf724d1d3565b05 Mon Sep 17 00:00:00 2001
From: songhuangfeng123 <shf18767906695@163.com>
Date: 星期四, 19 五月 2022 09:01:49 +0800
Subject: [PATCH] fix

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

diff --git a/src/views/safetyproduction/review.vue b/src/views/safetyproduction/review.vue
index d6517a6..f46fa78 100644
--- a/src/views/safetyproduction/review.vue
+++ b/src/views/safetyproduction/review.vue
@@ -124,7 +124,7 @@
               <el-col :span="24">
                 <el-form-item label="是否否决项">
                   <el-radio-group v-model="list.safetyInspectionItemResult">
-                    <el-radio :label="0">是</el-radio>
+                    <el-radio :label="0" v-if="list.veto!='' && list.veto!=null">是</el-radio>
                     <el-radio :label="1">否</el-radio>
                   </el-radio-group>
                 </el-form-item></el-col
@@ -237,6 +237,8 @@
       id: "",
       form: {},
       list: {},
+      point:"",
+      pointDel:""
     };
   },
   created() {
@@ -247,35 +249,45 @@
     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
-        }
-          });
-        }
-      });
-      }else{
-          this.$confirm('是否否决项未选择','提示', {
-            confirmButtonText: '确认',
-            cancelButtonText: '取消',
-            type: 'warning'
-        })
-      }
-    },
+      modItem() {
+          if(this.list.safetyInspectionItemResult!=null){
+              let pointFlag = this.pointDel
+              for(var i=0;i<this.list.selfDeductionList.length;i++){
+                  pointFlag=pointFlag-this.list.selfDeductionList[i].point
+              }
+              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: '取消',
+                  type: 'warning'
+              })
+          }
+      },
     back() {
       this.$router.push({
         path: "/gojudging",
@@ -289,19 +301,19 @@
       // this.form = data;
         this.form=JSON.parse(JSON.stringify(data));
     },
-    addC(){
-       if(this.form.point<=50){
-        for(let i = 0;i<this.list.selfDeductionList.length;i++){
-            if (this.form.id=this.list.selfDeductionList[i].id){
-                this.list.selfDeductionList[i].point = this.form.point
-                this.list.selfDeductionList[i].remark = this.form.remark
-            }
-        }
-        }else{
-                alert("扣分不得超过总分50")
+      addC(){
+          if(this.form.point<=this.point){
+              for(let i = 0;i<this.list.selfDeductionList.length;i++){
+                  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
+                  }
               }
-      this.dialogVisible = false;
-    },
+          }else{
+              alert(`扣分不得超过总分${this.point}`)
+          }
+          this.dialogVisible = false;
+      },
     lost() {
       this.dialogVisible = false;
       this.itemInfo(this.id);

--
Gitblit v1.9.2