heyang 1 年之前
父節點
當前提交
2d3d297115
共有 1 個文件被更改,包括 73 次插入34 次删除
  1. 73 34
      src/views/safetyCheck/laboratorySelfTest/selfInspectionTask/addDialog.vue

+ 73 - 34
src/views/safetyCheck/laboratorySelfTest/selfInspectionTask/addDialog.vue

@@ -48,25 +48,6 @@
               </div>
             </div>
           </el-form-item>
-          <el-form-item label="检查类型:" prop="inspectCategory">
-            <div class="dialog-range-max-box">
-              <div class="dialog-range-select-box">
-                <el-select  :disabled="lookInfoType" @change="inspectCategoryChange"
-                            v-model="dialogForm.checkCategory" placeholder="请选择检查类型" style="width:450px;">
-                  <el-option
-                    v-for="item in inspectCategoryList"
-                    :key="item.id"
-                    :label="item.name"
-                    :value="item.id">
-                  </el-option>
-                </el-select>
-              </div>
-              <div class="dialog-range-text-box" v-if="dialogForm.checkCategory==2">
-                <p class="inquire-button-one button-p"  @click="dialogClickType(6)">选择检查内容</p>
-                <p class="text-p">已选择{{dialogForm.hazardNum}}种</p>
-              </div>
-            </div>
-          </el-form-item>
           <el-form-item label="检查范围:" prop="checkRange">
             <div class="dialog-range-max-box">
               <div class="dialog-range-select-box">
@@ -89,6 +70,25 @@
               </div>
             </div>
           </el-form-item>
+          <el-form-item label="检查类型:" prop="inspectCategory">
+            <div class="dialog-range-max-box">
+              <div class="dialog-range-select-box">
+                <el-select  :disabled="lookInfoType" @change="inspectCategoryChange"
+                            v-model="dialogForm.checkCategory" placeholder="请选择检查类型" style="width:450px;">
+                  <el-option
+                    v-for="item in inspectCategoryList"
+                    :key="item.id"
+                    :label="item.name"
+                    :value="item.id">
+                  </el-option>
+                </el-select>
+              </div>
+              <div class="dialog-range-text-box" v-if="dialogForm.checkCategory==2">
+                <p class="inquire-button-one button-p"  @click="dialogClickType(6)">选择检查内容</p>
+                <p class="text-p">已选择{{dialogForm.hazardNum}}种</p>
+              </div>
+            </div>
+          </el-form-item>
           <el-form-item label="检查要求:" prop="checkDemand">
             <el-input
               :disabled="lookInfoType"
@@ -522,7 +522,7 @@
     getHistoryPlanTitles, checkGroupFind, findUserList,
     getAllSubNum, isSCollege, conditionCollegeInfo, findSubInfoByDeptIds,
     checkPlanAdd, conditionSubjectInfo, findCheckPlan, checkPlanUpdate,
-    hideHistoryPlanTitle, findDeviceList
+    hideHistoryPlanTitle, findDeviceList,haveHazardInSub
   } from '@/api/safetyCheck/index'
   import { dangerList } from '@/api/gasManage3_0/gasManage'
   export default {
@@ -685,7 +685,9 @@
         deviceNumRight:0,
         deviceIdsRight:[],
         deviceDialogTableDataList:[],
+        deviceDialogList:[],//存储所有的设备
         dangerArr:[],
+        deviceIsEmpty:false,//如果是专项检查-判断是否选择检查范围和检查内容
         /*===================================文档预览===================================*/
         iframeSrc:"",
         /*===================================弹窗相关结束===================================*/
@@ -697,6 +699,8 @@
     },
     mounted(){
       this.initializationInterface();
+      this.dangerList();
+      this.deviceGetList();//查询所有设备
     },
     methods:{
       //初始化接口
@@ -794,6 +798,10 @@
                   return
                 }
               }
+              if(this.dialogForm.checkCategory == 2 && !this.deviceIsEmpty){
+                this.msgError('请选择检查内容')
+                return
+              }
               let obj = {
                 title:this.dialogForm.title,
                 checkType:this.dialogForm.checkType,
@@ -862,8 +870,22 @@
             list.push(self.deviceDialogTableDataList[i].id)
           }
           this.$set(this.dialogForm,'hazardIds',list.join(','));
-          this.$set(this.dialogForm,'hazardNum',self.deviceDialogTableDataList.length);
+          this.$set(this.dialogForm,'hazardNum',list.length);
           this.dialogClickType(1);
+          //实验室是否有当前设备
+          let obj={
+            "checkRange":this.dialogForm.checkRange,
+            "collegeIds":this.dialogForm.checkRange==2?this.dialogForm.collegeIds+'':'',//学院ID转换字符串
+            "subIds":this.dialogForm.checkRange == 3?this.subCheckData.subIds+'':'',//实验室ID
+            "hazardIds":this.dialogForm.hazardIds,
+          }
+          haveHazardInSub(obj).then(response => {
+            if(response.code==200){
+              this.deviceIsEmpty=true;
+            }else{
+              this.deviceIsEmpty=false;
+            }
+          });
         }
       },
       /*===================================弹窗相关===================================*/
@@ -887,6 +909,19 @@
           this.$set(this,'addDialogBoxType',type);
         }else if(type == 6){//检查设备
           //设备
+          let list=[];
+          let list2=[];
+          if(this.dialogForm.hazardIds){
+            list=this.dialogForm.hazardIds.split(',')
+            for(let i=0;i<this.deviceDialogList.length;i++){
+              for(let b=0;b<list.length;b++){
+                if(list[b]==this.deviceDialogList[i].id){
+                  list2.push(this.deviceDialogList[i])
+                }
+              }
+            }
+          }
+          this.$set(self,'deviceDialogTableDataList',list2);
           this.deviceResetQueryLeft();
           this.deviceResetQueryRight();
           this.$set(this,'addDialogBoxType',type);
@@ -1195,13 +1230,8 @@
         let self = this;
         let leftObj = JSON.parse(JSON.stringify(this.deviceQueryParamsLeft));
         leftObj.selectedHazardIds = [];
-
-        if(self.deviceDialogTableDataList[0]){
-          for(let i=0;i<self.deviceDialogTableDataList.length;i++){
-            leftObj.selectedHazardIds.push(self.deviceDialogTableDataList[i].id);
-          }
-        }else{
-          leftObj.selectedHazardIds=self.dialogForm.hazardIds.split(',');
+        for(let i=0;i<self.deviceDialogTableDataList.length;i++){
+          leftObj.selectedHazardIds.push(self.deviceDialogTableDataList[i].id);
         }
 
         findDeviceList(leftObj).then(response => {
@@ -1228,17 +1258,26 @@
         });
         this.deviceHandleQueryRight();
       },
+      //查询所有的设备
+      deviceGetList(){
+        let obj={
+          pageNum: 1,
+          pageSize: 200,
+          hazardTypeMode:"",
+          searchValue:"",
+          filtType:""
+        }
+        findDeviceList(obj).then(response => {
+          this.deviceDialogList=response.rows
+        });
+      },
       //查询接口
       deviceGetListRight(){
         let self = this;
         let rightObj = JSON.parse(JSON.stringify(this.deviceQueryParamsRight));
         rightObj.hazardIds = [];
-        if(self.deviceDialogTableDataList[0]){
-          for(let i=0;i<self.deviceDialogTableDataList.length;i++){
-            rightObj.hazardIds.push(self.deviceDialogTableDataList[i].id);
-          }
-        }else{
-          rightObj.hazardIds=self.dialogForm.hazardIds.split(',');
+        for(let i=0;i<self.deviceDialogTableDataList.length;i++){
+          rightObj.hazardIds.push(self.deviceDialogTableDataList[i].id);
         }
         findDeviceList(rightObj).then(response => {
           this.deviceTotalRight = response.total;