heyang 1 jaar geleden
bovenliggende
commit
b72589fefe
1 gewijzigde bestanden met toevoegingen van 68 en 39 verwijderingen
  1. 68 39
      src/views/safetyCheck/startInspection/index.vue

+ 68 - 39
src/views/safetyCheck/startInspection/index.vue

@@ -37,8 +37,8 @@
                    style="font-size:14px;margin-left:20px;width:100px;" v-if="planList[0]">选择计划</p>
               </div>
               <el-form-item label="检查类型" prop="checkCategory">
-                <el-select v-model="addForm.checkCategory" placeholder="请选择检查类型"
-                           style="width: 500px">
+                <el-select :disabled="planType==2" v-model="addForm.checkCategory" placeholder="请选择检查类型"
+                           style="width: 500px;height: 40px;">
                   <el-option
                     v-for="item in inspectCategoryList"
                     :key="item.id"
@@ -139,7 +139,7 @@
                 <p class="for-title-p">第{{index+1}}隐患项</p>
                 <div class="for-del-box">
                   <p class="el-icon-delete"></p>
-                  <p @click="delCheckHazardDtoList(index)">删除此项</p>
+                  <p @click="delCheckHazardDtoList(index,'')">删除此项</p>
                 </div>
                 <div class="for-button-box" @click="dataLookButton(item)">
                   <p :class="item.lookType?'el-icon-arrow-up':'el-icon-arrow-down'"></p>
@@ -249,7 +249,7 @@
                 <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>
+                  <p @click="delCheckHazardDtoList(index,'')">删除此项</p>
                 </div>
                 <div class="for-button-box" @click="dataLookButton(item)">
                   <p :class="item.lookType?'el-icon-arrow-up':'el-icon-arrow-down'"></p>
@@ -279,6 +279,7 @@
                         <p v-else style="max-width:300px;overflow: hidden;text-overflow:ellipsis;white-space:nowrap;">{{data.labelName}}</p>
                       </template>
                     </el-cascader>
+                    <i class="el-icon-delete"  @click="delCheckHazardDtoList(index,index2)" style="color: #0183FA;margin-left: 20px;cursor: pointer;"></i>
                     <p class="hazard-check-count-p" v-if="hazardCheckCount>0">此检查项在当前实验室累计出现 <span>{{hazardCheckCount}}</span> 次隐患</p>
                   </el-form-item>
                   <el-form-item v-if="item2.checkFlag==0" label="隐患等级" :prop="'checkHazardInfoVoList.'+index+'.checkHazardDtoList.'+index2+'.hazardLevel'" :rules="rules.hazardLevel" label-width="123px">
@@ -322,9 +323,9 @@
                   </el-form-item>
                 </div>
               </div>
-              <p class="add-bottom-button" @click="addObjectTow(item)">+新增隐患检查项</p>
+              <p class="add-bottom-button" v-if="planType == 1" @click="addObjectTow(item)">+新增隐患检查项</p>
             </div>
-            <p class="add-bottom-button" @click="addObjectDevice()">+新增检查项</p>
+            <p class="add-bottom-button" v-if="planType == 1" @click="addObjectDevice()">+新增检查项</p>
           </div>
         </el-form>
       </div>
@@ -338,7 +339,7 @@
       <!--设备弹窗-->
       <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="deviceChange2" :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="hazardNum" show-overflow-tooltip/>
@@ -476,7 +477,7 @@
         myApplyGentle:false,
         /* ==专项检查== */
         dialogVisible:false,
-        pageType:1,
+        pageType:0,
         multipleSelection:[],
 
       }
@@ -506,19 +507,6 @@
           this.multipleSelection=list
         }
       },
-      //弹窗选中设备
-      deviceChange2(val){
-        console.log('2',val)
-        let deviceList=val
-        let list=[];
-        if(deviceList[0]){
-          for(let i=0;i<deviceList.length;i++){
-            list.push(deviceList[i].id)
-          }
-          this.multipleSelection=list
-        }
-        console.log(this.multipleSelection)
-      },
       handleClick(doType){
         let self=this;
         if(doType=='startBtn'){//开始检查
@@ -532,7 +520,6 @@
           }else{
             this.msgError('请先选择实验室内设备!')
           }
-        }else if(doType=='addDevice'){//新增检查项
         }
       },
       // 取消按钮
@@ -560,24 +547,58 @@
             if(this.planType == 1){
               //新计划
               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]
               obj.subIds = obj.subId;
               delete obj.subId;
               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;
+              }
               checkManageAdd(obj).then(response => {
                 this.msgSuccess(response.msg);
                 this.initializationAddData();
@@ -696,12 +717,12 @@
       addObjectDevice(item){
         let self=this;
         this.dialogVisible=true;
-        console.log(self.multipleSelection)
+        let list=JSON.parse(JSON.stringify(self.multipleSelection))
         setTimeout(function(){
           self.$refs.deviceTable.clearSelection();
-          if(self.multipleSelection[0]){
+          if(list[0]){
             self.deviceTableList.forEach(row => {
-              self.multipleSelection.forEach(function(item) {
+              list.forEach(function(item) {
                 if(row.id==item){
                   self.$refs.deviceTable.toggleRowSelection(row,true);
                 }
@@ -944,6 +965,7 @@
           }]);
           this.pageType=1;
         }else if(type == 2){
+          this.pageType=0;
           this.$set(this.addForm,'checkType',null);
           this.$set(this,'checkTypeList',[{ key:1, label:"校院巡查", },{ key:2, label:"实验室自查", }]);
         }
@@ -1021,7 +1043,9 @@
         this.$set(this,'planList',[]);
       },
       //删除检查项
-      delCheckHazardDtoList(index){
+      delCheckHazardDtoList(index,index2){
+        console.log(index)
+        console.log(index2)
         let self = this;
         this.$confirm('是否确认删除?', "警告", {
           confirmButtonText: "确定",
@@ -1031,7 +1055,12 @@
           if(self.addForm.checkCategory==1){//综合检查
             self.addForm.checkHazardDtoList.splice(index,1);
           }else if(self.addForm.checkCategory==2){//专项检查
-            self.addForm.specialCheckHazardDtoList.splice(index,1);
+            if(index2){//小检查项
+              self.addForm.checkHazardInfoVoList[index].checkHazardDtoList.splice(index2,1);
+            }else{//检查设备
+              self.addForm.checkHazardInfoVoList.splice(index,1);
+            }
+
           }
 
         }).then(() => {