index.vue 56 KB

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