unsubmittedInfo.vue 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068
  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: this.uploadUrl(), // 上传的图片服务器地址
  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. //临时存储隐患信息ID
  285. hiddenDangerIdList:[],
  286. // 表单校验
  287. rules: {
  288. fjNumber: [
  289. { required: true, message: "请输入实验室房间号", trigger: "blur" },
  290. { required: true, message: "请输入实验室房间号", validator: this.spaceJudgment, trigger: "blur" }
  291. ],
  292. buildingName: [
  293. { required: true, message: "请选择房间自动匹配实验楼", trigger: "blur" }
  294. ],
  295. laboratoryName: [
  296. { required: true, message: "请选择房间自动匹配实验室", trigger: "blur" }
  297. ],
  298. fzrName: [
  299. { required: true, message: "请选择房间自动匹配负责人", trigger: "blur" }
  300. ],
  301. zgjzTime: [
  302. { required: true, message: "选择整改截止时间", trigger: "blur" }
  303. ],
  304. zgType: [
  305. { required: true, message: "请选择整改类型", trigger: "blur" }
  306. ],
  307. jcDw: [
  308. { required: true, message: "请选择检查单位", trigger: "blur" }
  309. ],
  310. yhMs: [
  311. { required: true, message: "请输入隐患描述", trigger: "blur" },
  312. { required: true, message: "请输入隐患描述", validator: this.spaceJudgment, trigger: "blur" }
  313. ],
  314. // yhImg: [
  315. // { required: true, message: "请上传隐患照片", trigger: "blur" }
  316. // ],
  317. jcxId: [
  318. { required: true, message: "请选择检项", trigger: "blur" }
  319. ],
  320. name: [
  321. { required: true, message: "请输入检查项名称", trigger: "blur" }
  322. ],
  323. checkName: [
  324. { required: true, message: "请输入检查名称", trigger: "blur" }
  325. ],
  326. idList: [
  327. { required: true, message: "请选择目录", trigger: "blur" }
  328. ],
  329. },
  330. // 检查先搜索列表
  331. optionsUser:[],
  332. open:false,
  333. openIndex:"",
  334. //检查项联机
  335. examinationForm:{
  336. laboratoryName:""
  337. },
  338. //检查项联机搜索
  339. options:[],
  340. //检查项
  341. defaultCheckOptionList:[],
  342. defaultCheckOption:[],
  343. checkOptionListExamination:[],
  344. //临时数据组
  345. temporaryIdList:[],
  346. //检查单位
  347. inspectionUnitArrayData:[],
  348. //提醒页面开关
  349. remindOpen:false,
  350. remindList:[],
  351. nameOpen:false,
  352. nameForm:{
  353. checkName:"",
  354. },
  355. formData:{},
  356. addList:[],
  357. };
  358. },
  359. created() {
  360. this.getListCheckOptionData();
  361. this.getListCheckOptionTwo();
  362. // this.selectDeptListUserDeptId();
  363. this.treeselect();
  364. },
  365. mounted(){
  366. // this.getInfo();
  367. },
  368. methods: {
  369. remindOff(){
  370. this.remindOpen = false;
  371. },
  372. remindButton(){
  373. this.remindOpen = false;
  374. },
  375. focusClick(){
  376. this.$set(this,'defaultCheckOptionList',JSON.parse(JSON.stringify(this.defaultCheckOption.concat(this.addList))));
  377. },
  378. filterRegion(value,index){
  379. this.getListCheckOptionOne(value,index);
  380. return false
  381. },
  382. jcDwChange(val){
  383. let self = this;
  384. for(let i=0;i<self.inspectionUnitArrayData.length;i++){
  385. if(val == self.inspectionUnitArrayData[i].id){
  386. this.form.jcDwName = self.inspectionUnitArrayData[i].label;
  387. }
  388. }
  389. },
  390. //根据用户获取对应检查单位列表
  391. selectDeptListUserDeptId(){
  392. selectDeptListUserDeptId().then( data => {
  393. this.inspectionUnitArrayData = data.data;
  394. })
  395. },
  396. treeselect(){
  397. treeselect().then( data => {
  398. // let list = [];
  399. // for(let i=0;i<data.data[0].children.length;i++){
  400. // let obj = {
  401. // id:data.data[0].children[i].id,
  402. // label:data.data[0].children[i].label,
  403. // }
  404. // list.push(obj);
  405. // for(let o=0;o<data.data[0].children[i].children.length;o++){
  406. // let obj = {
  407. // id:data.data[0].children[i].children[o].id,
  408. // label:data.data[0].children[i].children[o].label,
  409. // }
  410. // list.push(obj);
  411. // }
  412. // }
  413. // this.inspectionUnitArrayData = list;
  414. this.inspectionUnitArrayData = this.toArray(data.data);
  415. });
  416. },
  417. toArray(data){
  418. let list = [];
  419. let newList = JSON.parse(JSON.stringify(data));
  420. for(let i=0;i<newList.length;i++){
  421. pushNode(newList[i]);
  422. }
  423. function pushNode(node){
  424. if(node.children){
  425. for (let nodeItem of node.children){
  426. pushNode(nodeItem)
  427. }
  428. delete node.children;
  429. list.push(node)
  430. }else{
  431. if(node.children){
  432. delete node.children
  433. }
  434. list.push(node)
  435. }
  436. }
  437. return list
  438. },
  439. getInfo(){
  440. let self = this;
  441. let obj = {
  442. id:this.infoId
  443. }
  444. recordDettailsList(obj).then( response => {
  445. let obj = JSON.parse(JSON.stringify(response.data))
  446. for(let i=0;i<obj.yhlist.length;i++){
  447. if(obj.yhlist[i].yhImg){
  448. obj.yhlist[i].yhImg = obj.yhlist[i].yhImg.split(",");
  449. }else{
  450. obj.yhlist[i].yhImg = [];
  451. }
  452. if(obj.yhlist[i].voice){
  453. obj.yhlist[i].voice = JSON.parse(obj.yhlist[i].voice);
  454. }else{
  455. obj.yhlist[i].voice = [];
  456. }
  457. for(let x=0;x<obj.yhlist[i].voice.length;x++){
  458. obj.yhlist[i].voice[x].url = window.location.href.split('://')[0]+'://' + this.judgmentNetworkReturnAddress() + '/' + obj.yhlist[i].voice[x].url;
  459. }
  460. obj.yhlist[i].jcxId = obj.yhlist[i].jcxId.split(",");
  461. for(let o=0;o<obj.yhlist[i].jcxId.length;o++){
  462. if(obj.yhlist[i].jcxId[o] == ''){
  463. obj.yhlist[i].jcxId.splice(o,1);
  464. }else{
  465. obj.yhlist[i].jcxId[o] = parseInt(obj.yhlist[i].jcxId[o])
  466. }
  467. }
  468. }
  469. for(let i=0;i<obj.yhlist.length;i++){
  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. let num = 0;
  476. for(let o=0;o<self.defaultCheckOptionList.length;o++){
  477. if(self.defaultCheckOptionList[o].id == newObj.id){
  478. num++
  479. }
  480. }
  481. if(num == 0){
  482. self.addList.push(newObj);
  483. let list = JSON.parse(JSON.stringify(this.defaultCheckOptionList));
  484. list = list.concat(this.addList);
  485. this.$set(this,'defaultCheckOptionList',JSON.parse(JSON.stringify(list)))
  486. }
  487. self.temporaryIdList.push(obj.yhlist[i].jcxId);
  488. }
  489. }
  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. this.$forceUpdate();
  497. });
  498. },
  499. //返回
  500. backPage(){
  501. this.$parent.goPageInfo(1);
  502. },
  503. //删除隐患
  504. delDanger(index){
  505. this.hiddenDangerIdList.push(this.form.detailsList[index].id)
  506. this.form.detailsList.splice(index,1)
  507. this.$forceUpdate();
  508. },
  509. //新增隐患项
  510. addDanger(){
  511. if(!this.form.fjNumber){
  512. this.msgError("请先选择房间")
  513. return
  514. }
  515. if(this.form.detailsList.length>19){
  516. this.msgError("最多添加20个隐患")
  517. return
  518. }
  519. let obj = {
  520. yhImg:[],
  521. yhMs:"",
  522. voice:[],
  523. };
  524. this.form.detailsList.push(obj);
  525. },
  526. //上传
  527. handleAvatarSuccess(res, file, index) {
  528. // let url=window.location.href.split('://')[0]+'://' + this.judgmentNetworkReturnAddress()+"/"+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. obj.ids=this.hiddenDangerIdList
  593. if(type == 1){
  594. obj.isCg = 1;
  595. obj.isFabu = 0;
  596. }else if(type == 2){
  597. obj.isCg = 0;
  598. obj.isFabu = 1;
  599. }
  600. this.formData = JSON.parse(JSON.stringify(obj));
  601. if(type == 1){
  602. this.loading = true;
  603. checkRecordUpdate(this.formData).then( response => {
  604. this.msgSuccess('保存草稿成功')
  605. this.loading = false;
  606. this.backPage();
  607. });
  608. }else if(type == 2){
  609. this.nameForm.checkName = "";
  610. this.nameOpen = true;
  611. }
  612. }
  613. });
  614. },
  615. /** 下列人员-懒加载 */
  616. userSelectList(query) {
  617. // if (query !== '' && query.length>1) {
  618. // this.loading = true;
  619. // this.userSelectList.nickName=query;
  620. // selectListUser(this.userSelectList).then(response => {
  621. // this.optionsUser = response.data;
  622. // this.loading = false;
  623. // });
  624. // } else {
  625. // this.optionsUser = [];
  626. // }
  627. },
  628. //新增检查项
  629. dialogClick(index){
  630. this.openIndex = index;
  631. this.examinationForm = {};
  632. this.open = true;
  633. },
  634. //检查项联机触发
  635. handleChange() {
  636. },
  637. //检查项确定
  638. cascaderChange(val,index){
  639. let self = this;
  640. if(val[0]){
  641. let text = "";
  642. let cascaderList = this.$refs['cascaderGet'][index].getCheckedNodes()[0].pathLabels // 获取label值
  643. let nodesList = this.$refs['cascaderGet'][index].getCheckedNodes()[0].pathNodes // 获取label值
  644. let jcxSstkNum = nodesList[nodesList.length-1].data.code;
  645. let jcxSstkMs = "";
  646. for(let i=0;i<nodesList.length-1;i++){
  647. if(i == 0){
  648. jcxSstkMs = jcxSstkMs + nodesList[i].data.name
  649. }else{
  650. jcxSstkMs = jcxSstkMs + '-' + nodesList[i].data.name
  651. }
  652. }
  653. let num = 0;
  654. for(let i=0;i<self.temporaryIdList.length;i++){
  655. if(self.temporaryIdList[i] == val){
  656. num++
  657. }
  658. }
  659. if(num == 0){
  660. this.$set(this.form.detailsList[index],'isLingshi',0);
  661. }else{
  662. this.$set(this.form.detailsList[index],'isLingshi',1);
  663. }
  664. this.$set(this.form.detailsList[index],'jcxName',cascaderList[cascaderList.length-1]);
  665. this.$set(this.form.detailsList[index],'jcxSstkNum',jcxSstkNum);
  666. this.$set(this.form.detailsList[index],'jcxSstkMs',jcxSstkMs);
  667. }else{
  668. this.$set(this.form.detailsList[index],'isLingshi',0);
  669. this.$set(this.form.detailsList[index],'jcxName',"");
  670. this.$set(this.form.detailsList[index],'jcxSstkNum',"");
  671. this.$set(this.form.detailsList[index],'jcxSstkMs',"");
  672. }
  673. console.log('val',val);
  674. if(val[0]){
  675. let obj = {
  676. laboratoryId:this.form.laboratoryId,
  677. checkId:val[val.length-1],
  678. };
  679. hiddenDangerCount(obj).then( response => {
  680. this.$set(this.form.detailsList[index],'yhcount',response.data.yhcount);
  681. if(response.data.yhflg){
  682. for(let i=0;i<response.data.yhlist.length;i++){
  683. response.data.yhlist[i].yhImg = response.data.yhlist[i].yhImg.split(',')
  684. }
  685. this.$set(this,'remindList',response.data.yhlist);
  686. this.remindOpen = true;
  687. }
  688. });
  689. }else{
  690. this.$set(this.form.detailsList[index],'yhcount','');
  691. }
  692. },
  693. //新增检查项
  694. dialogSubmitForm(){
  695. this.$refs["addForm"].validate(valid => {
  696. if (valid) {
  697. let obj = {
  698. name:this.examinationForm.name,
  699. parentId:this.examinationForm.idList[this.examinationForm.idList.length-1]
  700. };
  701. addTempCheckOption(obj).then( response => {
  702. let obj = {
  703. id:response.data.id,
  704. name:response.data.name,
  705. };
  706. this.defaultCheckOptionList.push(obj);
  707. this.addList.push(obj);
  708. this.temporaryIdList.push(response.data.id);
  709. this.$set(this.form.detailsList[this.openIndex],'jcxId',response.data.id);
  710. this.$set(this.form.detailsList[this.openIndex],'jcxName',response.data.name);
  711. this.$set(this.form.detailsList[this.openIndex],'isLingshi',1);
  712. this.msgSuccess("新增成功");
  713. this.open = false;
  714. });
  715. }
  716. });
  717. },
  718. //关闭检查项
  719. cancel(){
  720. this.open = false;
  721. },
  722. //实验室数据懒加载
  723. getSelectInfoByRoom(query){
  724. if (query !== '' && query.length>0) {
  725. this.loading = true;
  726. let obj = {
  727. room:query,
  728. }
  729. selectInfoByRoom(obj).then(response => {
  730. this.optionsSelect = response.data;
  731. this.loading = false;
  732. });
  733. } else {
  734. this.optionsSelect = [];
  735. }
  736. },
  737. //实验室房间懒加载选中
  738. selectChange(name){
  739. let self = this;
  740. if(!this.fjNumber){
  741. if(name){
  742. for(let i=0;i<self.optionsSelect.length;i++){
  743. if(name == self.optionsSelect[i].room){
  744. self.$set(self,"fjNumber",self.optionsSelect[i].room)
  745. self.$set(self.form,"fjNumber",self.optionsSelect[i].room)
  746. self.$set(self.form,"deptName",self.optionsSelect[i].deptName)
  747. self.$set(self.form,"buildingId",self.optionsSelect[i].building)
  748. self.$set(self.form,"deptId",self.optionsSelect[i].deptId)
  749. self.$set(self.form,"laboratoryId",self.optionsSelect[i].id)
  750. self.$set(self.form,"buildingName",self.optionsSelect[i].buildName)
  751. self.$set(self.form,"laboratoryName",self.optionsSelect[i].name)
  752. self.$set(self.form,"fzrId",self.optionsSelect[i].userId)
  753. self.$set(self.form,"fzrName",self.optionsSelect[i].safeUserName)
  754. self.$set(self.form,"fzrLxfs",self.optionsSelect[i].safeUserPhone)
  755. }
  756. }
  757. }
  758. else{
  759. self.$set(self.form,"fjNumber","")
  760. self.$set(self.form,"buildingId","")
  761. self.$set(self.form,"deptName","")
  762. self.$set(self.form,"deptId","")
  763. self.$set(self.form,"buildingName","")
  764. self.$set(self.form,"laboratoryId","")
  765. self.$set(self.form,"laboratoryName","")
  766. self.$set(self.form,"fzrId","")
  767. self.$set(self.form,"fzrName","")
  768. self.$set(self.form,"fzrLxfs","")
  769. }
  770. }else{
  771. if(this.fjNumber != name){
  772. this.$confirm('更换实验室后需要从新选择检查项,是否确认更换实验室?', "警告", {
  773. confirmButtonText: "确定",
  774. cancelButtonText: "取消",
  775. type: "warning"
  776. }).then(function() {
  777. }).then(() => {
  778. console.log("确定")
  779. for(let i=0;i<self.optionsSelect.length;i++){
  780. if(name == self.optionsSelect[i].room){
  781. self.$set(self,"fjNumber",self.optionsSelect[i].room)
  782. self.$set(self.form,"fjNumber",self.optionsSelect[i].room)
  783. self.$set(self.form,"buildingId",self.optionsSelect[i].deptId)
  784. self.$set(self.form,"deptName",self.optionsSelect[i].deptName)
  785. self.$set(self.form,"deptId",self.optionsSelect[i].id)
  786. self.$set(self.form,"buildingName",self.optionsSelect[i].buildName)
  787. self.$set(self.form,"laboratoryId",self.optionsSelect[i].building)
  788. self.$set(self.form,"laboratoryName",self.optionsSelect[i].name)
  789. self.$set(self.form,"fzrId",self.optionsSelect[i].userId)
  790. self.$set(self.form,"fzrName",self.optionsSelect[i].safeUserName)
  791. self.$set(self.form,"fzrLxfs",self.optionsSelect[i].safeUserPhone)
  792. self.$set(self.form,"detailsList",[])
  793. }
  794. }
  795. }).catch(() => {
  796. console.log("取消")
  797. self.$set(self.form,"fjNumber",self.fjNumber)
  798. this.getSelectInfoByRoom(self.fjNumber)
  799. });
  800. }
  801. }
  802. },
  803. getListCheckOptionData(){
  804. let newObj = {
  805. level:4,
  806. }
  807. listCheckOption(newObj).then( response => {
  808. this.defaultCheckOptionList = this.getTreeData(response.data);
  809. this.$set(this,'defaultCheckOption',this.defaultCheckOptionList);
  810. this.getInfo();
  811. });
  812. },
  813. //获取检查项
  814. getListCheckOptionOne(data,index) {
  815. let newObj = {
  816. level:4,
  817. searchValue:data
  818. }
  819. listCheckOption(newObj).then( response => {
  820. let list = this.getTreeData(response.data);
  821. if(list[0]){
  822. list = list.concat(this.addList);
  823. this.$set(this,'defaultCheckOptionList',JSON.parse(JSON.stringify(list)))
  824. this.$forceUpdate()
  825. }else{
  826. this.msgError('未找到相关检查项')
  827. }
  828. });
  829. },
  830. getListCheckOptionTwo(){
  831. let newObj = {
  832. level:3,
  833. }
  834. listCheckOption(newObj).then( response => {
  835. let list = this.getTreeData(response.data);
  836. this.checkOptionListExamination = JSON.parse(JSON.stringify(list));
  837. });
  838. },
  839. getTreeData(data){
  840. for(var i=0;i<data.length>0;i++){
  841. if(data[i].children == null||data[i].children.length<=0){
  842. // children若为空数组,则将children设为undefined
  843. data[i].children = undefined;
  844. }else {
  845. // children若不为空数组,则继续 递归调用 本方法
  846. this.getTreeData(data[i].children);
  847. }
  848. }
  849. return data;
  850. },
  851. }
  852. }
  853. </script>
  854. <style scoped lang="scss">
  855. .unsubmittedInfo{
  856. flex:1;
  857. display: flex;
  858. flex-direction: column;
  859. overflow: hidden !important;
  860. .addCheckPage-min{
  861. flex:1;
  862. display: flex;
  863. flex-direction: column;
  864. overflow: hidden !important;
  865. .top-addCheckPage-title{
  866. line-height:60px;
  867. padding:0 20px;
  868. font-size:16px;
  869. border-bottom:1px solid #dedede;
  870. }
  871. .top-addCheckPage{
  872. padding:20px 20px 10px;
  873. .el-form-item-top{
  874. margin:10px 24px 20px 0;
  875. }
  876. }
  877. .center-addCheckPage{
  878. flex:1;
  879. display: flex;
  880. flex-direction: column;
  881. overflow-y: scroll;
  882. border-top:1px solid #dedede;
  883. border-bottom:1px solid #dedede;
  884. .form-list-for-box:nth-child(1){
  885. border:none;
  886. }
  887. .form-list-for-box{
  888. border-top:1px solid #dedede;
  889. .el-form-item-bottom{
  890. display: block;
  891. margin:20px 0 30px 0;
  892. .audio-box:nth-child(1){
  893. margin-top:0;
  894. }
  895. .audio-box{
  896. width:280px;
  897. height:40px;
  898. background: #B2DAFD;
  899. border-radius:4px;
  900. overflow: hidden;
  901. position: relative;
  902. margin-top:10px;
  903. .video-box{
  904. position: absolute;
  905. z-index: 10;
  906. width:280px;
  907. height:40px;
  908. }
  909. }
  910. .audio-text{
  911. color:#FF3131;
  912. margin:10px 0 0 0;
  913. line-height:12px;
  914. font-size:12px;
  915. }
  916. .el-form-item-bottom-up{
  917. display: flex;
  918. min-width:200px;
  919. .form-up-img-box{
  920. .up-img-for-box{
  921. display: inline-block;
  922. width:80px;
  923. height:80px;
  924. position: relative;
  925. margin:10px 10px 0 0;
  926. img{
  927. width:80px;
  928. height:80px;
  929. }
  930. .del-i{
  931. position: absolute;
  932. top:0;
  933. right:0;
  934. width:20px;
  935. height:20px;
  936. line-height:20px;
  937. background: rgba(0,0,0,0.4);
  938. color:#fff;
  939. font-size:14px;
  940. text-align: center;
  941. cursor:pointer;
  942. }
  943. .del-i:hover{
  944. background: #FF6666;
  945. }
  946. }
  947. .certificate-avatar-uploader{
  948. width:80px;
  949. height:80px;
  950. }
  951. }
  952. }
  953. }
  954. .text-span{
  955. margin-left:20px;
  956. color:#999;
  957. }
  958. .add-span{
  959. margin-left:10px;
  960. color:#0183FA;
  961. cursor:pointer;
  962. }
  963. }
  964. .del-button-p{
  965. width:300px;
  966. line-height:40px;
  967. text-align: center;
  968. border-radius:6px;
  969. border:1px dashed #999;
  970. font-size:14px;
  971. color:#999;
  972. cursor:pointer;
  973. margin:20px 0 30px 146px;
  974. }
  975. .add-button-p{
  976. width:300px;
  977. line-height:40px;
  978. text-align: center;
  979. border-radius:6px;
  980. border:1px dashed #999;
  981. font-size:14px;
  982. color:#999;
  983. cursor:pointer;
  984. margin:20px 0 30px 146px;
  985. }
  986. .add-button-p-one{
  987. margin-top:-17px;
  988. }
  989. }
  990. .bottom-addCheckPage{
  991. padding:20px;
  992. height:80px;
  993. display: flex;
  994. p:nth-child(1){
  995. flex:1;
  996. }
  997. p:nth-child(2){
  998. width:100px;
  999. }
  1000. p:nth-child(3){
  1001. width:100px;
  1002. margin:0 20px;
  1003. }
  1004. p:nth-child(4){
  1005. width:100px;
  1006. }
  1007. }
  1008. }
  1009. }
  1010. </style>
  1011. <style lang="scss">
  1012. .remind-dialog-box{
  1013. .el-dialog__body{
  1014. padding: 0 20px;
  1015. }
  1016. .for-box:nth-child(1){
  1017. border:none;
  1018. }
  1019. .for-max-box{
  1020. max-height:500px;
  1021. }
  1022. .for-box{
  1023. border-top:1px dashed #dedede;
  1024. *{
  1025. margin:0;
  1026. }
  1027. .for-min-box{
  1028. display: flex;
  1029. margin-bottom:20px;
  1030. .for-min-title{
  1031. width:80px;
  1032. text-align: right;
  1033. }
  1034. .for-min-text{
  1035. flex:1;
  1036. }
  1037. .for-img-box{
  1038. img{
  1039. display: inline-block;
  1040. width:60px;
  1041. height:60px;
  1042. border:1px solid #dedede;
  1043. overflow: hidden;
  1044. margin:0 10px 10px 0;
  1045. }
  1046. }
  1047. }
  1048. }
  1049. }
  1050. .center-addCheckPage{
  1051. video::-webkit-media-controls-enclosure{
  1052. background: #B2DAFD;
  1053. border-radius:4px;
  1054. overflow: hidden;
  1055. width:280px;
  1056. }
  1057. video::-webkit-media-controls-timeline {
  1058. width:130px;
  1059. margin-right:50px ;
  1060. }
  1061. }
  1062. </style>