heyang vor 1 Jahr
Ursprung
Commit
fe4f4115ab
2 geänderte Dateien mit 39 neuen und 23 gelöschten Zeilen
  1. 8 0
      src/api/safetyCheck/index.js
  2. 31 23
      src/views/safetyCheck/startInspection/index.vue

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

@@ -739,6 +739,14 @@ export function getHazardListBySub(query) {
     params: query
   })
 }
+//通用接口-根据实验室id分类查询实验室内设备
+export function getHazardInfoBySubId(query) {
+  return request({
+    url: '/laboratory/hazard/getHazardInfoBySubId',
+    method: 'get',
+    params: query
+  })
+}
 //通用接口-根据选择的设备id生成检查项
 export function getHazardInfo(query) {
   return request({

+ 31 - 23
src/views/safetyCheck/startInspection/index.vue

@@ -231,9 +231,8 @@
               <el-table  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/>
                 <el-table-column label="型号" align="center" prop="code" show-overflow-tooltip />
-                <el-table-column label="类型" align="center" prop="hazardTypeMode" show-overflow-tooltip/>
+                <el-table-column label="类型" align="center" prop="hazardTypeModeName" show-overflow-tooltip/>
               </el-table>
             </div>
             <div class="start_btn" @click="handleClick('startBtn')">开始检查</div>
@@ -342,9 +341,8 @@
         <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/>
           <el-table-column label="型号" align="center" prop="code" show-overflow-tooltip />
-          <el-table-column label="类型" align="center" prop="hazardTypeMode" show-overflow-tooltip/>
+          <el-table-column label="类型" align="center" prop="hazardTypeModeName" show-overflow-tooltip/>
         </el-table>
         <div slot="footer" class="dialog-footer">
           <el-button @click="cancel">取 消</el-button>
@@ -360,8 +358,16 @@
   import { listDepartments } from "@/api/system/dept";
   import { buildFloorGetlist } from "@/api/laboratory/building";
   import {
-    buildBySubList, getCheckPlanBySubId, findCheckManage, checkOptionList,
-    checkManageUpdate, checkManageAdd, countHazardNum, getGentle, getHazardListBySub, getHazardInfo
+    buildBySubList,
+    getCheckPlanBySubId,
+    findCheckManage,
+    checkOptionList,
+    checkManageUpdate,
+    checkManageAdd,
+    countHazardNum,
+    getGentle,
+    getHazardInfoBySubId,
+    getHazardInfo,
   } from '@/api/safetyCheck/index'
   export default {
     name: 'index',
@@ -493,30 +499,25 @@
     },
     methods:{
       getRowKeys(row) {
-        return row.id
+        return row.hazardId
       },
       //选中设备
       deviceChange(val){
         console.log('1',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
-        }
+        this.multipleSelection=val
       },
       handleClick(doType){
         let self=this;
         if(doType=='startBtn'){//开始检查
-          let hazardIds='';
+          let hazardIds=[];
           if(this.multipleSelection[0]){
             this.pageType=2;
             this.checkOptionList();
             this.dialogVisible=false;
-            hazardIds=this.multipleSelection.join(',')
-            this.getHazardInfo(this.addForm.subId,hazardIds)
+            for(let i=0;i<this.multipleSelection.length;i++){
+              hazardIds.push(this.multipleSelection[i].hazardId)
+            }
+            this.getHazardInfo(this.addForm.subId,hazardIds.join(','))
           }else{
             this.msgError('请先选择实验室内设备!')
           }
@@ -602,7 +603,14 @@
                   }
                 }
                 if(this.multipleSelection[0]){
-                  obj.hazardIds=this.multipleSelection.join(',')
+                  let hazardIds=[];
+                  let joinHazardIds=[];
+                  for(let i=0;i<this.multipleSelection.length;i++){
+                    hazardIds.push(this.multipleSelection[i].hazardId)
+                    joinHazardIds.push(this.multipleSelection[i].joinHazardId)
+                  }
+                  obj.hazardIds=hazardIds.join(',')
+                  obj.joinHazardIds=joinHazardIds.join(',')
                 }
                 if(checkFlagList.every(item=>{return item==1})){//符合
                   obj.checkResult=1;
@@ -744,7 +752,7 @@
           if(list[0]){
             self.deviceTableList.forEach(row => {
               list.forEach(function(item) {
-                if(row.id==item){
+                if(row.hazardId==item.hazardId){
                   self.$refs.deviceTable.toggleRowSelection(row,true);
                 }
               })
@@ -922,7 +930,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);
+            this.getHazardInfoBySubId(val);
             return
           }
         }
@@ -953,8 +961,8 @@
         });
       },
       //根据实验室ID查询实验室设备
-      getHazardListBySub(id){
-        getHazardListBySub({subId:id}).then(response => {
+      getHazardInfoBySubId(id){
+        getHazardInfoBySubId({subId:id}).then(response => {
             this.deviceTableList=response.data;
         });
       },