index.vue 55 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412
  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.hazardName}}】专项检查</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. let list=[]
  569. let checkFlagList=[];
  570. for(let i=0;i<this.addForm.checkHazardInfoVoList.length;i++){
  571. for(let b=0;b<this.addForm.checkHazardInfoVoList[i].checkHazardDtoList.length;b++){
  572. checkFlagList.push(this.addForm.checkHazardInfoVoList[i].checkHazardDtoList[b].checkFlag)
  573. let obj={
  574. checkFlag:this.addForm.checkHazardInfoVoList[i].checkHazardDtoList[b].checkFlag,
  575. checkCategory:this.addForm.checkHazardInfoVoList[i].checkHazardDtoList[b].checkCategory,
  576. hazardCheckCode:this.addForm.checkHazardInfoVoList[i].checkHazardDtoList[b].hazardCheckCode,
  577. hazardCheckName:this.addForm.checkHazardInfoVoList[i].checkHazardDtoList[b].hazardCheckName,
  578. hazardCheckPro:this.addForm.checkHazardInfoVoList[i].checkHazardDtoList[b].hazardCheckPro,
  579. hazardDescribe:this.addForm.checkHazardInfoVoList[i].checkHazardDtoList[b].hazardDescribe,
  580. hazardLevel:this.addForm.checkHazardInfoVoList[i].checkHazardDtoList[b].hazardLevel,
  581. uploadDtoList:this.addForm.checkHazardInfoVoList[i].checkHazardDtoList[b].uploadDtoList,
  582. code:this.addForm.checkHazardInfoVoList[i].code,
  583. hazardId:this.addForm.checkHazardInfoVoList[i].hazardId,
  584. hazardName:this.addForm.checkHazardInfoVoList[i].hazardName,
  585. hazardTypeMode:this.addForm.checkHazardInfoVoList[i].hazardTypeMode,
  586. hazardTypeModeName:this.addForm.checkHazardInfoVoList[i].hazardTypeModeName,
  587. joinHazardId:this.addForm.checkHazardInfoVoList[i].joinHazardId,
  588. }
  589. list.push(obj)
  590. }
  591. }
  592. if(this.multipleSelection[0]){
  593. obj.hazardIds=this.multipleSelection.join(',')
  594. }
  595. if(checkFlagList.every(item=>{return item==1})){//符合
  596. obj.checkResult=1;
  597. }else{//不符合
  598. obj.checkResult=0;
  599. }
  600. obj.checkHazardDtoList=list;
  601. }
  602. checkManageAdd(obj).then(response => {
  603. this.msgSuccess(response.msg);
  604. this.initializationAddData();
  605. });
  606. }if(this.planType == 2){
  607. //已有计划修改
  608. let obj = JSON.parse(JSON.stringify(this.addForm));
  609. obj.manageStatus = type
  610. obj.cycleStartTime = obj.dateRange[0]
  611. obj.cycleEndTime = obj.dateRange[1]
  612. delete obj.dateRange
  613. if(this.addForm.checkCategory==1){//综合检查
  614. if(obj.checkResult === 0){
  615. if(!obj.checkHazardDtoList[0]){
  616. this.msgError('请添加隐患检查项')
  617. return
  618. }
  619. for(let i=0;i<obj.checkHazardDtoList.length;i++){
  620. obj.checkHazardDtoList[i].checkCategory=this.addForm.checkCategory;
  621. delete obj.checkHazardDtoList[i].lookType
  622. }
  623. obj.dangerNum = obj.checkHazardDtoList.length
  624. }else{
  625. obj.checkHazardDtoList = [];
  626. }
  627. }else if(this.addForm.checkCategory==2){//专项检查
  628. if(!obj.checkHazardInfoVoList[0]){
  629. this.msgError('请添加隐患检查项')
  630. return
  631. }
  632. let list=[]
  633. let checkFlagList=[];
  634. for(let i=0;i<this.addForm.checkHazardInfoVoList.length;i++){
  635. for(let b=0;b<this.addForm.checkHazardInfoVoList[i].checkHazardDtoList.length;b++){
  636. checkFlagList.push(this.addForm.checkHazardInfoVoList[i].checkHazardDtoList[b].checkFlag)
  637. let obj={
  638. checkFlag:this.addForm.checkHazardInfoVoList[i].checkHazardDtoList[b].checkFlag,
  639. checkCategory:this.addForm.checkHazardInfoVoList[i].checkHazardDtoList[b].checkCategory,
  640. hazardCheckCode:this.addForm.checkHazardInfoVoList[i].checkHazardDtoList[b].hazardCheckCode,
  641. hazardCheckName:this.addForm.checkHazardInfoVoList[i].checkHazardDtoList[b].hazardCheckName,
  642. hazardCheckPro:this.addForm.checkHazardInfoVoList[i].checkHazardDtoList[b].hazardCheckPro,
  643. hazardDescribe:this.addForm.checkHazardInfoVoList[i].checkHazardDtoList[b].hazardDescribe,
  644. hazardLevel:this.addForm.checkHazardInfoVoList[i].checkHazardDtoList[b].hazardLevel,
  645. uploadDtoList:this.addForm.checkHazardInfoVoList[i].checkHazardDtoList[b].uploadDtoList,
  646. code:this.addForm.checkHazardInfoVoList[i].code,
  647. hazardId:this.addForm.checkHazardInfoVoList[i].hazardId,
  648. hazardName:this.addForm.checkHazardInfoVoList[i].hazardName,
  649. hazardTypeMode:this.addForm.checkHazardInfoVoList[i].hazardTypeMode,
  650. hazardTypeModeName:this.addForm.checkHazardInfoVoList[i].hazardTypeModeName,
  651. joinHazardId:this.addForm.checkHazardInfoVoList[i].joinHazardId,
  652. }
  653. list.push(obj)
  654. }
  655. }
  656. if(checkFlagList.every(item=>{return item==1})){//符合
  657. obj.checkResult=1;
  658. }else{//不符合
  659. obj.checkResult=0;
  660. }
  661. obj.checkHazardDtoList=list;
  662. }
  663. checkManageUpdate(obj).then(response => {
  664. this.msgSuccess(response.msg);
  665. this.initializationAddData();
  666. });
  667. }
  668. }
  669. })
  670. },
  671. // 删除图片
  672. delImg(index,imgIndex){
  673. this.addForm.checkHazardDtoList[index].uploadDtoList.splice(imgIndex,1);
  674. },
  675. //收起/展开
  676. dataLookButton(item){
  677. item.lookType = !item.lookType
  678. },
  679. //检查结果选中
  680. checkResultChange(val){
  681. if(val == 0){
  682. //不符合时如果没有检查项则写入一条
  683. if(!this.addForm.checkHazardDtoList[0]){
  684. this.addObject();
  685. }
  686. }
  687. },
  688. //新增检查
  689. addObject(){
  690. if(this.addForm.checkHazardDtoList.length<10){
  691. let obj = {
  692. hazardCheckCode:'',
  693. hazardCheckName:'',
  694. hazardCheckPoint:'',
  695. hazardCheckPro:'',
  696. hazardDescribe:'',
  697. hazardLevel:'',
  698. lookType:true,
  699. uploadDtoList:[],
  700. };
  701. this.addForm.checkHazardDtoList.push(obj);
  702. }
  703. },
  704. //新增隐患项
  705. addObjectTow(item){
  706. if(item.checkHazardDtoList.length<10){
  707. let obj = {
  708. checkFlag:0,
  709. hazardCheckCode:'',
  710. hazardCheckName:'',
  711. hazardCheckPoint:'',
  712. hazardCheckPro:'',
  713. hazardDescribe:'',
  714. hazardLevel:'',
  715. lookType:true,
  716. uploadDtoList:[],
  717. };
  718. item.checkHazardDtoList.push(obj);
  719. }
  720. },
  721. //新增检查项
  722. addObjectDevice(item){
  723. let self=this;
  724. this.dialogVisible=true;
  725. let list=JSON.parse(JSON.stringify(self.multipleSelection))
  726. setTimeout(function(){
  727. self.$refs.deviceTable.clearSelection();
  728. if(list[0]){
  729. self.deviceTableList.forEach(row => {
  730. list.forEach(function(item) {
  731. if(row.id==item){
  732. self.$refs.deviceTable.toggleRowSelection(row,true);
  733. }
  734. })
  735. });
  736. }else{
  737. if(self.$refs.deviceTable){
  738. self.$refs.deviceTable.clearSelection();
  739. }
  740. }
  741. },100);
  742. },
  743. //查看图片
  744. lookImg(list,index){
  745. for(let i=0;i<list.length;i++){
  746. list[i].name = list[i].fileName;
  747. list[i].url = list[i].fileUrl;
  748. }
  749. this.$refs.lookImgDialog.lookImgDialogOpen(1,list,index);
  750. },
  751. /*==========上传相关==========*/
  752. handleAvatarSuccess(res,item) {
  753. this.$set(this,'loading',false);
  754. if(item.uploadDtoList.length>4){
  755. this.msgError('最多只可上传5张')
  756. return
  757. }
  758. let suffixName= this.upDataName.split('.')[this.upDataName.split('.').length - 2]
  759. //判断文件名中是否有逗号和分号
  760. if(suffixName.indexOf(',')==-1 && suffixName.indexOf(';')==-1){
  761. }else{
  762. this.msgError('文件名里包含逗号或分号,请修改后重新上传!')
  763. return
  764. }
  765. let obj ={
  766. fileName:this.upDataName,
  767. fileUrl:res.data.url,
  768. fileType:2,
  769. source:2,
  770. };
  771. item.uploadDtoList.push(obj);
  772. this.$forceUpdate()
  773. },
  774. beforeAvatarUpload(file,item) {
  775. if(item.uploadDtoList.length>4){
  776. this.msgError('最多只可上传5张')
  777. return false
  778. }
  779. let type = false;
  780. if (file.type == 'image/png' || file.type == 'image/jpeg' || file.type == 'image/gif' || file.type == 'image/bmp') {
  781. if(file.size> 2100000){
  782. this.msgError('上传图片大小不能超过2M')
  783. return false
  784. }
  785. this.$set(this,'loading',true);
  786. this.upDataName = file.name;
  787. type = true;
  788. }else{
  789. this.msgError('仅支持jpg/png/bmp/gif格式')
  790. type = false;
  791. }
  792. return type;
  793. },
  794. //获取检查项
  795. checkOptionList(){
  796. checkOptionList().then( response => {
  797. this.$set(this,'options',response.data);
  798. this.getCascaderData(this.options);
  799. })
  800. },
  801. //联级选择器数据处理
  802. getCascaderData(list){
  803. let self = this;
  804. if(this.addForm.checkCategory==1){//综合检查
  805. for(let i=0;i<list.length;i++){
  806. list[i].labelName = list[i].code? list[i].code +' '+ list[i].name:list[i].name
  807. if(list[i].level == 0 || list[i].level == 1 || list[i].level == 2){
  808. if(list[i].children){
  809. if(list[i].children[0]){
  810. self.getCascaderData(list[i].children)
  811. if(list[i].children){
  812. if(!list[i].children[0]){
  813. list.splice(i,1)
  814. i--
  815. }
  816. }else{
  817. list.splice(i,1)
  818. i--
  819. }
  820. }else{
  821. list.splice(i,1)
  822. i--
  823. }
  824. }else{
  825. list.splice(i,1)
  826. i--
  827. }
  828. }else{
  829. delete list[i].children
  830. }
  831. }
  832. }else if(this.addForm.checkCategory==2){//专项检查
  833. for(let i=0;i<list.length;i++){
  834. list[i].labelName = list[i].code? list[i].code +' '+ list[i].name:list[i].name
  835. if(list[i].level == 0 || list[i].level == 1 || list[i].level == 2 || list[i].level == 3){
  836. if(list[i].children){
  837. if(list[i].children[0]){
  838. self.getCascaderData(list[i].children)
  839. if(list[i].children){
  840. if(!list[i].children[0]){
  841. list.splice(i,1)
  842. i--
  843. }
  844. }else{
  845. list.splice(i,1)
  846. i--
  847. }
  848. }else{
  849. list.splice(i,1)
  850. i--
  851. }
  852. }else{
  853. list.splice(i,1)
  854. i--
  855. }
  856. }else{
  857. delete list[i].children
  858. }
  859. }
  860. }
  861. },
  862. //获取学院列表
  863. listDepartments(){
  864. listDepartments().then(response => {
  865. this.deptSelectList = response.data;
  866. });
  867. },
  868. //根据学院id查询楼栋列表
  869. buildFloorGetlist(){
  870. buildFloorGetlist({type:2}).then(response => {
  871. this.buildingsSelectList = response.rows;
  872. });
  873. },
  874. //根据楼栋id查询实验室列表
  875. buildBySubList(data,type){
  876. let obj = type == 1?{buildId:data}:{searchValue:data}
  877. buildBySubList(obj).then(response => {
  878. this.subSelectList = response.data;
  879. });
  880. },
  881. //选择学院触发
  882. deptChange(val){
  883. this.$set(this.addForm,'buildId','');
  884. this.$set(this.addForm,'subId','');
  885. this.$set(this,'subSelectList',[]);
  886. this.initializationAddFormData();
  887. this.$set(this,'planType',1);
  888. this.$set(this,'planList',[]);
  889. },
  890. //选择楼栋触发
  891. buildingsChange(val){
  892. this.$set(this,'subId','');
  893. this.$set(this.addForm,'subId','');
  894. this.initializationAddFormData();
  895. this.$set(this,'planType',1);
  896. this.$set(this,'planList',[]);
  897. this.buildBySubList(val,1);
  898. },
  899. //选择实验室触发
  900. subChange(val){
  901. let self = this;
  902. for(let i=0;i<self.subSelectList.length;i++){
  903. if(self.subSelectList[i].id == val){
  904. this.$set(this.addForm,'deptId',self.subSelectList[i].deptId);
  905. this.$set(this.addForm,'buildId',self.subSelectList[i].buildId);
  906. this.getCheckPlanBySubId(val);
  907. this.getHazardListBySub(val);
  908. return
  909. }
  910. }
  911. },
  912. //实验室搜索
  913. getSubList(val){
  914. this.$set(this.addForm,'deptId','');
  915. this.$set(this.addForm,'buildId','');
  916. this.$set(this.addForm,'subId','');
  917. this.$set(this,'subSelectList',[]);
  918. this.initializationAddFormData();
  919. this.$set(this,'planType',1);
  920. this.$set(this,'planList',[]);
  921. this.buildBySubList(val,2);
  922. },
  923. //根据实验室ID查询计划任务
  924. getCheckPlanBySubId(id){
  925. getCheckPlanBySubId({subId:id}).then(response => {
  926. this.initializationAddFormData();
  927. let list = [];
  928. for(let i=0;i<response.data.length;i++){
  929. if(response.data[i].isSelfData == 1){
  930. list.push(response.data[i]);
  931. }
  932. }
  933. this.$set(this,'planType',list[0]?2:1);
  934. this.$set(this,'planList',list);
  935. });
  936. },
  937. //根据实验室ID查询实验室设备
  938. getHazardListBySub(id){
  939. getHazardListBySub({subId:id}).then(response => {
  940. this.deviceTableList=response.data;
  941. });
  942. },
  943. //根据设备id生成检查项
  944. getHazardInfo(id,hazardIds){
  945. getHazardInfo({subId:id,hazardIds:hazardIds}).then(response => {
  946. if(response.data[0]){
  947. response.data.forEach(function(item) {
  948. item.lookType=true;
  949. item.checkHazardDtoList.forEach(function(item2) {
  950. item2.hazardCheckCode=item2.code
  951. })
  952. })
  953. }
  954. this.addForm.checkHazardInfoVoList=response.data
  955. });
  956. },
  957. //专项检查选中
  958. checkCategoryChange(){
  959. console.log(this.addForm.checkCategory)
  960. if(this.addForm.checkCategory==1){
  961. this.pageType=0;
  962. }else if(this.addForm.checkCategory==2){
  963. this.pageType=1;
  964. }
  965. },
  966. //计划列表选中
  967. planChange(val){
  968. let self = this;
  969. for(let i=0;i<self.planList.length;i++){
  970. if(self.planList[i].id == val){
  971. self.findCheckManage(self.planList[i].id);
  972. return
  973. }
  974. }
  975. },
  976. //状态切换按钮
  977. planButton(type){
  978. this.initializationAddFormData();
  979. this.$set(this,'planType',type);
  980. if(type == 1){
  981. this.$set(this.addForm,'checkType',2);
  982. this.$set(this,'checkTypeList',[{
  983. key:2,
  984. label:"实验室自查",
  985. }]);
  986. this.pageType=1;
  987. this.addForm.checkHazardInfoVoList=[];
  988. }else if(type == 2){
  989. this.pageType=0;
  990. this.$set(this.addForm,'checkType',null);
  991. this.$set(this,'checkTypeList',[{ key:1, label:"校院巡查", },{ key:2, label:"实验室自查", }]);
  992. }
  993. },
  994. //查询详情
  995. findCheckManage(id){
  996. findCheckManage({id:id}).then(response => {
  997. if(response.data.checkCategory==1){//综合检查
  998. response.data.checkResult = response.data.checkResult === 0 || response.data.checkResult === 1?response.data.checkResult:"";
  999. response.data.rectifyNotice = response.data.rectifyNotice?response.data.rectifyNotice:"";
  1000. response.data.rectifyDeadline = response.data.rectifyDeadline?response.data.rectifyDeadline:"";
  1001. response.data.dateRange = [response.data.cycleStartTime,response.data.cycleEndTime];
  1002. for(let i=0;i<response.data.checkHazardDtoList.length;i++){
  1003. response.data.checkHazardDtoList[i].lookType = true;
  1004. }
  1005. }else if(response.data.checkCategory==2){//专项检查
  1006. response.data.rectifyNotice = response.data.rectifyNotice?response.data.rectifyNotice:"";
  1007. response.data.rectifyDeadline = response.data.rectifyDeadline?response.data.rectifyDeadline:"";
  1008. response.data.dateRange = [response.data.cycleStartTime,response.data.cycleEndTime];
  1009. if(response.data.checkHazardInfoVoList[0]){
  1010. response.data.checkHazardInfoVoList.forEach(function(item) {
  1011. item.lookType = true;
  1012. item.checkHazardDtoList.forEach(function(item2) {
  1013. item2.hazardCheckCode=item2.code
  1014. })
  1015. })
  1016. }
  1017. this.pageType=2
  1018. }
  1019. this.buildBySubList(response.data.buildId,1);
  1020. this.$set(this,'addForm',{
  1021. id:response.data.id,
  1022. checkPlanId:response.data.checkPlanId,
  1023. title:response.data.title,
  1024. subId:response.data.subId,
  1025. buildId:response.data.buildId,
  1026. checkResult:response.data.checkResult,
  1027. rectifyNotice:response.data.rectifyNotice,
  1028. deptId:response.data.deptId,
  1029. checkType:response.data.checkType,
  1030. checkCategory:response.data.checkCategory+'',
  1031. dateRange:response.data.dateRange,
  1032. rectifyDeadline:response.data.rectifyDeadline,
  1033. checkHazardDtoList:response.data.checkHazardDtoList,
  1034. checkHazardInfoVoList:response.data.checkHazardInfoVoList,
  1035. });
  1036. this.checkOptionList();//获取检查项
  1037. });
  1038. },
  1039. //初始化数据
  1040. initializationAddFormData(){
  1041. this.$set(this.addForm,'id','');
  1042. this.$set(this.addForm,'checkPlanId','');
  1043. this.$set(this.addForm,'title','');
  1044. this.$set(this.addForm,'checkRange',3);
  1045. this.$set(this.addForm,'checkType',2);
  1046. this.$set(this.addForm,'dateRange',[]);
  1047. this.$set(this.addForm,'checkResult','');
  1048. this.$set(this.addForm,'rectifyNotice','');
  1049. this.$set(this.addForm,'rectifyDeadline','');
  1050. this.$set(this.addForm,'checkHazardDtoList',[]);
  1051. },
  1052. initializationAddData(){
  1053. this.$set(this,'addForm',{
  1054. checkRange:3,
  1055. id:"",
  1056. checkPlanId:"",
  1057. subId:"",
  1058. buildId:"",
  1059. deptId:"",
  1060. title:"",
  1061. checkResult:"",
  1062. rectifyNotice:"",
  1063. checkType:2,
  1064. dateRange:[],
  1065. rectifyDeadline:"",
  1066. checkHazardDtoList:[],
  1067. });
  1068. this.$set(this,'planType',1);
  1069. this.$set(this,'planList',[]);
  1070. },
  1071. //删除检查项
  1072. delCheckHazardDtoList(index,index2){
  1073. let self = this;
  1074. this.$confirm('是否确认删除?', "警告", {
  1075. confirmButtonText: "确定",
  1076. cancelButtonText: "取消",
  1077. type: "warning"
  1078. }).then(function() {
  1079. if(self.addForm.checkCategory==1){//综合检查
  1080. self.addForm.checkHazardDtoList.splice(index,1);
  1081. }else if(self.addForm.checkCategory==2){//专项检查
  1082. if(index2>=0){//小检查项
  1083. self.addForm.checkHazardInfoVoList[index].checkHazardDtoList.splice(index2,1);
  1084. }else{//检查设备
  1085. self.addForm.checkHazardInfoVoList.splice(index,1);
  1086. }
  1087. }
  1088. }).then(() => {
  1089. }).catch(() => {});
  1090. },
  1091. //检查项选中
  1092. cascaderChange(val,item,index){
  1093. let obj = this.getCascaderDataQuery(val,this.options);
  1094. if(this.addForm.checkCategory==1){//综合检查
  1095. if(!obj){
  1096. this.$set(this.addForm.checkHazardDtoList[index],'hazardCheckPro','');
  1097. this.msgError('未找到相关项目')
  1098. return
  1099. }
  1100. this.$set(this.addForm.checkHazardDtoList[index],'hazardCheckCode',obj.code);
  1101. this.$set(this.addForm.checkHazardDtoList[index],'hazardCheckName',obj.name);
  1102. this.$set(this.addForm.checkHazardDtoList[index],'hazardCheckPoint',obj.mainPoint);
  1103. countHazardNum({subId:this.addForm.subId, hazardCheckPro:val}).then( response => {
  1104. this.$set(this,'hazardCheckCount',response.data);
  1105. })
  1106. }else if(this.addForm.checkCategory==2){//专项检查
  1107. if(!obj){
  1108. this.$set(this.addForm.checkHazardInfoVoList[index],'hazardCheckPro','');
  1109. this.msgError('未找到相关项目')
  1110. return
  1111. }
  1112. console.log(obj)
  1113. item.hazardCheckCode=obj.code;
  1114. item.hazardCheckName=obj.name;
  1115. countHazardNum({subId:this.addForm.subId, hazardCheckPro:val}).then( response => {
  1116. this.$set(this,'hazardCheckCount',response.data);
  1117. })
  1118. }
  1119. },
  1120. /*==========专项检查==========*/
  1121. //联级选择器数据查询
  1122. getCascaderDataQuery(text,list){
  1123. let self = this;
  1124. for(let i=0;i<list.length;i++){
  1125. if(list[i].id == text){
  1126. return list[i]
  1127. }else{
  1128. if(list[i].children){
  1129. let obj = self.getCascaderDataQuery(text,list[i].children)
  1130. if(obj){
  1131. return obj
  1132. }
  1133. }
  1134. }
  1135. }
  1136. },
  1137. }
  1138. }
  1139. </script>
  1140. <style scoped lang="scss">
  1141. .startInspection{
  1142. flex: 1;
  1143. display: flex !important;
  1144. flex-direction: column;
  1145. overflow: hidden;
  1146. *{
  1147. font-weight:500;
  1148. }
  1149. img{
  1150. user-drag: none;
  1151. }
  1152. ::v-deep .el-range-editor--small .el-range-separator{
  1153. line-height:32px;
  1154. }
  1155. .dept-table-max-box{
  1156. padding: 0 20px;
  1157. box-sizing: border-box;
  1158. .device-tip{
  1159. font-size: 16px;
  1160. font-family: Microsoft YaHei-Regular, Microsoft YaHei;
  1161. font-weight: 400;
  1162. color: #333333;
  1163. line-height: 16px;
  1164. margin-bottom: 20px;
  1165. }
  1166. }
  1167. .start_btn{
  1168. font-size: 16px;
  1169. font-family: Microsoft YaHei-Regular, Microsoft YaHei;
  1170. font-weight: 400;
  1171. color: #0183FA;
  1172. line-height: 40px;
  1173. text-align: center;
  1174. width: 500px;
  1175. height: 40px;
  1176. border-radius: 4px 4px 4px 4px;
  1177. opacity: 1;
  1178. border: 1px dotted #0183FA;
  1179. margin:40px auto;
  1180. }
  1181. .title-max-box{
  1182. position: relative;
  1183. height:90px;
  1184. display: flex;
  1185. border-bottom:1px solid #dedede;
  1186. .title-p{
  1187. flex:1;
  1188. color:#0045AF;
  1189. margin-left:64px;
  1190. line-height:90px;
  1191. font-size:16px;
  1192. }
  1193. .title-button{
  1194. width:70px;
  1195. margin:24px 31px;
  1196. }
  1197. .position-img{
  1198. width:80px;
  1199. height:80px;
  1200. position: absolute;
  1201. top:0;
  1202. left:0;
  1203. }
  1204. }
  1205. .content-max-box{
  1206. flex:1;
  1207. display: flex;
  1208. flex-direction: column;
  1209. .top-form-box{
  1210. padding:40px 85px 20px;
  1211. display: flex;
  1212. .top-form-left-box{
  1213. flex:1;
  1214. height:310px;
  1215. }
  1216. .top-form-right-box{
  1217. height:310px;
  1218. }
  1219. }
  1220. .bottom-form-box{
  1221. .bottom-form-title-box{
  1222. background: #F5F5F5;
  1223. display: flex;
  1224. margin-bottom:31px;
  1225. p{
  1226. font-size:16px;
  1227. line-height:50px;
  1228. }
  1229. p:nth-child(1){
  1230. color:#333;
  1231. margin-left:30px;
  1232. flex:1;
  1233. }
  1234. p:nth-child(2){
  1235. color:#0183FA;
  1236. margin-right:37px;
  1237. }
  1238. }
  1239. .add-bottom-button{
  1240. cursor: pointer;
  1241. color:#0183FA;
  1242. border-radius:4px;
  1243. border:1px dashed #0183FA;
  1244. width:800px;
  1245. line-height:40px;
  1246. text-align: center;
  1247. font-size:14px;
  1248. margin: 20px auto;
  1249. }
  1250. }
  1251. }
  1252. .for-max-big-box{
  1253. border:1px solid #dedede;
  1254. overflow: hidden;
  1255. margin:0 81px;
  1256. .for-title-box{
  1257. display: flex;
  1258. background: #F5F5F5;
  1259. border-bottom:1px solid #dedede;
  1260. line-height:50px;
  1261. .for-title-p{
  1262. color:#333333;
  1263. font-size:16px;
  1264. margin-left: 30px;
  1265. flex:1;
  1266. }
  1267. .for-del-box{
  1268. color:#0183FA;
  1269. margin-left:46px;
  1270. cursor: pointer;
  1271. display: flex;
  1272. p{
  1273. font-size:14px;
  1274. line-height:50px;
  1275. margin-right:8px;
  1276. }
  1277. }
  1278. .for-button-box{
  1279. color:#0183FA;
  1280. margin-left:46px;
  1281. margin-right:43px;
  1282. cursor: pointer;
  1283. display: flex;
  1284. p{
  1285. font-size:14px;
  1286. line-height:50px;
  1287. margin-right:8px;
  1288. }
  1289. }
  1290. }
  1291. .for-big-box{
  1292. padding-top:27px;
  1293. .up-img-p{
  1294. height:80px;
  1295. width:80px;
  1296. line-height:80px;
  1297. text-align: center;
  1298. font-size:16px;
  1299. border-radius:4px;
  1300. border:1px dashed #E0E0E0;
  1301. }
  1302. .for-img-box{
  1303. width:80px;
  1304. height:80px;
  1305. border-radius:4px;
  1306. display: inline-block;
  1307. overflow: hidden;
  1308. margin-right:20px;
  1309. position: relative;
  1310. .for-img{
  1311. width:80px;
  1312. height:80px;
  1313. display: inline-block;
  1314. overflow: hidden;
  1315. }
  1316. .for-del-button{
  1317. background: rgba(0,0,0,0.7);
  1318. width:20px;
  1319. height:20px;
  1320. line-height: 20px;
  1321. text-align: center;
  1322. color:#fff;
  1323. border-bottom-left-radius:4px;
  1324. cursor: pointer;
  1325. position: absolute;
  1326. top:0;
  1327. right:0;
  1328. }
  1329. }
  1330. .hazard-check-count-p{
  1331. display: inline-block;
  1332. margin-left: 20px;
  1333. font-size: 14px;
  1334. line-height: 40px;
  1335. span{
  1336. color:#FF0000;
  1337. }
  1338. }
  1339. }
  1340. }
  1341. /*专项检查*/
  1342. .for-max-big-box-special{
  1343. margin-bottom: 20px;
  1344. .for-big-box-special{
  1345. border-bottom: 1px dotted #D8D8D8;
  1346. margin:30px;
  1347. display: flex;
  1348. justify-content: flex-start;
  1349. .for-big-box-special-l{
  1350. width: 30px;
  1351. height: 30px;
  1352. background: #0183FA;
  1353. border-radius: 6px 6px 6px 6px;
  1354. font-size: 16px;
  1355. font-family: Microsoft YaHei-Regular, Microsoft YaHei;
  1356. font-weight: 400;
  1357. color: #FFFFFF;
  1358. line-height: 30px;
  1359. text-align: center;
  1360. }
  1361. .for-big-box-special-r{}
  1362. }
  1363. .for-big-box-special:last-of-type{
  1364. border-bottom: none;
  1365. }
  1366. }
  1367. .bottom-button-max-box{
  1368. height:80px;
  1369. display: flex;
  1370. border-top:1px solid #dedede;
  1371. p{
  1372. margin-top:20px;
  1373. }
  1374. .null-p{
  1375. flex:1;
  1376. }
  1377. p:nth-child(2){
  1378. width:90px;
  1379. margin-right:20px;
  1380. }
  1381. p:nth-child(3){
  1382. width:90px;
  1383. margin-right:20px;
  1384. }
  1385. p:nth-child(4){
  1386. width:90px;
  1387. margin-right:20px;
  1388. }
  1389. }
  1390. }
  1391. </style>