index.vue 56 KB

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