dedsudiyu 2 年 前
コミット
6278d9e9f6

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

@@ -300,7 +300,7 @@ export function conditionCollegeInfo(query) {
 }
 
 //检查计划-查询选中院系下的实验室列表
-export function findSubInfoByDeptIds(query) {
+export function findSubInfoByDeptIds(data) {
   return request({
     url: '/zd-laboratory/subject/findSubInfoByDeptIds',
     method: 'post',
@@ -308,6 +308,24 @@ export function findSubInfoByDeptIds(query) {
   })
 }
 
+//检查计划-查询实验室(已过滤/未选)
+export function conditionSubjectInfo(data) {
+  return request({
+    url: '/zd-laboratory/subject/conditionSubjectInfo',
+    method: 'post',
+    data: data
+  })
+}
+
+//检查计划-新增计划
+export function checkPlanAdd(data) {
+  return request({
+    url: '/zd-security/checkPlan/add',
+    method: 'post',
+    data: data
+  })
+}
+
 /***************************校院巡察组***************************/
 
 //校院巡察组-分页获取校院巡查组列表

+ 26 - 18
src/views/safetyCheck/schoolInspection/inspectionGroup/addDialog.vue

@@ -3,7 +3,7 @@
              :title="addDialogTitle" :visible.sync="addDialogType" v-if="addDialogType"
              @close="addDialogAllOff" width="1303px" append-to-body>
     <div class="add-max-box" v-if="addDialogBoxType == 1">
-      <el-form  :model="dialogForm" :rules="rules" label-width="100px" class="add-form-box">
+      <el-form ref="addDialogForm" :model="dialogForm" :rules="rules" label-width="100px" class="add-form-box">
         <el-form-item label="是否启用:" prop="enable">
           <el-switch
             v-if="!lookInfoType"
@@ -286,23 +286,31 @@
       addUserButton(){
         let self = this;
         if(this.addDialogBoxType == 1){
-          if(this.dialogForm.id){
-            //编辑
-            let obj = this.dialogForm;
-            obj.checkGroupMemberList = this.dialogTableList
-            checkGroupUpdate(obj).then(response => {
-              this.msgSuccess(response.msg);
-              this.$parent.addDialogOpen(5)
-            })
-          }else{
-            //新增
-            let obj = this.dialogForm;
-            obj.checkGroupMemberList = this.dialogTableList
-            checkGroupAdd(obj).then(response => {
-              this.msgSuccess(response.msg);
-              this.$parent.addDialogOpen(5)
-            })
-          }
+          this.$refs["addDialogForm"].validate(valid => {
+            if (valid) {
+              if(!this.dialogTableList[0]){
+                this.msgError('请添加至少一名巡查成员')
+                return
+              }
+              if(this.dialogForm.id){
+                //编辑
+                let obj = this.dialogForm;
+                obj.checkGroupMemberList = this.dialogTableList
+                checkGroupUpdate(obj).then(response => {
+                  this.msgSuccess(response.msg);
+                  this.$parent.addDialogOpen(5)
+                })
+              }else{
+                //新增
+                let obj = this.dialogForm;
+                obj.checkGroupMemberList = this.dialogTableList
+                checkGroupAdd(obj).then(response => {
+                  this.msgSuccess(response.msg);
+                  this.$parent.addDialogOpen(5)
+                })
+              }
+            }
+          })
         }else{
           let list = [];
           let newObj = {};

+ 377 - 158
src/views/safetyCheck/schoolInspection/inspectionPlan/addDialog.vue

@@ -1,5 +1,6 @@
 <template>
   <el-dialog class="inspectionPlan-dialog-box"
+             v-loading="loading"
              :title="addDialogTitle" :visible.sync="addDialogType" v-if="addDialogType"
              @close="addDialogAllOff" width="1303px" append-to-body>
     <div class="inspectionPlan-dialog-add-box" v-show="addDialogBoxType==1">
@@ -13,20 +14,20 @@
         </div>
       </div>
       <div class="right-max-box scrollbar-box">
-        <el-form  :model="dialogForm" :rules="rules" label-width="140px">
-          <el-form-item label="计划标题:" prop="data1">
-            <el-input :disabled="lookInfoType" v-model="dialogForm.data1" placeholder="请输入计划标题" maxLength="30" style="width:450px;"/>
+        <el-form ref="addDialogForm" :model="dialogForm" :rules="rules" label-width="140px">
+          <el-form-item label="计划标题:" prop="title">
+            <el-input :disabled="lookInfoType" v-model="dialogForm.title" placeholder="请输入计划标题" maxLength="30" style="width:450px;"/>
           </el-form-item>
-          <el-form-item label="检查类型:" prop="data2">
-            <el-input v-model="dialogForm.data2" placeholder="请选择检查类型" maxLength="10" disabled style="width:450px;"/>
+          <el-form-item label="检查类型:">
+            <p style="width:450px;background:#f5f5f5;border-radius:4px;padding:0 15px;">校级巡查</p>
           </el-form-item>
-          <el-form-item label="检查周期:" prop="data3">
+          <el-form-item label="检查周期:" prop="dateRange">
             <div class="date-range-box">
               <div class="date-range-left-box">
                 <el-date-picker
                   :disabled="lookInfoType"
                   :clearable="false"
-                  v-model="dialogForm.data3"
+                  v-model="dialogForm.dateRange"
                   style="width:450px;"
                   value-format="yyyy-MM-dd"
                   type="daterange"
@@ -59,25 +60,26 @@
               <div class="dialog-range-text-box">
                 <p class="inquire-button-one button-p" v-if="dialogForm.checkRange == 2" @click="dialogClickType(2)">{{lookInfoType?'查看':'选择学院'}}</p>
                 <p class="inquire-button-one button-p" v-if="dialogForm.checkRange == 3" @click="dialogClickType(3)">{{lookInfoType?'查看':'选择实验室'}}</p>
-                <p class="text-p" v-if="dialogForm.checkRange == 2">已选择{{deptCheckNum}}个学院,共{{deptSubCheckNum}}间实验室</p>
-                <p class="text-p" v-if="dialogForm.checkRange != 2">已选择{{subCheckNum}}间实验室</p>
+                <p class="text-p" v-if="dialogForm.checkRange ==1 && dialogForm.schoolSubCheckNum>0">已选择{{dialogForm.schoolSubCheckNum}}间实验室</p>
+                <p class="text-p" v-if="dialogForm.checkRange == 2 && dialogForm.collegeNum>0">已选择{{dialogForm.collegeNum}}个学院,共{{dialogForm.collegeSubNum}}间实验室</p>
+                <p class="text-p" v-if="dialogForm.checkRange ==3 && dialogForm.subjectNum>0">已选择{{dialogForm.subjectNum}}间实验室</p>
               </div>
             </div>
           </el-form-item>
-          <el-form-item label="检查要求:" prop="data5">
+          <el-form-item label="检查要求:" prop="checkDemand">
             <el-input
               :disabled="lookInfoType"
               type="textarea"
               :autosize="{ minRows: 4, maxRows: 4}"
               :placeholder="lookInfoType?'未输入':'请输入检查检查要点:'"
-              v-model="dialogForm.data5"
+              v-model="dialogForm.checkDemand"
               maxlength="100"
               resize="none"
               show-word-limit
               style="width:450px;">
             </el-input>
           </el-form-item>
-          <el-form-item label="检查材料:" prop="data6">
+          <el-form-item label="检查材料:">
             <div class="dialog-material-max-box">
               <div class="dialog-material-button-box" v-if="!lookInfoType">
                 <el-upload
@@ -92,21 +94,21 @@
                 <p class="dialog-material-text">支持doc/docx/xls/xlsx/pdf格式文件</p>
               </div>
               <div class="dialog-material-list-box">
-                <div v-for="(item,index) in dialogUpList" :key="index">
+                <div v-for="(item,index) in dialogForm.uploadDtoList" :key="index">
                   <img src="@/assets/ZDimages/safetyCheck/icon_dr_wj.png">
-                  <p>{{item.name}}</p>
+                  <p>{{item.fileName}}</p>
                   <p @click="dialogClickType(5,item)">查看</p>
                   <p @click="delUpData(index)" v-if="!lookInfoType">删除</p>
                   <p v-if="lookInfoType">下载</p>
                 </div>
-                <p class="dialog-material-list-null" v-if="!dialogUpList[0]">暂无数据</p>
+                <p class="dialog-material-list-null" v-if="!dialogForm.uploadDtoList[0]">未上传</p>
               </div>
             </div>
           </el-form-item>
-          <el-form-item label="巡察组:" prop="data6">
+          <el-form-item label="巡察组:">
             <div class="dialog-table-max-box">
               <div v-if="!lookInfoType">
-                <el-select v-model="dialogForm.data6" placeholder="请选择" @change="groupChange">
+                <el-select v-model="groupData" placeholder="请选择" @change="groupChange">
                   <el-option
                     v-for="item in dialogOptions"
                     :key="item.id"
@@ -173,35 +175,35 @@
       </div>
       <div class="right-max-box">
         <div class="dept-table-title-box">
-          <p>已选实验室15间</p>
+          <p>已选实验室{{deptCheckData.subNum}}间</p>
           <p></p>
         </div>
         <div class="dept-table-max-box">
           <el-form v-if="!lookInfoType" :model="deptQueryParamsRight" class="form-box" ref="queryForm" :inline="true" label-width="50px">
-            <el-form-item label="" prop="classType">
-              <el-select v-model="deptQueryParamsRight.classType" clearable placeholder="选择分类" style="width: 120px">
+            <el-form-item label="" prop="typeId">
+              <el-select v-model="deptQueryParamsRight.typeId" clearable placeholder="选择分类" style="width: 120px">
                 <el-option
                   v-for="item in classTypeList"
-                  :key="item.key"
-                  :label="item.label"
-                  :value="item.key">
+                  :key="item.id"
+                  :label="item.typeName"
+                  :value="item.id">
                 </el-option>
               </el-select>
             </el-form-item>
-            <el-form-item label="" prop="classified">
-              <el-select v-model="deptQueryParamsRight.classified" clearable placeholder="选择分级" style="width: 120px">
+            <el-form-item label="" prop="level">
+              <el-select v-model="deptQueryParamsRight.level" clearable placeholder="选择分级" style="width: 120px">
                 <el-option
                   v-for="item in classifiedList"
-                  :key="item.key"
-                  :label="item.label"
-                  :value="item.key">
+                  :key="item.id"
+                  :label="item.classifiedName"
+                  :value="item.id">
                 </el-option>
               </el-select>
             </el-form-item>
             <el-form-item label="" prop="deptId">
               <el-select v-model="deptQueryParamsRight.deptId" clearable placeholder="选择学院" style="width: 120px">
                 <el-option
-                  v-for="item in deptSelectList"
+                  v-for="item in changeDeptSelectList"
                   :key="item.deptId"
                   :label="item.deptName"
                   :value="item.deptId">
@@ -224,12 +226,18 @@
           </el-form>
           <el-table  border :data="deptTableListRight">
             <el-table-column label="序号" align="center"  type="index" width="60"/>
-            <el-table-column label="实验室" align="center" prop="deptName" show-overflow-tooltip/>
-            <el-table-column label="楼东楼层" align="center" prop="deptName" show-overflow-tooltip width="150"/>
-            <el-table-column label="分类分级" align="center" prop="deptName" show-overflow-tooltip width="150"/>
-            <el-table-column label="学院" align="center" prop="deptName" show-overflow-tooltip width="140"/>
+            <el-table-column label="实验室" align="center" prop="subjectName" show-overflow-tooltip/>
+            <el-table-column label="楼栋楼层" align="center" prop="buildName" show-overflow-tooltip width="150"/>
+            <el-table-column label="分类分级" align="center" prop="deptName" show-overflow-tooltip width="150">
+              <template slot-scope="scope">
+                <span v-for="item in classTypeList" v-if="item.id == scope.row.typeId">{{item.typeName}}</span>
+                <span style="border-right:1px solid #E0E0E0;margin:0 10px;"></span>
+                <span v-for="item in classifiedList" v-if="item.id == scope.row.level" :style="'color:'+item.classifiedColor+';'">{{item.classifiedName}}</span>
+              </template>
+            </el-table-column>
+            <el-table-column label="学院" align="center" prop="collegeName" show-overflow-tooltip width="140"/>
           </el-table>
-          <pagination :page-sizes="[20, 30, 40, 50]"
+          <pagination layout="total, prev, pager, next, jumper"
                       v-show="deptTotalRight>0"
                       :total="deptTotalRight"
                       :page.sync="deptTableListRight.pageNum"
@@ -247,22 +255,22 @@
         </div>
         <div class="dept-table-max-box">
           <el-form :model="subQueryParamsLeft" class="form-box" ref="queryForm" :inline="true" label-width="50px">
-            <el-form-item label="" prop="classType">
-              <el-select v-model="subQueryParamsLeft.classType" clearable placeholder="选择分类" style="width: 110px">
+            <el-form-item label="" prop="typeId">
+              <el-select v-model="subQueryParamsLeft.typeId" clearable placeholder="选择分类" style="width: 110px">
                 <el-option
                   v-for="item in classTypeList"
                   :key="item.key"
-                  :label="item.label"
+                  :label="item.typeName"
                   :value="item.key">
                 </el-option>
               </el-select>
             </el-form-item>
-            <el-form-item label="" prop="classified">
-              <el-select v-model="subQueryParamsLeft.classified" clearable placeholder="选择分级" style="width: 110px">
+            <el-form-item label="" prop="level">
+              <el-select v-model="subQueryParamsLeft.level" clearable placeholder="选择分级" style="width: 110px">
                 <el-option
                   v-for="item in classifiedList"
                   :key="item.key"
-                  :label="item.label"
+                  :label="item.classifiedName"
                   :value="item.key">
                 </el-option>
               </el-select>
@@ -291,13 +299,19 @@
               <p class="inquire-button-one" @click="subResetQueryLeft" style="width:60px;margin-right:0;">重置</p>
             </el-form-item>
           </el-form>
-          <el-table  border :data="subTableListLeft" @selection-change="subChangeLeft" :row-key="getSubRowKeys">
+          <el-table ref="leftSubTable" border :data="subTableListLeft" @selection-change="subChangeLeft" :row-key="getSubRowKeys">
             <el-table-column type="selection" width="50" :reserve-selection="true" align="center"/>
-            <el-table-column label="实验室" align="center" prop="deptName" show-overflow-tooltip/>
-            <el-table-column label="分类分级" align="center" prop="deptName" show-overflow-tooltip width="120"/>
-            <el-table-column label="学院" align="center" prop="deptName" show-overflow-tooltip width="150"/>
+            <el-table-column label="实验室" align="center" prop="subjectName" show-overflow-tooltip/>
+            <el-table-column label="分类分级" align="center" prop="deptName" show-overflow-tooltip width="140">
+              <template slot-scope="scope">
+                <span v-for="item in classTypeList" v-if="item.id == scope.row.typeId">{{item.typeName}}</span>
+                <span style="border-right:1px solid #E0E0E0;margin:0 10px;"></span>
+                <span v-for="item in classifiedList" v-if="item.id == scope.row.level" :style="'color:'+item.classifiedColor+';'">{{item.classifiedName}}</span>
+              </template>
+            </el-table-column>
+            <el-table-column label="学院" align="center" prop="collegeName" show-overflow-tooltip width="150"/>
           </el-table>
-          <pagination :page-sizes="[20, 30, 40, 50]"
+          <pagination layout="total, prev, pager, next, jumper"
                       v-show="subTotalLeft>0"
                       :total="subTotalLeft"
                       :page.sync="subQueryParamsLeft.pageNum"
@@ -317,22 +331,22 @@
         </div>
         <div class="dept-table-max-box">
           <el-form v-if="!lookInfoType" :model="subQueryParamsRight" class="form-box" ref="queryForm" :inline="true" label-width="50px">
-            <el-form-item label="" prop="classType">
-              <el-select v-model="subQueryParamsRight.classType" clearable placeholder="选择分类" style="width: 110px">
+            <el-form-item label="" prop="typeId">
+              <el-select v-model="subQueryParamsRight.typeId" clearable placeholder="选择分类" style="width: 110px">
                 <el-option
                   v-for="item in classTypeList"
                   :key="item.key"
-                  :label="item.label"
+                  :label="item.typeName"
                   :value="item.key">
                 </el-option>
               </el-select>
             </el-form-item>
-            <el-form-item label="" prop="classified">
-              <el-select v-model="subQueryParamsRight.classified" clearable placeholder="选择分级" style="width: 110px">
+            <el-form-item label="" prop="level">
+              <el-select v-model="subQueryParamsRight.level" clearable placeholder="选择分级" style="width: 110px">
                 <el-option
                   v-for="item in classifiedList"
                   :key="item.key"
-                  :label="item.label"
+                  :label="item.classifiedName"
                   :value="item.key">
                 </el-option>
               </el-select>
@@ -361,13 +375,19 @@
               <p class="inquire-button-one" @click="subResetQueryRight" style="width:60px;margin-right:0;">重置</p>
             </el-form-item>
           </el-form>
-          <el-table border :data="subTableListRight" @selection-change="subChangeRight" :row-key="getSubRowKeys">
+          <el-table ref="rightSubTable" border :data="subTableListRight" @selection-change="subChangeRight" :row-key="getSubRowKeys">
             <el-table-column v-if="!lookInfoType" type="selection" width="50" :reserve-selection="true" align="center"/>
-            <el-table-column label="实验室" align="center" prop="deptName" show-overflow-tooltip/>
-            <el-table-column label="分类分级" align="center" prop="deptName" show-overflow-tooltip width="120"/>
-            <el-table-column label="学院" align="center" prop="deptName" show-overflow-tooltip width="150"/>
+            <el-table-column label="实验室" align="center" prop="subjectName" show-overflow-tooltip/>
+            <el-table-column label="分类分级" align="center" prop="deptName" show-overflow-tooltip width="140">
+              <template slot-scope="scope">
+                <span v-for="item in classTypeList" v-if="item.id == scope.row.typeId">{{item.typeName}}</span>
+                <span style="border-right:1px solid #E0E0E0;margin:0 10px;"></span>
+                <span v-for="item in classifiedList" v-if="item.id == scope.row.level" :style="'color:'+item.classifiedColor+';'">{{item.classifiedName}}</span>
+              </template>
+            </el-table-column>
+            <el-table-column label="学院" align="center" prop="collegeName" show-overflow-tooltip width="150"/>
           </el-table>
-          <pagination :page-sizes="[20, 30, 40, 50]"
+          <pagination layout="total, prev, pager, next, jumper"
                       v-show="subTotalRight>0"
                       :total="subTotalRight"
                       :page.sync="subQueryParamsRight.pageNum"
@@ -492,7 +512,10 @@
 <script>
   import { getToken } from "@/utils/auth";
   import { listDepartments } from "@/api/system/dept";
-  import { getHistoryPlanTitles,findGroupList,checkGroupFind,findUserList,getAllSubNum,conditionCollegeInfo,findSubInfoByDeptIds } from '@/api/safetyCheck/index'
+  import { listClassifiedAll } from "@/api/laboratory/classified";
+  import { listClasstypeAll } from "@/api/laboratory/classtype";
+  import { getHistoryPlanTitles,findGroupList,checkGroupFind,findUserList,getAllSubNum,
+           conditionCollegeInfo,findSubInfoByDeptIds,checkPlanAdd,conditionSubjectInfo } from '@/api/safetyCheck/index'
   export default {
     name: 'addDialog',
     props:{
@@ -500,6 +523,7 @@
     },
     data(){
       return{
+        loading:false,
         uploadImgUrl: this.uploadUrl(), // 上传的图片服务器地址
         headers: {
           Authorization: "Bearer " + getToken(),
@@ -520,46 +544,52 @@
         dialogOptions:[],
         //上传文件名称暂存
         upDataName:"",
-        //上传文件列表
-        dialogUpList:[
-          {
-            name:"我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容",
-            url:"statics/bigFile/2023022011/f23a32c8-bf8e-40b5-9e52-04cf73fc6037.docx",
-          },
-          {
-            name:"我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容",
-            url:"statics/bigFile/2023022011/f23a32c8-bf8e-40b5-9e52-04cf73fc6037.docx",
-          }
-        ],
+        //巡察组
+        groupData:"",
         //选中巡查人员列表
         dialogTableList:[],
         //巡查范围列表
         dialogRangeOptions:[{label:"全校",value:"1"},{label:"学院",value:"2"},{label:"实验室",value:"3"}],
-        //巡查院系数量
-        deptCheckNum:0,
-        deptSubCheckNum:0,
+        //学院数量
+        collegeNum:0,
+        //学院实验室数量
+        collegeSubNum:0,
+        //学院选择页面已选数据
+        deptCheckData:{
+          deptIds:[],
+          deptNum:0,
+          subNum:0
+        },
+        //实验室选择页面已选数据
+        subCheckData:{
+          subIds:[]
+        },
         //巡查院系列表
         deptList:[],
-        //巡查实验室数量
-        subCheckNum:0,
         //巡查实验室列表
         subList:[],
         //提交数据
         dialogForm:{
-          data1:"",
-          data2:"",
-          data3:[],
-          checkRange:"",
-          data5:"",
-          data6:"",
+          title:"",//奥体
+          checkType:"1",//检查类型
+          dateRange:[],//时间
+          checkRange:"",//检查范围
+          checkDemand:"",//检查要点
+          schoolSubCheckNum:0,//学校实验室数量
+          collegeNum:0,//学院数量
+          collegeSubNum:0,//学院实验室数量
+          subCheckNum:0,//实验室数量
+          subjectNum:0,
+          collegeIds:[],
+          uploadDtoList:[],
         },
         // 表单校验
         rules: {
-          data1: [
+          title: [
             { required: true, message: "请输入计划标题", trigger: "change" },
             { required: true, message: "请输入计划标题", validator: this.spaceJudgment, trigger: "change" },
           ],
-          data3: [
+          dateRange: [
             { required: true, message: "请选择检查周期", trigger: "change" },
           ],
           checkRange: [
@@ -572,43 +602,54 @@
         //查看状态
         lookInfoType:false,
         /*===================================学院选择相关===================================*/
+        changeDeptSelectList:[],
         deptQueryParamsLeft:{
           searchValue:"",
         },
-        deptTableListLeft:[{}],
+        deptTableListLeft:[],
         deptTotalLeft:0,
         deptNumLeft:0,
         deptIdsLeft:[],
         deptQueryParamsRight:{
           pageNum:1,
           pageSize:20,
+          searchValue:"",
           deptId:"",
+          deptIds:"",
           level:"",
-          searchValue:"",
+          typeId:"",
         },
-        deptTableListRight:[{}],
+        deptTableListRight:[],
         deptTotalRight:0,
         /*===================================实验室选择相关===================================*/
         subQueryParamsLeft:{
-          classType:"",
-          classified:"",
+          pageNum:1,
+          pageSize:20,
+          typeId:"",
+          level:"",
           deptId:"",
           searchValue:"",
+          filtType:1
         },
-        subTableListLeft:[{}],
+        subTableListLeft:[],
         subTotalLeft:0,
         subNumLeft:0,
         subIdsLeft:[],
         subQueryParamsRight:{
-          classType:"",
-          classified:"",
+          pageNum:1,
+          pageSize:20,
+          typeId:"",
+          level:"",
           deptId:"",
           searchValue:"",
+          filtType:2
         },
-        subTableListRight:[{}],
+        subTableListRight:[],
         subTotalRight:0,
         subNumRight:0,
         subIdsRight:[],
+        dialogTableSubList:[],
+        dialogTableSubDataList:[],
         /*===================================人员选择相关===================================*/
         userQueryParamsLeft:{
           pageNum: 1,
@@ -641,7 +682,6 @@
     created(){
       this.$set(this,'addDialogTitle',this.addDialogData.title);
       this.$set(this,'lookInfoType',this.addDialogData.lookInfoType);
-
       if(!this.addDialogData.addType){
         //编辑
       }else{
@@ -670,13 +710,25 @@
         listDepartments().then(response => {
           this.deptSelectList = response.data;
         });
+        /**获取分级*/
+        listClassifiedAll().then(response=>{
+          if(response.code==200){
+            this.classifiedList = response.data
+          }
+        })
+        /**获取分类*/
+        listClasstypeAll().then(response=>{
+          if(response.code==200){
+            this.classTypeList = response.data;
+          }
+        });
       },
       //选中检查范围
       rangeChange(val){
         if(val == 1){
           //全校
           getAllSubNum().then(response => {
-            this.$set(this,'subCheckNum',response.data.subCount);
+            this.$set(this.dialogForm,'schoolSubCheckNum',response.data.subCount);
           })
         }
       },
@@ -690,42 +742,88 @@
       addUserButton(){
         let self = this;
         if(this.addDialogBoxType == 1){
+          this.$refs["addDialogForm"].validate(valid => {
+            if (valid) {
+              if(!this.dialogTableList[0]){
+                this.msgError('请添加至少一名巡查成员')
+                return
+              }
+              let obj = {
+                title:this.dialogForm.title,
+                checkType:this.dialogForm.checkType,
+                cycleStartTime:this.dialogForm.dateRange[0],
+                cycleEndTime:this.dialogForm.dateRange[1],
+                checkRange:this.dialogForm.checkRange,//检查范围
+                subjectNum:this.dialogForm.checkRange == 1?this.dialogForm.schoolSubCheckNum:(
+                           this.dialogForm.checkRange == 2?this.dialogForm.collegeSubNum:(
+                           this.dialogForm.checkRange == 3?this.dialogForm.subCheckNum:'')),//实验室数量
+                collegeIds:this.dialogForm.checkRange==2?this.dialogForm.collegeIds+'':'',//学院ID转换字符串
+                subIds:this.dialogForm.checkRange == 3?this.subCheckData.subIds+'':'',//实验室ID
+                checkDemand:this.dialogForm.checkDemand,//检查要求
+                uploadDtoList:this.dialogForm.uploadDtoList,//检查要求
+                checkMemberDtoList:[],//成员
+              };
+              let userList = [];
+              //过滤多余字段
+              for(let i=0;i<self.dialogTableList.length;i++){
+                let obj = {
+                  deptId: self.dialogTableList[i].deptId,
+                  deptName: self.dialogTableList[i].deptName,
+                  enable: self.dialogTableList[i].enable,
+                  jobNum: self.dialogTableList[i].jobNum,
+                  name: self.dialogTableList[i].name,
+                  userId: self.dialogTableList[i].userId,
+                  userType: self.dialogTableList[i].userType,
+                };
+                userList.push(obj);
+              }
+              obj.checkMemberDtoList = userList
+              checkPlanAdd(obj).then(response => {
 
+              })
+            }
+          })
+        }else if(this.addDialogBoxType == 2){
+          // 学院选择
+          this.$set(this.dialogForm,'collegeNum',this.deptCheckData.deptNum);
+          this.$set(this.dialogForm,'collegeSubNum',this.deptCheckData.subNum);
+          this.$set(this.dialogForm,'collegeIds',this.deptCheckData.deptIds);
+          this.dialogClickType(1);
+        }else if(this.addDialogBoxType == 3){
+          //实验室选择确定
+          let list = [];
+          let ids = [];
+          for(let o=0;o<self.dialogTableSubDataList.length;o++){
+            ids.push(self.dialogTableSubDataList[o].subId)
+            let obj = {
+              subId:self.dialogTableSubDataList[o].subId,
+              subjectName:self.dialogTableSubDataList[o].subjectName,
+              typeId:self.dialogTableSubDataList[o].typeId,
+              level:self.dialogTableSubDataList[o].level,
+              collegeName:self.dialogTableSubDataList[o].collegeName,
+            };
+            list.push(obj)
+          }
+          this.$set(this.subCheckData,'subIds',ids);
+          console.log('list',list);
+          console.log('length',list.length);
+          this.$set(this.dialogForm,'subCheckNum',list.length);
+          this.$set(this,'dialogTableSubList',list);
+          this.dialogClickType(1);
         }else if(this.addDialogBoxType == 4){
           //人员选择确定
           let list = [];
-          let newObj = {};
           for(let o=0;o<self.dialogTableDataList.length;o++){
-            let num = 0;
-            for(let i=0;i<self.dialogTableList.length;i++){
-              if(self.dialogTableList[i].userId == self.dialogTableDataList[o].userId){
-                num++
-                newObj = JSON.parse(JSON.stringify(self.dialogTableList[i]))
-              }
-            }
-            if(num == 0){
-              let obj = {
-                userId:self.dialogTableDataList[o].userId,
-                name:self.dialogTableDataList[o].name,
-                jobNum:self.dialogTableDataList[o].jobNum,
-                deptName:self.dialogTableDataList[o].deptName,
-                deptId:self.dialogTableDataList[o].deptId,
-                userType:self.dialogTableDataList[o].userType,
-                enable:1,
-              };
-              list.push(obj)
-            }else{
-              let obj = {
-                userId:self.dialogTableDataList[o].userId,
-                name:self.dialogTableDataList[o].name,
-                jobNum:self.dialogTableDataList[o].jobNum,
-                deptName:self.dialogTableDataList[o].deptName,
-                deptId:self.dialogTableDataList[o].deptId,
-                userType:self.dialogTableDataList[o].userType,
-                enable:newObj.enable,
-              };
-              list.push(obj)
-            }
+            let obj = {
+              userId:self.dialogTableDataList[o].userId,
+              name:self.dialogTableDataList[o].name,
+              jobNum:self.dialogTableDataList[o].jobNum,
+              deptName:self.dialogTableDataList[o].deptName,
+              deptId:self.dialogTableDataList[o].deptId,
+              userType:self.dialogTableDataList[o].userType,
+              enable:1,
+            };
+            list.push(obj)
           }
           this.$set(this,'dialogTableList',list);
           this.dialogClickType(1);
@@ -747,7 +845,7 @@
       dialogClickType(type,item){
         let self = this;
         if(type == 5){
-          this.$set(this,'iframeSrc',this.urlJudge(item.url));
+          this.$set(this,'iframeSrc',this.urlJudge(item.fileUrl));
           this.$set(this,'addDialogBoxType',type);
         }else if(type == 4){
           //添加成员
@@ -757,10 +855,28 @@
           this.$set(this,'addDialogBoxType',type);
         }else if(type == 2){
           //选择学院
-          this.deptResetQueryLeft();
           this.$set(this,'addDialogBoxType',type);
+          this.deptResetQueryLeft();
+          if(this.dialogForm.collegeIds[0]){
+            this.$nextTick(() => {
+              conditionCollegeInfo(self.deptQueryParamsLeft).then(response => {
+                self.$set(self,'deptTableListLeft',response.data);
+                self.$set(self,'deptTotalLeft',response.data.length);
+                for(let i=0;i<self.dialogForm.collegeIds.length;i++){
+                  for(let o=0;o<self.deptTableListLeft.length;o++){
+                    if(self.dialogForm.collegeIds[i] == self.deptTableListLeft[o].deptId){
+                      self.$refs.leftDeptTable.toggleRowSelection(self.deptTableListLeft[o]);
+                    }
+                  }
+                }
+              })
+            })
+          }
         }else if(type == 3){
           //选择实验室
+          this.$set(self,'dialogTableSubDataList',JSON.parse(JSON.stringify(this.dialogTableSubList)));
+          this.subResetQueryLeft();
+          this.subResetQueryRight();
           this.$set(this,'addDialogBoxType',type);
         }else{
           this.$set(this,'addDialogBoxType',type);
@@ -773,27 +889,27 @@
         let month = myDate.getMonth()+1;
         let day = myDate.getDate();
         let minTime = year + '-' + month + '-' + day
+        let maxTime = '';
         if(type==1){
-          let maxTime = this.getMonthFinalDay(year,month);
-          this.$set(this.dialogForm,'data3',[minTime,maxTime]);
+          maxTime = this.getMonthFinalDay(year,month);
         }else if(type==2){
           if(month>0 && month<4){
-            let maxTime = this.getMonthFinalDay(year,3);
-            this.$set(this.dialogForm,'data3',[minTime,maxTime]);
+            maxTime = this.getMonthFinalDay(year,3);
           }else if(month>3 && month<7){
-            let maxTime = this.getMonthFinalDay(year,6);
-            this.$set(this.dialogForm,'data3',[minTime,maxTime]);
+            maxTime = this.getMonthFinalDay(year,6);
           }else if(month>6 && month<10){
-            let maxTime = this.getMonthFinalDay(year,9);
-            this.$set(this.dialogForm,'data3',[minTime,maxTime]);
+            maxTime = this.getMonthFinalDay(year,9);
           }else if(month>9 && month<13){
-            let maxTime = this.getMonthFinalDay(year,12);
-            this.$set(this.dialogForm,'data3',[minTime,maxTime]);
+            maxTime = this.getMonthFinalDay(year,12);
           }
         }else if(type==3){
-          let maxTime = this.getMonthFinalDay(year,12);
-          this.$set(this.dialogForm,'data3',[minTime,maxTime]);
+          maxTime = this.getMonthFinalDay(year,12);
         }
+        let timeListA = minTime.split('-')
+        minTime = timeListA[0]+'-'+(timeListA[1]<10?'0'+timeListA[1]:timeListA[1])+'-'+(timeListA[2]<10?'0'+timeListA[1]:timeListA[2])
+        let timeListB = maxTime.split('-')
+        maxTime = timeListB[0]+'-'+(timeListB[1]<10?'0'+timeListB[1]:timeListB[1])+'-'+(timeListB[2]<10?'0'+timeListB[1]:timeListB[2])
+        this.$set(this.dialogForm,'dateRange',[minTime,maxTime]);
       },
       //返回指定月份最后一天
       getMonthFinalDay(year,month){
@@ -810,7 +926,7 @@
       },
       //删除弹窗上传文件
       delUpData(index){
-        this.dialogUpList.splice(index,1)
+        this.dialogForm.uploadDtoList.splice(index,1)
       },
       //删除弹窗列表
       delTable(row){
@@ -823,7 +939,7 @@
       },
       //快捷选中标题
       checkTitle(val){
-        this.$set(this.dialogForm,'data1',val);
+        this.$set(this.dialogForm,'title',val);
       },
       /*===================================学院选择相关===================================*/
       //重置
@@ -848,18 +964,23 @@
       //重置
       deptResetQueryRight(){
         this.$set(this,'deptQueryParamsRight',{
+          pageNum:1,
+          pageSize:20,
           searchValue:"",
+          deptId:"",
+          deptIds:"",
+          level:"",
+          typeId:"",
         });
         this.deptHandleQueryRight();
       },
       //查询接口
       deptGetListRight(){
-
-        console.log('selection',selection);
         let obj = JSON.parse(JSON.stringify(this.deptQueryParamsRight));
+        obj.deptIds = this.deptIdsLeft;
         findSubInfoByDeptIds(obj).then(response => {
-          this.userTotalLeft = response.total;
-          this.userTableListLeft = response.rows;
+          this.deptTotalRight = response.total;
+          this.deptTableListRight = response.rows;
         });
       },
       /*===================================实验室选择相关===================================*/
@@ -870,12 +991,29 @@
       },
       //重置
       subResetQueryLeft(){
-        this.$set(this,'subQueryParamsLeft',{ searchValue:"", });
+        this.$set(this,'subQueryParamsLeft',{
+          pageNum:1,
+          pageSize:20,
+          typeId:"",
+          level:"",
+          deptId:"",
+          searchValue:"",
+          filtType:1
+        });
         this.subHandleQueryLeft();
       },
       //查询接口
       subGetListLeft(){
-
+        let self = this;
+        let leftObj = JSON.parse(JSON.stringify(this.subQueryParamsLeft));
+        leftObj.selectedSubIds = [];
+        for(let i=0;i<self.dialogTableSubDataList.length;i++){
+          leftObj.selectedSubIds.push(self.dialogTableSubDataList[i].subId);
+        }
+        conditionSubjectInfo(leftObj).then(response => {
+          this.subTotalLeft = response.total;
+          this.subTableListLeft = response.rows;
+        });
       },
       //查询
       subHandleQueryRight(){
@@ -887,25 +1025,70 @@
         this.$set(this,'subQueryParamsRight',{
           pageNum:1,
           pageSize:20,
-          classType:"",
-          classified:"",
+          typeId:"",
+          level:"",
           deptId:"",
           searchValue:"",
+          filtType:2
         });
         this.subHandleQueryRight();
       },
       //查询接口
       subGetListRight(){
-
+        let self = this;
+        let rightObj = JSON.parse(JSON.stringify(this.subQueryParamsRight));
+        rightObj.subIds = [];
+        for(let i=0;i<self.dialogTableSubDataList.length;i++){
+          rightObj.subIds.push(self.dialogTableSubDataList[i].subId);
+        }
+        conditionSubjectInfo(rightObj).then(response => {
+          this.subTotalRight = response.total;
+          this.subTableListRight = response.rows;
+        });
       },
       subArrowButton(type){
+        let self = this;
         if(type == 1){
           if(this.subIdsRight[0]){
-
+            let list = JSON.parse(JSON.stringify(this.dialogTableSubDataList));
+            for(let i=0;i<self.subIdsRight.length;i++){
+              for(let s=0;s<list.length;s++){
+                if(self.subIdsRight[i] == list[s].subId){
+                  list.splice(s,1);
+                  s--
+                }
+              }
+            }
+            this.$set(this,'dialogTableSubDataList',list);
+            this.$refs.rightSubTable.clearSelection();
+            this.subGetListLeft();
+            this.subGetListRight();
+          }else{
+            this.msgError('请先勾选左侧列表')
           }
         }else if(type == 2){
           if(this.subIdsLeft[0]){
-
+            let list = JSON.parse(JSON.stringify(this.dialogTableSubDataList));
+            for(let i=0;i<self.subIdsLeft.length;i++){
+              for(let o=0;o<self.subTableListLeft.length;o++){
+                if(self.subIdsLeft[i] == self.subTableListLeft[o].subId){
+                  let obj = {
+                    subId:self.subTableListLeft[o].subId,
+                    subjectName:self.subTableListLeft[o].subjectName,
+                    typeId:self.subTableListLeft[o].typeId,
+                    level:self.subTableListLeft[o].level,
+                    collegeName:self.subTableListLeft[o].collegeName,
+                  }
+                  list.push(obj);
+                }
+              }
+            }
+            this.$set(this,'dialogTableSubDataList',list);
+            this.$refs.leftSubTable.clearSelection();
+            this.subGetListLeft();
+            this.subGetListRight();
+          }else{
+            this.msgError('请先勾选左侧列表')
           }
         }
       },
@@ -1027,7 +1210,8 @@
       /*===================================弹窗相关结束===================================*/
       /*==========上传相关==========*/
       handleAvatarSuccess(res) {
-        if(this.dialogUpList.length>9){
+        this.$set(this,'loading',false);
+        if(this.dialogForm.uploadDtoList.length>9){
           this.msgError('已到达上传数量上限')
           return
         }
@@ -1039,19 +1223,22 @@
           return
         }
         let obj ={
-          name:this.upDataName,
-          url:res.data.url,
+          fileName:this.upDataName,
+          fileUrl:res.data.url,
+          fileType:1,
+          source:1,
         };
-        this.dialogUpList.push(obj);
+        this.dialogForm.uploadDtoList.push(obj);
         this.$forceUpdate()
       },
       beforeAvatarUpload(file) {
-        console.log('file',file)
+        this.$set(this,'loading',true);
         let type = false;
         if (file.type == 'application/pdf' || file.type == 'application/msword' || file.type == 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'|| file.type == 'application/vnd.ms-excel' || file.type == 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet') {
           this.upDataName = file.name;
           type = true;
         }else{
+          this.$set(this,'loading',false);
           this.$message.error('只能上传doc/docx/xls/xlsx/pdf格式');
           type = false;
         }
@@ -1071,16 +1258,40 @@
         return row.subId
       },
       deptChange(selection){
+        let self = this;
         this.deptNumLeft = selection.length;
-        this.deptIdsLeft = selection.map(item => item.userId);
+        this.deptIdsLeft = selection.map(item => item.deptId);
+        let num = 0;
+        let list = [];
+        for(let i=0;i<self.deptIdsLeft.length;i++){
+          for(let o=0;o<self.deptTableListLeft.length;o++){
+            if(self.deptIdsLeft[i] == self.deptTableListLeft[o].deptId){
+              num = self.accAdd(num,self.deptTableListLeft[o].subNum)
+              let obj = {
+                deptId:self.deptTableListLeft[o].deptId,
+                deptName:self.deptTableListLeft[o].deptName,
+              }
+              list.push(obj)
+            }
+          }
+        }
+        this.$set(this,'changeDeptSelectList',list);
+        this.$set(this.subQueryParamsRight,'deptId','');
+        let obj = {
+          deptIds:this.deptIdsLeft,
+          deptNum:this.deptNumLeft,
+          subNum:num
+        }
+        this.$set(this,'deptCheckData',JSON.parse(JSON.stringify(obj)));
+        this.deptResetQueryRight();
       },
       subChangeLeft(selection){
         this.subNumLeft = selection.length;
-        this.subIdsLeft = selection.map(item => item.userId);
+        this.subIdsLeft = selection.map(item => item.subId);
       },
       subChangeRight(selection){
         this.subNumRight = selection.length;
-        this.subIdsRight = selection.map(item => item.userId);
+        this.subIdsRight = selection.map(item => item.subId);
       },
       userChangeLeft(selection){
         this.userNumLeft = selection.length;
@@ -1090,6 +1301,14 @@
         this.userNumRight = selection.length;
         this.userIdsRight = selection.map(item => item.userId);
       },
+      //加法
+      accAdd(arg1,arg2){
+        var r1,r2,m;
+        try{r1=arg1.toString().split(".")[1].length}catch(e){r1=0}
+        try{r2=arg2.toString().split(".")[1].length}catch(e){r2=0}
+        m=Math.pow(10,Math.max(r1,r2))
+        return ((arg1*m+arg2*m)/m).toFixed(0);
+      },
     }
   }
 </script>

+ 1 - 1
src/views/safetyCheck/snapshotManagement/infoPage.vue

@@ -64,7 +64,7 @@
           </div>
         </div>
       </div>
-      <div class="up-data-box" v-if="infoData.rectifyStatus == 0">
+      <div class="up-data-box" v-if="infoData.rectifyStatus == 0 && infoData.rectifyGentle">
         <el-form ref="addDialogForm" :model="upFormData" :rules="rules" label-width="140px">
           <el-form-item label="隐患描述:" prop="rectifyStatus">
             <el-radio-group v-model="upFormData.rectifyStatus" style="margin-top:5px;">