From e5fb337fe1b0e788f4d99523f889aa28aa03fc86 Mon Sep 17 00:00:00 2001
From: songhuangfeng123 <shf18767906695@163.com>
Date: 星期四, 07 四月 2022 16:47:41 +0800
Subject: [PATCH] 已评审

---
 src/views/safetyproduction/gojudging.vue |   79 +++++++++++++++++++++++++++++++++------
 1 files changed, 66 insertions(+), 13 deletions(-)

diff --git a/src/views/safetyproduction/gojudging.vue b/src/views/safetyproduction/gojudging.vue
index 6230be4..80eb638 100644
--- a/src/views/safetyproduction/gojudging.vue
+++ b/src/views/safetyproduction/gojudging.vue
@@ -1,7 +1,8 @@
 <template>
   <div>
     <div class="box-right">
-      <div v-for="(item, index) in lists" :key="index">
+      <el-button type="primary" style="float: right" @click="finish()">结单</el-button>
+      <div v-for="(item, index) in lists" :key="index" style="padding:0 0 20px 0">
         <div class="title">
           A级要素:<span>{{ item.elementAName }}</span>
         </div>
@@ -11,12 +12,14 @@
               ><p><span>B级要素:</span>{{ item.elementBName }}</p></el-col
             >
             <el-col :span="6"
-              ><p><span>得分:</span>50</p></el-col
+              ><p><span>总分:</span>50</p></el-col
             >
+               <el-col :span="6"
+              ><p><span>得分:</span>{{item.point}}</p></el-col>
           </el-row>
           <el-row>
             <el-col :span="24">
-              <el-table border :data="item.child">
+              <el-table border :data="item.child" :header-cell-style="{background:'#eef1f6',color:'#606266'}" :cell-style="{background:'#fff',color:'#606266'}">
                 <el-table-column
                   prop="standardizationRequirements"
                   align="center"
@@ -40,11 +43,11 @@
                 ></el-table-column>
                 <el-table-column align="center" label="评审结果">
                   <template slot-scope="scope">
-                    <span v-if="(scope.row.safetyInspectionItemResult = 0)"
-                      >是</span
+                    <span v-if="(scope.row.safetyInspectionItemResult== 0)"
+                      >否决</span
                     >
-                    <span v-if="(scope.row.safetyInspectionItemResult = 1)"
-                      >否</span
+                    <span v-if="(scope.row.safetyInspectionItemResult == 1)"
+                      >扣分</span
                     >
                   </template>
                 </el-table-column>
@@ -57,6 +60,8 @@
                 <template slot-scope="scope">
                   <el-table
                     :data="scope.row.selfDeductionList"
+                    border
+                    :header-cell-style="{background:'#eef1f6',color:'#606266'}" :cell-style="{background:'#fff',color:'#606266'}"
                   >
                     <el-table-column prop="name" align="center" label="扣分项">
                     </el-table-column>
@@ -72,7 +77,7 @@
                 </template>
                 </el-table-column>
                 <el-table-column
-                  prop=""
+                  prop="remark"
                   align="center"
                   label="备注"
                 ></el-table-column>
@@ -99,7 +104,7 @@
 </template>
 <script>
 import Titlename from "../../components/Titlename/index.vue";
-import { safetySelfInspectionInfo } from "@/api/safetySelfInspection.js";
+import { safetySelfInspectionInfo ,safetySelfInspectionFinish} from "@/api/safetySelfInspection.js";
 export default {
   components: { Titlename },
   data() {
@@ -122,16 +127,42 @@
     this.safeInitem(this.id);
   },
   methods: {
+      finish(){
+          let id = this.id
+          this.$confirm('确定要结单吗?','提示',{
+              confirmButtonText:'确定',
+              cancelButtonText:'取消',
+              type:'warning',
+          }).then(()=> {
+              safetySelfInspectionFinish({id:this.id}).then(res=>{
+                  console.log(123,res)
+                  if (res.data.code === '200') {
+                      this.$notify({
+                          title:'成功',
+                          message:'结单成功',
+                          type:'success',
+                          duration:2000,
+                      })
+                  }else{
+                      this.$message({
+                          message:res.data.message,
+                          type:'warning'
+                      })
+                  }
+              })
+          }).catch(error =>{
+          })
+      },
+
     safeInitem(id) {
       safetySelfInspectionInfo({ id: id }).then((res) => {
-        // console.log("数据", res);
         if (res.data.code == 200) this.list = res.data.result;
         var arr = this.checkSameDataA(this.list.itemList);
         for (var i = 0; i < arr.length; i++) {
           arr[i].child = this.checkSameData(arr[i].child);
         }
         this.lists = arr;
-        console.log(this.lists)
+        // console.log('tag', arr)
       });
     },
     checkSameDataA(resData) {
@@ -156,16 +187,33 @@
         if (!dataInfo[elementBName]) {
           dataInfo[elementBName] = {
             elementBName,
+            point:"",
             child: [],
           };
         }
         dataInfo[elementBName].child.push(item);
       });
       let list = Object.values(dataInfo); // list 转换成功的数据
+      console.log(list)
+        for(var i=0;i<list.length;i++){
+          var pot=50
+         for(var j=0;j<list[i].child.length;j++){
+           if(list[i].child[j].safetyInspectionItemResult!=0){
+           pot=pot-list[i].child[j].selfDeductionList[0].point
+           }else{
+             var cont=0
+             pot=0
+           }
+         }
+         if(pot>0){
+         list[i].point=pot
+         }else{
+            list[i].point=0
+         }
+        }
       return list;
     },
     handleClick(data) {
-      console.log(data.id);
       this.$router.push({
         path: "/review",
         query: {
@@ -189,6 +237,8 @@
   background-color: white;
   border-radius: 5px;
   padding: 20px;
+  height: 850px;
+  overflow-y:overlay;
 }
 .title {
   font-size: 16px;
@@ -198,4 +248,7 @@
 .titles {
   font-size: 14px;
 }
-</style>
\ No newline at end of file
+.box-right /deep/ .el-table__expanded-cell{
+  background-color: #fff !important;
+}
+</style>

--
Gitblit v1.9.2