unsubmittedInfo.vue 39 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094
  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. v-if="checkOptionList[index]"
  136. placeholder="请输入检查项名称或点击箭头选择"
  137. :before-filter="(value)=>filterRegion(value,index)"
  138. filterable
  139. clearable
  140. :show-all-levels="false"
  141. ref="cascaderGet"
  142. style="width:240px;"
  143. v-model="item.jcxId"
  144. :options="checkOptionList[index]"
  145. @change="(val)=>cascaderChange(val,index)"
  146. @blur="blurCheck(index)"
  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="form" :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. checkOptionList:[],
  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. };
  355. },
  356. created() {
  357. this.getListCheckOptionData();
  358. // this.selectDeptListUserDeptId();
  359. this.treeselect();
  360. },
  361. mounted(){
  362. this.getInfo();
  363. },
  364. methods: {
  365. remindOff(){
  366. this.remindOpen = false;
  367. },
  368. remindButton(){
  369. this.remindOpen = false;
  370. },
  371. blurCheck(index){
  372. let list = JSON.parse(JSON.stringify(this.checkOptionList));
  373. list[index] = JSON.parse(JSON.stringify(this.defaultCheckOptionList));
  374. this.$set(this,'checkOptionList',JSON.parse(JSON.stringify(list)))
  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. console.log("this.infoId",this.infoId)
  440. let obj = {
  441. id:this.infoId
  442. }
  443. recordDettailsList(obj).then( response => {
  444. let obj = JSON.parse(JSON.stringify(response.data))
  445. for(let i=0;i<obj.yhlist.length;i++){
  446. if(obj.yhlist[i].yhImg){
  447. obj.yhlist[i].yhImg = obj.yhlist[i].yhImg.split(",");
  448. }else{
  449. obj.yhlist[i].yhImg = [];
  450. }
  451. if(obj.yhlist[i].voice){
  452. obj.yhlist[i].voice = JSON.parse(obj.yhlist[i].voice);
  453. }else{
  454. obj.yhlist[i].voice = [];
  455. }
  456. for(let x=0;x<obj.yhlist[i].voice.length;x++){
  457. obj.yhlist[i].voice[x].url = window.location.href.split('://')[0]+'://' + process.env.VUE_APP_BASE_API + '/' + obj.yhlist[i].voice[x].url;
  458. }
  459. obj.yhlist[i].jcxId = obj.yhlist[i].jcxId.split(",");
  460. for(let o=0;o<obj.yhlist[i].jcxId.length;o++){
  461. if(obj.yhlist[i].jcxId[o] == ''){
  462. obj.yhlist[i].jcxId.splice(o,1);
  463. }else{
  464. obj.yhlist[i].jcxId[o] = parseInt(obj.yhlist[i].jcxId[o])
  465. }
  466. }
  467. }
  468. for(let i=0;i<obj.yhlist.length;i++){
  469. let newObj = {};
  470. if(obj.yhlist[i].isLingshi == 1){
  471. // let newObj = {
  472. // id:parseInt(obj.yhlist[i].jcxId+''),
  473. // name:obj.yhlist[i].jcxName,
  474. // }
  475. newObj.id=parseInt(obj.yhlist[i].jcxId+'')
  476. newObj.name=obj.yhlist[i].jcxName
  477. // console.log('list',list);
  478. // list.push(newObj);
  479. // self.$set(self,'checkOptionList',JSON.parse(JSON.stringify(list)));
  480. // list.push('self.checkOptionList',self.checkOptionList);
  481. self.temporaryIdList.push(obj.yhlist[i].jcxId);
  482. }
  483. if (newObj.id){
  484. self.getListCheckOption(newObj);
  485. }else{
  486. self.getListCheckOption();
  487. }
  488. }
  489. console.log(obj)
  490. let newOjb = obj.record;
  491. newOjb.detailsList = obj.yhlist;
  492. newOjb.jcDw = parseInt(newOjb.jcDw);
  493. this.fjNumber = obj.record.fjNumber;
  494. this.getSelectInfoByRoom(obj.record.fjNumber)
  495. this.$set(this,'form',newOjb);
  496. });
  497. },
  498. //返回
  499. backPage(){
  500. this.$parent.goPageInfo(1);
  501. },
  502. //删除隐患
  503. delDanger(index){
  504. this.checkOptionList.splice(index,1)
  505. this.form.detailsList.splice(index,1)
  506. this.$forceUpdate();
  507. },
  508. //新增隐患项
  509. addDanger(){
  510. if(!this.form.fjNumber){
  511. this.msgError("请先选择房间")
  512. return
  513. }
  514. if(this.form.detailsList.length>19){
  515. this.msgError("最多添加20个隐患")
  516. return
  517. }
  518. let obj = {
  519. yhImg:[],
  520. yhMs:"",
  521. voice:[],
  522. };
  523. this.form.detailsList.push(obj);
  524. this.getListCheckOption();
  525. },
  526. //上传
  527. handleAvatarSuccess(res, file, index) {
  528. // let url=window.location.href.split('://')[0]+'://' + process.env.VUE_APP_BASE_API+"/"+res.data.url;
  529. // this.form.detailsList[index].yhImg.push(url);
  530. // this.form.detailsList[index].yhImg.push(res.data.url);
  531. this.form.detailsList[index].yhImg.push(res.data.url);
  532. this.$forceUpdate()
  533. },
  534. beforeAvatarUpload(file) {
  535. let type = false;
  536. console.log('file',file);
  537. if (file.type == 'image/png' || file.type == 'image/jpeg' || file.type == 'image/gif') {
  538. type = true;
  539. }else{
  540. this.$message.error('只能上传png/jpeg/gif格式图片');
  541. type = false;
  542. }
  543. return type;
  544. },
  545. //删除
  546. imgDel(index,minIndex){
  547. this.form.detailsList[index].yhImg.splice(minIndex,1);
  548. },
  549. /** 查询安全检查列表 */
  550. getList() {
  551. this.loading = true;
  552. listCheckRecord({}).then( response => {
  553. this.checkRecordList = response.rows;
  554. this.total = response.total;
  555. this.loading = false;
  556. });
  557. },
  558. //发布按钮
  559. nameFormButton(type){
  560. if(type == 1){
  561. this.nameOpen = false;
  562. }else if(type == 2){
  563. this.$refs["nameForm"].validate(valid => {
  564. if (valid) {
  565. this.loading = true;
  566. this.formData.checkName = this.nameForm.checkName;
  567. checkRecordUpdate(this.formData).then( response => {
  568. this.msgSuccess('提交成功')
  569. this.loading = false;
  570. this.backPage();
  571. });
  572. }
  573. })
  574. }
  575. },
  576. /** 提交按钮 */
  577. submitForm(type) {
  578. let self = this;
  579. if(!this.form.detailsList[0]){
  580. this.msgError('请添加至少一个隐患项')
  581. return
  582. }
  583. this.$refs["form"].validate(valid => {
  584. if (valid) {
  585. let obj = JSON.parse(JSON.stringify(self.form));
  586. for(let i=0;i<obj.detailsList.length;i++){
  587. obj.detailsList[i].jcxId = obj.detailsList[i].jcxId + ',';
  588. obj.detailsList[i].yhImg = obj.detailsList[i].yhImg + '';
  589. obj.detailsList[i].voice = null;
  590. }
  591. obj.zgStatus = 0;
  592. if(type == 1){
  593. obj.isCg = 1;
  594. obj.isFabu = 0;
  595. }else if(type == 2){
  596. obj.isCg = 0;
  597. obj.isFabu = 1;
  598. }
  599. this.formData = JSON.parse(JSON.stringify(obj));
  600. if(type == 1){
  601. this.loading = true;
  602. checkRecordUpdate(this.formData).then( response => {
  603. this.msgSuccess('保存草稿成功')
  604. this.loading = false;
  605. this.backPage();
  606. });
  607. }else if(type == 2){
  608. this.nameForm.checkName = "";
  609. this.nameOpen = true;
  610. }
  611. }
  612. });
  613. },
  614. /** 下列人员-懒加载 */
  615. userSelectList(query) {
  616. // if (query !== '' && query.length>1) {
  617. // this.loading = true;
  618. // this.userSelectList.nickName=query;
  619. // selectListUser(this.userSelectList).then(response => {
  620. // this.optionsUser = response.data;
  621. // this.loading = false;
  622. // });
  623. // } else {
  624. // this.optionsUser = [];
  625. // }
  626. },
  627. //新增检查项
  628. dialogClick(index){
  629. this.openIndex = index;
  630. this.examinationForm = {};
  631. this.open = true;
  632. },
  633. //检查项联机触发
  634. handleChange() {
  635. },
  636. //检查项确定
  637. cascaderChange(val,index){
  638. let self = this;
  639. if(val[0]){
  640. let text = "";
  641. let cascaderList = this.$refs['cascaderGet'][index].getCheckedNodes()[0].pathLabels // 获取label值
  642. let nodesList = this.$refs['cascaderGet'][index].getCheckedNodes()[0].pathNodes // 获取label值
  643. let jcxSstkNum = nodesList[nodesList.length-1].data.code;
  644. let jcxSstkMs = "";
  645. for(let i=0;i<nodesList.length-1;i++){
  646. if(i == 0){
  647. jcxSstkMs = jcxSstkMs + nodesList[i].data.name
  648. }else{
  649. jcxSstkMs = jcxSstkMs + '-' + nodesList[i].data.name
  650. }
  651. }
  652. let num = 0;
  653. for(let i=0;i<self.temporaryIdList.length;i++){
  654. if(self.temporaryIdList[i] == val){
  655. num++
  656. }
  657. }
  658. if(num == 0){
  659. this.$set(this.form.detailsList[index],'isLingshi',0);
  660. }else{
  661. this.$set(this.form.detailsList[index],'isLingshi',1);
  662. }
  663. this.$set(this.form.detailsList[index],'jcxName',cascaderList[cascaderList.length-1]);
  664. this.$set(this.form.detailsList[index],'jcxSstkNum',jcxSstkNum);
  665. this.$set(this.form.detailsList[index],'jcxSstkMs',jcxSstkMs);
  666. }else{
  667. this.$set(this.form.detailsList[index],'isLingshi',0);
  668. this.$set(this.form.detailsList[index],'jcxName',"");
  669. this.$set(this.form.detailsList[index],'jcxSstkNum',"");
  670. this.$set(this.form.detailsList[index],'jcxSstkMs',"");
  671. }
  672. console.log('val',val);
  673. if(val[0]){
  674. let obj = {
  675. laboratoryId:this.form.laboratoryId,
  676. checkId:val[val.length-1],
  677. };
  678. hiddenDangerCount(obj).then( response => {
  679. this.$set(this.form.detailsList[index],'yhcount',response.data.yhcount);
  680. if(response.data.yhflg){
  681. for(let i=0;i<response.data.yhlist.length;i++){
  682. response.data.yhlist[i].yhImg = response.data.yhlist[i].yhImg.split(',')
  683. }
  684. this.$set(this,'remindList',response.data.yhlist);
  685. this.remindOpen = true;
  686. }
  687. });
  688. }else{
  689. this.$set(this.form.detailsList[index],'yhcount','');
  690. }
  691. },
  692. //新增检查项
  693. dialogSubmitForm(){
  694. this.$refs["form"].validate(valid => {
  695. if (valid) {
  696. let obj = {
  697. name:this.examinationForm.name,
  698. parentId:this.examinationForm.idList[this.examinationForm.idList.length-1]
  699. };
  700. addTempCheckOption(obj).then( response => {
  701. let list = JSON.parse(JSON.stringify(this.checkOptionList));
  702. let obj = {
  703. id:response.data.id,
  704. name:response.data.name,
  705. };
  706. console.log('this.openIndex',this.openIndex)
  707. console.log('list',list)
  708. console.log('list[this.openIndex]',list[this.openIndex])
  709. list[this.openIndex].push(obj);
  710. this.$set(this,'checkOptionList',JSON.parse(JSON.stringify(list)));
  711. this.defaultCheckOptionList = JSON.parse(JSON.stringify(list))
  712. console.log('111')
  713. this.temporaryIdList.push(response.data.id);
  714. this.$set(this.form.detailsList[this.openIndex],'jcxId',response.data.id);
  715. this.$set(this.form.detailsList[this.openIndex],'jcxName',response.data.name);
  716. this.$set(this.form.detailsList[this.openIndex],'isLingshi',1);
  717. this.msgSuccess("新增成功");
  718. this.open = false;
  719. });
  720. }
  721. });
  722. },
  723. //关闭检查项
  724. cancel(){
  725. this.open = false;
  726. },
  727. //实验室数据懒加载
  728. getSelectInfoByRoom(query){
  729. if (query !== '' && query.length>0) {
  730. this.loading = true;
  731. let obj = {
  732. room:query,
  733. }
  734. selectInfoByRoom(obj).then(response => {
  735. this.optionsSelect = response.data;
  736. this.loading = false;
  737. });
  738. } else {
  739. this.optionsSelect = [];
  740. }
  741. },
  742. //清除实验室选中
  743. delSelect(){
  744. },
  745. //实验室房间懒加载选中
  746. selectChange(name){
  747. let self = this;
  748. if(!this.fjNumber){
  749. if(name){
  750. for(let i=0;i<self.optionsSelect.length;i++){
  751. if(name == self.optionsSelect[i].room){
  752. self.$set(self,"fjNumber",self.optionsSelect[i].room)
  753. self.$set(self.form,"fjNumber",self.optionsSelect[i].room)
  754. self.$set(self.form,"deptName",self.optionsSelect[i].deptName)
  755. self.$set(self.form,"buildingId",self.optionsSelect[i].building)
  756. self.$set(self.form,"deptId",self.optionsSelect[i].deptId)
  757. self.$set(self.form,"laboratoryId",self.optionsSelect[i].id)
  758. self.$set(self.form,"buildingName",self.optionsSelect[i].buildName)
  759. self.$set(self.form,"laboratoryName",self.optionsSelect[i].name)
  760. self.$set(self.form,"fzrId",self.optionsSelect[i].userId)
  761. self.$set(self.form,"fzrName",self.optionsSelect[i].safeUserName)
  762. self.$set(self.form,"fzrLxfs",self.optionsSelect[i].safeUserPhone)
  763. }
  764. }
  765. }
  766. else{
  767. self.$set(self.form,"fjNumber","")
  768. self.$set(self.form,"buildingId","")
  769. self.$set(self.form,"deptName","")
  770. self.$set(self.form,"deptId","")
  771. self.$set(self.form,"buildingName","")
  772. self.$set(self.form,"laboratoryId","")
  773. self.$set(self.form,"laboratoryName","")
  774. self.$set(self.form,"fzrId","")
  775. self.$set(self.form,"fzrName","")
  776. self.$set(self.form,"fzrLxfs","")
  777. }
  778. }else{
  779. if(this.fjNumber != name){
  780. this.$confirm('更换实验室后需要从新选择检查项,是否确认更换实验室?', "警告", {
  781. confirmButtonText: "确定",
  782. cancelButtonText: "取消",
  783. type: "warning"
  784. }).then(function() {
  785. }).then(() => {
  786. console.log("确定")
  787. for(let i=0;i<self.optionsSelect.length;i++){
  788. if(name == self.optionsSelect[i].room){
  789. self.$set(self,"fjNumber",self.optionsSelect[i].room)
  790. self.$set(self.form,"fjNumber",self.optionsSelect[i].room)
  791. self.$set(self.form,"buildingId",self.optionsSelect[i].deptId)
  792. self.$set(self.form,"deptName",self.optionsSelect[i].deptName)
  793. self.$set(self.form,"deptId",self.optionsSelect[i].id)
  794. self.$set(self.form,"buildingName",self.optionsSelect[i].buildName)
  795. self.$set(self.form,"laboratoryId",self.optionsSelect[i].building)
  796. self.$set(self.form,"laboratoryName",self.optionsSelect[i].name)
  797. self.$set(self.form,"fzrId",self.optionsSelect[i].userId)
  798. self.$set(self.form,"fzrName",self.optionsSelect[i].safeUserName)
  799. self.$set(self.form,"fzrLxfs",self.optionsSelect[i].safeUserPhone)
  800. self.$set(self.form,"detailsList",[])
  801. }
  802. }
  803. }).catch(() => {
  804. console.log("取消")
  805. self.$set(self.form,"fjNumber",self.fjNumber)
  806. this.getSelectInfoByRoom(self.fjNumber)
  807. });
  808. }
  809. }
  810. },
  811. //获取检查项
  812. getListCheckOption(data) {
  813. let newObj = {
  814. level:4,
  815. }
  816. listCheckOption(newObj).then( response => {
  817. let list = this.getTreeData(response.data);
  818. if(data){
  819. list.push(data);
  820. }
  821. this.checkOptionList.push(JSON.parse(JSON.stringify(list)));
  822. console.log('this.checkOptionList',this.checkOptionList)
  823. });
  824. this.$forceUpdate();
  825. },
  826. getListCheckOptionData(){
  827. let newObj = {
  828. level:4,
  829. }
  830. listCheckOption(newObj).then( response => {
  831. this.defaultCheckOptionList = this.getTreeData(response.data);
  832. this.getListCheckOptionTwo();
  833. // let list = JSON.parse(JSON.stringify(this.checkOptionList));
  834. // list[index] = this.getTreeData(response.data);
  835. // this.$set(this,'checkOptionList',JSON.parse(JSON.stringify(list)))
  836. // this.$forceUpdate();
  837. });
  838. },
  839. //获取检查项
  840. getListCheckOptionOne(data,index) {
  841. let newObj = {
  842. level:4,
  843. searchValue:data
  844. }
  845. listCheckOption(newObj).then( response => {
  846. let list = JSON.parse(JSON.stringify(this.checkOptionList));
  847. list[index] = this.getTreeData(response.data);
  848. if(list[index][0]){
  849. this.$set(this,'checkOptionList',JSON.parse(JSON.stringify(list)))
  850. this.$forceUpdate()
  851. }else{
  852. this.msgError('未找到相关检查项')
  853. }
  854. });
  855. },
  856. getListCheckOptionTwo(){
  857. let newObj = {
  858. level:3,
  859. }
  860. listCheckOption(newObj).then( response => {
  861. let list = this.getTreeData(response.data);
  862. this.checkOptionListExamination = JSON.parse(JSON.stringify(list));
  863. });
  864. },
  865. getTreeData(data){
  866. for(var i=0;i<data.length>0;i++){
  867. if(data[i].children == null||data[i].children.length<=0){
  868. // children若为空数组,则将children设为undefined
  869. data[i].children = undefined;
  870. }else {
  871. // children若不为空数组,则继续 递归调用 本方法
  872. this.getTreeData(data[i].children);
  873. }
  874. }
  875. return data;
  876. },
  877. }
  878. }
  879. </script>
  880. <style scoped lang="scss">
  881. .unsubmittedInfo{
  882. flex:1;
  883. display: flex;
  884. flex-direction: column;
  885. overflow: hidden !important;
  886. .addCheckPage-min{
  887. flex:1;
  888. display: flex;
  889. flex-direction: column;
  890. overflow: hidden !important;
  891. .top-addCheckPage-title{
  892. line-height:60px;
  893. padding:0 20px;
  894. font-size:16px;
  895. border-bottom:1px solid #dedede;
  896. }
  897. .top-addCheckPage{
  898. padding:20px 20px 10px;
  899. .el-form-item-top{
  900. margin:10px 24px 20px 0;
  901. }
  902. }
  903. .center-addCheckPage{
  904. flex:1;
  905. display: flex;
  906. flex-direction: column;
  907. overflow-y: scroll;
  908. border-top:1px solid #dedede;
  909. border-bottom:1px solid #dedede;
  910. .form-list-for-box:nth-child(1){
  911. border:none;
  912. }
  913. .form-list-for-box{
  914. border-top:1px solid #dedede;
  915. .el-form-item-bottom{
  916. display: block;
  917. margin:20px 0 30px 0;
  918. .audio-box:nth-child(1){
  919. margin-top:0;
  920. }
  921. .audio-box{
  922. width:280px;
  923. height:40px;
  924. background: #B2DAFD;
  925. border-radius:4px;
  926. overflow: hidden;
  927. position: relative;
  928. margin-top:10px;
  929. .video-box{
  930. position: absolute;
  931. z-index: 10;
  932. width:280px;
  933. height:40px;
  934. }
  935. }
  936. .audio-text{
  937. color:#FF3131;
  938. margin:10px 0 0 0;
  939. line-height:12px;
  940. font-size:12px;
  941. }
  942. .el-form-item-bottom-up{
  943. display: flex;
  944. min-width:200px;
  945. .form-up-img-box{
  946. .up-img-for-box{
  947. display: inline-block;
  948. width:80px;
  949. height:80px;
  950. position: relative;
  951. margin:10px 10px 0 0;
  952. img{
  953. width:80px;
  954. height:80px;
  955. }
  956. .del-i{
  957. position: absolute;
  958. top:0;
  959. right:0;
  960. width:20px;
  961. height:20px;
  962. line-height:20px;
  963. background: rgba(0,0,0,0.4);
  964. color:#fff;
  965. font-size:14px;
  966. text-align: center;
  967. cursor:pointer;
  968. }
  969. .del-i:hover{
  970. background: #FF6666;
  971. }
  972. }
  973. .certificate-avatar-uploader{
  974. width:80px;
  975. height:80px;
  976. }
  977. }
  978. }
  979. }
  980. .text-span{
  981. margin-left:20px;
  982. color:#999;
  983. }
  984. .add-span{
  985. margin-left:10px;
  986. color:#0183FA;
  987. cursor:pointer;
  988. }
  989. }
  990. .del-button-p{
  991. width:300px;
  992. line-height:40px;
  993. text-align: center;
  994. border-radius:6px;
  995. border:1px dashed #999;
  996. font-size:14px;
  997. color:#999;
  998. cursor:pointer;
  999. margin:20px 0 30px 146px;
  1000. }
  1001. .add-button-p{
  1002. width:300px;
  1003. line-height:40px;
  1004. text-align: center;
  1005. border-radius:6px;
  1006. border:1px dashed #999;
  1007. font-size:14px;
  1008. color:#999;
  1009. cursor:pointer;
  1010. margin:20px 0 30px 146px;
  1011. }
  1012. .add-button-p-one{
  1013. margin-top:-17px;
  1014. }
  1015. }
  1016. .bottom-addCheckPage{
  1017. padding:20px;
  1018. height:80px;
  1019. display: flex;
  1020. p:nth-child(1){
  1021. flex:1;
  1022. }
  1023. p:nth-child(2){
  1024. width:100px;
  1025. }
  1026. p:nth-child(3){
  1027. width:100px;
  1028. margin:0 20px;
  1029. }
  1030. p:nth-child(4){
  1031. width:100px;
  1032. }
  1033. }
  1034. }
  1035. }
  1036. </style>
  1037. <style lang="scss">
  1038. .remind-dialog-box{
  1039. .el-dialog__body{
  1040. padding: 0 20px;
  1041. }
  1042. .for-box:nth-child(1){
  1043. border:none;
  1044. }
  1045. .for-max-box{
  1046. max-height:500px;
  1047. }
  1048. .for-box{
  1049. border-top:1px dashed #dedede;
  1050. *{
  1051. margin:0;
  1052. }
  1053. .for-min-box{
  1054. display: flex;
  1055. margin-bottom:20px;
  1056. .for-min-title{
  1057. width:80px;
  1058. text-align: right;
  1059. }
  1060. .for-min-text{
  1061. flex:1;
  1062. }
  1063. .for-img-box{
  1064. img{
  1065. display: inline-block;
  1066. width:60px;
  1067. height:60px;
  1068. border:1px solid #dedede;
  1069. overflow: hidden;
  1070. margin:0 10px 10px 0;
  1071. }
  1072. }
  1073. }
  1074. }
  1075. }
  1076. .center-addCheckPage{
  1077. video::-webkit-media-controls-enclosure{
  1078. background: #B2DAFD;
  1079. border-radius:4px;
  1080. overflow: hidden;
  1081. width:280px;
  1082. }
  1083. video::-webkit-media-controls-timeline {
  1084. width:130px;
  1085. margin-right:50px ;
  1086. }
  1087. }
  1088. </style>