From dd43c95c5a020c1a828263cc5944ed6fb644b65d Mon Sep 17 00:00:00 2001
From: 马宇豪 <978517621@qq.com>
Date: 星期五, 05 五月 2023 08:53:18 +0800
Subject: [PATCH] Merge branch 'master' of https://sinanoaq.cn:8888/r/~mayuhao/HazardInvestigationSystem

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

diff --git a/src/views/safetyproduction/review.vue b/src/views/safetyproduction/review.vue
index 80d9bdc..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
@@ -201,7 +201,7 @@
     <el-dialog title="扣分详情" :visible.sync="dialogVisible" :close-on-click-modal="false" width="30%">
       <el-form ref="form" :model="form" label-width="54px">
         <el-form-item label="说明">
-          <el-input disabled="true" v-model="form.name"></el-input>
+          <el-input :disabled="true" v-model="form.name"></el-input>
         </el-form-item>
         <el-form-item label="扣分值">
           <el-input v-model="form.point"></el-input>
@@ -215,7 +215,7 @@
         class="dialog-footer"
         style="text-align: center; display: block"
       >
-        <el-button type="primary" class="btns" @click="dialogVisible = false"
+        <el-button type="primary" class="btns" @click="addC"
           >确 定</el-button
         >
         <el-button @click="lost()">取 消</el-button>
@@ -236,7 +236,9 @@
       dialogVisible: false,
       id: "",
       form: {},
-      list: [],
+      list: {},
+      point:"",
+      pointDel:""
     };
   },
   created() {
@@ -247,34 +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){
-      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",
@@ -285,8 +298,22 @@
     },
     handleClick(data) {
       this.dialogVisible = true;
-      this.form = data;
+      // this.form = data;
+        this.form=JSON.parse(JSON.stringify(data));
     },
+      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
+                  }
+              }
+          }else{
+              alert(`扣分不得超过总分${this.point}`)
+          }
+          this.dialogVisible = false;
+      },
     lost() {
       this.dialogVisible = false;
       this.itemInfo(this.id);
@@ -317,6 +344,8 @@
   width: 100%;
   background-color: white;
   border-radius: 5px;
+   height: 850px;
+  overflow-y:overlay;
 }
 .box-right-content {
   padding: 15px 0;
@@ -325,4 +354,4 @@
   background-color: #034ea2;
   border: 1px solid #034ea2;
 }
-</style>
\ No newline at end of file
+</style>

--
Gitblit v1.9.2