unsubmittedInfo.vue 38 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063
  1. <!--未提交检查详情-->
  2. <template>
  3. <div class="unsubmittedInfo">
  4. <el-form :model="form" ref="form" :inline="true" :rules="rules" class="addCheckPage-min">
  5. <div class="top-addCheckPage-title">基本信息</div>
  6. <div class="top-addCheckPage">
  7. <el-form-item label="房间号:" prop="fjNumber" label-width="130px" class="el-form-item-top">
  8. <el-select
  9. style="width:230px;"
  10. v-model="form.fjNumber"
  11. filterable
  12. remote
  13. reserve-keyword
  14. placeholder="请输入实验室房间号"
  15. :remote-method="getSelectInfoByRoom"
  16. @change="selectChange"
  17. >
  18. <el-option
  19. v-for="item in optionsSelect"
  20. :key="item.room"
  21. :label="item.room"
  22. :value="item.room">
  23. </el-option>
  24. </el-select>
  25. </el-form-item>
  26. <el-form-item label="实验楼:" prop="buildingName" label-width="130px" class="el-form-item-top">
  27. <el-input
  28. disabled
  29. style="width:230px;"
  30. maxlength="20"
  31. v-model="form.buildingName"
  32. placeholder="请选择房间号"
  33. clearable
  34. size="small"
  35. />
  36. </el-form-item>
  37. <el-form-item label="实验室:" prop="laboratoryName" label-width="130px" class="el-form-item-top">
  38. <el-input
  39. disabled
  40. style="width:230px;"
  41. maxlength="20"
  42. v-model="form.laboratoryName"
  43. placeholder="请选择房间号"
  44. clearable
  45. size="small"
  46. />
  47. </el-form-item>
  48. <el-form-item label="负责人:" prop="fzrName" label-width="130px" class="el-form-item-top">
  49. <el-input
  50. disabled
  51. style="width:230px;"
  52. maxlength="10"
  53. v-model="form.fzrName"
  54. placeholder="请选择房间号"
  55. clearable
  56. size="small"
  57. />
  58. </el-form-item>
  59. <el-form-item label="联系方式:" prop="fzrLxfs" label-width="130px" class="el-form-item-top">
  60. <el-input
  61. oninput="value=value.replace(/[^\d]/g,'')"
  62. style="width:230px;"
  63. maxlength="11"
  64. v-model="form.fzrLxfs"
  65. placeholder="请输入联系方式"
  66. clearable
  67. size="small"
  68. />
  69. </el-form-item>
  70. <el-form-item label="整改截止时间:" prop="zgjzTime" label-width="130px" class="el-form-item-top">
  71. <el-date-picker style="width:230px;"
  72. v-model="form.zgjzTime"
  73. type="date"
  74. value-format="yyyy-MM-dd"
  75. :picker-options="pickerBeginOption"
  76. placeholder="选择整改截止时间">
  77. </el-date-picker>
  78. </el-form-item>
  79. <el-form-item label="整改类型:" prop="zgType" class="el-form-item-top" label-width="130px">
  80. <el-select v-model="form.zgType" placeholder="请选择整改类型" style="width:230px;">
  81. <el-option label="一般整改" :value="0" />
  82. <el-option label="重大整改" :value="1" />
  83. </el-select>
  84. </el-form-item>
  85. <el-form-item label="检查单位:" prop="jcDw" class="el-form-item-top" label-width="130px">
  86. <el-select v-model="form.jcDw" @change="jcDwChange" placeholder="请选择检查单位" style="width:230px;">
  87. <el-option v-for="(item,index) in inspectionUnitArrayData" :key="index" :label="item.label" :value="item.id" />
  88. </el-select>
  89. </el-form-item>
  90. </div>
  91. <div class="top-addCheckPage-title" style="border-top:10px solid #dedede;">隐患信息</div>
  92. <div class="center-addCheckPage scrollbar-box">
  93. <div v-for="(item,index) in form.detailsList" :key="index" class="form-list-for-box">
  94. <el-form-item label="隐患照片:" :prop="'detailsList.'+ index +'.yhImg'" :rules="rules.yhImg" label-width="150px" class="el-form-item-bottom">
  95. <div class="el-form-item-bottom-up">
  96. <div class="form-up-img-box">
  97. <div v-for="(imgUrl,imgIndex) in item.yhImg" :key="imgIndex" class="up-img-for-box">
  98. <img :src="imgUrl">
  99. <i class="el-icon-close del-i" @click="imgDel(index,imgIndex)"></i>
  100. </div>
  101. </div>
  102. <el-upload
  103. v-if="!item.yhImg[4]"
  104. class="certificate-avatar-uploader"
  105. style="margin-top:10px;"
  106. :action="uploadImgUrl"
  107. :show-file-list="false"
  108. accept="image/jpeg,image/gif,image/png"
  109. :on-success="function (res, file){return handleAvatarSuccess(res, file, index)}"
  110. :headers="headers"
  111. :before-upload="beforeAvatarUpload">
  112. <i class="el-icon-plus avatar-uploader-icon"></i>
  113. </el-upload>
  114. </div>
  115. </el-form-item>
  116. <el-form-item label="语音备注:" label-width="150px" class="el-form-item-bottom" v-if="item.voice[0]">
  117. <div class="audio-box" v-for="(voiceItem,voiceIndex) in item.voice" :key="voiceIndex">
  118. <video controls="" ref="video" name="media" class="video-box">
  119. <source :src="voiceItem.url" type="audio/mpeg">
  120. </video>
  121. </div>
  122. <p class="audio-text">依据语音描述重新整理并完善下面隐患描述并提交检查单</p>
  123. </el-form-item>
  124. <el-form-item label="隐患描述:" :prop="'detailsList.'+ index +'.yhMs'" :rules="rules.yhMs" label-width="150px" class="el-form-item-bottom">
  125. <el-input
  126. style="width:450px;"
  127. maxlength="50"
  128. v-model="item.yhMs"
  129. type="textarea"
  130. placeholder="请输入隐患描述">
  131. </el-input>
  132. </el-form-item>
  133. <el-form-item label="对应检查项:" :prop="'detailsList.'+ index +'.jcxId'" :rules="rules.jcxId" label-width="150px" class="el-form-item-bottom">
  134. <el-cascader
  135. placeholder="请输入检查项名称或点击箭头选择"
  136. :before-filter="(value)=>filterRegion(value,index)"
  137. filterable
  138. clearable
  139. maxlength="10"
  140. :show-all-levels="false"
  141. ref="cascaderGet"
  142. style="width:240px;"
  143. v-model="item.jcxId"
  144. :options="defaultCheckOptionList"
  145. @change="(val)=>cascaderChange(val,index)"
  146. @focus="focusClick()"
  147. :props="{ expandTrigger: 'hover',value: 'id', label: 'name' }">
  148. <template slot-scope="{ node, data }">
  149. <el-tooltip :disabled="data.name.length < 14" class="item" effect="dark" :content="data.name" placement="top-start">
  150. <p style="max-width:200px;overflow: hidden;display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">{{ data.name}}</p>
  151. </el-tooltip>
  152. </template>
  153. </el-cascader>
  154. <!--<span class="add-span" style="margin-left:20px;" @click="blurCheck(index)">重置检查项</span>-->
  155. <span class="text-span">没有找到对应的隐患</span>
  156. <span class="add-span" @click="dialogClick(index)">手动添加</span>
  157. <p style="color:#999999;" v-if="item.yhcount">此检查项在当前实验室累计出现<span style="color:#FF2D2D;">{{item.yhcount}}</span>次隐患</p>
  158. </el-form-item>
  159. <p class="del-button-p" @click="delDanger(index)">删除隐患项</p>
  160. </div>
  161. <p class="add-button-p" :class="form.detailsList[0]?'add-button-p-one':''" @click="addDanger">+ 新增隐患项</p>
  162. </div>
  163. <div class="bottom-addCheckPage">
  164. <p></p>
  165. <p class="reset-button-one" @click="backPage">返回</p>
  166. <p class="add-button-one-90" @click="submitForm(1)" v-hasPermi="['laboratory:checkRecord:edit']">保存草稿</p>
  167. <p class="inquire-button-one" @click="submitForm(2)" v-hasPermi="['laboratory:checkRecord:edit']">提交发布</p>
  168. </div>
  169. </el-form>
  170. <el-dialog title="添加检查项" :visible.sync="open" width="500px" append-to-body>
  171. <el-form ref="addForm" :model="examinationForm" :rules="rules" label-width="100px">
  172. <el-form-item label="检查项名称" prop="name">
  173. <el-input type="textarea" maxlength="20" v-model="examinationForm.name" placeholder="请输入检查项名称" rows="3" resize="none"></el-input>
  174. </el-form-item>
  175. <el-form-item label="目录" prop="idList">
  176. <el-cascader
  177. :show-all-levels="false"
  178. style="width:360px;"
  179. v-model="examinationForm.idList"
  180. :options="checkOptionListExamination"
  181. :props="{ expandTrigger: 'hover',value: 'id', label: 'name' }"
  182. @change="handleChange">
  183. <template slot-scope="{ node, data }">
  184. <el-tooltip :disabled="data.name.length < 14" class="item" effect="dark" :content="data.name" placement="top-start">
  185. <p style="max-width:200px;overflow: hidden;display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">{{ data.name}}</p>
  186. </el-tooltip>
  187. </template>
  188. </el-cascader>
  189. </el-form-item>
  190. </el-form>
  191. <div slot="footer" class="dialog-footer">
  192. <el-button @click="cancel">取 消</el-button>
  193. <el-button type="primary" @click="dialogSubmitForm">确 定</el-button>
  194. </div>
  195. </el-dialog>
  196. <!--检查重复提示-->
  197. <el-dialog title="提示" :visible.sync="remindOpen" width="600px" append-to-body class="remind-dialog-box">
  198. <div class="for-max-box scrollbar-box">
  199. <div v-for="(item,index) in remindList" :key="index" class="for-box">
  200. <div class="for-min-box" style="margin-top:20px;">
  201. <p class="for-min-title">检查时间:</p>
  202. <p class="for-min-text" style="flex:1;">{{item.createTime}}<span style="margin-left:30px;">检查人:{{item.jcRyxm}}</span></p>
  203. </div>
  204. <div class="for-min-box">
  205. <p class="for-min-title">隐患描述:</p>
  206. <p class="for-min-text" style="flex:1;">{{item.yhMs}}</p>
  207. </div>
  208. <div class="for-min-box" v-if="item.yhImg[0]">
  209. <p class="for-min-title">照片:</p>
  210. <div class="for-img-box">
  211. <img :src="minItem" v-for="(minItem,minIndex) in item.yhImg" :key="minIndex">
  212. </div>
  213. </div>
  214. </div>
  215. </div>
  216. <div slot="footer" class="dialog-footer">
  217. <el-button @click="remindOff">取 消</el-button>
  218. <el-button type="primary" @click="remindButton">确 定</el-button>
  219. </div>
  220. </el-dialog>
  221. <el-dialog title="发布" :visible.sync="nameOpen" width="600px" append-to-body class="remind-dialog-box">
  222. <el-form ref="nameForm" :model="nameForm" :rules="rules" label-width="100px">
  223. <el-form-item label="检查名称" prop="checkName" style="margin-top:20px;">
  224. <el-input maxlength="20" v-model="nameForm.checkName" placeholder="请输入检查名称" rows="3" resize="none"></el-input>
  225. </el-form-item>
  226. </el-form>
  227. <div slot="footer" class="dialog-footer">
  228. <el-button @click="nameFormButton(1)">取 消</el-button>
  229. <el-button type="primary" @click="nameFormButton(2)">确 定</el-button>
  230. </div>
  231. </el-dialog>
  232. </div>
  233. </template>
  234. <script>
  235. import { listCheckOption } from "@/api/laboratory/checkOption";
  236. import { treeselect,recordDettailsList ,addTempCheckOption ,checkRecordUpdate,selectInfoByRoom ,selectDeptListUserDeptId,hiddenDangerCount } from "@/api/laboratory/checkRecord";
  237. import { getToken } from "@/utils/auth";
  238. export default {
  239. name: 'unsubmittedInfo',
  240. props:{
  241. infoId: {},
  242. },
  243. data() {
  244. return {
  245. //限制时间范围
  246. pickerBeginOption: {
  247. disabledDate: (time) => {
  248. return time.getTime() < Date.now()-1 * 24 * 60 * 60 * 1000
  249. }
  250. },
  251. //上传设置
  252. uploadImgUrl: window.location.href.split('://')[0]+'://' + process.env.VUE_APP_BASE_API + "/file/upload", // 上传的图片服务器地址
  253. headers: {
  254. Authorization: "Bearer " + getToken(),
  255. },
  256. // 遮罩层
  257. loading: true,
  258. //实验室懒加载数据
  259. optionsSelect:[],
  260. // 安全检查表格数据
  261. checkRecordList: [],
  262. // 表单参数
  263. form: {
  264. fjNumber:"",
  265. buildingId:"",
  266. buildingName:"",
  267. laboratoryId:"",
  268. laboratoryName:"",
  269. fzrName:"",
  270. fzrLxfs:"",
  271. detailsList:[
  272. // {
  273. // isLingshi:0,
  274. // yhImg:[],
  275. // yhMs:"",
  276. // jcxId:"",
  277. // jcxName:"",
  278. // }
  279. ],
  280. },
  281. imgIndex:"",
  282. //临时存储房间号
  283. fjNumber:"",
  284. // 表单校验
  285. rules: {
  286. fjNumber: [
  287. { required: true, message: "请输入实验室房间号", trigger: "blur" },
  288. { required: true, message: "请输入实验室房间号", validator: this.spaceJudgment, trigger: "blur" }
  289. ],
  290. buildingName: [
  291. { required: true, message: "请选择房间自动匹配实验楼", trigger: "blur" }
  292. ],
  293. laboratoryName: [
  294. { required: true, message: "请选择房间自动匹配实验室", trigger: "blur" }
  295. ],
  296. fzrName: [
  297. { required: true, message: "请选择房间自动匹配负责人", trigger: "blur" }
  298. ],
  299. zgjzTime: [
  300. { required: true, message: "选择整改截止时间", trigger: "blur" }
  301. ],
  302. zgType: [
  303. { required: true, message: "请选择整改类型", trigger: "blur" }
  304. ],
  305. jcDw: [
  306. { required: true, message: "请选择检查单位", trigger: "blur" }
  307. ],
  308. yhMs: [
  309. { required: true, message: "请输入隐患描述", trigger: "blur" },
  310. { required: true, message: "请输入隐患描述", validator: this.spaceJudgment, trigger: "blur" }
  311. ],
  312. // yhImg: [
  313. // { required: true, message: "请上传隐患照片", trigger: "blur" }
  314. // ],
  315. jcxId: [
  316. { required: true, message: "请选择检项", trigger: "blur" }
  317. ],
  318. name: [
  319. { required: true, message: "请输入检查项名称", trigger: "blur" }
  320. ],
  321. checkName: [
  322. { required: true, message: "请输入检查名称", trigger: "blur" }
  323. ],
  324. idList: [
  325. { required: true, message: "请选择目录", trigger: "blur" }
  326. ],
  327. },
  328. // 检查先搜索列表
  329. optionsUser:[],
  330. open:false,
  331. openIndex:"",
  332. //检查项联机
  333. examinationForm:{
  334. laboratoryName:""
  335. },
  336. //检查项联机搜索
  337. options:[],
  338. //检查项
  339. defaultCheckOptionList:[],
  340. defaultCheckOption:[],
  341. checkOptionListExamination:[],
  342. //临时数据组
  343. temporaryIdList:[],
  344. //检查单位
  345. inspectionUnitArrayData:[],
  346. //提醒页面开关
  347. remindOpen:false,
  348. remindList:[],
  349. nameOpen:false,
  350. nameForm:{
  351. checkName:"",
  352. },
  353. formData:{},
  354. addList:[],
  355. };
  356. },
  357. created() {
  358. this.getListCheckOptionData();
  359. this.getListCheckOptionTwo();
  360. // this.selectDeptListUserDeptId();
  361. this.treeselect();
  362. },
  363. mounted(){
  364. // this.getInfo();
  365. },
  366. methods: {
  367. remindOff(){
  368. this.remindOpen = false;
  369. },
  370. remindButton(){
  371. this.remindOpen = false;
  372. },
  373. focusClick(){
  374. this.$set(this,'defaultCheckOptionList',JSON.parse(JSON.stringify(this.defaultCheckOption.concat(this.addList))));
  375. },
  376. filterRegion(value,index){
  377. this.getListCheckOptionOne(value,index);
  378. return false
  379. },
  380. jcDwChange(val){
  381. let self = this;
  382. for(let i=0;i<self.inspectionUnitArrayData.length;i++){
  383. if(val == self.inspectionUnitArrayData[i].id){
  384. this.form.jcDwName = self.inspectionUnitArrayData[i].label;
  385. }
  386. }
  387. },
  388. //根据用户获取对应检查单位列表
  389. selectDeptListUserDeptId(){
  390. selectDeptListUserDeptId().then( data => {
  391. this.inspectionUnitArrayData = data.data;
  392. })
  393. },
  394. treeselect(){
  395. treeselect().then( data => {
  396. // let list = [];
  397. // for(let i=0;i<data.data[0].children.length;i++){
  398. // let obj = {
  399. // id:data.data[0].children[i].id,
  400. // label:data.data[0].children[i].label,
  401. // }
  402. // list.push(obj);
  403. // for(let o=0;o<data.data[0].children[i].children.length;o++){
  404. // let obj = {
  405. // id:data.data[0].children[i].children[o].id,
  406. // label:data.data[0].children[i].children[o].label,
  407. // }
  408. // list.push(obj);
  409. // }
  410. // }
  411. // this.inspectionUnitArrayData = list;
  412. this.inspectionUnitArrayData = this.toArray(data.data);
  413. });
  414. },
  415. toArray(data){
  416. let list = [];
  417. let newList = JSON.parse(JSON.stringify(data));
  418. for(let i=0;i<newList.length;i++){
  419. pushNode(newList[i]);
  420. }
  421. function pushNode(node){
  422. if(node.children){
  423. for (let nodeItem of node.children){
  424. pushNode(nodeItem)
  425. }
  426. delete node.children;
  427. list.push(node)
  428. }else{
  429. if(node.children){
  430. delete node.children
  431. }
  432. list.push(node)
  433. }
  434. }
  435. return list
  436. },
  437. getInfo(){
  438. let self = this;
  439. let obj = {
  440. id:this.infoId
  441. }
  442. recordDettailsList(obj).then( response => {
  443. let obj = JSON.parse(JSON.stringify(response.data))
  444. for(let i=0;i<obj.yhlist.length;i++){
  445. if(obj.yhlist[i].yhImg){
  446. obj.yhlist[i].yhImg = obj.yhlist[i].yhImg.split(",");
  447. }else{
  448. obj.yhlist[i].yhImg = [];
  449. }
  450. if(obj.yhlist[i].voice){
  451. obj.yhlist[i].voice = JSON.parse(obj.yhlist[i].voice);
  452. }else{
  453. obj.yhlist[i].voice = [];
  454. }
  455. for(let x=0;x<obj.yhlist[i].voice.length;x++){
  456. obj.yhlist[i].voice[x].url = window.location.href.split('://')[0]+'://' + process.env.VUE_APP_BASE_API + '/' + obj.yhlist[i].voice[x].url;
  457. }
  458. obj.yhlist[i].jcxId = obj.yhlist[i].jcxId.split(",");
  459. for(let o=0;o<obj.yhlist[i].jcxId.length;o++){
  460. if(obj.yhlist[i].jcxId[o] == ''){
  461. obj.yhlist[i].jcxId.splice(o,1);
  462. }else{
  463. obj.yhlist[i].jcxId[o] = parseInt(obj.yhlist[i].jcxId[o])
  464. }
  465. }
  466. }
  467. for(let i=0;i<obj.yhlist.length;i++){
  468. if(obj.yhlist[i].isLingshi == 1){
  469. let newObj = {
  470. id:parseInt(obj.yhlist[i].jcxId+''),
  471. name:obj.yhlist[i].jcxName,
  472. }
  473. let num = 0;
  474. for(let o=0;o<self.defaultCheckOptionList.length;o++){
  475. if(self.defaultCheckOptionList[o].id == newObj.id){
  476. num++
  477. }
  478. }
  479. if(num == 0){
  480. self.addList.push(newObj);
  481. let list = JSON.parse(JSON.stringify(this.defaultCheckOptionList));
  482. list = list.concat(this.addList);
  483. this.$set(this,'defaultCheckOptionList',JSON.parse(JSON.stringify(list)))
  484. }
  485. self.temporaryIdList.push(obj.yhlist[i].jcxId);
  486. }
  487. }
  488. let newOjb = obj.record;
  489. newOjb.detailsList = obj.yhlist;
  490. newOjb.jcDw = parseInt(newOjb.jcDw);
  491. this.fjNumber = obj.record.fjNumber;
  492. this.getSelectInfoByRoom(obj.record.fjNumber)
  493. this.$set(this,'form',newOjb);
  494. this.$forceUpdate();
  495. });
  496. },
  497. //返回
  498. backPage(){
  499. this.$parent.goPageInfo(1);
  500. },
  501. //删除隐患
  502. delDanger(index){
  503. this.form.detailsList.splice(index,1)
  504. this.$forceUpdate();
  505. },
  506. //新增隐患项
  507. addDanger(){
  508. if(!this.form.fjNumber){
  509. this.msgError("请先选择房间")
  510. return
  511. }
  512. if(this.form.detailsList.length>19){
  513. this.msgError("最多添加20个隐患")
  514. return
  515. }
  516. let obj = {
  517. yhImg:[],
  518. yhMs:"",
  519. voice:[],
  520. };
  521. this.form.detailsList.push(obj);
  522. },
  523. //上传
  524. handleAvatarSuccess(res, file, index) {
  525. // let url=window.location.href.split('://')[0]+'://' + process.env.VUE_APP_BASE_API+"/"+res.data.url;
  526. // this.form.detailsList[index].yhImg.push(url);
  527. // this.form.detailsList[index].yhImg.push(res.data.url);
  528. this.form.detailsList[index].yhImg.push(res.data.url);
  529. this.$forceUpdate()
  530. },
  531. beforeAvatarUpload(file) {
  532. let type = false;
  533. console.log('file',file);
  534. if (file.type == 'image/png' || file.type == 'image/jpeg' || file.type == 'image/gif') {
  535. type = true;
  536. }else{
  537. this.$message.error('只能上传png/jpeg/gif格式图片');
  538. type = false;
  539. }
  540. return type;
  541. },
  542. //删除
  543. imgDel(index,minIndex){
  544. this.form.detailsList[index].yhImg.splice(minIndex,1);
  545. },
  546. /** 查询安全检查列表 */
  547. getList() {
  548. this.loading = true;
  549. listCheckRecord({}).then( response => {
  550. this.checkRecordList = response.rows;
  551. this.total = response.total;
  552. this.loading = false;
  553. });
  554. },
  555. //发布按钮
  556. nameFormButton(type){
  557. if(type == 1){
  558. this.nameOpen = false;
  559. }else if(type == 2){
  560. this.$refs["nameForm"].validate(valid => {
  561. if (valid) {
  562. this.loading = true;
  563. this.formData.checkName = this.nameForm.checkName;
  564. checkRecordUpdate(this.formData).then( response => {
  565. this.msgSuccess('提交成功')
  566. this.loading = false;
  567. this.backPage();
  568. });
  569. }
  570. })
  571. }
  572. },
  573. /** 提交按钮 */
  574. submitForm(type) {
  575. let self = this;
  576. if(!this.form.detailsList[0]){
  577. this.msgError('请添加至少一个隐患项')
  578. return
  579. }
  580. this.$refs["form"].validate(valid => {
  581. if (valid) {
  582. let obj = JSON.parse(JSON.stringify(self.form));
  583. for(let i=0;i<obj.detailsList.length;i++){
  584. obj.detailsList[i].jcxId = obj.detailsList[i].jcxId + ',';
  585. obj.detailsList[i].yhImg = obj.detailsList[i].yhImg + '';
  586. obj.detailsList[i].voice = null;
  587. }
  588. obj.zgStatus = 0;
  589. if(type == 1){
  590. obj.isCg = 1;
  591. obj.isFabu = 0;
  592. }else if(type == 2){
  593. obj.isCg = 0;
  594. obj.isFabu = 1;
  595. }
  596. this.formData = JSON.parse(JSON.stringify(obj));
  597. if(type == 1){
  598. this.loading = true;
  599. checkRecordUpdate(this.formData).then( response => {
  600. this.msgSuccess('保存草稿成功')
  601. this.loading = false;
  602. this.backPage();
  603. });
  604. }else if(type == 2){
  605. this.nameForm.checkName = "";
  606. this.nameOpen = true;
  607. }
  608. }
  609. });
  610. },
  611. /** 下列人员-懒加载 */
  612. userSelectList(query) {
  613. // if (query !== '' && query.length>1) {
  614. // this.loading = true;
  615. // this.userSelectList.nickName=query;
  616. // selectListUser(this.userSelectList).then(response => {
  617. // this.optionsUser = response.data;
  618. // this.loading = false;
  619. // });
  620. // } else {
  621. // this.optionsUser = [];
  622. // }
  623. },
  624. //新增检查项
  625. dialogClick(index){
  626. this.openIndex = index;
  627. this.examinationForm = {};
  628. this.open = true;
  629. },
  630. //检查项联机触发
  631. handleChange() {
  632. },
  633. //检查项确定
  634. cascaderChange(val,index){
  635. let self = this;
  636. if(val[0]){
  637. let text = "";
  638. let cascaderList = this.$refs['cascaderGet'][index].getCheckedNodes()[0].pathLabels // 获取label值
  639. let nodesList = this.$refs['cascaderGet'][index].getCheckedNodes()[0].pathNodes // 获取label值
  640. let jcxSstkNum = nodesList[nodesList.length-1].data.code;
  641. let jcxSstkMs = "";
  642. for(let i=0;i<nodesList.length-1;i++){
  643. if(i == 0){
  644. jcxSstkMs = jcxSstkMs + nodesList[i].data.name
  645. }else{
  646. jcxSstkMs = jcxSstkMs + '-' + nodesList[i].data.name
  647. }
  648. }
  649. let num = 0;
  650. for(let i=0;i<self.temporaryIdList.length;i++){
  651. if(self.temporaryIdList[i] == val){
  652. num++
  653. }
  654. }
  655. if(num == 0){
  656. this.$set(this.form.detailsList[index],'isLingshi',0);
  657. }else{
  658. this.$set(this.form.detailsList[index],'isLingshi',1);
  659. }
  660. this.$set(this.form.detailsList[index],'jcxName',cascaderList[cascaderList.length-1]);
  661. this.$set(this.form.detailsList[index],'jcxSstkNum',jcxSstkNum);
  662. this.$set(this.form.detailsList[index],'jcxSstkMs',jcxSstkMs);
  663. }else{
  664. this.$set(this.form.detailsList[index],'isLingshi',0);
  665. this.$set(this.form.detailsList[index],'jcxName',"");
  666. this.$set(this.form.detailsList[index],'jcxSstkNum',"");
  667. this.$set(this.form.detailsList[index],'jcxSstkMs',"");
  668. }
  669. console.log('val',val);
  670. if(val[0]){
  671. let obj = {
  672. laboratoryId:this.form.laboratoryId,
  673. checkId:val[val.length-1],
  674. };
  675. hiddenDangerCount(obj).then( response => {
  676. this.$set(this.form.detailsList[index],'yhcount',response.data.yhcount);
  677. if(response.data.yhflg){
  678. for(let i=0;i<response.data.yhlist.length;i++){
  679. response.data.yhlist[i].yhImg = response.data.yhlist[i].yhImg.split(',')
  680. }
  681. this.$set(this,'remindList',response.data.yhlist);
  682. this.remindOpen = true;
  683. }
  684. });
  685. }else{
  686. this.$set(this.form.detailsList[index],'yhcount','');
  687. }
  688. },
  689. //新增检查项
  690. dialogSubmitForm(){
  691. this.$refs["addForm"].validate(valid => {
  692. if (valid) {
  693. let obj = {
  694. name:this.examinationForm.name,
  695. parentId:this.examinationForm.idList[this.examinationForm.idList.length-1]
  696. };
  697. addTempCheckOption(obj).then( response => {
  698. let obj = {
  699. id:response.data.id,
  700. name:response.data.name,
  701. };
  702. this.defaultCheckOptionList.push(obj);
  703. this.addList.push(obj);
  704. this.temporaryIdList.push(response.data.id);
  705. this.$set(this.form.detailsList[this.openIndex],'jcxId',response.data.id);
  706. this.$set(this.form.detailsList[this.openIndex],'jcxName',response.data.name);
  707. this.$set(this.form.detailsList[this.openIndex],'isLingshi',1);
  708. this.msgSuccess("新增成功");
  709. this.open = false;
  710. });
  711. }
  712. });
  713. },
  714. //关闭检查项
  715. cancel(){
  716. this.open = false;
  717. },
  718. //实验室数据懒加载
  719. getSelectInfoByRoom(query){
  720. if (query !== '' && query.length>0) {
  721. this.loading = true;
  722. let obj = {
  723. room:query,
  724. }
  725. selectInfoByRoom(obj).then(response => {
  726. this.optionsSelect = response.data;
  727. this.loading = false;
  728. });
  729. } else {
  730. this.optionsSelect = [];
  731. }
  732. },
  733. //实验室房间懒加载选中
  734. selectChange(name){
  735. let self = this;
  736. if(!this.fjNumber){
  737. if(name){
  738. for(let i=0;i<self.optionsSelect.length;i++){
  739. if(name == self.optionsSelect[i].room){
  740. self.$set(self,"fjNumber",self.optionsSelect[i].room)
  741. self.$set(self.form,"fjNumber",self.optionsSelect[i].room)
  742. self.$set(self.form,"deptName",self.optionsSelect[i].deptName)
  743. self.$set(self.form,"buildingId",self.optionsSelect[i].building)
  744. self.$set(self.form,"deptId",self.optionsSelect[i].deptId)
  745. self.$set(self.form,"laboratoryId",self.optionsSelect[i].id)
  746. self.$set(self.form,"buildingName",self.optionsSelect[i].buildName)
  747. self.$set(self.form,"laboratoryName",self.optionsSelect[i].name)
  748. self.$set(self.form,"fzrId",self.optionsSelect[i].userId)
  749. self.$set(self.form,"fzrName",self.optionsSelect[i].safeUserName)
  750. self.$set(self.form,"fzrLxfs",self.optionsSelect[i].safeUserPhone)
  751. }
  752. }
  753. }
  754. else{
  755. self.$set(self.form,"fjNumber","")
  756. self.$set(self.form,"buildingId","")
  757. self.$set(self.form,"deptName","")
  758. self.$set(self.form,"deptId","")
  759. self.$set(self.form,"buildingName","")
  760. self.$set(self.form,"laboratoryId","")
  761. self.$set(self.form,"laboratoryName","")
  762. self.$set(self.form,"fzrId","")
  763. self.$set(self.form,"fzrName","")
  764. self.$set(self.form,"fzrLxfs","")
  765. }
  766. }else{
  767. if(this.fjNumber != name){
  768. this.$confirm('更换实验室后需要从新选择检查项,是否确认更换实验室?', "警告", {
  769. confirmButtonText: "确定",
  770. cancelButtonText: "取消",
  771. type: "warning"
  772. }).then(function() {
  773. }).then(() => {
  774. console.log("确定")
  775. for(let i=0;i<self.optionsSelect.length;i++){
  776. if(name == self.optionsSelect[i].room){
  777. self.$set(self,"fjNumber",self.optionsSelect[i].room)
  778. self.$set(self.form,"fjNumber",self.optionsSelect[i].room)
  779. self.$set(self.form,"buildingId",self.optionsSelect[i].deptId)
  780. self.$set(self.form,"deptName",self.optionsSelect[i].deptName)
  781. self.$set(self.form,"deptId",self.optionsSelect[i].id)
  782. self.$set(self.form,"buildingName",self.optionsSelect[i].buildName)
  783. self.$set(self.form,"laboratoryId",self.optionsSelect[i].building)
  784. self.$set(self.form,"laboratoryName",self.optionsSelect[i].name)
  785. self.$set(self.form,"fzrId",self.optionsSelect[i].userId)
  786. self.$set(self.form,"fzrName",self.optionsSelect[i].safeUserName)
  787. self.$set(self.form,"fzrLxfs",self.optionsSelect[i].safeUserPhone)
  788. self.$set(self.form,"detailsList",[])
  789. }
  790. }
  791. }).catch(() => {
  792. console.log("取消")
  793. self.$set(self.form,"fjNumber",self.fjNumber)
  794. this.getSelectInfoByRoom(self.fjNumber)
  795. });
  796. }
  797. }
  798. },
  799. getListCheckOptionData(){
  800. let newObj = {
  801. level:4,
  802. }
  803. listCheckOption(newObj).then( response => {
  804. this.defaultCheckOptionList = this.getTreeData(response.data);
  805. this.$set(this,'defaultCheckOption',this.defaultCheckOptionList);
  806. this.getInfo();
  807. });
  808. },
  809. //获取检查项
  810. getListCheckOptionOne(data,index) {
  811. let newObj = {
  812. level:4,
  813. searchValue:data
  814. }
  815. listCheckOption(newObj).then( response => {
  816. let list = this.getTreeData(response.data);
  817. if(list[0]){
  818. list = list.concat(this.addList);
  819. this.$set(this,'defaultCheckOptionList',JSON.parse(JSON.stringify(list)))
  820. this.$forceUpdate()
  821. }else{
  822. this.msgError('未找到相关检查项')
  823. }
  824. });
  825. },
  826. getListCheckOptionTwo(){
  827. let newObj = {
  828. level:3,
  829. }
  830. listCheckOption(newObj).then( response => {
  831. let list = this.getTreeData(response.data);
  832. this.checkOptionListExamination = JSON.parse(JSON.stringify(list));
  833. });
  834. },
  835. getTreeData(data){
  836. for(var i=0;i<data.length>0;i++){
  837. if(data[i].children == null||data[i].children.length<=0){
  838. // children若为空数组,则将children设为undefined
  839. data[i].children = undefined;
  840. }else {
  841. // children若不为空数组,则继续 递归调用 本方法
  842. this.getTreeData(data[i].children);
  843. }
  844. }
  845. return data;
  846. },
  847. }
  848. }
  849. </script>
  850. <style scoped lang="scss">
  851. .unsubmittedInfo{
  852. flex:1;
  853. display: flex;
  854. flex-direction: column;
  855. overflow: hidden !important;
  856. .addCheckPage-min{
  857. flex:1;
  858. display: flex;
  859. flex-direction: column;
  860. overflow: hidden !important;
  861. .top-addCheckPage-title{
  862. line-height:60px;
  863. padding:0 20px;
  864. font-size:16px;
  865. border-bottom:1px solid #dedede;
  866. }
  867. .top-addCheckPage{
  868. padding:20px 20px 10px;
  869. .el-form-item-top{
  870. margin:10px 24px 20px 0;
  871. }
  872. }
  873. .center-addCheckPage{
  874. flex:1;
  875. display: flex;
  876. flex-direction: column;
  877. overflow-y: scroll;
  878. border-top:1px solid #dedede;
  879. border-bottom:1px solid #dedede;
  880. .form-list-for-box:nth-child(1){
  881. border:none;
  882. }
  883. .form-list-for-box{
  884. border-top:1px solid #dedede;
  885. .el-form-item-bottom{
  886. display: block;
  887. margin:20px 0 30px 0;
  888. .audio-box:nth-child(1){
  889. margin-top:0;
  890. }
  891. .audio-box{
  892. width:280px;
  893. height:40px;
  894. background: #B2DAFD;
  895. border-radius:4px;
  896. overflow: hidden;
  897. position: relative;
  898. margin-top:10px;
  899. .video-box{
  900. position: absolute;
  901. z-index: 10;
  902. width:280px;
  903. height:40px;
  904. }
  905. }
  906. .audio-text{
  907. color:#FF3131;
  908. margin:10px 0 0 0;
  909. line-height:12px;
  910. font-size:12px;
  911. }
  912. .el-form-item-bottom-up{
  913. display: flex;
  914. min-width:200px;
  915. .form-up-img-box{
  916. .up-img-for-box{
  917. display: inline-block;
  918. width:80px;
  919. height:80px;
  920. position: relative;
  921. margin:10px 10px 0 0;
  922. img{
  923. width:80px;
  924. height:80px;
  925. }
  926. .del-i{
  927. position: absolute;
  928. top:0;
  929. right:0;
  930. width:20px;
  931. height:20px;
  932. line-height:20px;
  933. background: rgba(0,0,0,0.4);
  934. color:#fff;
  935. font-size:14px;
  936. text-align: center;
  937. cursor:pointer;
  938. }
  939. .del-i:hover{
  940. background: #FF6666;
  941. }
  942. }
  943. .certificate-avatar-uploader{
  944. width:80px;
  945. height:80px;
  946. }
  947. }
  948. }
  949. }
  950. .text-span{
  951. margin-left:20px;
  952. color:#999;
  953. }
  954. .add-span{
  955. margin-left:10px;
  956. color:#0183FA;
  957. cursor:pointer;
  958. }
  959. }
  960. .del-button-p{
  961. width:300px;
  962. line-height:40px;
  963. text-align: center;
  964. border-radius:6px;
  965. border:1px dashed #999;
  966. font-size:14px;
  967. color:#999;
  968. cursor:pointer;
  969. margin:20px 0 30px 146px;
  970. }
  971. .add-button-p{
  972. width:300px;
  973. line-height:40px;
  974. text-align: center;
  975. border-radius:6px;
  976. border:1px dashed #999;
  977. font-size:14px;
  978. color:#999;
  979. cursor:pointer;
  980. margin:20px 0 30px 146px;
  981. }
  982. .add-button-p-one{
  983. margin-top:-17px;
  984. }
  985. }
  986. .bottom-addCheckPage{
  987. padding:20px;
  988. height:80px;
  989. display: flex;
  990. p:nth-child(1){
  991. flex:1;
  992. }
  993. p:nth-child(2){
  994. width:100px;
  995. }
  996. p:nth-child(3){
  997. width:100px;
  998. margin:0 20px;
  999. }
  1000. p:nth-child(4){
  1001. width:100px;
  1002. }
  1003. }
  1004. }
  1005. }
  1006. </style>
  1007. <style lang="scss">
  1008. .remind-dialog-box{
  1009. .el-dialog__body{
  1010. padding: 0 20px;
  1011. }
  1012. .for-box:nth-child(1){
  1013. border:none;
  1014. }
  1015. .for-max-box{
  1016. max-height:500px;
  1017. }
  1018. .for-box{
  1019. border-top:1px dashed #dedede;
  1020. *{
  1021. margin:0;
  1022. }
  1023. .for-min-box{
  1024. display: flex;
  1025. margin-bottom:20px;
  1026. .for-min-title{
  1027. width:80px;
  1028. text-align: right;
  1029. }
  1030. .for-min-text{
  1031. flex:1;
  1032. }
  1033. .for-img-box{
  1034. img{
  1035. display: inline-block;
  1036. width:60px;
  1037. height:60px;
  1038. border:1px solid #dedede;
  1039. overflow: hidden;
  1040. margin:0 10px 10px 0;
  1041. }
  1042. }
  1043. }
  1044. }
  1045. }
  1046. .center-addCheckPage{
  1047. video::-webkit-media-controls-enclosure{
  1048. background: #B2DAFD;
  1049. border-radius:4px;
  1050. overflow: hidden;
  1051. width:280px;
  1052. }
  1053. video::-webkit-media-controls-timeline {
  1054. width:130px;
  1055. margin-right:50px ;
  1056. }
  1057. }
  1058. </style>