瀏覽代碼

Merge remote-tracking branch 'remotes/origin/web-v2' into web-v2-pro

heyang 1 年之前
父節點
當前提交
133f25deb0

+ 33 - 1
src/api/safetyCheck/index.js

@@ -645,7 +645,22 @@ export function dataStatisticsItemsList(query) {
   })
 }
 
-
+//数据统计-按检查内容查询列表
+export function dataStatisticsContentList(query) {
+  return request({
+    url: '/zd-security/DataStatistics/contentList',
+    method: 'get',
+    params: query
+  })
+}
+//数据统计-按检查内容头部数据汇总
+export function dataStatisticsContentListTop(query) {
+  return request({
+    url: '/zd-security/DataStatistics/hazardContentTop',
+    method: 'get',
+    params: query
+  })
+}
 
 
 
@@ -716,6 +731,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({

+ 1 - 1
src/views/medicUniversity-3_1/chemicalManagement/InventoryManagement/InventoryDetails/index.vue

@@ -270,7 +270,7 @@
             delete this.queryParams.timeTwo
           }
           this.queryParams.pageNum = 1;
-          this.queryParams.pageSize = 10;
+          this.queryParams.pageSize = 20;
           this.getList();
         }else if(type == 2){ //type  1.重置
           this.queryParams = {

+ 7 - 0
src/views/safetyCheck/components/addPage/addPage.vue

@@ -388,6 +388,13 @@
           }else if(response.data.checkCategory==2){//专项检查
             response.data.rectifyNotice = response.data.rectifyNotice?response.data.rectifyNotice:"";
             response.data.rectifyDeadline = response.data.rectifyDeadline?response.data.rectifyDeadline:"";
+            if(response.data.checkHazardInfoVoList[0]){
+              response.data.checkHazardInfoVoList.forEach(function(item) {
+                item.checkHazardDtoList.forEach(function(item2) {
+                  item2.hazardCheckCode=item2.code
+                })
+              })
+            }
           }
           this.$set(this,'addForm',response.data);
           this.checkOptionList();//获取检查项

+ 2 - 1
src/views/safetyCheck/components/infoDialog/infoDialog.vue

@@ -120,7 +120,8 @@
         <p class="table-top-title-p">不符合项</p>
         <div class="info-dialog-content-info-bottom">
           <div class="table-box">
-            <p class="table-title-p">隐患项</p>
+            <p class="table-title-p" v-if="infoDialogData.checkHazardApplyDto.checkCategory==1">隐患项</p>
+            <p class="table-title-p" v-if="infoDialogData.checkHazardApplyDto.checkCategory==2">【{{infoDialogData.checkHazardApplyDto.hazardName}}】 专项检查</p>
             <div class="table-min">
               <div class="left-box">
                 <p></p>

+ 3 - 1
src/views/safetyCheck/dataStatistics/checkIndexStatistics.vue

@@ -63,7 +63,7 @@
       </el-form-item>
     </el-form>
     <div class="num-data-box">
-      共搜索到隐患总数 {{numData.sumTotal}},一级指标隐患总数 {{numData.level1}},占比 {{numData.percent1}},二级指标隐患总数 {{numData.level2}},占比 {{numData.percent2}},三级指标隐患总数 {{numData.level3}},占比 {{numData.percent3}}
+      共搜索到隐患总数 {{numData.sumTotal}},一级指标隐患总数 {{numData.level1}},占比 {{numData.percent1}},二级指标隐患总数 {{numData.level2}},占比 {{numData.percent2}},三级指标隐患总数 {{numData.level3}},占比 {{numData.percent3}},四级指标隐患总数 {{numData.level4}},占比 {{numData.percent4}}
     </div>
     <el-table  border :data="tableList" ref="multipleTable"
                :row-key="getRowKeys"
@@ -80,6 +80,8 @@
       <el-table-column label="二级指标占比" align="center" prop="percent2" show-overflow-tooltip width="130"/>
       <el-table-column label="三级指标隐患数" align="center" prop="itemsTotal3" show-overflow-tooltip width="130"/>
       <el-table-column label="三级指标占比" align="center" prop="percent3" show-overflow-tooltip width="130"/>
+      <el-table-column label="四级指标隐患数" align="center" prop="itemsTotal4" show-overflow-tooltip width="130"/>
+      <el-table-column label="四级指标占比" align="center" prop="percent4" show-overflow-tooltip width="130"/>
     </el-table>
     <pagination :page-sizes="[20, 30, 40, 50]"
                 v-show="total>0"

+ 8 - 1
src/views/safetyCheck/dataStatistics/index.vue

@@ -13,10 +13,15 @@
         <p>按检查指标</p>
         <p></p>
       </div>
+      <div :class="pageType == 4?'checkTitle':''" @click="checkTitleButton(4)">
+        <p>按检查内容</p>
+        <p></p>
+      </div>
     </div>
     <laboratoryStatistics v-if="pageType == 1"></laboratoryStatistics>
     <safetyHazardStatistics v-if="pageType == 2"></safetyHazardStatistics>
     <checkIndexStatistics v-if="pageType == 3" :propsData="propsData"></checkIndexStatistics>
+    <inspectContent v-if="pageType == 4" ></inspectContent>
   </div>
 </template>
 
@@ -24,12 +29,14 @@
   import laboratoryStatistics from './laboratoryStatistics.vue'
   import safetyHazardStatistics from './safetyHazardStatistics.vue'
   import checkIndexStatistics from './checkIndexStatistics.vue'
+  import inspectContent from './inspectContent.vue'
   export default {
     name: 'index',
     components: {
       laboratoryStatistics,
       safetyHazardStatistics,
-      checkIndexStatistics
+      checkIndexStatistics,
+      inspectContent
     },
     data(){
       return{

+ 333 - 0
src/views/safetyCheck/dataStatistics/inspectContent.vue

@@ -0,0 +1,333 @@
+<!--检查内容统计列表-->
+<template>
+  <div class="safetyHazardStatistics">
+    <el-form :model="queryParams" class="form-box" ref="queryForm" :inline="true">
+      <el-form-item label="" prop="rectifyStatus">
+        <el-select v-model="queryParams.hazardTypeMode" clearable placeholder="全部检查内容">
+          <el-option
+            v-for="item in materialTypeList"
+            :key="item.dictValue"
+            :label="item.dictLabel"
+            :value="item.dictValue">
+          </el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item label="" prop="deptId" label-width="50px">
+        <el-select v-model="queryParams.deptId" @change="handleNodeClick" clearable placeholder="全部学院">
+          <el-option
+            v-for="item in deptSelectList"
+            :key="item.deptId"
+            :label="item.deptName"
+            :value="item.deptId">
+          </el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item label="" prop="subId" label-width="58px">
+        <el-select v-model="queryParams.subId" placeholder="请选择实验室">
+          <el-option
+            v-for="item in subjectOptions"
+            :key="item.id"
+            :label="item.name"
+            :value="item.id">
+          </el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item label="" prop="dateRange" label-width="70px">
+        <el-date-picker
+          :clearable="false"
+          v-model="dateRange"
+          size="small"
+          style="width: 240px"
+          value-format="yyyy-MM-dd"
+          type="daterange"
+          range-separator="-"
+          start-placeholder="开始日期"
+          end-placeholder="结束日期"
+        ></el-date-picker>
+      </el-form-item>
+      <el-form-item>
+        <p class="inquire-button-one" @click="handleQuery" style="margin-right:10px;">查询</p>
+        <p class="reset-button-one" @click="resetQuery">重置</p>
+      </el-form-item>
+      <el-form-item style="float: right;" v-hasPermi="['safety:dataSub:export']">
+        <el-dropdown @command="exportButton">
+          <div class="form-dropdown-box">
+            <img src="@/assets/ZDimages/personnelManagement/icon_jzgxx_sc.png">
+            <p>导出</p>
+            <img src="@/assets/ZDimages/personnelManagement/icon_jzggl_xljt.png">
+          </div>
+          <el-dropdown-menu slot="dropdown">
+            <el-dropdown-item style="border-bottom:1px solid #E0E0E0;margin:0 10px;color:#333;" :command="{command:1}">导出全部数据</el-dropdown-item>
+            <el-dropdown-item style="margin:0 10px;color:#333;" :command="{command:2}">导出选中数据</el-dropdown-item>
+          </el-dropdown-menu>
+        </el-dropdown>
+      </el-form-item>
+    </el-form>
+    <div class="num-data-box">
+      共搜索到隐患总数 {{numData.numData}},已整改数 {{numData.sumYzg}}, 未整改数 {{numData.sumWzg}},整改率 {{numData.rate}}
+    </div>
+    <el-table  border :data="tableList" ref="multipleTable"
+               :row-key="getRowKeys"
+               @select="select" @select-all="selectAll">
+      <el-table-column type="selection" width="50" align="center" fixed/>
+      <el-table-column label="序号" align="center"  type="index" width="60" fixed/>
+      <el-table-column label="检查内容" align="center" prop="hazardName" show-overflow-tooltip width="200" fixed/>
+      <el-table-column label="学院" align="center" prop="collegeName" show-overflow-tooltip width="200" fixed/>
+      <el-table-column label="实验室" align="center" prop="subjectName" show-overflow-tooltip width="180"/>
+      <el-table-column label="隐患总数" align="center" prop="sumTotal" show-overflow-tooltip width="100"/>
+      <el-table-column label="隐患占比" align="center" prop="percent" show-overflow-tooltip width="180"/>
+      <el-table-column label="已整改" align="center" prop="sumYzg" show-overflow-tooltip width="180"/>
+      <el-table-column label="未整改" align="center" prop="sumWzg" show-overflow-tooltip width="180"/>
+      <el-table-column label="整改率" align="center" prop="percent2" show-overflow-tooltip width="180"/>
+    </el-table>
+    <pagination :page-sizes="[20, 30, 40, 50]"
+                v-show="total>0"
+                :total="total"
+                :page.sync="queryParams.pageNum"
+                :limit.sync="queryParams.pageSize"
+                @pagination="getList"
+    />
+  </div>
+</template>
+
+<script>
+  import { listDepartments } from "@/api/system/dept";
+  import { dataStatisticsContentList,dataStatisticsContentListTop } from "@/api/safetyCheck/index";
+  import { dangerList } from '@/api/gasManage3_0/gasManage'
+  import { subjectDictList } from '@/api/laboratory/record'
+  export default {
+    name: 'safetyHazardStatistics',
+    data(){
+      return{
+        deptSelectList:[],
+        materialTypeList:[],
+        subjectOptions:[],
+        levelList:[{label:"一般隐患",key:"2"},{label:"重大隐患",key:"1"},{label:"管理问题",key:"3"}],
+        dateRange:[],
+        queryParams:{
+          pageNum:1,
+          pageSize:20,
+          hazardTypeMode:"",
+          deptId:"",
+          subId:"",
+        },
+        setChildren:"",
+        numData:{},
+        tableList:[],
+        total:0,
+      }
+    },
+    created(){
+
+    },
+    mounted(){
+      this.dangerList();
+      this.initializationInterface();
+      this.getList();
+    },
+    methods:{
+      initializationInterface(){
+        //获取学院列表
+        listDepartments().then(response => {
+          this.deptSelectList = response.data;
+        });
+      },
+      //获取危险源类型
+      dangerList(){
+        let _this=this;
+        dangerList().then( response => {
+          let res=response.rows;
+          _this.materialTypeList=res;
+        });
+      },
+      // 节点单击事件
+      handleNodeClick(data) {
+        this.queryParams.deptId = data;
+        this.getSubjectDictList(data);
+      },
+      /** 查询实验室字典列表 */
+      getSubjectDictList (deptId) {
+        this.subjectOptions = null;
+        this.loading = true;
+        let params = {};
+        params.deptId = deptId;
+        this.queryParams.subId = "";
+        subjectDictList(params).then(response => {
+          this.subjectOptions = response.data;
+          this.loading = false;
+        });
+      },
+      //获取数据列表
+      getList(){
+        let obj = JSON.parse(JSON.stringify(this.queryParams))
+        if(this.dateRange[0]){
+          obj.beginTime = this.dateRange[0];
+        }else{
+          obj.beginTime = "";
+        }
+        if(this.dateRange[1]){
+          obj.endTime = this.dateRange[1];
+        }else{
+          obj.endTime = "";
+        }
+        dataStatisticsContentList(obj).then(response => {
+          this.total = response.data.total;
+          this.tableList = response.data.records;
+        });
+        dataStatisticsContentListTop(obj).then(response => {
+          this.$set(this,'numData',response.data);
+        });
+      },
+      /** 搜索按钮操作 */
+      handleQuery() {
+        this.$set(this.queryParams,'pageNum',1);
+        this.getList();
+      },
+      /** 重置按钮操作 */
+      resetQuery() {
+        this.$set(this,'dateRange',[]);
+        this.$set(this,'queryParams',{
+          pageNum:1,
+          pageSize:20,
+          hazardTypeMode:"",
+          deptId:"",
+          subId:"",
+        });
+        this.handleQuery();
+      },
+      /** 导出按钮操作 */
+      exportButton(item) {
+        let self = this;
+        if(item.command == 1){
+          self.$confirm(`确认导出全部数据?`, "提示", {
+            confirmButtonText: "确定",
+            cancelButtonText: "取消",
+            type: "warning"
+          }).then(async () => {
+            self.download('/zd-security/DataStatistics/contentExport/', {}, '检查内容统计.xlsx')
+          }).catch(() => {})
+        }else if(item.command == 2){
+          let list = self.$refs.multipleTable.selection;
+          let ids = [];
+          for(let i=0;i<list.length;i++){
+            ids.push(list[i].id)
+          }
+          if(ids.length>0) {
+            self.$confirm(`确认导出选中数据?`, "提示", {
+              confirmButtonText: "确定",
+              cancelButtonText: "取消",
+              type: "warning"
+            }).then(async () => {
+              self.download(`/zd-security/DataStatistics/contentExport/?ids=`+ids,{}, '检查内容统计.xlsx')
+              this.$refs.multipleTable.clearSelection();
+            }).catch(() => {})
+          }else {
+            this.msgError('请选择要导出的数据')
+          }
+        }
+      },
+      /*===记录勾选数据===
+        需要再el-table 添加  :row-key="getRowKeys"
+        需要在selection 添加 :reserve-selection="true"
+      */
+      getRowKeys(row) {
+        return row.id
+      },
+      // 单选
+      select (selection, row) {
+        if (selection.some(el => { return row.id === el.id })) {
+          if (row.children) {
+            this.setChildren(row.children, true)
+          }
+        } else {
+          if (row.children) {
+            this.setChildren(row.children, false)
+          }
+        }
+      },
+      // 全选
+      selectAll (selection) {
+        const isSelect = selection.some(el => {
+          const tableDataIds = this.tableData.map(j => j.id)
+          return tableDataIds.includes(el.id)
+        })
+        const isCancel = !this.tableData.every(el => {
+          const selectIds = selection.map(j => j.id)
+          return selectIds.includes(el.id)
+        })
+        if (isSelect) {
+          selection.map(el => {
+            if (el.children) {
+              this.setChildren(el.children, true)
+            }
+          })
+        }
+        if (isCancel) {
+          this.tableData.map(el => {
+            if (el.children) {
+              this.setChildren(el.children, false)
+            }
+          })
+        }
+      },
+    }
+  }
+</script>
+
+<style scoped lang="scss">
+  ::v-deep .el-table__body-wrapper{
+    padding-bottom: 8px;
+  }
+  ::v-deep .el-table__fixed{
+    margin-top:-1px;
+    margin-left:-1px;
+    height:calc(100% - 8px)!important;
+  }
+  ::v-deep .el-table__fixed-body-wrapper{
+    height: calc(100% - 48px);
+    overflow-y: auto;
+  }
+  .safetyHazardStatistics{
+    flex:1;
+    display: flex;
+    flex-direction: column;
+    overflow: hidden;
+    padding:20px;
+    .form-box{
+      .form-dropdown-box{
+        display: flex;
+        margin:0;
+        padding:0 10px;
+        cursor: pointer;
+        height:40px;
+        img:nth-child(1){
+          width:16px;
+          height:16px;
+          margin-top:12px;
+        }
+        p{
+          width:47px;
+          text-align: center;
+          font-size:14px;
+          margin:0;
+          line-height:40px;
+        }
+        img:nth-child(3){
+          width:10px;
+          height:6px;
+          margin-top:17px;
+        }
+      }
+    }
+    .num-data-box{
+      background: rgba(1,131,250,0.2);
+      color:#0183FA;
+      font-size:14px;
+      line-height:40px;
+      padding:0 20px;
+      border-radius:4px;
+      margin-bottom:20px;
+    }
+
+  }
+</style>

+ 50 - 17
src/views/safetyCheck/equipmentConfig/index.vue

@@ -62,7 +62,7 @@
                :close-on-click-modal="false">
       <el-form ref="addDialogForm" :model="addDialogForm" :rules="rules" label-width="120px">
         <el-form-item label="检查内容:" prop="checkLevel">
-          <el-select  v-model="addDialogForm.joinHazardReid" placeholder="请选择检查项" style="width:548px;">
+          <el-select  v-model="addDialogForm.joinHazardReid" placeholder="请选择检查项" :disabled="isDetail" style="width:548px;">
             <el-option
               v-for="item in materialTypeList"
               :key="item.id"
@@ -72,7 +72,7 @@
           </el-select>
         </el-form-item>
         <div class="small_title">对应检查项目</div>
-        <el-form-item label="检查类目" prop="joinCheckOpList">
+        <el-form-item label="检查类目" prop="joinCheckOpList" v-if="!isDetail">
           <el-cascader
             style="width:548px;"
             v-model="addDialogForm.joinCheckOpList"
@@ -90,7 +90,8 @@
         <div style="height: 300px;overflow-y: auto">
           <el-form-item label="">
             <el-tree
-              :data="cascaderData"
+              ref="tree"
+              :data="cascaderTreeData"
               :props="defaultProps"
               show-checkbox
               node-key="id"
@@ -157,14 +158,15 @@ export default {
       },
       //检查项
       cascaderData:[],
+      cascaderTreeData:[],
       cascaderDataPrimitive:[],
       dangerArr:[],//危险源类型
       materialTypeList:[],//检查内容
       // 表单校验
       rules: {
         joinCheckOpList: [
-          { required: true, message: "请选择上级指标", trigger: "change" },
-          { required: true, message: "请选择上级指标", validator: this.spaceJudgment, trigger: "change" },
+          { required: true, message: "请选择", trigger: "change" },
+          { required: true, message: "请选择", validator: this.spaceJudgment, trigger: "change" },
         ],
         name: [
           { required: true, message: "请输入检查项目内容", trigger: "change" },
@@ -177,6 +179,7 @@ export default {
         label: 'labelName'
       },
       cascaderCheckedData:[],//检查类目树回显
+      isDetail:false,
     }
 
   },
@@ -213,21 +216,38 @@ export default {
     handleClick(index,row,doType){
       let _this=this;
       if(doType=='add'){//新增
+        this.isDetail=false;
+        this.$set(this,'addDialogType',true);
         this.$set(this,'addDialogTitle','新增检查项');
         this.$set(this,'addDialogForm',{
           joinHazardReid:'',
           joinCheckOpList:[],
         });
-        this.cascaderCheckedData=[];
         this.inspectContentList()//检查内容
-        this.$set(this,'addDialogType',true);
-
+        this.$nextTick(function () {
+          //Dom更新完毕
+          this.$refs.tree.setCheckedKeys([]);
+        });
       }else if(doType=='detail'){//详情
-
-      }else if(doType=='edit'){//编辑
+        this.isDetail=true;
+        this.$set(this,'addDialogType',true);
+        this.$set(this,'addDialogTitle','编辑检查项');
         this.getInfo(row.id)
         this.inspectContentList(row.id)//检查内容
+        this.$nextTick(function () {
+          //Dom更新完毕
+          this.$refs.tree.setCheckedKeys([]);
+        });
+      }else if(doType=='edit'){//编辑
+        this.isDetail=false;
         this.$set(this,'addDialogType',true);
+        this.$set(this,'addDialogTitle','编辑检查项');
+        this.getInfo(row.id)
+        this.inspectContentList(row.id)//检查内容
+        this.$nextTick(function () {
+          //Dom更新完毕
+          this.$refs.tree.setCheckedKeys([]);
+        });
 
       }else if(doType=='delete'){//删除
         this.$confirm('是否确认删除?', "警告", {
@@ -250,12 +270,7 @@ export default {
     },
     //联级选中
     cascaderCheck(val){
-      // let obj = this.cascaderCheckData(val,this.cascaderDataPrimitive);
-      // this.$set(this.addDialogForm,'code',obj.key);
-      // this.getCodeButton(this.cascaderDataPrimitive,obj.parentId,val);
-      // this.$set(this,'addDialogLevel',obj.level);
-      console.log(val)
-      this.addDialogForm.joinCheckOpList=val
+
     },
     /** 搜索按钮操作 */
     handleQuery() {
@@ -266,7 +281,7 @@ export default {
     resetQuery() {
       this.queryParams.searchValue = "";
       this.queryParams.hazardType='',
-      this.handleQuery();
+        this.handleQuery();
     },
     /** 查询检查项选项列表 */
     checkOptionList() {
@@ -274,8 +289,10 @@ export default {
       checkOptionList(this.queryParams).then( response => {
         let list=JSON.parse(JSON.stringify(response.data))
         this.$set(this,'cascaderData',list);
+        this.$set(this,'cascaderTreeData',JSON.parse(JSON.stringify(list)));
         this.$set(this,'cascaderDataPrimitive',JSON.parse(JSON.stringify(list)));
         this.getCascaderData(this.cascaderData);
+        this.getCascaderTreeData(this.cascaderTreeData);
         this.loading = false;
       });
     },
@@ -291,6 +308,19 @@ export default {
         }
       }
     },
+    //树形选择器数据处理
+    getCascaderTreeData(list){
+      let self = this;
+      for(let i=0;i<list.length;i++){
+        list[i].labelName = list[i].code? list[i].code +' '+ list[i].name:list[i].name
+        list[i].disabled = true;
+        if(list[i].level == 1 || list[i].level == 2 || list[i].level == 3){
+          self.getCascaderTreeData(list[i].children)
+        }else{
+          delete list[i].children
+        }
+      }
+    },
     //获取危险源类型
     dangerList(){
       let _this=this;
@@ -388,6 +418,9 @@ export default {
 .approval_handle {
   display: flex!important;
   flex-direction: column;
+  .goods-category-cascader-stocking-page .el-cascader-menu:nth-of-type(1) .el-checkbox__input {
+    display: none !important;
+  }
   .approval_handle-page{
     flex:1;
     display: flex!important;

+ 1 - 1
src/views/safetyCheck/safetyHazard/cannotListPage.vue

@@ -63,7 +63,7 @@
         </el-table-column>
         <el-table-column label="检查内容" align="center" prop="checkRange" show-overflow-tooltip width="120">
           <template slot-scope="scope">
-            <p>{{scope.row.checkCategory?scope.row.checkCategory:'-'}}</p>
+            <p>{{scope.row.hazardName?scope.row.hazardName:'-'}}</p>
           </template>
         </el-table-column>
         <el-table-column label="检查时间" sortable align="center" prop="checkTime" show-overflow-tooltip width="160"/>

+ 1 - 1
src/views/safetyCheck/safetyHazard/departmentListPage.vue

@@ -79,7 +79,7 @@
           </el-table-column>
           <el-table-column label="检查内容" align="center" prop="checkRange" show-overflow-tooltip width="120">
             <template slot-scope="scope">
-              <p>{{scope.row.checkCategory?scope.row.checkCategory:'-'}}</p>
+              <p>{{scope.row.hazardName?scope.row.hazardName:'-'}}</p>
             </template>
           </el-table-column>
           <el-table-column label="检查时间" sortable="custom" align="center" prop="checkTime" show-overflow-tooltip width="160"/>

+ 1 - 1
src/views/safetyCheck/safetyHazard/schoolListPage.vue

@@ -79,7 +79,7 @@
           </el-table-column>
           <el-table-column label="检查内容" align="center" prop="checkRange" show-overflow-tooltip width="120">
             <template slot-scope="scope">
-              <p>{{scope.row.checkCategory?scope.row.checkCategory:'-'}}</p>
+              <p>{{scope.row.hazardName?scope.row.hazardName:'-'}}</p>
             </template>
           </el-table-column>
           <el-table-column label="检查时间" sortable="custom" align="center" prop="checkTime" show-overflow-tooltip width="160"/>

+ 214 - 97
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>
@@ -224,14 +224,14 @@
           <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" :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/>
+                <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>
@@ -246,10 +246,10 @@
             </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>
+                  <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>
@@ -258,7 +258,7 @@
               </div>
               <div class="for-big-box-special"  v-for="(item2,index2) in item.checkHazardDtoList">
                 <div class="for-big-box-special-l">{{index+1}}.{{index2+1}}</div>
-                <div class="for-big-box-special-r">
+                <div class="for-big-box for-big-box-special-r">
                   <el-form-item label="检查项目" :prop="'checkHazardInfoVoList.'+index+'.checkHazardDtoList.'+index2+'.hazardCheckPro'" :rules="rules.hazardCheckPro" label-width="123px">
                     <el-radio-group v-model="item2.checkFlag" style="margin-right: 20px;">
                       <el-radio :label="1">符合</el-radio>
@@ -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>
@@ -336,12 +337,12 @@
       </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/>
+          <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>
@@ -358,8 +359,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 +407,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 +415,7 @@
         hazardCheckCount:0,
         //上传用名称保存
         upDataName:"",
-        deviceTableList:[{
-          'chName':'测试',
-          'num':'2',
-          'code':'001',
-          'hazardTypeMode':'冷热设备',
-        }],
+        deviceTableList:[],
         //检查类型
         inspectCategoryList:[{id:'1',name:'综合检查'},{id:'2',name:'专项检查'}],
         // 表单校验
@@ -507,7 +477,9 @@
         myApplyGentle:false,
         /* ==专项检查== */
         dialogVisible:false,
-        pageType:1,
+        pageType:0,
+        multipleSelection:[],
+
       }
     },
     created(){
@@ -523,23 +495,30 @@
       getRowKeys(row) {
         return row.id
       },
-      deviceChange(selection){
-        console.log(selection)
-
+      //选中设备
+      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
+        }
       },
       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='';
+          if(this.multipleSelection[0]){
+            this.pageType=2;
+            this.checkOptionList();
+            this.dialogVisible=false;
+            hazardIds=this.multipleSelection.join(',')
+            this.getHazardInfo(this.addForm.subId,hazardIds)
+          }else{
+            this.msgError('请先选择实验室内设备!')
           }
         }
       },
@@ -568,24 +547,62 @@
             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++){
+                    obj.checkHazardDtoList[i].checkCategory=this.addForm.checkCategory;
+                    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(this.multipleSelection[0]){
+                  obj.hazardIds=this.multipleSelection.join(',')
+                }
+                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();
@@ -593,22 +610,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,7 +719,25 @@
       },
       //新增检查项
       addObjectDevice(item){
+        let self=this;
         this.dialogVisible=true;
+        let list=JSON.parse(JSON.stringify(self.multipleSelection))
+        setTimeout(function(){
+          self.$refs.deviceTable.clearSelection();
+          if(list[0]){
+            self.deviceTableList.forEach(row => {
+              list.forEach(function(item) {
+                if(row.id==item){
+                  self.$refs.deviceTable.toggleRowSelection(row,true);
+                }
+              })
+            });
+          }else{
+            if(self.$refs.deviceTable){
+              self.$refs.deviceTable.clearSelection();
+            }
+          }
+        },100);
 
       },
       //查看图片
@@ -837,6 +905,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 +935,25 @@
           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 => {
+            if(response.data[0]){
+              response.data.forEach(function(item) {
+                item.checkHazardDtoList.forEach(function(item2) {
+                  item2.hazardCheckCode=item2.code
+                })
+              })
+            }
+            this.addForm.checkHazardInfoVoList=response.data
+        });
+      },
       //计划列表选中
       planChange(val){
         let self = this;
@@ -886,7 +974,9 @@
             key:2,
             label:"实验室自查",
           }]);
+          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:"实验室自查", }]);
         }
@@ -894,12 +984,27 @@
       //查询详情
       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];
+            if(response.data.checkHazardInfoVoList[0]){
+              response.data.checkHazardInfoVoList.forEach(function(item) {
+                item.checkHazardDtoList.forEach(function(item2) {
+                  item2.hazardCheckCode=item2.code
+                })
+              })
+            }
+            this.pageType=2
           }
           this.buildBySubList(response.data.buildId,1);
           this.$set(this,'addForm',{
@@ -916,7 +1021,11 @@
             dateRange:response.data.dateRange,
             rectifyDeadline:response.data.rectifyDeadline,
             checkHazardDtoList:response.data.checkHazardDtoList,
+            checkHazardInfoVoList:response.data.checkHazardInfoVoList,
+
           });
+          this.checkOptionList();//获取检查项
+
         });
       },
       //初始化数据
@@ -952,7 +1061,9 @@
         this.$set(this,'planList',[]);
       },
       //删除检查项
-      delCheckHazardDtoList(index){
+      delCheckHazardDtoList(index,index2){
+        console.log(index)
+        console.log(index2)
         let self = this;
         this.$confirm('是否确认删除?', "警告", {
           confirmButtonText: "确定",
@@ -962,7 +1073,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(() => {
@@ -990,6 +1106,7 @@
             this.msgError('未找到相关项目')
             return
           }
+          console.log(obj)
           item.hazardCheckCode=obj.code;
           item.hazardCheckName=obj.name;
           countHazardNum({subId:this.addForm.subId, hazardCheckPro:val}).then( response => {