index.vue 58 KB

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