index.vue 57 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456
  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. <el-form-item label="检查类型" prop="checkCategory" >
  40. <el-select :disabled="planType==2" v-model="addForm.checkCategory" @change="checkCategoryChange" placeholder="请选择检查类型"
  41. style="width: 500px;height: 40px;">
  42. <el-option
  43. v-for="item in inspectCategoryList"
  44. :key="item.id"
  45. :label="item.name"
  46. :value="item.id">
  47. </el-option>
  48. </el-select>
  49. </el-form-item>
  50. <div style="display: flex" v-if="planType == 2">
  51. <el-form-item label="计划" prop="id">
  52. <el-select v-model="addForm.id" placeholder="请选择计划"
  53. @change="planChange" style="width: 500px">
  54. <el-option
  55. v-for="item in planList"
  56. :key="item.id"
  57. :label="item.title"
  58. :value="item.id">
  59. </el-option>
  60. </el-select>
  61. </el-form-item>
  62. <p class="inquire-button-one" @click="planButton(1)"
  63. style="font-size:14px;margin-left:20px;width:100px;">自定义输入</p>
  64. </div>
  65. <el-form-item label="整改期限" prop="rectifyDeadline" v-if="addForm.checkResult === 0 || addForm.checkCategory==2">
  66. <el-date-picker
  67. style="width: 500px"
  68. v-model="addForm.rectifyDeadline"
  69. type="date"
  70. value-format="yyyy-MM-dd"
  71. :picker-options="pickerOptions"
  72. :clearable="false"
  73. placeholder="请选择整改期限">
  74. </el-date-picker>
  75. </el-form-item>
  76. </div>
  77. <div class="top-form-right-box">
  78. <el-form-item label="学院" prop="deptId">
  79. <el-select disabled v-model="addForm.deptId" placeholder="请选择学院"
  80. @change="deptChange" style="width: 500px">
  81. <el-option
  82. v-for="item in deptSelectList"
  83. :key="item.deptId"
  84. :label="item.deptName"
  85. :value="item.deptId">
  86. </el-option>
  87. </el-select>
  88. </el-form-item>
  89. <el-form-item label="检查组织" prop="checkType">
  90. <el-select v-model="addForm.checkType" placeholder="请选择检查组织"
  91. disabled style="width: 500px">
  92. <el-option
  93. v-for="item in checkTypeList"
  94. :key="item.key"
  95. :label="item.label"
  96. :value="item.key">
  97. </el-option>
  98. </el-select>
  99. </el-form-item>
  100. <el-form-item label="计划周期" prop="dateRange">
  101. <el-date-picker
  102. :disabled="planType == 2"
  103. :clearable="false"
  104. v-model="addForm.dateRange"
  105. size="small"
  106. style="width: 500px"
  107. value-format="yyyy-MM-dd"
  108. type="daterange"
  109. :picker-options="pickerOptions"
  110. range-separator="至"
  111. start-placeholder="开始日期"
  112. end-placeholder="结束日期"
  113. ></el-date-picker>
  114. </el-form-item>
  115. <el-form-item label="检查结果" prop="checkResult" v-if="addForm.checkCategory==1">
  116. <el-select v-model="addForm.checkResult" @change="checkResultChange" placeholder="请选择检查结果" style="width: 500px">
  117. <el-option :key="0" label="不符合" :value="0"></el-option>
  118. <el-option :key="1" label="符合" :value="1"></el-option>
  119. </el-select>
  120. </el-form-item>
  121. <el-form-item label="整改通知" prop="rectifyNotice" v-if="addForm.checkResult === 0 || addForm.checkCategory==2">
  122. <el-radio-group v-model="addForm.rectifyNotice" style="margin-top:5px;">
  123. <el-radio :label="1">整改告知书</el-radio>
  124. <el-radio :label="2">整改通知书</el-radio>
  125. </el-radio-group>
  126. </el-form-item>
  127. </div>
  128. </div>
  129. <!--综合检查-->
  130. <div class="bottom-form-box" v-if="addForm.checkResult === 0 && addForm.checkCategory==1">
  131. <div class="bottom-form-title-box">
  132. <p>不符合项</p>
  133. <p>隐患数:{{addForm.checkHazardDtoList.length}}</p>
  134. </div>
  135. <div class="for-max-big-box" v-for="(item,index) in addForm.checkHazardDtoList" :key="index">
  136. <div class="for-title-box">
  137. <p class="for-title-p">第{{index+1}}隐患项</p>
  138. <div class="for-del-box">
  139. <p class="el-icon-delete"></p>
  140. <p @click="delCheckHazardDtoList(index,'',1)">删除此项</p>
  141. </div>
  142. <div class="for-button-box" @click="dataLookButton(item)">
  143. <p :class="item.lookType?'el-icon-arrow-up':'el-icon-arrow-down'"></p>
  144. <p>{{item.lookType?'收起':'展开'}}</p>
  145. </div>
  146. </div>
  147. <div class="for-big-box" v-if="item.lookType">
  148. <el-form-item label="隐患等级" :prop="'checkHazardDtoList.'+index+'.hazardLevel'" :rules="rules.hazardLevel" label-width="123px">
  149. <el-select v-model="item.hazardLevel" clearable placeholder="请选择隐患等级" style="width: 408px">
  150. <el-option :key="2" label="一般隐患" :value="2"></el-option>
  151. <el-option :key="1" label="重大隐患" :value="1"></el-option>
  152. <el-option :key="3" label="管理问题" :value="3"></el-option>
  153. </el-select>
  154. </el-form-item>
  155. <el-form-item label="检查项目" :prop="'checkHazardDtoList.'+index+'.hazardCheckPro'" :rules="rules.hazardCheckPro" label-width="123px">
  156. <el-cascader
  157. @change="(val)=>cascaderChange(val,'',index,'')"
  158. v-model="item.hazardCheckPro"
  159. style="width: 898px"
  160. placeholder="请选择检查项"
  161. :options="options"
  162. :props="{ checkStrictly: false, value: 'id', label: 'labelName',emitPath:false }"
  163. popper-class="cascader-filterable-hazardCheckPro"
  164. filterable>
  165. <template slot-scope="{data}">
  166. <el-tooltip :content="data.labelName" v-if="data.labelName.length>22">
  167. <p style="max-width:300px;overflow: hidden;text-overflow:ellipsis;white-space:nowrap;">{{data.labelName}}</p>
  168. </el-tooltip>
  169. <p v-else style="max-width:300px;overflow: hidden;text-overflow:ellipsis;white-space:nowrap;">{{data.labelName}}</p>
  170. </template>
  171. </el-cascader>
  172. <p class="hazard-check-count-p" v-if="item.hazardCheckCount>0">此检查项在当前实验室累计出现 <span>{{item.hazardCheckCount}}</span> 次隐患</p>
  173. </el-form-item>
  174. <el-form-item label="检查要点" label-width="123px">
  175. <el-input
  176. style="width: 898px"
  177. type="textarea"
  178. :autosize="{ minRows: 6, maxRows: 6}"
  179. placeholder="未查到此项检查要点,可在此输入添加"
  180. resize="none"
  181. maxlength="300"
  182. show-word-limit
  183. v-model="item.hazardCheckPoint">
  184. </el-input>
  185. </el-form-item>
  186. <el-form-item label="隐患描述" :prop="'checkHazardDtoList.'+index+'.hazardDescribe'" :rules="rules.hazardDescribe" label-width="123px">
  187. <el-input
  188. style="width: 898px"
  189. type="textarea"
  190. :autosize="{ minRows: 4, maxRows: 4}"
  191. placeholder="请输入隐患描述"
  192. resize="none"
  193. maxlength="100"
  194. show-word-limit
  195. v-model="item.hazardDescribe">
  196. </el-input>
  197. </el-form-item>
  198. <el-form-item label="隐患照片" :prop="'checkHazardDtoList.'+index+'.uploadDtoList'" :rules="rules.uploadDtoList" label-width="123px">
  199. <div class="for-img-box" v-for="(img,imgIndex) in item.uploadDtoList" :key="imgIndex">
  200. <img class="for-img" :src="img.fileUrl" @click="lookImg(item.uploadDtoList,imgIndex)">
  201. <p class="for-del-button el-icon-circle-close" @click="delImg(index,imgIndex)"></p>
  202. </div>
  203. <el-upload
  204. v-if="item.uploadDtoList.length<5"
  205. style="display: inline-block;overflow: hidden"
  206. class="avatar-uploader"
  207. :action="uploadImgUrl"
  208. :show-file-list="false"
  209. :on-success="(res)=>handleAvatarSuccess(res,item)"
  210. :headers="headers"
  211. :before-upload="(res)=>beforeAvatarUpload(res,item)">
  212. <p class="el-icon-plus up-img-p" style="display: inline-block"></p>
  213. </el-upload>
  214. </el-form-item>
  215. <el-form-item label="" label-width="123px" style="margin-bottom:40px;color:#999;">
  216. <p>支持jpg/png/bmp/gif格式,且不超过2M,最多上传5张</p>
  217. </el-form-item>
  218. </div>
  219. </div>
  220. <p class="add-bottom-button" @click="addObject">+新增隐患检查项</p>
  221. </div>
  222. <!--专项检查-->
  223. <div class="bottom-form-box" v-if="addForm.checkCategory==2 && pageType==1">
  224. <div class="bottom-form-title-box">
  225. <p>检查项</p>
  226. <p>检查项:{{addForm.checkHazardInfoVoList.length}}</p>
  227. </div>
  228. <div class="dept-table-max-box">
  229. <div class="device-tip">请选择以下实验室内设备开始检查</div>
  230. <el-table border :data="deviceTableList" @selection-change="deviceChange" :row-key="getRowKeys" height="350">
  231. <el-table-column type="selection" width="50" :reserve-selection="true" align="center"/>
  232. <el-table-column label="名称" align="center" prop="chName" show-overflow-tooltip/>
  233. <el-table-column label="型号" align="center" prop="code" show-overflow-tooltip />
  234. <el-table-column label="类型" align="center" prop="hazardTypeModeName" show-overflow-tooltip/>
  235. </el-table>
  236. </div>
  237. <div class="start_btn" @click="handleClick('startBtn')">开始检查</div>
  238. </div>
  239. <!--专项检查项-->
  240. <div class="bottom-form-box" v-if="addForm.checkCategory==2 && pageType==2">
  241. <div class="bottom-form-title-box">
  242. <p>检查项</p>
  243. <p>检查项:{{addForm.checkHazardInfoVoList.length}}</p>
  244. </div>
  245. <div class="for-max-big-box for-max-big-box-special" v-for="(item,index) in addForm.checkHazardInfoVoList" :key="index">
  246. <div class="for-title-box">
  247. <p class="for-title-p">{{index+1}}、【{{item.hazardName}}-{{item.code}}】专项检查</p>
  248. <div class="for-del-box" v-if="planType==1">
  249. <p class="el-icon-delete"></p>
  250. <p @click="delCheckHazardDtoList(index,'',2)">删除此项</p>
  251. </div>
  252. <div class="for-button-box" @click="dataLookButton(item)">
  253. <p :class="item.lookType?'el-icon-arrow-up':'el-icon-arrow-down'"></p>
  254. <p>{{item.lookType?'收起':'展开'}}</p>
  255. </div>
  256. </div>
  257. <div class="for-big-box-special" v-if="item.lookType" v-for="(item2,index2) in item.checkHazardDtoList">
  258. <div class="for-big-box-special-l">{{index+1}}.{{index2+1}}</div>
  259. <div class="for-big-box for-big-box-special-r">
  260. <el-form-item label="检查项目" :prop="'checkHazardInfoVoList.'+index+'.checkHazardDtoList.'+index2+'.hazardCheckPro'" :rules="rules.hazardCheckPro" label-width="123px">
  261. <el-radio-group v-model="item2.checkFlag" style="margin-right: 20px;">
  262. <el-radio :label="1">符合</el-radio>
  263. <el-radio :label="0">不符合</el-radio>
  264. </el-radio-group>
  265. <el-cascader
  266. @change="(val)=>cascaderChange(val,item2,index,index2)"
  267. v-model="item2.hazardCheckPro"
  268. style="width: 730px"
  269. placeholder="请选择检查项"
  270. :options="options"
  271. :props="{ checkStrictly: false, value: 'id', label: 'labelName',emitPath:false }"
  272. popper-class="cascader-filterable-hazardCheckPro"
  273. filterable>
  274. <template slot-scope="{data}">
  275. <el-tooltip :content="data.labelName" v-if="data.labelName.length>22">
  276. <p style="max-width:300px;overflow: hidden;text-overflow:ellipsis;white-space:nowrap;">{{data.labelName}}</p>
  277. </el-tooltip>
  278. <p v-else style="max-width:300px;overflow: hidden;text-overflow:ellipsis;white-space:nowrap;">{{data.labelName}}</p>
  279. </template>
  280. </el-cascader>
  281. <i class="el-icon-delete" v-if="planType==1" @click="delCheckHazardDtoList(index,index2,3)" style="color: #0183FA;margin-left: 20px;cursor: pointer;"></i>
  282. <p class="hazard-check-count-p" v-if="item2.hazardCheckCount>0">此检查项在当前实验室累计出现 <span>{{item2.hazardCheckCount}}</span> 次隐患</p>
  283. </el-form-item>
  284. <el-form-item v-if="item2.checkFlag==0" label="隐患等级" :prop="'checkHazardInfoVoList.'+index+'.checkHazardDtoList.'+index2+'.hazardLevel'" :rules="rules.hazardLevel" label-width="123px">
  285. <el-select v-model="item2.hazardLevel" clearable placeholder="请选择隐患等级" style="width: 408px">
  286. <el-option :key="2" label="一般隐患" :value="2"></el-option>
  287. <el-option :key="1" label="重大隐患" :value="1"></el-option>
  288. <el-option :key="3" label="管理问题" :value="3"></el-option>
  289. </el-select>
  290. </el-form-item>
  291. <el-form-item v-if="item2.checkFlag==0" label="隐患描述" label-width="123px">
  292. <el-input
  293. style="width: 898px"
  294. type="textarea"
  295. :autosize="{ minRows: 4, maxRows: 4}"
  296. placeholder="请输入隐患描述"
  297. resize="none"
  298. maxlength="100"
  299. show-word-limit
  300. v-model="item2.hazardDescribe">
  301. </el-input>
  302. </el-form-item>
  303. <el-form-item v-if="item2.checkFlag==0" label="隐患照片" :prop="'checkHazardInfoVoList.'+index+'.checkHazardDtoList.'+index2+'.uploadDtoList'" :rules="rules.uploadDtoList" label-width="123px">
  304. <div class="for-img-box" v-for="(img,imgIndex) in item2.uploadDtoList" :key="imgIndex">
  305. <img class="for-img" :src="img.fileUrl" @click="lookImg(item2.uploadDtoList,imgIndex)">
  306. <p class="for-del-button el-icon-circle-close" @click="delImg(index,imgIndex)"></p>
  307. </div>
  308. <el-upload
  309. v-if="item2.uploadDtoList.length<5"
  310. style="display: inline-block;overflow: hidden"
  311. class="avatar-uploader"
  312. :action="uploadImgUrl"
  313. :show-file-list="false"
  314. :on-success="(res)=>handleAvatarSuccess(res,item2)"
  315. :headers="headers"
  316. :before-upload="(res)=>beforeAvatarUpload(res,item2)">
  317. <p class="el-icon-plus up-img-p" style="display: inline-block"></p>
  318. </el-upload>
  319. </el-form-item>
  320. <el-form-item v-if="item2.checkFlag==0" label="" label-width="123px" style="margin-bottom:40px;color:#999;">
  321. <p>支持jpg/png/bmp/gif格式,且不超过2M,最多上传5张</p>
  322. </el-form-item>
  323. </div>
  324. </div>
  325. <p class="add-bottom-button" v-if="planType == 1" @click="addObjectTow(item)">+新增隐患检查项</p>
  326. </div>
  327. <p class="add-bottom-button" v-if="planType == 1" @click="addObjectDevice()">+新增检查项</p>
  328. </div>
  329. </el-form>
  330. </div>
  331. <div class="bottom-button-max-box" v-hasPermi="['safety:checkManage_4:edit']">
  332. <p class="null-p"></p>
  333. <p class="add-button-two-90" @click="upDataButton(1)">保存</p>
  334. <p class="inquire-button-one" @click="upDataButton(2)">提交</p>
  335. <p class="null-p"></p>
  336. </div>
  337. <lookImgDialog ref="lookImgDialog"></lookImgDialog>
  338. <!--设备弹窗-->
  339. <el-dialog title="检查项" v-if="dialogVisible" :visible.sync="dialogVisible" width="730px" :append-to-body="false" :modal-append-to-body="false" :close-on-click-modal="false">
  340. <div style="margin-bottom:20px ">请选择以下实验室内设备开始检查</div>
  341. <el-table ref="deviceTable" border :data="deviceTableList" @selection-change="deviceChange" :row-key="getRowKeys" height="350">
  342. <el-table-column type="selection" width="50" :reserve-selection="true" align="center"/>
  343. <el-table-column label="名称" align="center" prop="chName" show-overflow-tooltip/>
  344. <el-table-column label="型号" align="center" prop="code" show-overflow-tooltip />
  345. <el-table-column label="类型" align="center" prop="hazardTypeModeName" show-overflow-tooltip/>
  346. </el-table>
  347. <div slot="footer" class="dialog-footer">
  348. <el-button @click="cancel">取 消</el-button>
  349. <el-button type="primary" @click="handleClick('startBtn')">确 定</el-button>
  350. </div>
  351. </el-dialog>
  352. </div>
  353. </template>
  354. <script>
  355. import { getToken } from "@/utils/auth";
  356. import lookImgDialog from '@/components/lookImgDialog/lookImgDialog.vue'
  357. import { listDepartments } from "@/api/system/dept";
  358. import { buildFloorGetlist } from "@/api/laboratory/building";
  359. import {
  360. buildBySubList,
  361. getCheckPlanBySubId,
  362. findCheckManage,
  363. checkOptionList,
  364. checkManageUpdate,
  365. checkManageAdd,
  366. countHazardNum,
  367. getGentle,
  368. getHazardInfoBySubId,
  369. getHazardInfo, getHazardInfoByJoinIds
  370. } from '@/api/safetyCheck/index'
  371. export default {
  372. name: 'index',
  373. components: {
  374. lookImgDialog,
  375. },
  376. data(){
  377. return{
  378. loading:false,
  379. uploadImgUrl: this.uploadUrl(), // 上传的图片服务器地址
  380. headers: {
  381. Authorization: "Bearer " + getToken(),
  382. },
  383. //期限时间
  384. pickerOptions: {
  385. disabledDate(time) {
  386. return time.getTime() < Date.now() - 8.64e7;//如果没有后面的-8.64e7就是不可以选择今天的
  387. }
  388. },
  389. //检查组织
  390. checkTypeList:[{ key:1, label:"校院巡查", },{ key:2, label:"实验室自查", }],
  391. //学院列表
  392. deptSelectList:[],
  393. //楼栋列表
  394. buildingsSelectList:[],
  395. //实验室列表
  396. subSelectList:[],
  397. //楼栋列表
  398. options:[],
  399. addForm:{
  400. checkRange:3,
  401. id:"",
  402. subId:"",
  403. buildId:"",
  404. deptId:"",
  405. title:"",
  406. checkResult:"",
  407. rectifyNotice:"",
  408. checkCategory:'1',
  409. checkType:2,
  410. dateRange:[],
  411. rectifyDeadline:"",
  412. //综合检查
  413. checkHazardDtoList:[],
  414. //专项检查
  415. checkHazardInfoVoList:[],
  416. },
  417. //检查项出现次数
  418. hazardCheckCount:0,
  419. //上传用名称保存
  420. upDataName:"",
  421. deviceTableList:[],
  422. //检查类型
  423. inspectCategoryList:[{id:'1',name:'综合检查'},{id:'2',name:'专项检查'}],
  424. // 表单校验
  425. rules: {
  426. subId: [
  427. { required: true, message: "请选择实验室", trigger: "blur" },
  428. ],
  429. buildId: [
  430. { required: true, message: "请选择楼栋", trigger: "blur" },
  431. ],
  432. deptId: [
  433. { required: true, message: "请选择学院", trigger: "blur" },
  434. ],
  435. checkType: [
  436. { required: true, message: "请选择检查组织", trigger: "blur" },
  437. ],
  438. checkCategory: [
  439. { required: true, message: "请选择检查类型", trigger: "blur" },
  440. ],
  441. dateRange: [
  442. { required: true, message: "请选择计划周期", trigger: "blur" },
  443. ],
  444. title: [
  445. { required: true, message: "请输入计划标题", trigger: "blur" },
  446. { required: true, message: "请输入计划标题", validator: this.spaceJudgment, trigger: "blur" },
  447. ],
  448. id: [
  449. { required: true, message: "请选择计划", trigger: "blur" },
  450. ],
  451. checkResult: [
  452. { required: true, message: "请选择检查结果", trigger: "blur" },
  453. ],
  454. rectifyNotice: [
  455. { required: true, message: "请选择整改通知", trigger: "blur" },
  456. ],
  457. rectifyDeadline: [
  458. { required: true, message: "请选择整改期限", trigger: "blur" },
  459. ],
  460. hazardLevel: [
  461. { required: true, message: "请选择隐患等级", trigger: "blur" },
  462. ],
  463. hazardCheckPro: [
  464. { required: true, message: "请选择检查项目", trigger: "blur" },
  465. ],
  466. hazardDescribe: [
  467. { required: true, message: "请输入隐患描述", trigger: "blur" },
  468. { required: true, message: "请输入隐患描述", validator: this.spaceJudgment, trigger: "blur" },
  469. ],
  470. uploadDtoList: [
  471. { required: true, message: "请上传隐患照片", trigger: "blur" },
  472. ],
  473. },
  474. //自主输入与列表选择相关数据
  475. planList:[],
  476. planType:1,//1手动 2选择
  477. //权限范围
  478. adminGentle:false,
  479. applyGentle:false,
  480. myApplyGentle:false,
  481. /* ==专项检查== */
  482. dialogVisible:false,
  483. pageType:0,
  484. multipleSelection:[],
  485. }
  486. },
  487. created(){
  488. },
  489. mounted(){
  490. this.checkOptionList();
  491. this.listDepartments();
  492. this.getGentle();
  493. this.buildFloorGetlist();
  494. },
  495. methods:{
  496. getRowKeys(row) {
  497. return row.joinHazardId
  498. },
  499. //选中设备
  500. deviceChange(val){
  501. console.log('1',val)
  502. this.multipleSelection=val
  503. },
  504. handleClick(doType){
  505. let self=this;
  506. if(doType=='startBtn'){//开始检查
  507. let joinHazardIds=[];
  508. if(this.multipleSelection[0]){
  509. this.checkOptionList();
  510. this.dialogVisible=false;
  511. for(let i=0;i<this.multipleSelection.length;i++){
  512. joinHazardIds.push(this.multipleSelection[i].joinHazardId)
  513. }
  514. this.getHazardInfoByJoinIds(this.addForm.subId,joinHazardIds.join(','))
  515. }else{
  516. this.msgError('请先选择实验室内设备!')
  517. }
  518. }
  519. },
  520. // 取消按钮
  521. cancel() {
  522. this.dialogVisible = false;
  523. },
  524. //获取权限范围
  525. getGentle(){
  526. getGentle().then(response => {
  527. this.$set(this,'adminGentle',response.data.adminGentle);
  528. this.$set(this,'applyGentle',response.data.applyGentle);
  529. this.$set(this,'myApplyGentle',response.data.myApplyGentle);
  530. });
  531. },
  532. //提交按钮
  533. upDataButton(type){
  534. this.$refs["addForm"].validate(valid => {
  535. if (valid) {
  536. let startTime = Date.parse(new Date(this.addForm.dateRange[0]));
  537. let currentTime = Date.parse(new Date);
  538. if(currentTime<startTime){
  539. this.msgError('当前时间不在计划周期内')
  540. return
  541. }
  542. if(this.planType == 1){
  543. //新计划
  544. let obj = JSON.parse(JSON.stringify(this.addForm));
  545. obj.manageStatus = type
  546. obj.cycleStartTime = obj.dateRange[0]
  547. obj.cycleEndTime = obj.dateRange[1]
  548. obj.subIds = obj.subId;
  549. delete obj.subId;
  550. delete obj.dateRange
  551. if(this.addForm.checkCategory==1){//综合检查
  552. if(obj.checkResult === 0){
  553. if(!obj.checkHazardDtoList[0]){
  554. this.msgError('请添加隐患检查项')
  555. return
  556. }
  557. for(let i=0;i<obj.checkHazardDtoList.length;i++){
  558. obj.checkHazardDtoList[i].checkCategory=this.addForm.checkCategory;
  559. delete obj.checkHazardDtoList[i].lookType
  560. }
  561. obj.dangerNum = obj.checkHazardDtoList.length
  562. }else{
  563. obj.checkHazardDtoList = [];
  564. }
  565. }else if(this.addForm.checkCategory==2){//专项检查
  566. if(!obj.checkHazardInfoVoList[0]){
  567. this.msgError('请添加隐患检查项')
  568. return
  569. }
  570. if(!obj.checkHazardInfoVoList[0].checkHazardDtoList[0]){
  571. this.msgError('请添加隐患检查项')
  572. return
  573. }
  574. let list=[]
  575. let checkFlagList=[];
  576. for(let i=0;i<this.addForm.checkHazardInfoVoList.length;i++){
  577. for(let b=0;b<this.addForm.checkHazardInfoVoList[i].checkHazardDtoList.length;b++){
  578. checkFlagList.push(this.addForm.checkHazardInfoVoList[i].checkHazardDtoList[b].checkFlag)
  579. let obj={
  580. checkFlag:this.addForm.checkHazardInfoVoList[i].checkHazardDtoList[b].checkFlag,
  581. checkCategory:this.addForm.checkCategory,
  582. hazardCheckCode:this.addForm.checkHazardInfoVoList[i].checkHazardDtoList[b].hazardCheckCode,
  583. hazardCheckName:this.addForm.checkHazardInfoVoList[i].checkHazardDtoList[b].hazardCheckName,
  584. hazardCheckPro:this.addForm.checkHazardInfoVoList[i].checkHazardDtoList[b].hazardCheckPro,
  585. hazardDescribe:this.addForm.checkHazardInfoVoList[i].checkHazardDtoList[b].hazardDescribe,
  586. hazardLevel:this.addForm.checkHazardInfoVoList[i].checkHazardDtoList[b].hazardLevel,
  587. uploadDtoList:this.addForm.checkHazardInfoVoList[i].checkHazardDtoList[b].uploadDtoList,
  588. code:this.addForm.checkHazardInfoVoList[i].code,
  589. hazardId:this.addForm.checkHazardInfoVoList[i].hazardId,
  590. hazardName:this.addForm.checkHazardInfoVoList[i].hazardName,
  591. hazardTypeMode:this.addForm.checkHazardInfoVoList[i].hazardTypeMode,
  592. hazardTypeModeName:this.addForm.checkHazardInfoVoList[i].hazardTypeModeName,
  593. joinHazardId:this.addForm.checkHazardInfoVoList[i].joinHazardId,
  594. }
  595. list.push(obj)
  596. }
  597. }
  598. if(this.multipleSelection[0]){
  599. let hazardIds=[];
  600. let joinHazardIds=[];
  601. for(let i=0;i<this.multipleSelection.length;i++){
  602. hazardIds.push(this.multipleSelection[i].hazardId)
  603. joinHazardIds.push(this.multipleSelection[i].joinHazardId)
  604. }
  605. obj.hazardIds=hazardIds.join(',')
  606. obj.joinHazardIds=joinHazardIds.join(',')
  607. }
  608. if(checkFlagList.every(item=>{return item==1})){//符合
  609. obj.checkResult=1;
  610. }else{//不符合
  611. obj.checkResult=0;
  612. }
  613. obj.checkHazardDtoList=list;
  614. }
  615. checkManageAdd(obj).then(response => {
  616. this.msgSuccess(response.msg);
  617. this.initializationAddData();
  618. });
  619. }if(this.planType == 2){
  620. //已有计划修改
  621. let obj = JSON.parse(JSON.stringify(this.addForm));
  622. obj.manageStatus = type
  623. obj.cycleStartTime = obj.dateRange[0]
  624. obj.cycleEndTime = obj.dateRange[1]
  625. delete obj.dateRange
  626. if(this.addForm.checkCategory==1){//综合检查
  627. if(obj.checkResult === 0){
  628. if(!obj.checkHazardDtoList[0]){
  629. this.msgError('请添加隐患检查项')
  630. return
  631. }
  632. for(let i=0;i<obj.checkHazardDtoList.length;i++){
  633. obj.checkHazardDtoList[i].checkCategory=this.addForm.checkCategory;
  634. delete obj.checkHazardDtoList[i].lookType
  635. }
  636. obj.dangerNum = obj.checkHazardDtoList.length
  637. }else{
  638. obj.checkHazardDtoList = [];
  639. }
  640. }else if(this.addForm.checkCategory==2){//专项检查
  641. if(!obj.checkHazardInfoVoList[0]){
  642. this.msgError('请添加隐患检查项')
  643. return
  644. }
  645. if(!obj.checkHazardInfoVoList[0].checkHazardDtoList[0]){
  646. this.msgError('请添加隐患检查项')
  647. return
  648. }
  649. let list=[]
  650. let checkFlagList=[];
  651. for(let i=0;i<this.addForm.checkHazardInfoVoList.length;i++){
  652. for(let b=0;b<this.addForm.checkHazardInfoVoList[i].checkHazardDtoList.length;b++){
  653. checkFlagList.push(this.addForm.checkHazardInfoVoList[i].checkHazardDtoList[b].checkFlag)
  654. let obj={
  655. checkFlag:this.addForm.checkHazardInfoVoList[i].checkHazardDtoList[b].checkFlag,
  656. checkCategory:this.addForm.checkCategory,
  657. hazardCheckCode:this.addForm.checkHazardInfoVoList[i].checkHazardDtoList[b].hazardCheckCode,
  658. hazardCheckName:this.addForm.checkHazardInfoVoList[i].checkHazardDtoList[b].hazardCheckName,
  659. hazardCheckPro:this.addForm.checkHazardInfoVoList[i].checkHazardDtoList[b].hazardCheckPro,
  660. hazardDescribe:this.addForm.checkHazardInfoVoList[i].checkHazardDtoList[b].hazardDescribe,
  661. hazardLevel:this.addForm.checkHazardInfoVoList[i].checkHazardDtoList[b].hazardLevel,
  662. uploadDtoList:this.addForm.checkHazardInfoVoList[i].checkHazardDtoList[b].uploadDtoList,
  663. code:this.addForm.checkHazardInfoVoList[i].code,
  664. hazardId:this.addForm.checkHazardInfoVoList[i].hazardId,
  665. hazardName:this.addForm.checkHazardInfoVoList[i].hazardName,
  666. hazardTypeMode:this.addForm.checkHazardInfoVoList[i].hazardTypeMode,
  667. hazardTypeModeName:this.addForm.checkHazardInfoVoList[i].hazardTypeModeName,
  668. joinHazardId:this.addForm.checkHazardInfoVoList[i].joinHazardId,
  669. }
  670. list.push(obj)
  671. }
  672. }
  673. if(checkFlagList.every(item=>{return item==1})){//符合
  674. obj.checkResult=1;
  675. }else{//不符合
  676. obj.checkResult=0;
  677. }
  678. obj.checkHazardDtoList=list;
  679. }
  680. checkManageUpdate(obj).then(response => {
  681. this.msgSuccess(response.msg);
  682. this.initializationAddData();
  683. });
  684. }
  685. }
  686. })
  687. },
  688. // 删除图片
  689. delImg(index,imgIndex){
  690. this.addForm.checkHazardDtoList[index].uploadDtoList.splice(imgIndex,1);
  691. },
  692. //收起/展开
  693. dataLookButton(item){
  694. item.lookType = !item.lookType
  695. },
  696. //检查结果选中
  697. checkResultChange(val){
  698. if(val == 0){
  699. //不符合时如果没有检查项则写入一条
  700. if(!this.addForm.checkHazardDtoList[0]){
  701. this.addObject();
  702. }
  703. }
  704. },
  705. //新增检查
  706. addObject(){
  707. if(this.addForm.checkHazardDtoList.length<10){
  708. let obj = {
  709. hazardCheckCode:'',
  710. hazardCheckName:'',
  711. hazardCheckPoint:'',
  712. hazardCheckPro:'',
  713. hazardDescribe:'',
  714. hazardLevel:'',
  715. lookType:true,
  716. uploadDtoList:[],
  717. };
  718. this.addForm.checkHazardDtoList.push(obj);
  719. }
  720. },
  721. //新增隐患项
  722. addObjectTow(item){
  723. if(item.checkHazardDtoList.length<10){
  724. let obj = {
  725. checkFlag:0,
  726. hazardCheckCode:'',
  727. hazardCheckName:'',
  728. hazardCheckPoint:'',
  729. hazardCheckPro:'',
  730. hazardDescribe:'',
  731. hazardLevel:'',
  732. lookType:true,
  733. uploadDtoList:[],
  734. };
  735. item.checkHazardDtoList.push(obj);
  736. }
  737. },
  738. //新增检查项
  739. addObjectDevice(item){
  740. let self=this;
  741. this.dialogVisible=true;
  742. let list=JSON.parse(JSON.stringify(self.multipleSelection))
  743. setTimeout(function(){
  744. self.$refs.deviceTable.clearSelection();
  745. if(list[0]){
  746. self.deviceTableList.forEach(row => {
  747. list.forEach(function(item) {
  748. if(row.joinHazardId==item.joinHazardId){
  749. self.$refs.deviceTable.toggleRowSelection(row,true);
  750. }
  751. })
  752. });
  753. }else{
  754. if(self.$refs.deviceTable){
  755. self.$refs.deviceTable.clearSelection();
  756. }
  757. }
  758. },100);
  759. },
  760. //查看图片
  761. lookImg(list,index){
  762. for(let i=0;i<list.length;i++){
  763. list[i].name = list[i].fileName;
  764. list[i].url = list[i].fileUrl;
  765. }
  766. this.$refs.lookImgDialog.lookImgDialogOpen(1,list,index);
  767. },
  768. /*==========上传相关==========*/
  769. handleAvatarSuccess(res,item) {
  770. this.$set(this,'loading',false);
  771. if(item.uploadDtoList.length>4){
  772. this.msgError('最多只可上传5张')
  773. return
  774. }
  775. let suffixName= this.upDataName.split('.')[this.upDataName.split('.').length - 2]
  776. //判断文件名中是否有逗号和分号
  777. if(suffixName.indexOf(',')==-1 && suffixName.indexOf(';')==-1){
  778. }else{
  779. this.msgError('文件名里包含逗号或分号,请修改后重新上传!')
  780. return
  781. }
  782. let obj ={
  783. fileName:this.upDataName,
  784. fileUrl:res.data.url,
  785. fileType:2,
  786. source:2,
  787. };
  788. item.uploadDtoList.push(obj);
  789. this.$forceUpdate()
  790. },
  791. beforeAvatarUpload(file,item) {
  792. if(item.uploadDtoList.length>4){
  793. this.msgError('最多只可上传5张')
  794. return false
  795. }
  796. let type = false;
  797. if (file.type == 'image/png' || file.type == 'image/jpeg' || file.type == 'image/gif' || file.type == 'image/bmp') {
  798. if(file.size> 2100000){
  799. this.msgError('上传图片大小不能超过2M')
  800. return false
  801. }
  802. this.$set(this,'loading',true);
  803. this.upDataName = file.name;
  804. type = true;
  805. }else{
  806. this.msgError('仅支持jpg/png/bmp/gif格式')
  807. type = false;
  808. }
  809. return type;
  810. },
  811. //获取检查项
  812. checkOptionList(){
  813. checkOptionList().then( response => {
  814. this.$set(this,'options',response.data);
  815. this.getCascaderData(this.options);
  816. })
  817. },
  818. //联级选择器数据处理
  819. getCascaderData(list){
  820. let self = this;
  821. if(this.addForm.checkCategory==1){//综合检查
  822. for(let i=0;i<list.length;i++){
  823. list[i].labelName = list[i].code? list[i].code +' '+ list[i].name:list[i].name
  824. if(list[i].level == 0 || list[i].level == 1 || list[i].level == 2){
  825. if(list[i].children){
  826. if(list[i].children[0]){
  827. self.getCascaderData(list[i].children)
  828. if(list[i].children){
  829. if(!list[i].children[0]){
  830. list.splice(i,1)
  831. i--
  832. }
  833. }else{
  834. list.splice(i,1)
  835. i--
  836. }
  837. }else{
  838. list.splice(i,1)
  839. i--
  840. }
  841. }else{
  842. list.splice(i,1)
  843. i--
  844. }
  845. }else{
  846. if(list[i].level == 3){
  847. if(list[i].children[0]){
  848. let mainPoint=[]
  849. for(let b=0;b<list[i].children.length;b++){
  850. mainPoint.push(list[i].children[b].name)
  851. list[i].mainPoint=mainPoint.join(',')
  852. }
  853. }else{
  854. list[i].mainPoint='';
  855. }
  856. }
  857. delete list[i].children
  858. }
  859. }
  860. }else if(this.addForm.checkCategory==2){//专项检查
  861. for(let i=0;i<list.length;i++){
  862. list[i].labelName = list[i].code? list[i].code +' '+ list[i].name:list[i].name
  863. if(list[i].level == 0 || list[i].level == 1 || list[i].level == 2 || list[i].level == 3){
  864. if(list[i].children){
  865. if(list[i].children[0]){
  866. self.getCascaderData(list[i].children)
  867. if(list[i].children){
  868. if(!list[i].children[0]){
  869. list.splice(i,1)
  870. i--
  871. }
  872. }else{
  873. list.splice(i,1)
  874. i--
  875. }
  876. }else{
  877. list.splice(i,1)
  878. i--
  879. }
  880. }else{
  881. list.splice(i,1)
  882. i--
  883. }
  884. }else{
  885. delete list[i].children
  886. }
  887. }
  888. }
  889. },
  890. //获取学院列表
  891. listDepartments(){
  892. listDepartments().then(response => {
  893. this.deptSelectList = response.data;
  894. });
  895. },
  896. //根据学院id查询楼栋列表
  897. buildFloorGetlist(){
  898. buildFloorGetlist({type:2}).then(response => {
  899. this.buildingsSelectList = response.rows;
  900. });
  901. },
  902. //根据楼栋id查询实验室列表
  903. buildBySubList(data,type){
  904. let obj = type == 1?{buildId:data}:{searchValue:data}
  905. buildBySubList(obj).then(response => {
  906. this.subSelectList = response.data;
  907. });
  908. },
  909. //选择学院触发
  910. deptChange(val){
  911. this.$set(this.addForm,'buildId','');
  912. this.$set(this.addForm,'subId','');
  913. this.$set(this,'subSelectList',[]);
  914. this.initializationAddFormData();
  915. this.$set(this,'planType',1);
  916. this.$set(this,'planList',[]);
  917. },
  918. //选择楼栋触发
  919. buildingsChange(val){
  920. this.$set(this,'subId','');
  921. this.$set(this.addForm,'subId','');
  922. this.initializationAddFormData();
  923. this.$set(this,'planType',1);
  924. this.$set(this,'planList',[]);
  925. this.buildBySubList(val,1);
  926. },
  927. //选择实验室触发
  928. subChange(val){
  929. let self = this;
  930. for(let i=0;i<self.subSelectList.length;i++){
  931. if(self.subSelectList[i].id == val){
  932. this.$set(this.addForm,'deptId',self.subSelectList[i].deptId);
  933. this.$set(this.addForm,'buildId',self.subSelectList[i].buildId);
  934. this.getCheckPlanBySubId(val);
  935. this.getHazardInfoBySubId(val);
  936. return
  937. }
  938. }
  939. },
  940. //实验室搜索
  941. getSubList(val){
  942. this.$set(this.addForm,'deptId','');
  943. this.$set(this.addForm,'buildId','');
  944. this.$set(this.addForm,'subId','');
  945. this.$set(this,'subSelectList',[]);
  946. this.initializationAddFormData();
  947. this.$set(this,'planType',1);
  948. this.$set(this,'planList',[]);
  949. this.buildBySubList(val,2);
  950. },
  951. //根据实验室ID查询计划任务
  952. getCheckPlanBySubId(id){
  953. getCheckPlanBySubId({subId:id}).then(response => {
  954. this.initializationAddFormData();
  955. let list = [];
  956. for(let i=0;i<response.data.length;i++){
  957. if(response.data[i].isSelfData == 1){
  958. list.push(response.data[i]);
  959. }
  960. }
  961. this.$set(this,'planType',list[0]?2:1);
  962. this.$set(this,'planList',list);
  963. });
  964. },
  965. //根据实验室ID查询实验室设备
  966. getHazardInfoBySubId(id){
  967. getHazardInfoBySubId({subId:id}).then(response => {
  968. this.deviceTableList=response.data;
  969. });
  970. },
  971. //根据设备id生成检查项
  972. getHazardInfoByJoinIds(id,joinHazardIds){
  973. getHazardInfoByJoinIds({joinHazardIds:joinHazardIds}).then(response => {
  974. if(response.data[0]){
  975. let dataList=JSON.parse(JSON.stringify(response.data))
  976. for(let i=0;i<dataList.length;i++){
  977. dataList[i].lookType=true;
  978. for(let b=0;b<dataList[i].checkHazardDtoList.length;b++){
  979. //把最外层的code填充到内层
  980. dataList[i].checkHazardDtoList[b].hazardCheckCode=dataList[i].code
  981. }
  982. //判断新旧数据是否相等,如果相等旧数据填充新数据
  983. console.log(this.addForm.checkHazardInfoVoList)
  984. if(this.addForm.checkHazardInfoVoList[0]){
  985. for(let k=0;k<this.addForm.checkHazardInfoVoList.length;k++){
  986. if(dataList[i].joinHazardId==this.addForm.checkHazardInfoVoList[k].joinHazardId){
  987. dataList[i]=this.addForm.checkHazardInfoVoList[k]
  988. }
  989. }
  990. }
  991. }
  992. this.$set(this.addForm,'checkHazardInfoVoList',dataList);
  993. this.pageType=2;
  994. }
  995. });
  996. },
  997. //专项检查选中
  998. checkCategoryChange(){
  999. console.log(this.addForm.checkCategory)
  1000. if(this.addForm.checkCategory==1){
  1001. this.pageType=0;
  1002. }else if(this.addForm.checkCategory==2){
  1003. this.pageType=1;
  1004. }
  1005. },
  1006. //计划列表选中
  1007. planChange(val){
  1008. let self = this;
  1009. for(let i=0;i<self.planList.length;i++){
  1010. if(self.planList[i].id == val){
  1011. self.findCheckManage(self.planList[i].id);
  1012. return
  1013. }
  1014. }
  1015. },
  1016. //状态切换按钮
  1017. planButton(type){
  1018. this.initializationAddFormData();
  1019. this.$set(this,'planType',type);
  1020. if(type == 1){
  1021. this.$set(this.addForm,'checkType',2);
  1022. this.$set(this,'checkTypeList',[{
  1023. key:2,
  1024. label:"实验室自查",
  1025. }]);
  1026. this.pageType=1;
  1027. this.addForm.checkHazardInfoVoList=[];
  1028. }else if(type == 2){
  1029. this.pageType=0;
  1030. this.$set(this.addForm,'checkType',null);
  1031. this.$set(this,'checkTypeList',[{ key:1, label:"校院巡查", },{ key:2, label:"实验室自查", }]);
  1032. }
  1033. },
  1034. //查询详情
  1035. findCheckManage(id){
  1036. findCheckManage({id:id}).then(response => {
  1037. if(response.data.checkCategory==1){//综合检查
  1038. response.data.checkResult = response.data.checkResult === 0 || response.data.checkResult === 1?response.data.checkResult:"";
  1039. response.data.rectifyNotice = response.data.rectifyNotice?response.data.rectifyNotice:"";
  1040. response.data.rectifyDeadline = response.data.rectifyDeadline?response.data.rectifyDeadline:"";
  1041. response.data.dateRange = [response.data.cycleStartTime,response.data.cycleEndTime];
  1042. for(let i=0;i<response.data.checkHazardDtoList.length;i++){
  1043. response.data.checkHazardDtoList[i].lookType = true;
  1044. }
  1045. }else if(response.data.checkCategory==2){//专项检查
  1046. response.data.rectifyNotice = response.data.rectifyNotice?response.data.rectifyNotice:"";
  1047. response.data.rectifyDeadline = response.data.rectifyDeadline?response.data.rectifyDeadline:"";
  1048. response.data.dateRange = [response.data.cycleStartTime,response.data.cycleEndTime];
  1049. if(response.data.checkHazardInfoVoList[0]){
  1050. response.data.checkHazardInfoVoList.forEach(function(item) {
  1051. item.lookType = true;
  1052. item.checkHazardDtoList.forEach(function(item2) {
  1053. item2.hazardCheckCode=item2.code
  1054. })
  1055. })
  1056. }
  1057. this.pageType=2
  1058. }
  1059. this.buildBySubList(response.data.buildId,1);
  1060. this.$set(this,'addForm',{
  1061. id:response.data.id,
  1062. checkPlanId:response.data.checkPlanId,
  1063. title:response.data.title,
  1064. subId:response.data.subId,
  1065. buildId:response.data.buildId,
  1066. checkResult:response.data.checkResult,
  1067. rectifyNotice:response.data.rectifyNotice,
  1068. deptId:response.data.deptId,
  1069. checkType:response.data.checkType,
  1070. checkCategory:response.data.checkCategory+'',
  1071. dateRange:response.data.dateRange,
  1072. rectifyDeadline:response.data.rectifyDeadline,
  1073. checkHazardDtoList:response.data.checkHazardDtoList,
  1074. checkHazardInfoVoList:response.data.checkHazardInfoVoList,
  1075. });
  1076. this.checkOptionList();//获取检查项
  1077. });
  1078. },
  1079. //初始化数据
  1080. initializationAddFormData(){
  1081. this.$set(this.addForm,'id','');
  1082. this.$set(this.addForm,'checkPlanId','');
  1083. this.$set(this.addForm,'title','');
  1084. this.$set(this.addForm,'checkRange',3);
  1085. this.$set(this.addForm,'checkType',2);
  1086. this.$set(this.addForm,'dateRange',[]);
  1087. this.$set(this.addForm,'checkResult','');
  1088. this.$set(this.addForm,'rectifyNotice','');
  1089. this.$set(this.addForm,'rectifyDeadline','');
  1090. this.$set(this.addForm,'checkHazardDtoList',[]);
  1091. this.$set(this.addForm,'checkHazardInfoVoList',[]);
  1092. },
  1093. initializationAddData(){
  1094. this.$set(this,'addForm',{
  1095. checkRange:3,
  1096. id:"",
  1097. checkPlanId:"",
  1098. subId:"",
  1099. buildId:"",
  1100. deptId:"",
  1101. title:"",
  1102. checkResult:"",
  1103. rectifyNotice:"",
  1104. checkType:2,
  1105. dateRange:[],
  1106. rectifyDeadline:"",
  1107. checkHazardDtoList:[],
  1108. checkHazardInfoVoList:[],
  1109. });
  1110. this.$set(this,'planType',1);
  1111. this.$set(this,'planList',[]);
  1112. },
  1113. //删除检查项
  1114. delCheckHazardDtoList(index,index2,type){//type 1综合检查 2专项检查设备项 3专项检查检查项
  1115. let self = this;
  1116. this.$confirm('是否确认删除?', "警告", {
  1117. confirmButtonText: "确定",
  1118. cancelButtonText: "取消",
  1119. type: "warning"
  1120. }).then(function() {
  1121. if(self.addForm.checkCategory==1){//综合检查
  1122. self.addForm.checkHazardDtoList.splice(index,1);
  1123. }else if(self.addForm.checkCategory==2){//专项检查
  1124. if(type==2){//检查设备
  1125. self.addForm.checkHazardInfoVoList.splice(index,1);
  1126. }else if(type==3){//检查项
  1127. self.addForm.checkHazardInfoVoList[index].checkHazardDtoList.splice(index2,1);
  1128. }
  1129. }
  1130. }).then(() => {
  1131. }).catch(() => {});
  1132. },
  1133. //检查项选中
  1134. cascaderChange(val,item,index,index2){
  1135. let obj = this.getCascaderDataQuery(val,this.options);
  1136. if(this.addForm.checkCategory==1){//综合检查
  1137. if(!obj){
  1138. this.$set(this.addForm.checkHazardDtoList[index],'hazardCheckPro','');
  1139. this.msgError('未找到相关项目')
  1140. return
  1141. }
  1142. this.$set(this.addForm.checkHazardDtoList[index],'hazardCheckCode',obj.code);
  1143. this.$set(this.addForm.checkHazardDtoList[index],'hazardCheckName',obj.name);
  1144. this.$set(this.addForm.checkHazardDtoList[index],'hazardCheckPoint',obj.mainPoint);
  1145. countHazardNum({subId:this.addForm.subId, hazardCheckPro:val}).then( response => {
  1146. this.$set(this.addForm.checkHazardDtoList[index],'hazardCheckCount',response.data);
  1147. })
  1148. }else if(this.addForm.checkCategory==2){//专项检查
  1149. if(!obj){
  1150. this.$set(this.addForm.checkHazardInfoVoList[index],'hazardCheckPro','');
  1151. this.msgError('未找到相关项目')
  1152. return
  1153. }
  1154. item.hazardCheckCode=obj.code;
  1155. item.hazardCheckName=obj.name;
  1156. countHazardNum({subId:this.addForm.subId, hazardCheckPro:val}).then( response => {
  1157. this.$set(this.addForm.checkHazardInfoVoList[index].checkHazardDtoList[index2],'hazardCheckCount',response.data);
  1158. })
  1159. }
  1160. },
  1161. /*==========专项检查==========*/
  1162. //联级选择器数据查询
  1163. getCascaderDataQuery(text,list){
  1164. let self = this;
  1165. for(let i=0;i<list.length;i++){
  1166. if(list[i].id == text){
  1167. return list[i]
  1168. }else{
  1169. if(list[i].children){
  1170. let obj = self.getCascaderDataQuery(text,list[i].children)
  1171. if(obj){
  1172. return obj
  1173. }
  1174. }
  1175. }
  1176. }
  1177. },
  1178. }
  1179. }
  1180. </script>
  1181. <style scoped lang="scss">
  1182. .startInspection{
  1183. flex: 1;
  1184. display: flex !important;
  1185. flex-direction: column;
  1186. overflow: hidden;
  1187. *{
  1188. font-weight:500;
  1189. }
  1190. img{
  1191. user-drag: none;
  1192. }
  1193. ::v-deep .el-range-editor--small .el-range-separator{
  1194. line-height:32px;
  1195. }
  1196. .dept-table-max-box{
  1197. padding: 0 20px;
  1198. box-sizing: border-box;
  1199. .device-tip{
  1200. font-size: 16px;
  1201. font-family: Microsoft YaHei-Regular, Microsoft YaHei;
  1202. font-weight: 400;
  1203. color: #333333;
  1204. line-height: 16px;
  1205. margin-bottom: 20px;
  1206. }
  1207. }
  1208. .start_btn{
  1209. cursor: pointer;
  1210. font-size: 16px;
  1211. font-family: Microsoft YaHei-Regular, Microsoft YaHei;
  1212. font-weight: 400;
  1213. color: #0183FA;
  1214. line-height: 40px;
  1215. text-align: center;
  1216. width: 500px;
  1217. height: 40px;
  1218. border-radius: 4px 4px 4px 4px;
  1219. opacity: 1;
  1220. border: 1px dotted #0183FA;
  1221. margin:40px auto;
  1222. }
  1223. .title-max-box{
  1224. position: relative;
  1225. height:90px;
  1226. display: flex;
  1227. border-bottom:1px solid #dedede;
  1228. .title-p{
  1229. flex:1;
  1230. color:#0045AF;
  1231. margin-left:64px;
  1232. line-height:90px;
  1233. font-size:16px;
  1234. }
  1235. .title-button{
  1236. width:70px;
  1237. margin:24px 31px;
  1238. }
  1239. .position-img{
  1240. width:80px;
  1241. height:80px;
  1242. position: absolute;
  1243. top:0;
  1244. left:0;
  1245. }
  1246. }
  1247. .content-max-box{
  1248. flex:1;
  1249. display: flex;
  1250. flex-direction: column;
  1251. .top-form-box{
  1252. padding:40px 85px 20px;
  1253. display: flex;
  1254. .top-form-left-box{
  1255. flex:1;
  1256. height:310px;
  1257. }
  1258. .top-form-right-box{
  1259. height:310px;
  1260. }
  1261. }
  1262. .bottom-form-box{
  1263. .bottom-form-title-box{
  1264. background: #F5F5F5;
  1265. display: flex;
  1266. margin-bottom:31px;
  1267. p{
  1268. font-size:16px;
  1269. line-height:50px;
  1270. }
  1271. p:nth-child(1){
  1272. color:#333;
  1273. margin-left:30px;
  1274. flex:1;
  1275. }
  1276. p:nth-child(2){
  1277. color:#0183FA;
  1278. margin-right:37px;
  1279. }
  1280. }
  1281. .add-bottom-button{
  1282. cursor: pointer;
  1283. color:#0183FA;
  1284. border-radius:4px;
  1285. border:1px dashed #0183FA;
  1286. width:800px;
  1287. line-height:40px;
  1288. text-align: center;
  1289. font-size:14px;
  1290. margin: 20px auto;
  1291. }
  1292. }
  1293. }
  1294. .for-max-big-box{
  1295. border:1px solid #dedede;
  1296. overflow: hidden;
  1297. margin:0 81px;
  1298. .for-title-box{
  1299. display: flex;
  1300. background: #F5F5F5;
  1301. border-bottom:1px solid #dedede;
  1302. line-height:50px;
  1303. .for-title-p{
  1304. color:#333333;
  1305. font-size:16px;
  1306. margin-left: 30px;
  1307. flex:1;
  1308. }
  1309. .for-del-box{
  1310. color:#0183FA;
  1311. margin-left:46px;
  1312. cursor: pointer;
  1313. display: flex;
  1314. p{
  1315. font-size:14px;
  1316. line-height:50px;
  1317. margin-right:8px;
  1318. }
  1319. }
  1320. .for-button-box{
  1321. color:#0183FA;
  1322. margin-left:46px;
  1323. margin-right:43px;
  1324. cursor: pointer;
  1325. display: flex;
  1326. p{
  1327. font-size:14px;
  1328. line-height:50px;
  1329. margin-right:8px;
  1330. }
  1331. }
  1332. }
  1333. .for-big-box{
  1334. padding-top:27px;
  1335. .up-img-p{
  1336. height:80px;
  1337. width:80px;
  1338. line-height:80px;
  1339. text-align: center;
  1340. font-size:16px;
  1341. border-radius:4px;
  1342. border:1px dashed #E0E0E0;
  1343. }
  1344. .for-img-box{
  1345. width:80px;
  1346. height:80px;
  1347. border-radius:4px;
  1348. display: inline-block;
  1349. overflow: hidden;
  1350. margin-right:20px;
  1351. position: relative;
  1352. .for-img{
  1353. width:80px;
  1354. height:80px;
  1355. display: inline-block;
  1356. overflow: hidden;
  1357. }
  1358. .for-del-button{
  1359. background: rgba(0,0,0,0.7);
  1360. width:20px;
  1361. height:20px;
  1362. line-height: 20px;
  1363. text-align: center;
  1364. color:#fff;
  1365. border-bottom-left-radius:4px;
  1366. cursor: pointer;
  1367. position: absolute;
  1368. top:0;
  1369. right:0;
  1370. }
  1371. }
  1372. .hazard-check-count-p{
  1373. display: inline-block;
  1374. margin-left: 20px;
  1375. font-size: 14px;
  1376. line-height: 40px;
  1377. span{
  1378. color:#FF0000;
  1379. }
  1380. }
  1381. }
  1382. }
  1383. /*专项检查*/
  1384. .for-max-big-box-special{
  1385. margin-bottom: 20px;
  1386. .for-big-box-special{
  1387. border-bottom: 1px dotted #D8D8D8;
  1388. margin:30px;
  1389. display: flex;
  1390. justify-content: flex-start;
  1391. .for-big-box-special-l{
  1392. width: 30px;
  1393. height: 30px;
  1394. background: #0183FA;
  1395. border-radius: 6px 6px 6px 6px;
  1396. font-size: 16px;
  1397. font-family: Microsoft YaHei-Regular, Microsoft YaHei;
  1398. font-weight: 400;
  1399. color: #FFFFFF;
  1400. line-height: 30px;
  1401. text-align: center;
  1402. }
  1403. .for-big-box-special-r{}
  1404. }
  1405. .for-big-box-special:last-of-type{
  1406. border-bottom: none;
  1407. }
  1408. }
  1409. .bottom-button-max-box{
  1410. height:80px;
  1411. display: flex;
  1412. border-top:1px solid #dedede;
  1413. p{
  1414. margin-top:20px;
  1415. }
  1416. .null-p{
  1417. flex:1;
  1418. }
  1419. p:nth-child(2){
  1420. width:90px;
  1421. margin-right:20px;
  1422. }
  1423. p:nth-child(3){
  1424. width:90px;
  1425. margin-right:20px;
  1426. }
  1427. p:nth-child(4){
  1428. width:90px;
  1429. margin-right:20px;
  1430. }
  1431. }
  1432. }
  1433. </style>