index.vue 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938
  1. <template>
  2. <div class="app-container startInspection" v-loading.fullscreen.lock="loading">
  3. <div class="title-max-box">
  4. <p class="title-p">开展检查</p>
  5. </div>
  6. <div class="content-max-box scrollbar-box">
  7. <el-form ref="addForm" :model="addForm" :rules="rules" label-width="82px">
  8. <div class="top-form-box">
  9. <div class="top-form-left-box">
  10. <el-form-item label="实验室" prop="subId">
  11. <el-select placeholder="搜索实验室或房间号" filterable remote reserve-keyword style="width: 500px"
  12. v-model="addForm.subId" @change="subChange" :remote-method="getSubList">
  13. <el-option
  14. v-for="item in subSelectList"
  15. :key="item.id"
  16. :label="item.name"
  17. :value="item.id">
  18. </el-option>
  19. </el-select>
  20. </el-form-item>
  21. <el-form-item label="楼栋" prop="buildId">
  22. <el-select v-model="addForm.buildId" placeholder="请选择学院"
  23. @change="buildingsChange" style="width: 500px">
  24. <el-option
  25. v-for="item in buildingsSelectList"
  26. :key="item.deptId"
  27. :label="item.deptName"
  28. :value="item.deptId">
  29. </el-option>
  30. </el-select>
  31. </el-form-item>
  32. <div style="display: flex" v-if="planType == 1">
  33. <el-form-item label="计划标题" prop="title">
  34. <el-input v-model="addForm.title" placeholder="请输入计划标题" maxLength="30" style="width: 500px"/>
  35. </el-form-item>
  36. <p class="inquire-button-one" @click="planButton(2)"
  37. style="font-size:14px;margin-left:20px;width:100px;" v-if="planList[0]">选择计划</p>
  38. </div>
  39. <div style="display: flex" v-if="planType == 2">
  40. <el-form-item label="计划" prop="id">
  41. <el-select v-model="addForm.id" placeholder="请选择计划"
  42. @change="planChange" style="width: 500px">
  43. <el-option
  44. v-for="item in planList"
  45. :key="item.id"
  46. :label="item.title"
  47. :value="item.id">
  48. </el-option>
  49. </el-select>
  50. </el-form-item>
  51. <p class="inquire-button-one" @click="planButton(1)"
  52. style="font-size:14px;margin-left:20px;width:100px;">自定义输入</p>
  53. </div>
  54. <el-form-item label="检查结果" prop="checkResult">
  55. <el-select v-model="addForm.checkResult" @change="checkResultChange" placeholder="请选择检查结果" style="width: 500px">
  56. <el-option :key="0" label="不符合" :value="0"></el-option>
  57. <el-option :key="1" label="符合" :value="1"></el-option>
  58. </el-select>
  59. </el-form-item>
  60. <el-form-item label="整改通知" prop="rectifyNotice" v-if="addForm.checkResult === 0">
  61. <el-radio-group v-model="addForm.rectifyNotice" style="margin-top:5px;">
  62. <el-radio :label="1">整改告知书</el-radio>
  63. <el-radio :label="2">整改通知书</el-radio>
  64. </el-radio-group>
  65. </el-form-item>
  66. </div>
  67. <div class="top-form-right-box">
  68. <el-form-item label="学院" prop="deptId">
  69. <el-select v-model="addForm.deptId" placeholder="请选择学院"
  70. @change="deptChange" style="width: 500px">
  71. <el-option
  72. v-for="item in deptSelectList"
  73. :key="item.deptId"
  74. :label="item.deptName"
  75. :value="item.deptId">
  76. </el-option>
  77. </el-select>
  78. </el-form-item>
  79. <el-form-item label="检查类型" prop="checkType">
  80. <el-select v-model="addForm.checkType" placeholder="请选择检查类型"
  81. disabled style="width: 500px">
  82. <el-option
  83. v-for="item in checkTypeList"
  84. :key="item.key"
  85. :label="item.label"
  86. :value="item.key">
  87. </el-option>
  88. </el-select>
  89. </el-form-item>
  90. <el-form-item label="计划周期" prop="dateRange">
  91. <el-date-picker
  92. :disabled="planType == 2"
  93. :clearable="false"
  94. v-model="addForm.dateRange"
  95. size="small"
  96. style="width: 500px"
  97. value-format="yyyy-MM-dd"
  98. type="daterange"
  99. :picker-options="pickerOptions"
  100. range-separator="至"
  101. start-placeholder="开始日期"
  102. end-placeholder="结束日期"
  103. ></el-date-picker>
  104. </el-form-item>
  105. <el-form-item label="整改期限" prop="rectifyDeadline" v-if="addForm.checkResult === 0">
  106. <el-date-picker
  107. style="width: 500px"
  108. v-model="addForm.rectifyDeadline"
  109. type="date"
  110. value-format="yyyy-MM-dd"
  111. :picker-options="pickerOptions"
  112. :clearable="false"
  113. placeholder="请选择整改期限">
  114. </el-date-picker>
  115. </el-form-item>
  116. </div>
  117. </div>
  118. <div class="bottom-form-box" v-if="addForm.checkResult === 0">
  119. <div class="bottom-form-title-box">
  120. <p>不符合项</p>
  121. <p>隐患数:{{addForm.checkHazardDtoList.length}}</p>
  122. </div>
  123. <div class="for-max-big-box" v-for="(item,index) in addForm.checkHazardDtoList" :key="index">
  124. <div class="for-title-box">
  125. <p class="for-title-p">第{{index+1}}隐患项</p>
  126. <div class="for-del-box">
  127. <p class="el-icon-delete"></p>
  128. <p @click="delCheckHazardDtoList(index)">删除此项</p>
  129. </div>
  130. <div class="for-button-box" @click="dataLookButton(item)">
  131. <p :class="item.lookType?'el-icon-arrow-up':'el-icon-arrow-down'"></p>
  132. <p>{{item.lookType?'收起':'展开'}}</p>
  133. </div>
  134. </div>
  135. <div class="for-big-box" v-if="item.lookType">
  136. <el-form-item label="隐患等级" :prop="'checkHazardDtoList.'+index+'.hazardLevel'" :rules="rules.hazardLevel" label-width="123px">
  137. <el-select v-model="item.hazardLevel" clearable placeholder="请选择隐患等级" style="width: 408px">
  138. <el-option :key="2" label="一般隐患" :value="2"></el-option>
  139. <el-option :key="1" label="重大隐患" :value="1"></el-option>
  140. <el-option :key="3" label="管理问题" :value="3"></el-option>
  141. </el-select>
  142. </el-form-item>
  143. <el-form-item label="检查项目" :prop="'checkHazardDtoList.'+index+'.hazardCheckPro'" :rules="rules.hazardCheckPro" label-width="123px">
  144. <el-cascader
  145. @change="(val)=>cascaderChange(val,index)"
  146. v-model="item.hazardCheckPro"
  147. style="width: 898px"
  148. placeholder="请选择检查项"
  149. :options="options"
  150. :props="{ checkStrictly: false, value: 'id', label: 'labelName',emitPath:false }"
  151. filterable>
  152. <template slot-scope="{data}">
  153. <el-tooltip :content="data.labelName" v-if="data.labelName.length>22">
  154. <p style="max-width:300px;overflow: hidden;text-overflow:ellipsis;white-space:nowrap;">{{data.labelName}}</p>
  155. </el-tooltip>
  156. <p v-else style="max-width:300px;overflow: hidden;text-overflow:ellipsis;white-space:nowrap;">{{data.labelName}}</p>
  157. </template>
  158. </el-cascader>
  159. <p class="hazard-check-count-p" v-if="hazardCheckCount>0">此检查项在当前实验室累计出现 <span>{{hazardCheckCount}}</span> 次隐患</p>
  160. </el-form-item>
  161. <el-form-item label="检查要点" label-width="123px">
  162. <el-input
  163. style="width: 898px"
  164. type="textarea"
  165. :autosize="{ minRows: 6, maxRows: 6}"
  166. placeholder="未查到此项检查要点,可在此输入添加"
  167. resize="none"
  168. maxlength="300"
  169. show-word-limit
  170. v-model="item.hazardCheckPoint">
  171. </el-input>
  172. </el-form-item>
  173. <el-form-item label="隐患描述" :prop="'checkHazardDtoList.'+index+'.hazardDescribe'" :rules="rules.hazardDescribe" label-width="123px">
  174. <el-input
  175. style="width: 898px"
  176. type="textarea"
  177. :autosize="{ minRows: 4, maxRows: 4}"
  178. placeholder="请输入隐患描述"
  179. resize="none"
  180. maxlength="100"
  181. show-word-limit
  182. v-model="item.hazardDescribe">
  183. </el-input>
  184. </el-form-item>
  185. <el-form-item label="隐患照片" :prop="'checkHazardDtoList.'+index+'.uploadDtoList'" :rules="rules.uploadDtoList" label-width="123px">
  186. <div class="for-img-box" v-for="(img,imgIndex) in item.uploadDtoList" :key="imgIndex">
  187. <img class="for-img" :src="img.fileUrl" @click="lookImg(item.uploadDtoList,imgIndex)">
  188. <p class="for-del-button el-icon-circle-close" @click="delImg(index,imgIndex)"></p>
  189. </div>
  190. <el-upload
  191. v-if="item.uploadDtoList.length<5"
  192. style="display: inline-block;overflow: hidden"
  193. class="avatar-uploader"
  194. :action="uploadImgUrl"
  195. :show-file-list="false"
  196. :on-success="(res)=>handleAvatarSuccess(res,item)"
  197. :headers="headers"
  198. :before-upload="(res)=>beforeAvatarUpload(res,item)">
  199. <p class="el-icon-plus up-img-p" style="display: inline-block"></p>
  200. </el-upload>
  201. </el-form-item>
  202. <el-form-item label="" label-width="123px" style="margin-bottom:40px;color:#999;">
  203. <p>支持jpg/png/bmp/gif格式,且不超过2M,最多上传5张</p>
  204. </el-form-item>
  205. </div>
  206. </div>
  207. <p class="add-bottom-button" @click="addObject">+新增隐患检查项</p>
  208. </div>
  209. </el-form>
  210. </div>
  211. <div class="bottom-button-max-box" v-hasPermi="['safety:checkManage_4:edit']">
  212. <p class="null-p"></p>
  213. <p class="add-button-two-90" @click="upDataButton(1)">保存</p>
  214. <p class="inquire-button-one" @click="upDataButton(2)">提交</p>
  215. <p class="null-p"></p>
  216. </div>
  217. <lookImgDialog ref="lookImgDialog"></lookImgDialog>
  218. </div>
  219. </template>
  220. <script>
  221. import { getToken } from "@/utils/auth";
  222. import lookImgDialog from '@/components/lookImgDialog/lookImgDialog.vue'
  223. import { listDepartments,listbuildings } from "@/api/system/dept";
  224. import { buildBySubList,getCheckPlanBySubId,findCheckManage,checkOptionList,
  225. checkManageUpdate,checkManageAdd,countHazardNum,getGentle } from "@/api/safetyCheck/index";
  226. export default {
  227. name: 'index',
  228. components: {
  229. lookImgDialog,
  230. },
  231. data(){
  232. return{
  233. loading:false,
  234. uploadImgUrl: this.uploadUrl(), // 上传的图片服务器地址
  235. headers: {
  236. Authorization: "Bearer " + getToken(),
  237. },
  238. //期限时间
  239. pickerOptions: {
  240. disabledDate(time) {
  241. return time.getTime() < Date.now() - 8.64e7;//如果没有后面的-8.64e7就是不可以选择今天的
  242. }
  243. },
  244. //检查类型
  245. checkTypeList:[{ key:1, label:"校院巡查", },{ key:2, label:"实验室自查", }],
  246. //学院列表
  247. deptSelectList:[],
  248. //楼栋列表
  249. buildingsSelectList:[],
  250. //实验室列表
  251. subSelectList:[],
  252. //楼栋列表
  253. options:[],
  254. addForm:{
  255. checkRange:3,
  256. id:"",
  257. subId:"",
  258. buildId:"",
  259. deptId:"",
  260. title:"",
  261. checkResult:"",
  262. rectifyNotice:"",
  263. checkType:2,
  264. dateRange:[],
  265. rectifyDeadline:"",
  266. checkHazardDtoList:[],
  267. },
  268. //检查项出现次数
  269. hazardCheckCount:0,
  270. //上传用名称保存
  271. upDataName:"",
  272. // 表单校验
  273. rules: {
  274. subId: [
  275. { required: true, message: "请选择实验室", trigger: "blur" },
  276. ],
  277. buildId: [
  278. { required: true, message: "请选择楼栋", trigger: "blur" },
  279. ],
  280. deptId: [
  281. { required: true, message: "请选择学院", trigger: "blur" },
  282. ],
  283. checkType: [
  284. { required: true, message: "请选择检查类型", trigger: "blur" },
  285. ],
  286. dateRange: [
  287. { required: true, message: "请选择计划周期", trigger: "blur" },
  288. ],
  289. title: [
  290. { required: true, message: "请输入计划标题", trigger: "blur" },
  291. { required: true, message: "请输入计划标题", validator: this.spaceJudgment, trigger: "blur" },
  292. ],
  293. id: [
  294. { required: true, message: "请选择计划", trigger: "blur" },
  295. ],
  296. checkResult: [
  297. { required: true, message: "请选择检查结果", trigger: "blur" },
  298. ],
  299. rectifyNotice: [
  300. { required: true, message: "请选择整改通知", trigger: "blur" },
  301. ],
  302. rectifyDeadline: [
  303. { required: true, message: "请选择整改期限", trigger: "blur" },
  304. ],
  305. hazardLevel: [
  306. { required: true, message: "请选择隐患等级", trigger: "blur" },
  307. ],
  308. hazardCheckPro: [
  309. { required: true, message: "请选择检查项目", trigger: "blur" },
  310. ],
  311. hazardDescribe: [
  312. { required: true, message: "请输入隐患描述", trigger: "blur" },
  313. { required: true, message: "请输入隐患描述", validator: this.spaceJudgment, trigger: "blur" },
  314. ],
  315. uploadDtoList: [
  316. { required: true, message: "请上传隐患照片", trigger: "blur" },
  317. ],
  318. },
  319. //自主输入与列表选择相关数据
  320. planList:[],
  321. planType:1,//1手动 2选择
  322. //权限范围
  323. adminGentle:false,
  324. applyGentle:false,
  325. myApplyGentle:false,
  326. }
  327. },
  328. created(){
  329. },
  330. mounted(){
  331. this.checkOptionList();
  332. this.listDepartments();
  333. this.getGentle();
  334. },
  335. methods:{
  336. //获取权限范围
  337. getGentle(){
  338. getGentle().then(response => {
  339. this.$set(this,'adminGentle',response.data.adminGentle);
  340. this.$set(this,'applyGentle',response.data.applyGentle);
  341. this.$set(this,'myApplyGentle',response.data.myApplyGentle);
  342. });
  343. },
  344. //提交按钮
  345. upDataButton(type){
  346. this.$refs["addForm"].validate(valid => {
  347. if (valid) {
  348. let startTime = Date.parse(new Date(this.addForm.dateRange[0]));
  349. let currentTime = Date.parse(new Date);
  350. if(currentTime<startTime){
  351. this.msgError('当前时间不在计划周期内')
  352. return
  353. }
  354. if(this.planType == 1){
  355. //新计划
  356. let obj = JSON.parse(JSON.stringify(this.addForm));
  357. if(obj.checkResult === 0){
  358. if(!obj.checkHazardDtoList[0]){
  359. this.msgError('请添加隐患检查项')
  360. return
  361. }
  362. for(let i=0;i<obj.checkHazardDtoList.length;i++){
  363. delete obj.checkHazardDtoList[i].lookType
  364. }
  365. obj.dangerNum = obj.checkHazardDtoList.length
  366. }else{
  367. obj.checkHazardDtoList = [];
  368. }
  369. obj.manageStatus = type
  370. obj.cycleStartTime = obj.dateRange[0]
  371. obj.cycleEndTime = obj.dateRange[1]
  372. obj.subIds = obj.subId;
  373. delete obj.subId;
  374. delete obj.dateRange
  375. checkManageAdd(obj).then(response => {
  376. this.msgSuccess(response.msg);
  377. this.initializationAddData();
  378. });
  379. }if(this.planType == 2){
  380. //已有计划修改
  381. let obj = JSON.parse(JSON.stringify(this.addForm));
  382. if(obj.checkResult === 0){
  383. if(!obj.checkHazardDtoList[0]){
  384. this.msgError('请添加隐患检查项')
  385. return
  386. }
  387. for(let i=0;i<obj.checkHazardDtoList.length;i++){
  388. delete obj.checkHazardDtoList[i].lookType
  389. }
  390. obj.dangerNum = obj.checkHazardDtoList.length
  391. }else{
  392. obj.checkHazardDtoList = [];
  393. }
  394. obj.manageStatus = type
  395. obj.cycleStartTime = obj.dateRange[0]
  396. obj.cycleEndTime = obj.dateRange[1]
  397. delete obj.dateRange
  398. checkManageUpdate(obj).then(response => {
  399. this.msgSuccess(response.msg);
  400. this.initializationAddData();
  401. });
  402. }
  403. }
  404. })
  405. },
  406. // 删除图片
  407. delImg(index,imgIndex){
  408. this.addForm.checkHazardDtoList[index].uploadDtoList.splice(imgIndex,1);
  409. },
  410. //收起/展开
  411. dataLookButton(item){
  412. item.lookType = !item.lookType
  413. },
  414. //检查结果选中
  415. checkResultChange(val){
  416. if(val == 0){
  417. //不符合时如果没有检查项则写入一条
  418. if(!this.addForm.checkHazardDtoList[0]){
  419. this.addObject();
  420. }
  421. }
  422. },
  423. //新增检查
  424. addObject(){
  425. if(this.addForm.checkHazardDtoList.length<10){
  426. let obj = {
  427. hazardCheckCode:'',
  428. hazardCheckName:'',
  429. hazardCheckPoint:'',
  430. hazardCheckPro:'',
  431. hazardDescribe:'',
  432. hazardLevel:'',
  433. lookType:true,
  434. uploadDtoList:[],
  435. };
  436. this.addForm.checkHazardDtoList.push(obj);
  437. }
  438. },
  439. //查看图片
  440. lookImg(list,index){
  441. for(let i=0;i<list.length;i++){
  442. list[i].name = list[i].fileName;
  443. list[i].url = list[i].fileUrl;
  444. }
  445. this.$refs.lookImgDialog.lookImgDialogOpen(1,list,index);
  446. },
  447. /*==========上传相关==========*/
  448. handleAvatarSuccess(res,item) {
  449. this.$set(this,'loading',false);
  450. if(item.uploadDtoList.length>4){
  451. this.msgError('最多只可上传5张')
  452. return
  453. }
  454. let suffixName= this.upDataName.split('.')[this.upDataName.split('.').length - 2]
  455. //判断文件名中是否有逗号和分号
  456. if(suffixName.indexOf(',')==-1 && suffixName.indexOf(';')==-1){
  457. }else{
  458. this.msgError('文件名里包含逗号或分号,请修改后重新上传!')
  459. return
  460. }
  461. let obj ={
  462. fileName:this.upDataName,
  463. fileUrl:res.data.url,
  464. fileType:2,
  465. source:2,
  466. };
  467. item.uploadDtoList.push(obj);
  468. this.$forceUpdate()
  469. },
  470. beforeAvatarUpload(file,item) {
  471. if(item.uploadDtoList.length>4){
  472. this.msgError('最多只可上传5张')
  473. return false
  474. }
  475. let type = false;
  476. if (file.type == 'image/png' || file.type == 'image/jpeg' || file.type == 'image/gif' || file.type == 'image/bmp') {
  477. if(file.size> 2100000){
  478. this.msgError('上传图片大小不能超过2M')
  479. return false
  480. }
  481. this.$set(this,'loading',true);
  482. this.upDataName = file.name;
  483. type = true;
  484. }else{
  485. this.msgError('仅支持jpg/png/bmp/gif格式')
  486. type = false;
  487. }
  488. return type;
  489. },
  490. //获取检查项
  491. checkOptionList(){
  492. checkOptionList().then( response => {
  493. this.$set(this,'options',response.data);
  494. this.getCascaderData(this.options);
  495. })
  496. },
  497. //联级选择器数据处理
  498. getCascaderData(list){
  499. let self = this;
  500. for(let i=0;i<list.length;i++){
  501. list[i].labelName = list[i].code? list[i].code +' '+ list[i].name:list[i].name
  502. if(list[i].level == 0 || list[i].level == 1 || list[i].level == 2){
  503. if(list[i].children){
  504. if(list[i].children[0]){
  505. self.getCascaderData(list[i].children)
  506. if(list[i].children){
  507. if(!list[i].children[0]){
  508. list.splice(i,1)
  509. i--
  510. }
  511. }else{
  512. list.splice(i,1)
  513. i--
  514. }
  515. }else{
  516. list.splice(i,1)
  517. i--
  518. }
  519. }else{
  520. list.splice(i,1)
  521. i--
  522. }
  523. }else{
  524. delete list[i].children
  525. }
  526. }
  527. },
  528. //获取学院列表
  529. listDepartments(){
  530. listDepartments().then(response => {
  531. this.deptSelectList = response.data;
  532. });
  533. },
  534. //根据学院id查询楼栋列表
  535. listbuildings(id){
  536. listbuildings(id).then(response => {
  537. this.buildingsSelectList = response.data;
  538. });
  539. },
  540. //根据楼栋id查询实验室列表
  541. buildBySubList(data,type){
  542. let obj = type == 1?{buildId:data}:{searchValue:data}
  543. buildBySubList(obj).then(response => {
  544. this.subSelectList = response.data;
  545. });
  546. },
  547. //选择学院触发
  548. deptChange(val){
  549. this.$set(this.addForm,'buildId','');
  550. this.$set(this.addForm,'subId','');
  551. this.$set(this,'subSelectList',[]);
  552. this.initializationAddFormData();
  553. this.$set(this,'planType',1);
  554. this.$set(this,'planList',[]);
  555. this.listbuildings(val);
  556. },
  557. //选择楼栋触发
  558. buildingsChange(val){
  559. this.$set(this,'subId','');
  560. this.initializationAddFormData();
  561. this.$set(this,'planType',1);
  562. this.$set(this,'planList',[]);
  563. this.buildBySubList(val,1);
  564. },
  565. //选择实验室触发
  566. subChange(val){
  567. let self = this;
  568. for(let i=0;i<self.subSelectList.length;i++){
  569. if(self.subSelectList[i].id == val){
  570. this.$set(this.addForm,'deptId',self.subSelectList[i].deptId);
  571. this.$set(this.addForm,'buildId',self.subSelectList[i].buildId);
  572. this.listbuildings(self.subSelectList[i].deptId);
  573. this.getCheckPlanBySubId(val);
  574. return
  575. }
  576. }
  577. },
  578. //实验室搜索
  579. getSubList(val){
  580. this.$set(this.addForm,'deptId','');
  581. this.$set(this.addForm,'buildId','');
  582. this.$set(this,'buildingsSelectList',[]);
  583. this.$set(this.addForm,'subId','');
  584. this.$set(this,'subSelectList',[]);
  585. this.initializationAddFormData();
  586. this.$set(this,'planType',1);
  587. this.$set(this,'planList',[]);
  588. this.buildBySubList(val,2);
  589. },
  590. //根据实验室ID查询计划任务
  591. getCheckPlanBySubId(id){
  592. getCheckPlanBySubId({subId:id}).then(response => {
  593. this.initializationAddFormData();
  594. let list = [];
  595. for(let i=0;i<response.data.length;i++){
  596. if(response.data[i].isSelfData == 1){
  597. list.push(response.data[i]);
  598. }
  599. }
  600. this.$set(this,'planType',list[0]?2:1);
  601. this.$set(this,'planList',list);
  602. });
  603. },
  604. //计划列表选中
  605. planChange(val){
  606. let self = this;
  607. for(let i=0;i<self.planList.length;i++){
  608. if(self.planList[i].id == val){
  609. self.findCheckManage(self.planList[i].id);
  610. return
  611. }
  612. }
  613. },
  614. //状态切换按钮
  615. planButton(type){
  616. this.initializationAddFormData();
  617. this.$set(this,'planType',type);
  618. if(type == 1){
  619. this.$set(this.addForm,'checkType',2);
  620. this.$set(this,'checkTypeList',[{
  621. key:2,
  622. label:"实验室自查",
  623. }]);
  624. }else if(type == 2){
  625. this.$set(this.addForm,'checkType',null);
  626. this.$set(this,'checkTypeList',[{ key:1, label:"校院巡查", },{ key:2, label:"实验室自查", }]);
  627. }
  628. },
  629. //查询详情
  630. findCheckManage(id){
  631. findCheckManage({id:id}).then(response => {
  632. response.data.checkResult = response.data.checkResult === 0 || response.data.checkResult === 1?response.data.checkResult:"";
  633. response.data.rectifyNotice = response.data.rectifyNotice?response.data.rectifyNotice:"";
  634. response.data.rectifyDeadline = response.data.rectifyDeadline?response.data.rectifyDeadline:"";
  635. response.data.dateRange = [response.data.cycleStartTime,response.data.cycleEndTime];
  636. for(let i=0;i<response.data.checkHazardDtoList.length;i++){
  637. response.data.checkHazardDtoList[i].lookType = true;
  638. }
  639. this.listbuildings(response.data.deptId);
  640. this.buildBySubList(response.data.buildId,1);
  641. this.$set(this,'addForm',{
  642. id:response.data.id,
  643. checkPlanId:response.data.checkPlanId,
  644. title:response.data.title,
  645. subId:response.data.subId,
  646. buildId:response.data.buildId,
  647. checkResult:response.data.checkResult,
  648. rectifyNotice:response.data.rectifyNotice,
  649. deptId:response.data.deptId,
  650. checkType:response.data.checkType,
  651. dateRange:response.data.dateRange,
  652. rectifyDeadline:response.data.rectifyDeadline,
  653. checkHazardDtoList:response.data.checkHazardDtoList,
  654. });
  655. });
  656. },
  657. //初始化数据
  658. initializationAddFormData(){
  659. this.$set(this.addForm,'id','');
  660. this.$set(this.addForm,'checkPlanId','');
  661. this.$set(this.addForm,'title','');
  662. this.$set(this.addForm,'checkRange',3);
  663. this.$set(this.addForm,'checkType',2);
  664. this.$set(this.addForm,'dateRange',[]);
  665. this.$set(this.addForm,'checkResult','');
  666. this.$set(this.addForm,'rectifyNotice','');
  667. this.$set(this.addForm,'rectifyDeadline','');
  668. this.$set(this.addForm,'checkHazardDtoList',[]);
  669. },
  670. initializationAddData(){
  671. this.$set(this,'addForm',{
  672. checkRange:3,
  673. id:"",
  674. checkPlanId:"",
  675. subId:"",
  676. buildId:"",
  677. deptId:"",
  678. title:"",
  679. checkResult:"",
  680. rectifyNotice:"",
  681. checkType:2,
  682. dateRange:[],
  683. rectifyDeadline:"",
  684. checkHazardDtoList:[],
  685. });
  686. this.$set(this,'planType',1);
  687. this.$set(this,'planList',[]);
  688. },
  689. //删除检查项
  690. delCheckHazardDtoList(index){
  691. let self = this;
  692. this.$confirm('是否确认删除?', "警告", {
  693. confirmButtonText: "确定",
  694. cancelButtonText: "取消",
  695. type: "warning"
  696. }).then(function() {
  697. self.addForm.checkHazardDtoList.splice(index,1);
  698. }).then(() => {
  699. }).catch(() => {});
  700. },
  701. //检查项选中
  702. cascaderChange(val,index){
  703. let obj = this.getCascaderDataQuery(val,this.options);
  704. if(!obj){
  705. this.$set(this.addForm.checkHazardDtoList[index],'hazardCheckPro','');
  706. this.msgError('未找到相关项目')
  707. return
  708. }
  709. this.$set(this.addForm.checkHazardDtoList[index],'hazardCheckCode',obj.code);
  710. this.$set(this.addForm.checkHazardDtoList[index],'hazardCheckName',obj.name);
  711. this.$set(this.addForm.checkHazardDtoList[index],'hazardCheckPoint',obj.mainPoint);
  712. countHazardNum({subId:this.addForm.subId, hazardCheckPro:val}).then( response => {
  713. this.$set(this,'hazardCheckCount',response.data);
  714. })
  715. },
  716. //联级选择器数据查询
  717. getCascaderDataQuery(text,list){
  718. let self = this;
  719. for(let i=0;i<list.length;i++){
  720. if(list[i].id == text){
  721. return list[i]
  722. }else{
  723. if(list[i].children){
  724. let obj = self.getCascaderDataQuery(text,list[i].children)
  725. if(obj){
  726. return obj
  727. }
  728. }
  729. }
  730. }
  731. },
  732. }
  733. }
  734. </script>
  735. <style scoped lang="scss">
  736. .startInspection{
  737. flex: 1;
  738. display: flex !important;
  739. flex-direction: column;
  740. overflow: hidden;
  741. *{
  742. font-weight:500;
  743. }
  744. img{
  745. user-drag: none;
  746. }
  747. ::v-deep .el-range-editor--small .el-range-separator{
  748. line-height:32px;
  749. }
  750. .title-max-box{
  751. position: relative;
  752. height:90px;
  753. display: flex;
  754. border-bottom:1px solid #dedede;
  755. .title-p{
  756. flex:1;
  757. color:#0045AF;
  758. margin-left:64px;
  759. line-height:90px;
  760. font-size:16px;
  761. }
  762. .title-button{
  763. width:70px;
  764. margin:24px 31px;
  765. }
  766. .position-img{
  767. width:80px;
  768. height:80px;
  769. position: absolute;
  770. top:0;
  771. left:0;
  772. }
  773. }
  774. .content-max-box{
  775. flex:1;
  776. display: flex;
  777. flex-direction: column;
  778. .top-form-box{
  779. padding:40px 85px 20px;
  780. display: flex;
  781. .top-form-left-box{
  782. flex:1;
  783. height:310px;
  784. }
  785. .top-form-right-box{
  786. height:310px;
  787. }
  788. }
  789. .bottom-form-box{
  790. .bottom-form-title-box{
  791. background: #F5F5F5;
  792. display: flex;
  793. margin-bottom:31px;
  794. p{
  795. font-size:16px;
  796. line-height:50px;
  797. }
  798. p:nth-child(1){
  799. color:#333;
  800. margin-left:30px;
  801. flex:1;
  802. }
  803. p:nth-child(2){
  804. color:#0183FA;
  805. margin-right:37px;
  806. }
  807. }
  808. .add-bottom-button{
  809. cursor: pointer;
  810. color:#0183FA;
  811. border-radius:4px;
  812. border:1px dashed #0183FA;
  813. width:800px;
  814. line-height:40px;
  815. text-align: center;
  816. font-size:14px;
  817. margin: 20px auto;
  818. }
  819. }
  820. }
  821. .for-max-big-box{
  822. border:1px solid #dedede;
  823. overflow: hidden;
  824. margin:0 81px;
  825. .for-title-box{
  826. display: flex;
  827. background: #F5F5F5;
  828. border-bottom:1px solid #dedede;
  829. line-height:50px;
  830. .for-title-p{
  831. color:#333333;
  832. font-size:16px;
  833. margin-left: 30px;
  834. flex:1;
  835. }
  836. .for-del-box{
  837. color:#0183FA;
  838. margin-left:46px;
  839. cursor: pointer;
  840. display: flex;
  841. p{
  842. font-size:14px;
  843. line-height:50px;
  844. margin-right:8px;
  845. }
  846. }
  847. .for-button-box{
  848. color:#0183FA;
  849. margin-left:46px;
  850. margin-right:43px;
  851. cursor: pointer;
  852. display: flex;
  853. p{
  854. font-size:14px;
  855. line-height:50px;
  856. margin-right:8px;
  857. }
  858. }
  859. }
  860. .for-big-box{
  861. padding-top:27px;
  862. .up-img-p{
  863. height:80px;
  864. width:80px;
  865. line-height:80px;
  866. text-align: center;
  867. font-size:16px;
  868. border-radius:4px;
  869. border:1px dashed #E0E0E0;
  870. }
  871. .for-img-box{
  872. width:80px;
  873. height:80px;
  874. border-radius:4px;
  875. display: inline-block;
  876. overflow: hidden;
  877. margin-right:20px;
  878. position: relative;
  879. .for-img{
  880. width:80px;
  881. height:80px;
  882. display: inline-block;
  883. overflow: hidden;
  884. }
  885. .for-del-button{
  886. background: rgba(0,0,0,0.7);
  887. width:20px;
  888. height:20px;
  889. line-height: 20px;
  890. text-align: center;
  891. color:#fff;
  892. border-bottom-left-radius:4px;
  893. cursor: pointer;
  894. position: absolute;
  895. top:0;
  896. right:0;
  897. }
  898. }
  899. .hazard-check-count-p{
  900. display: inline-block;
  901. margin-left: 20px;
  902. font-size: 14px;
  903. line-height: 40px;
  904. span{
  905. color:#FF0000;
  906. }
  907. }
  908. }
  909. }
  910. .bottom-button-max-box{
  911. height:80px;
  912. display: flex;
  913. border-top:1px solid #dedede;
  914. p{
  915. margin-top:20px;
  916. }
  917. .null-p{
  918. flex:1;
  919. }
  920. p:nth-child(2){
  921. width:90px;
  922. margin-right:20px;
  923. }
  924. p:nth-child(3){
  925. width:90px;
  926. margin-right:20px;
  927. }
  928. p:nth-child(4){
  929. width:90px;
  930. margin-right:20px;
  931. }
  932. }
  933. }
  934. </style>