index.vue 31 KB

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