index.vue 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937
  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 disabled v-model="addForm.buildId" placeholder="请选择学院"
  23. @change="buildingsChange" style="width: 500px">
  24. <el-option
  25. v-for="item in buildingsSelectList"
  26. :key="item.id"
  27. :label="item.name"
  28. :value="item.id">
  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 disabled 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 } from "@/api/system/dept";
  224. import { buildFloorGetlist } from "@/api/laboratory/building";
  225. import { buildBySubList,getCheckPlanBySubId,findCheckManage,checkOptionList,
  226. checkManageUpdate,checkManageAdd,countHazardNum,getGentle } from "@/api/safetyCheck/index";
  227. export default {
  228. name: 'index',
  229. components: {
  230. lookImgDialog,
  231. },
  232. data(){
  233. return{
  234. loading:false,
  235. uploadImgUrl: this.uploadUrl(), // 上传的图片服务器地址
  236. headers: {
  237. Authorization: "Bearer " + getToken(),
  238. },
  239. //期限时间
  240. pickerOptions: {
  241. disabledDate(time) {
  242. return time.getTime() < Date.now() - 8.64e7;//如果没有后面的-8.64e7就是不可以选择今天的
  243. }
  244. },
  245. //检查组织
  246. checkTypeList:[{ key:1, label:"校院巡查", },{ key:2, label:"实验室自查", }],
  247. //学院列表
  248. deptSelectList:[],
  249. //楼栋列表
  250. buildingsSelectList:[],
  251. //实验室列表
  252. subSelectList:[],
  253. //楼栋列表
  254. options:[],
  255. addForm:{
  256. checkRange:3,
  257. id:"",
  258. subId:"",
  259. buildId:"",
  260. deptId:"",
  261. title:"",
  262. checkResult:"",
  263. rectifyNotice:"",
  264. checkType:2,
  265. dateRange:[],
  266. rectifyDeadline:"",
  267. checkHazardDtoList:[],
  268. },
  269. //检查项出现次数
  270. hazardCheckCount:0,
  271. //上传用名称保存
  272. upDataName:"",
  273. // 表单校验
  274. rules: {
  275. subId: [
  276. { required: true, message: "请选择实验室", trigger: "blur" },
  277. ],
  278. buildId: [
  279. { required: true, message: "请选择楼栋", trigger: "blur" },
  280. ],
  281. deptId: [
  282. { required: true, message: "请选择学院", trigger: "blur" },
  283. ],
  284. checkType: [
  285. { required: true, message: "请选择检查组织", trigger: "blur" },
  286. ],
  287. dateRange: [
  288. { required: true, message: "请选择计划周期", trigger: "blur" },
  289. ],
  290. title: [
  291. { required: true, message: "请输入计划标题", trigger: "blur" },
  292. { required: true, message: "请输入计划标题", validator: this.spaceJudgment, trigger: "blur" },
  293. ],
  294. id: [
  295. { required: true, message: "请选择计划", trigger: "blur" },
  296. ],
  297. checkResult: [
  298. { required: true, message: "请选择检查结果", trigger: "blur" },
  299. ],
  300. rectifyNotice: [
  301. { required: true, message: "请选择整改通知", trigger: "blur" },
  302. ],
  303. rectifyDeadline: [
  304. { required: true, message: "请选择整改期限", trigger: "blur" },
  305. ],
  306. hazardLevel: [
  307. { required: true, message: "请选择隐患等级", trigger: "blur" },
  308. ],
  309. hazardCheckPro: [
  310. { required: true, message: "请选择检查项目", trigger: "blur" },
  311. ],
  312. hazardDescribe: [
  313. { required: true, message: "请输入隐患描述", trigger: "blur" },
  314. { required: true, message: "请输入隐患描述", validator: this.spaceJudgment, trigger: "blur" },
  315. ],
  316. uploadDtoList: [
  317. { required: true, message: "请上传隐患照片", trigger: "blur" },
  318. ],
  319. },
  320. //自主输入与列表选择相关数据
  321. planList:[],
  322. planType:1,//1手动 2选择
  323. //权限范围
  324. adminGentle:false,
  325. applyGentle:false,
  326. myApplyGentle:false,
  327. }
  328. },
  329. created(){
  330. },
  331. mounted(){
  332. this.checkOptionList();
  333. this.listDepartments();
  334. this.getGentle();
  335. this.buildFloorGetlist();
  336. },
  337. methods:{
  338. //获取权限范围
  339. getGentle(){
  340. getGentle().then(response => {
  341. this.$set(this,'adminGentle',response.data.adminGentle);
  342. this.$set(this,'applyGentle',response.data.applyGentle);
  343. this.$set(this,'myApplyGentle',response.data.myApplyGentle);
  344. });
  345. },
  346. //提交按钮
  347. upDataButton(type){
  348. this.$refs["addForm"].validate(valid => {
  349. if (valid) {
  350. let startTime = Date.parse(new Date(this.addForm.dateRange[0]));
  351. let currentTime = Date.parse(new Date);
  352. if(currentTime<startTime){
  353. this.msgError('当前时间不在计划周期内')
  354. return
  355. }
  356. if(this.planType == 1){
  357. //新计划
  358. let obj = JSON.parse(JSON.stringify(this.addForm));
  359. if(obj.checkResult === 0){
  360. if(!obj.checkHazardDtoList[0]){
  361. this.msgError('请添加隐患检查项')
  362. return
  363. }
  364. for(let i=0;i<obj.checkHazardDtoList.length;i++){
  365. delete obj.checkHazardDtoList[i].lookType
  366. }
  367. obj.dangerNum = obj.checkHazardDtoList.length
  368. }else{
  369. obj.checkHazardDtoList = [];
  370. }
  371. obj.manageStatus = type
  372. obj.cycleStartTime = obj.dateRange[0]
  373. obj.cycleEndTime = obj.dateRange[1]
  374. obj.subIds = obj.subId;
  375. delete obj.subId;
  376. delete obj.dateRange
  377. checkManageAdd(obj).then(response => {
  378. this.msgSuccess(response.msg);
  379. this.initializationAddData();
  380. });
  381. }if(this.planType == 2){
  382. //已有计划修改
  383. let obj = JSON.parse(JSON.stringify(this.addForm));
  384. if(obj.checkResult === 0){
  385. if(!obj.checkHazardDtoList[0]){
  386. this.msgError('请添加隐患检查项')
  387. return
  388. }
  389. for(let i=0;i<obj.checkHazardDtoList.length;i++){
  390. delete obj.checkHazardDtoList[i].lookType
  391. }
  392. obj.dangerNum = obj.checkHazardDtoList.length
  393. }else{
  394. obj.checkHazardDtoList = [];
  395. }
  396. obj.manageStatus = type
  397. obj.cycleStartTime = obj.dateRange[0]
  398. obj.cycleEndTime = obj.dateRange[1]
  399. delete obj.dateRange
  400. checkManageUpdate(obj).then(response => {
  401. this.msgSuccess(response.msg);
  402. this.initializationAddData();
  403. });
  404. }
  405. }
  406. })
  407. },
  408. // 删除图片
  409. delImg(index,imgIndex){
  410. this.addForm.checkHazardDtoList[index].uploadDtoList.splice(imgIndex,1);
  411. },
  412. //收起/展开
  413. dataLookButton(item){
  414. item.lookType = !item.lookType
  415. },
  416. //检查结果选中
  417. checkResultChange(val){
  418. if(val == 0){
  419. //不符合时如果没有检查项则写入一条
  420. if(!this.addForm.checkHazardDtoList[0]){
  421. this.addObject();
  422. }
  423. }
  424. },
  425. //新增检查
  426. addObject(){
  427. if(this.addForm.checkHazardDtoList.length<10){
  428. let obj = {
  429. hazardCheckCode:'',
  430. hazardCheckName:'',
  431. hazardCheckPoint:'',
  432. hazardCheckPro:'',
  433. hazardDescribe:'',
  434. hazardLevel:'',
  435. lookType:true,
  436. uploadDtoList:[],
  437. };
  438. this.addForm.checkHazardDtoList.push(obj);
  439. }
  440. },
  441. //查看图片
  442. lookImg(list,index){
  443. for(let i=0;i<list.length;i++){
  444. list[i].name = list[i].fileName;
  445. list[i].url = list[i].fileUrl;
  446. }
  447. this.$refs.lookImgDialog.lookImgDialogOpen(1,list,index);
  448. },
  449. /*==========上传相关==========*/
  450. handleAvatarSuccess(res,item) {
  451. this.$set(this,'loading',false);
  452. if(item.uploadDtoList.length>4){
  453. this.msgError('最多只可上传5张')
  454. return
  455. }
  456. let suffixName= this.upDataName.split('.')[this.upDataName.split('.').length - 2]
  457. //判断文件名中是否有逗号和分号
  458. if(suffixName.indexOf(',')==-1 && suffixName.indexOf(';')==-1){
  459. }else{
  460. this.msgError('文件名里包含逗号或分号,请修改后重新上传!')
  461. return
  462. }
  463. let obj ={
  464. fileName:this.upDataName,
  465. fileUrl:res.data.url,
  466. fileType:2,
  467. source:2,
  468. };
  469. item.uploadDtoList.push(obj);
  470. this.$forceUpdate()
  471. },
  472. beforeAvatarUpload(file,item) {
  473. if(item.uploadDtoList.length>4){
  474. this.msgError('最多只可上传5张')
  475. return false
  476. }
  477. let type = false;
  478. if (file.type == 'image/png' || file.type == 'image/jpeg' || file.type == 'image/gif' || file.type == 'image/bmp') {
  479. if(file.size> 2100000){
  480. this.msgError('上传图片大小不能超过2M')
  481. return false
  482. }
  483. this.$set(this,'loading',true);
  484. this.upDataName = file.name;
  485. type = true;
  486. }else{
  487. this.msgError('仅支持jpg/png/bmp/gif格式')
  488. type = false;
  489. }
  490. return type;
  491. },
  492. //获取检查项
  493. checkOptionList(){
  494. checkOptionList().then( response => {
  495. this.$set(this,'options',response.data);
  496. this.getCascaderData(this.options);
  497. })
  498. },
  499. //联级选择器数据处理
  500. getCascaderData(list){
  501. let self = this;
  502. for(let i=0;i<list.length;i++){
  503. list[i].labelName = list[i].code? list[i].code +' '+ list[i].name:list[i].name
  504. if(list[i].level == 0 || list[i].level == 1 || list[i].level == 2){
  505. if(list[i].children){
  506. if(list[i].children[0]){
  507. self.getCascaderData(list[i].children)
  508. if(list[i].children){
  509. if(!list[i].children[0]){
  510. list.splice(i,1)
  511. i--
  512. }
  513. }else{
  514. list.splice(i,1)
  515. i--
  516. }
  517. }else{
  518. list.splice(i,1)
  519. i--
  520. }
  521. }else{
  522. list.splice(i,1)
  523. i--
  524. }
  525. }else{
  526. delete list[i].children
  527. }
  528. }
  529. },
  530. //获取学院列表
  531. listDepartments(){
  532. listDepartments().then(response => {
  533. this.deptSelectList = response.data;
  534. });
  535. },
  536. //根据学院id查询楼栋列表
  537. buildFloorGetlist(){
  538. buildFloorGetlist({type:2}).then(response => {
  539. this.buildingsSelectList = response.rows;
  540. });
  541. },
  542. //根据楼栋id查询实验室列表
  543. buildBySubList(data,type){
  544. let obj = type == 1?{buildId:data}:{searchValue:data}
  545. buildBySubList(obj).then(response => {
  546. this.subSelectList = response.data;
  547. });
  548. },
  549. //选择学院触发
  550. deptChange(val){
  551. this.$set(this.addForm,'buildId','');
  552. this.$set(this.addForm,'subId','');
  553. this.$set(this,'subSelectList',[]);
  554. this.initializationAddFormData();
  555. this.$set(this,'planType',1);
  556. this.$set(this,'planList',[]);
  557. },
  558. //选择楼栋触发
  559. buildingsChange(val){
  560. this.$set(this,'subId','');
  561. this.$set(this.addForm,'subId','');
  562. this.initializationAddFormData();
  563. this.$set(this,'planType',1);
  564. this.$set(this,'planList',[]);
  565. this.buildBySubList(val,1);
  566. },
  567. //选择实验室触发
  568. subChange(val){
  569. let self = this;
  570. for(let i=0;i<self.subSelectList.length;i++){
  571. if(self.subSelectList[i].id == val){
  572. this.$set(this.addForm,'deptId',self.subSelectList[i].deptId);
  573. this.$set(this.addForm,'buildId',self.subSelectList[i].buildId);
  574. this.getCheckPlanBySubId(val);
  575. return
  576. }
  577. }
  578. },
  579. //实验室搜索
  580. getSubList(val){
  581. this.$set(this.addForm,'deptId','');
  582. this.$set(this.addForm,'buildId','');
  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.buildBySubList(response.data.buildId,1);
  640. this.$set(this,'addForm',{
  641. id:response.data.id,
  642. checkPlanId:response.data.checkPlanId,
  643. title:response.data.title,
  644. subId:response.data.subId,
  645. buildId:response.data.buildId,
  646. checkResult:response.data.checkResult,
  647. rectifyNotice:response.data.rectifyNotice,
  648. deptId:response.data.deptId,
  649. checkType:response.data.checkType,
  650. dateRange:response.data.dateRange,
  651. rectifyDeadline:response.data.rectifyDeadline,
  652. checkHazardDtoList:response.data.checkHazardDtoList,
  653. });
  654. });
  655. },
  656. //初始化数据
  657. initializationAddFormData(){
  658. this.$set(this.addForm,'id','');
  659. this.$set(this.addForm,'checkPlanId','');
  660. this.$set(this.addForm,'title','');
  661. this.$set(this.addForm,'checkRange',3);
  662. this.$set(this.addForm,'checkType',2);
  663. this.$set(this.addForm,'dateRange',[]);
  664. this.$set(this.addForm,'checkResult','');
  665. this.$set(this.addForm,'rectifyNotice','');
  666. this.$set(this.addForm,'rectifyDeadline','');
  667. this.$set(this.addForm,'checkHazardDtoList',[]);
  668. },
  669. initializationAddData(){
  670. this.$set(this,'addForm',{
  671. checkRange:3,
  672. id:"",
  673. checkPlanId:"",
  674. subId:"",
  675. buildId:"",
  676. deptId:"",
  677. title:"",
  678. checkResult:"",
  679. rectifyNotice:"",
  680. checkType:2,
  681. dateRange:[],
  682. rectifyDeadline:"",
  683. checkHazardDtoList:[],
  684. });
  685. this.$set(this,'planType',1);
  686. this.$set(this,'planList',[]);
  687. },
  688. //删除检查项
  689. delCheckHazardDtoList(index){
  690. let self = this;
  691. this.$confirm('是否确认删除?', "警告", {
  692. confirmButtonText: "确定",
  693. cancelButtonText: "取消",
  694. type: "warning"
  695. }).then(function() {
  696. self.addForm.checkHazardDtoList.splice(index,1);
  697. }).then(() => {
  698. }).catch(() => {});
  699. },
  700. //检查项选中
  701. cascaderChange(val,index){
  702. let obj = this.getCascaderDataQuery(val,this.options);
  703. if(!obj){
  704. this.$set(this.addForm.checkHazardDtoList[index],'hazardCheckPro','');
  705. this.msgError('未找到相关项目')
  706. return
  707. }
  708. this.$set(this.addForm.checkHazardDtoList[index],'hazardCheckCode',obj.code);
  709. this.$set(this.addForm.checkHazardDtoList[index],'hazardCheckName',obj.name);
  710. this.$set(this.addForm.checkHazardDtoList[index],'hazardCheckPoint',obj.mainPoint);
  711. countHazardNum({subId:this.addForm.subId, hazardCheckPro:val}).then( response => {
  712. this.$set(this,'hazardCheckCount',response.data);
  713. })
  714. },
  715. //联级选择器数据查询
  716. getCascaderDataQuery(text,list){
  717. let self = this;
  718. for(let i=0;i<list.length;i++){
  719. if(list[i].id == text){
  720. return list[i]
  721. }else{
  722. if(list[i].children){
  723. let obj = self.getCascaderDataQuery(text,list[i].children)
  724. if(obj){
  725. return obj
  726. }
  727. }
  728. }
  729. }
  730. },
  731. }
  732. }
  733. </script>
  734. <style scoped lang="scss">
  735. .startInspection{
  736. flex: 1;
  737. display: flex !important;
  738. flex-direction: column;
  739. overflow: hidden;
  740. *{
  741. font-weight:500;
  742. }
  743. img{
  744. user-drag: none;
  745. }
  746. ::v-deep .el-range-editor--small .el-range-separator{
  747. line-height:32px;
  748. }
  749. .title-max-box{
  750. position: relative;
  751. height:90px;
  752. display: flex;
  753. border-bottom:1px solid #dedede;
  754. .title-p{
  755. flex:1;
  756. color:#0045AF;
  757. margin-left:64px;
  758. line-height:90px;
  759. font-size:16px;
  760. }
  761. .title-button{
  762. width:70px;
  763. margin:24px 31px;
  764. }
  765. .position-img{
  766. width:80px;
  767. height:80px;
  768. position: absolute;
  769. top:0;
  770. left:0;
  771. }
  772. }
  773. .content-max-box{
  774. flex:1;
  775. display: flex;
  776. flex-direction: column;
  777. .top-form-box{
  778. padding:40px 85px 20px;
  779. display: flex;
  780. .top-form-left-box{
  781. flex:1;
  782. height:310px;
  783. }
  784. .top-form-right-box{
  785. height:310px;
  786. }
  787. }
  788. .bottom-form-box{
  789. .bottom-form-title-box{
  790. background: #F5F5F5;
  791. display: flex;
  792. margin-bottom:31px;
  793. p{
  794. font-size:16px;
  795. line-height:50px;
  796. }
  797. p:nth-child(1){
  798. color:#333;
  799. margin-left:30px;
  800. flex:1;
  801. }
  802. p:nth-child(2){
  803. color:#0183FA;
  804. margin-right:37px;
  805. }
  806. }
  807. .add-bottom-button{
  808. cursor: pointer;
  809. color:#0183FA;
  810. border-radius:4px;
  811. border:1px dashed #0183FA;
  812. width:800px;
  813. line-height:40px;
  814. text-align: center;
  815. font-size:14px;
  816. margin: 20px auto;
  817. }
  818. }
  819. }
  820. .for-max-big-box{
  821. border:1px solid #dedede;
  822. overflow: hidden;
  823. margin:0 81px;
  824. .for-title-box{
  825. display: flex;
  826. background: #F5F5F5;
  827. border-bottom:1px solid #dedede;
  828. line-height:50px;
  829. .for-title-p{
  830. color:#333333;
  831. font-size:16px;
  832. margin-left: 30px;
  833. flex:1;
  834. }
  835. .for-del-box{
  836. color:#0183FA;
  837. margin-left:46px;
  838. cursor: pointer;
  839. display: flex;
  840. p{
  841. font-size:14px;
  842. line-height:50px;
  843. margin-right:8px;
  844. }
  845. }
  846. .for-button-box{
  847. color:#0183FA;
  848. margin-left:46px;
  849. margin-right:43px;
  850. cursor: pointer;
  851. display: flex;
  852. p{
  853. font-size:14px;
  854. line-height:50px;
  855. margin-right:8px;
  856. }
  857. }
  858. }
  859. .for-big-box{
  860. padding-top:27px;
  861. .up-img-p{
  862. height:80px;
  863. width:80px;
  864. line-height:80px;
  865. text-align: center;
  866. font-size:16px;
  867. border-radius:4px;
  868. border:1px dashed #E0E0E0;
  869. }
  870. .for-img-box{
  871. width:80px;
  872. height:80px;
  873. border-radius:4px;
  874. display: inline-block;
  875. overflow: hidden;
  876. margin-right:20px;
  877. position: relative;
  878. .for-img{
  879. width:80px;
  880. height:80px;
  881. display: inline-block;
  882. overflow: hidden;
  883. }
  884. .for-del-button{
  885. background: rgba(0,0,0,0.7);
  886. width:20px;
  887. height:20px;
  888. line-height: 20px;
  889. text-align: center;
  890. color:#fff;
  891. border-bottom-left-radius:4px;
  892. cursor: pointer;
  893. position: absolute;
  894. top:0;
  895. right:0;
  896. }
  897. }
  898. .hazard-check-count-p{
  899. display: inline-block;
  900. margin-left: 20px;
  901. font-size: 14px;
  902. line-height: 40px;
  903. span{
  904. color:#FF0000;
  905. }
  906. }
  907. }
  908. }
  909. .bottom-button-max-box{
  910. height:80px;
  911. display: flex;
  912. border-top:1px solid #dedede;
  913. p{
  914. margin-top:20px;
  915. }
  916. .null-p{
  917. flex:1;
  918. }
  919. p:nth-child(2){
  920. width:90px;
  921. margin-right:20px;
  922. }
  923. p:nth-child(3){
  924. width:90px;
  925. margin-right:20px;
  926. }
  927. p:nth-child(4){
  928. width:90px;
  929. margin-right:20px;
  930. }
  931. }
  932. }
  933. </style>