heyang vor 1 Jahr
Ursprung
Commit
a34e210553
2 geänderte Dateien mit 157 neuen und 74 gelöschten Zeilen
  1. 17 0
      src/api/safetyCheck/index.js
  2. 140 74
      src/views/safetyCheck/startInspection/index.vue

+ 17 - 0
src/api/safetyCheck/index.js

@@ -716,6 +716,23 @@ export function buildBySubList(query) {
   })
 }
 
+//通用接口-根据实验室id分类查询实验室内设备
+export function getHazardListBySub(query) {
+  return request({
+    url: '/laboratory/hazard/getHazardListBySub',
+    method: 'get',
+    params: query
+  })
+}
+//通用接口-根据选择的设备id生成检查项
+export function getHazardInfo(query) {
+  return request({
+    url: '/zd-security/checkManage/getHazardInfo',
+    method: 'get',
+    params: query
+  })
+}
+
 //开展检查-提交
 export function checkManageAdd(data) {
   return request({

+ 140 - 74
src/views/safetyCheck/startInspection/index.vue

@@ -224,11 +224,11 @@
           <div class="bottom-form-box" v-if="addForm.checkCategory==2 && pageType==1">
             <div class="bottom-form-title-box">
               <p>检查项</p>
-              <p>隐患数:{{addForm.checkHazardDtoList.length}}</p>
+              <p>检查项:{{addForm.checkHazardInfoVoList.length}}</p>
             </div>
             <div class="dept-table-max-box">
               <div class="device-tip">请选择以下实验室内设备开始检查</div>
-              <el-table ref="deviceTable" border :data="deviceTableList" @selection-change="deviceChange" :row-key="getRowKeys" height="350">
+              <el-table  border :data="deviceTableList" @selection-change="deviceChange" height="350">
                 <el-table-column type="selection" width="50" :reserve-selection="true" align="center"/>
                 <el-table-column label="名称" align="center" prop="chName" show-overflow-tooltip/>
                 <el-table-column label="数量" align="center" prop="num" show-overflow-tooltip/>
@@ -246,7 +246,7 @@
             </div>
             <div class="for-max-big-box for-max-big-box-special" v-for="(item,index) in addForm.checkHazardInfoVoList" :key="index">
               <div class="for-title-box">
-                <p class="for-title-p">{{index+1}}、【{{item.name}}】{{item.type}}</p>
+                <p class="for-title-p">{{index+1}}、【{{item.hazardName}}】专项检查</p>
                 <div class="for-del-box">
                   <p class="el-icon-delete"></p>
                   <p @click="delCheckHazardDtoList(index)">删除此项</p>
@@ -336,9 +336,9 @@
       </div>
       <lookImgDialog ref="lookImgDialog"></lookImgDialog>
       <!--设备弹窗-->
-      <el-dialog title="检查项" :visible.sync="dialogVisible" width="730px" append-to-body :close-on-click-modal="false">
+      <el-dialog title="检查项" v-if="dialogVisible" :visible.sync="dialogVisible" width="730px" :append-to-body="false" :modal-append-to-body="false" :close-on-click-modal="false">
         <div style="margin-bottom:20px ">请选择以下实验室内设备开始检查</div>
-        <el-table ref="deviceTable" border :data="deviceTableList" @selection-change="deviceChange" :row-key="getRowKeys" height="350">
+        <el-table ref="deviceTable"  border :data="deviceTableList" @selection-change="deviceChange" :row-key="getRowKeys" height="350">
           <el-table-column type="selection" width="50" :reserve-selection="true" align="center"/>
           <el-table-column label="名称" align="center" prop="chName" show-overflow-tooltip/>
           <el-table-column label="数量" align="center" prop="num" show-overflow-tooltip/>
@@ -358,8 +358,10 @@
   import lookImgDialog from '@/components/lookImgDialog/lookImgDialog.vue'
   import { listDepartments } from "@/api/system/dept";
   import { buildFloorGetlist } from "@/api/laboratory/building";
-  import { buildBySubList,getCheckPlanBySubId,findCheckManage,checkOptionList,
-           checkManageUpdate,checkManageAdd,countHazardNum,getGentle } from "@/api/safetyCheck/index";
+  import {
+    buildBySubList, getCheckPlanBySubId, findCheckManage, checkOptionList,
+    checkManageUpdate, checkManageAdd, countHazardNum, getGentle, getHazardListBySub, getHazardInfo
+  } from '@/api/safetyCheck/index'
   export default {
     name: 'index',
     components: {
@@ -404,35 +406,7 @@
           //综合检查
           checkHazardDtoList:[],
           //专项检查
-          checkHazardInfoVoList:[
-            {
-              name:'烘箱-001',
-              type:'专项检查',
-              checkHazardDtoList:[
-                {
-                  checkFlag:0,
-                  hazardCheckCode:'',
-                  hazardCheckName:'',
-                  hazardCheckPoint:'',
-                  hazardCheckPro:'',
-                  hazardDescribe:'',
-                  hazardLevel:'',
-                  lookType:true,
-                  uploadDtoList:[],
-                },{
-                  checkFlag:0,
-                  hazardCheckCode:'',
-                  hazardCheckName:'',
-                  hazardCheckPoint:'',
-                  hazardCheckPro:'',
-                  hazardDescribe:'',
-                  hazardLevel:'',
-                  lookType:true,
-                  uploadDtoList:[],
-                }
-              ]
-            }
-          ],
+          checkHazardInfoVoList:[],
         },
 
 
@@ -440,12 +414,7 @@
         hazardCheckCount:0,
         //上传用名称保存
         upDataName:"",
-        deviceTableList:[{
-          'chName':'测试',
-          'num':'2',
-          'code':'001',
-          'hazardTypeMode':'冷热设备',
-        }],
+        deviceTableList:[],
         //检查类型
         inspectCategoryList:[{id:'1',name:'综合检查'},{id:'2',name:'专项检查'}],
         // 表单校验
@@ -506,8 +475,10 @@
         applyGentle:false,
         myApplyGentle:false,
         /* ==专项检查== */
-        dialogVisible:false,
+        dialogVisible:true,
         pageType:1,
+        multipleSelection:[],
+        multipleSelectionArr:[],
       }
     },
     created(){
@@ -523,24 +494,38 @@
       getRowKeys(row) {
         return row.id
       },
-      deviceChange(selection){
-        console.log(selection)
-
+      //选中设备
+      deviceChange(val){
+        this.multipleSelection = val;
+        this.multipleSelectionArr=JSON.parse(JSON.stringify(val))
       },
       handleClick(doType){
         let self=this;
         if(doType=='startBtn'){//开始检查
-          this.pageType=2;
-          this.checkOptionList();
-          this.dialogVisible=false;
-          if(this.addForm.checkHazardInfoVoList.length<10){
-            let obj = {
-              name:'烘箱-001',
-              type:'专项检查',
-              checkHazardDtoList:[]
-            };
-            this.addForm.checkHazardInfoVoList.push(obj);
+          let hazardIds='';
+          let list=[];
+          if(this.multipleSelection[0]){
+            for(let i=0;i<this.multipleSelection.length;i++){
+              list.push(this.multipleSelection[i].id)
+            }
+            this.pageType=2;
+            this.checkOptionList();
+            this.dialogVisible=false;
+            hazardIds=list.join(',')
+            this.getHazardInfo(this.addForm.subId,hazardIds)
+          }else{
+            this.msgError('请先选择实验室内设备!')
           }
+          // if(this.addForm.checkHazardInfoVoList.length<10){
+          //   let obj = {
+          //     name:'烘箱-001',
+          //     type:'专项检查',
+          //     checkHazardDtoList:[]
+          //   };
+          //   this.addForm.checkHazardInfoVoList.push(obj);
+          // }
+        }else if(doType=='addDevice'){//新增检查项
+          console.log(this.multipleSelectionArr)
         }
       },
       // 取消按钮
@@ -593,22 +578,55 @@
             }if(this.planType == 2){
               //已有计划修改
               let obj = JSON.parse(JSON.stringify(this.addForm));
-              if(obj.checkResult === 0){
-                if(!obj.checkHazardDtoList[0]){
-                  this.msgError('请添加隐患检查项')
-                  return
-                }
-                for(let i=0;i<obj.checkHazardDtoList.length;i++){
-                  delete obj.checkHazardDtoList[i].lookType
-                }
-                obj.dangerNum = obj.checkHazardDtoList.length
-              }else{
-                obj.checkHazardDtoList = [];
-              }
               obj.manageStatus = type
               obj.cycleStartTime = obj.dateRange[0]
               obj.cycleEndTime = obj.dateRange[1]
               delete obj.dateRange
+              if(this.addForm.checkCategory==1){//综合检查
+                if(obj.checkResult === 0){
+                  if(!obj.checkHazardDtoList[0]){
+                    this.msgError('请添加隐患检查项')
+                    return
+                  }
+                  for(let i=0;i<obj.checkHazardDtoList.length;i++){
+                    delete obj.checkHazardDtoList[i].lookType
+                  }
+                  obj.dangerNum = obj.checkHazardDtoList.length
+                }else{
+                  obj.checkHazardDtoList = [];
+                }
+              }else if(this.addForm.checkCategory==2){//专项检查
+                let list=[]
+                let checkFlagList=[];
+                for(let i=0;i<this.addForm.checkHazardInfoVoList.length;i++){
+                  for(let b=0;b<this.addForm.checkHazardInfoVoList[i].checkHazardDtoList.length;b++){
+                    checkFlagList.push(this.addForm.checkHazardInfoVoList[i].checkHazardDtoList[b].checkFlag)
+                    let obj={
+                      checkFlag:this.addForm.checkHazardInfoVoList[i].checkHazardDtoList[b].checkFlag,
+                      checkCategory:this.addForm.checkHazardInfoVoList[i].checkHazardDtoList[b].checkCategory,
+                      hazardCheckCode:this.addForm.checkHazardInfoVoList[i].checkHazardDtoList[b].hazardCheckCode,
+                      hazardCheckName:this.addForm.checkHazardInfoVoList[i].checkHazardDtoList[b].hazardCheckName,
+                      hazardCheckPro:this.addForm.checkHazardInfoVoList[i].checkHazardDtoList[b].hazardCheckPro,
+                      hazardDescribe:this.addForm.checkHazardInfoVoList[i].checkHazardDtoList[b].hazardDescribe,
+                      hazardLevel:this.addForm.checkHazardInfoVoList[i].checkHazardDtoList[b].hazardLevel,
+                      uploadDtoList:this.addForm.checkHazardInfoVoList[i].checkHazardDtoList[b].uploadDtoList,
+                      code:this.addForm.checkHazardInfoVoList[i].code,
+                      hazardId:this.addForm.checkHazardInfoVoList[i].hazardId,
+                      hazardName:this.addForm.checkHazardInfoVoList[i].hazardName,
+                      hazardTypeMode:this.addForm.checkHazardInfoVoList[i].hazardTypeMode,
+                      hazardTypeModeName:this.addForm.checkHazardInfoVoList[i].hazardTypeModeName,
+                      joinHazardId:this.addForm.checkHazardInfoVoList[i].joinHazardId,
+                    }
+                    list.push(obj)
+                  }
+                }
+                if(checkFlagList.every(item=>{return item==1})){//符合
+                  obj.checkResult=1;
+                }else{//不符合
+                  obj.checkResult=0;
+                }
+                obj.checkHazardDtoList=list;
+              }
               checkManageUpdate(obj).then(response => {
                 this.msgSuccess(response.msg);
                 this.initializationAddData();
@@ -669,8 +687,30 @@
       },
       //新增检查项
       addObjectDevice(item){
+        let self=this;
         this.dialogVisible=true;
+        //this.$refs.deviceTable.clearSelection()
+        console.log(self.multipleSelectionArr)
+        let row={
+          chName:'一氧化碳',
+          code:'001',
+          hazardNum:1,
+          hazardTypeMode:1,
+          hazardTypeModeName:'危险品',
+          id:37
+        }
+        setTimeout(function() {
+          self.$refs.deviceTable.toggleRowSelection(row,true);
+        },1000)
+        // self.$nextTick(()=>{
+        //   self.multipleSelectionArr.forEach(row => {
+        //     console.log(row)
+        //     //self.$refs.deviceTable.toggleRowSelection(row,true);
+        //   });
+        // })
 
+       // this.$refs.deviceTable=this.multipleSelectionArr;
+        //this.dialogVisible=true;
       },
       //查看图片
       lookImg(list,index){
@@ -837,6 +877,7 @@
             this.$set(this.addForm,'deptId',self.subSelectList[i].deptId);
             this.$set(this.addForm,'buildId',self.subSelectList[i].buildId);
             this.getCheckPlanBySubId(val);
+            this.getHazardListBySub(val);
             return
           }
         }
@@ -866,6 +907,18 @@
           this.$set(this,'planList',list);
         });
       },
+      //根据实验室ID查询实验室设备
+      getHazardListBySub(id){
+        getHazardListBySub({subId:id}).then(response => {
+            this.deviceTableList=response.data;
+        });
+      },
+      //根据实验室ID查询实验室设备
+      getHazardInfo(id,hazardIds){
+        getHazardInfo({subId:id,hazardIds:hazardIds}).then(response => {
+            this.addForm.checkHazardInfoVoList=response.data
+        });
+      },
       //计划列表选中
       planChange(val){
         let self = this;
@@ -886,6 +939,7 @@
             key:2,
             label:"实验室自查",
           }]);
+          this.pageType=1;
         }else if(type == 2){
           this.$set(this.addForm,'checkType',null);
           this.$set(this,'checkTypeList',[{ key:1, label:"校院巡查", },{ key:2, label:"实验室自查", }]);
@@ -894,12 +948,20 @@
       //查询详情
       findCheckManage(id){
         findCheckManage({id:id}).then(response => {
-          response.data.checkResult = response.data.checkResult === 0 || response.data.checkResult === 1?response.data.checkResult:"";
-          response.data.rectifyNotice = response.data.rectifyNotice?response.data.rectifyNotice:"";
-          response.data.rectifyDeadline = response.data.rectifyDeadline?response.data.rectifyDeadline:"";
-          response.data.dateRange = [response.data.cycleStartTime,response.data.cycleEndTime];
-          for(let i=0;i<response.data.checkHazardDtoList.length;i++){
-            response.data.checkHazardDtoList[i].lookType = true;
+          if(response.data.checkCategory==1){//综合检查
+            response.data.checkResult = response.data.checkResult === 0 || response.data.checkResult === 1?response.data.checkResult:"";
+            response.data.rectifyNotice = response.data.rectifyNotice?response.data.rectifyNotice:"";
+            response.data.rectifyDeadline = response.data.rectifyDeadline?response.data.rectifyDeadline:"";
+            response.data.dateRange = [response.data.cycleStartTime,response.data.cycleEndTime];
+            for(let i=0;i<response.data.checkHazardDtoList.length;i++){
+              response.data.checkHazardDtoList[i].lookType = true;
+            }
+
+          }else if(response.data.checkCategory==2){//专项检查
+            response.data.rectifyNotice = response.data.rectifyNotice?response.data.rectifyNotice:"";
+            response.data.rectifyDeadline = response.data.rectifyDeadline?response.data.rectifyDeadline:"";
+            response.data.dateRange = [response.data.cycleStartTime,response.data.cycleEndTime];
+            this.pageType=2
           }
           this.buildBySubList(response.data.buildId,1);
           this.$set(this,'addForm',{
@@ -916,7 +978,11 @@
             dateRange:response.data.dateRange,
             rectifyDeadline:response.data.rectifyDeadline,
             checkHazardDtoList:response.data.checkHazardDtoList,
+            checkHazardInfoVoList:response.data.checkHazardInfoVoList,
+
           });
+          this.checkOptionList();//获取检查项
+
         });
       },
       //初始化数据