unsubmittedInfo.vue 38 KB

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