CheckRecordInfoUp.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456
  1. <!--问题整改详情提交-->
  2. <template>
  3. <div class="CheckRecordInfoUp">
  4. <div class="CheckRecordInfoUp-page scrollbar-box">
  5. <div class="center-for-box" v-for="(item,index) in infoData" :key="index">
  6. <p class="position-left-p" v-if="item.isZg==0||item.isZg==1">{{item.isZg == 0?'完成整改':(item.isZg == 1?'暂无法整改':'')}}</p>
  7. <div class="center-for-top-box">
  8. <div class="center-for-left-box">
  9. <p class="for-title-p">{{item.jcxName}}</p>
  10. <div class="for-text-box" v-if="item.isLingshi == 1">
  11. <p>条款:</p>
  12. <p>临时检查项</p>
  13. </div>
  14. <div class="for-text-box" v-if="item.isLingshi == 0">
  15. <p>条款:</p>
  16. <p>{{item.allCheckOptionName}}</p>
  17. </div>
  18. <div class="for-text-box">
  19. <p>隐患描述:</p>
  20. <p>{{item.yhMs}}</p>
  21. </div>
  22. <div class="for-text-box" v-if="item.zgMs">
  23. <p>整改描述:</p>
  24. <p>{{item.zgMs}}</p>
  25. </div>
  26. </div>
  27. <div class="center-for-right-box">
  28. <div class="for-img-max-box">
  29. <p class="for-img-max-title-p" v-if="!item.yhImg[0]">未上传隐患照片</p>
  30. <p class="for-img-max-title-p" v-if="item.yhImg[0]">整改前照片:</p>
  31. <div class="for-img-box">
  32. <img v-for="(itemImg,imgIndex) in item.yhImg" :key="imgIndex" :src="itemImg" @click="lockImg(1,itemImg)">
  33. </div>
  34. </div>
  35. <div class="for-img-max-box" v-if="item.isZg == 1">
  36. <p class="for-img-max-title-p">证明材料:</p>
  37. <div class="for-img-box">
  38. <img v-for="(itemImg,imgIndex) in item.zmClImg" :key="imgIndex" :src="itemImg" @click="lockImg(2,itemImg)">
  39. </div>
  40. </div>
  41. <div class="for-img-max-box" v-if="item.isZg == 0">
  42. <p class="for-img-max-title-p">整改后照片:</p>
  43. <div class="for-img-box">
  44. <img v-for="(itemImg,imgIndex) in item.yhZghImg" :key="imgIndex" :src="itemImg" @click="lockImg(2,itemImg)">
  45. </div>
  46. </div>
  47. </div>
  48. </div>
  49. <div class="center-for-bottom-box">
  50. <p></p>
  51. <p class="add-button-one-90" @click="goDialog(1,index)">暂无法整改</p>
  52. <p class="add-button-one-90" @click="goDialog(2,index)">完成整改</p>
  53. <p></p>
  54. </div>
  55. </div>
  56. </div>
  57. <div class="bottom-button-box">
  58. <p></p>
  59. <p class="reset-button-one" @click="backPage">返回</p>
  60. <p class="inquire-button-one" style="width:120px;" @click="upClick">提交</p>
  61. <p></p>
  62. </div>
  63. <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
  64. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  65. <div class="prove-box scrollbar-box" style="height:700px;overflow-y: scroll" v-if="dialogType == 1">
  66. <p style="margin:0 0 20px;font-size:16px;">不能立即整立改的隐患,请在下方上传或填写整改计划及措施等相关材料。</p>
  67. <el-form-item label="证明信息" prop="zmClMs"label-width="100px">
  68. <el-input type="textarea" maxlength="50" v-model="form.zmClMs" placeholder="请输入相关证明信息" rows="3" resize="none" style="width:430px"></el-input>
  69. </el-form-item>
  70. <div style="width:500px;margin:20px auto;position: relative" v-for="(url,index) in form.proveImg" :key="index">
  71. <img style="display:block;width:500px;margin:20px auto;" :src="url">
  72. <i style="position: absolute;top:0;right:0;width:40px;height:40px;line-height:40px;text-align:center;cursor:pointer;" class="el-icon-close" @click="delImg(index)"></i>
  73. </div>
  74. <el-upload
  75. v-if="!form.proveImg[8]"
  76. style="display:block;width:500px;margin:0 auto;font-size:24px;color:#999;"
  77. class="certificate-avatar-uploader"
  78. :action="uploadImgUrl"
  79. :show-file-list="false"
  80. accept="image/jpeg,image/gif,image/png"
  81. :on-success="handleAvatarSuccess"
  82. :headers="headers"
  83. :before-upload="beforeAvatarUpload">
  84. <i style="display:block;width:500px;margin:0 auto;" class="el-icon-plus avatar-uploader-icon"></i>
  85. </el-upload>
  86. </div>
  87. <div class="scrollbar-box" v-if="dialogType == 2" style="height:700px;overflow-y: scroll">
  88. <el-form-item v-if="newData.zgType == 0" label="整改描述" prop="zgMs" label-width="100px">
  89. <el-input type="textarea" maxlength="50" v-model="form.zgMs" placeholder="请输入整改描述" rows="3" resize="none" style="width:430px"></el-input>
  90. </el-form-item>
  91. <el-form-item v-if="newData.zgType == 1" label="原因分析" prop="zgYyfx" label-width="100px">
  92. <el-input type="textarea" maxlength="50" v-model="form.zgYyfx" placeholder="请输入原因分析" rows="3" resize="none" style="width:430px"></el-input>
  93. </el-form-item>
  94. <el-form-item v-if="newData.zgType == 1" label="整改措施" prop="zgCs" label-width="100px">
  95. <el-input type="textarea" maxlength="50" v-model="form.zgCs" placeholder="请输入整改措施" rows="3" resize="none" style="width:430px"></el-input>
  96. </el-form-item>
  97. <el-form-item label="" prop="proveImg" label-width="0px">
  98. <div style="width:500px;margin:20px auto;position: relative" v-for="(url,index) in form.proveImg" :key="index">
  99. <img style="display:block;width:500px;margin:20px auto;" :src="url">
  100. <i style="position: absolute;top:0;right:0;width:40px;height:40px;line-height:40px;text-align:center;cursor:pointer;" class="el-icon-close" @click="delImg(index)"></i>
  101. </div>
  102. <el-upload
  103. v-if="!form.proveImg[8]"
  104. style="display:block;width:500px;margin:0 auto;font-size:24px;color:#999;"
  105. class="certificate-avatar-uploader"
  106. :action="uploadImgUrl"
  107. :show-file-list="false"
  108. accept="image/jpeg,image/gif,image/png"
  109. :on-success="handleAvatarSuccess"
  110. :headers="headers"
  111. :before-upload="beforeAvatarUpload">
  112. <i style="display:block;width:500px;margin:0 auto;" class="el-icon-plus avatar-uploader-icon"></i>
  113. </el-upload>
  114. </el-form-item>
  115. </div>
  116. </el-form>
  117. <div slot="footer" class="dialog-footer">
  118. <el-button @click="cancel">取 消</el-button>
  119. <el-button type="primary" @click="submitForm">确 定</el-button>
  120. </div>
  121. </el-dialog>
  122. </div>
  123. </template>
  124. <script>
  125. import { checkRecordUpdate } from "@/api/laboratory/checkRecord";
  126. import { getToken } from "@/utils/auth";
  127. export default {
  128. name: 'CheckRecordInfoUp',
  129. props:{
  130. newData:{},
  131. // newData:{},
  132. },
  133. data() {
  134. return {
  135. infoData:{},
  136. uploadImgUrl: this.uploadUrl(), // 上传的图片服务器地址
  137. headers: {
  138. Authorization: "Bearer " + getToken(),
  139. },
  140. //整改窗口相关
  141. open:false,
  142. dialogType:"",
  143. dialogIndex:"",
  144. title:"",
  145. form:{
  146. zgCs:"",
  147. zgMs:"",
  148. zgYyfx:"",
  149. proveImg:[],
  150. },
  151. rules:{
  152. zmClMs: [
  153. { required: true, message: "请输入相关证明信息", trigger: "blur" },
  154. { required: true, message: "请输入相关证明信息", validator: this.spaceJudgment, trigger: "blur" }
  155. ],
  156. zgCs: [
  157. { required: true, message: "请输入整改措施", trigger: "blur" },
  158. { required: true, message: "请输入整改措施", validator: this.spaceJudgment, trigger: "blur" }
  159. ],
  160. zgMs: [
  161. { required: true, message: "请输入整改描述", trigger: "blur" },
  162. { required: true, message: "请输入整改描述", validator: this.spaceJudgment, trigger: "blur" }
  163. ],
  164. zgYyfx: [
  165. { required: true, message: "请输入原因分析", trigger: "blur" },
  166. { required: true, message: "请输入原因分析", validator: this.spaceJudgment, trigger: "blur" }
  167. ],
  168. proveImg: [
  169. { required: true, message: "请上传图片", trigger: "blur" }
  170. ],
  171. }
  172. }
  173. },
  174. created() {
  175. this.infoData = JSON.parse(JSON.stringify(this.newData.detailsList))
  176. },
  177. methods: {
  178. delImg(index){
  179. this.form.proveImg.splice(index,1);
  180. this.$forceUpdate();
  181. },
  182. upClick(){
  183. let self = this;
  184. let num = 0;
  185. let list = JSON.parse(JSON.stringify(this.infoData))
  186. let newList = [];
  187. let age = 0;
  188. for(let i=0;i<list.length;i++){
  189. if(list[i].isZg!=1 && list[i].isZg!=0){
  190. num++
  191. }else{
  192. let obj = {
  193. id:list[i].id,
  194. isZg:list[i].isZg,
  195. };
  196. if(list[i].isZg == 1){
  197. age++
  198. obj.zmClMs = list[i].zmClMs;
  199. obj.zmClImg = list[i].zmClImg+'';
  200. }else if(list[i].isZg == 0){
  201. if(self.newData.zgType == 0){
  202. obj.zgMs = list[i].zgMs;
  203. obj.yhZghImg = list[i].yhZghImg+'';
  204. }else if(self.newData.zgType == 1){
  205. obj.zgYyfx = list[i].zgYyfx;
  206. obj.zgCs = list[i].zgCs;
  207. obj.yhZghImg = list[i].yhZghImg+'';
  208. }
  209. }
  210. newList.push(obj);
  211. }
  212. }
  213. let newObj = {
  214. id:this.newData.id,
  215. fzrId:this.newData.fzrId,
  216. detailsList:newList
  217. };
  218. if (age == 0){
  219. newObj.zgStatus = 1;
  220. } else {
  221. newObj.zgStatus = 3;
  222. }
  223. if(num != 0){
  224. this.msgError("请整改所有隐患后提交");
  225. return
  226. }
  227. //detailsList
  228. checkRecordUpdate(newObj).then( response => {
  229. this.msgSuccess("提交成功")
  230. this.backPage();
  231. });
  232. },
  233. //整改弹窗
  234. goDialog(type,index){
  235. let obj={
  236. zmClMs:"",
  237. zgCs:"",
  238. zgMs:"",
  239. zgYyfx:"",
  240. proveImg:[],
  241. };
  242. this.$set(this,'form',obj);
  243. this.dialogIndex = index;
  244. if(type == 1){
  245. this.dialogType = 1;
  246. this.title = "提供证明材料";
  247. }else if(type == 2){
  248. this.dialogType = 2;
  249. if(this.newData.zgType == 0){
  250. this.title = "一般整改";
  251. }else if(this.newData.zgType == 1){
  252. this.title = "重大整改";
  253. }
  254. }
  255. if(this.infoData[index].isZg == 0){
  256. if(this.newData.zgType == 0){
  257. this.$set(this.form,'zgMs',this.infoData[index].zgMs);
  258. }else if(this.newData.zgType == 1){
  259. this.$set(this.form,'zgYyfx',this.infoData[index].zgYyfx);
  260. this.$set(this.form,'zgCs',this.infoData[index].zgCs);
  261. }
  262. if(this.infoData[index].yhZghImg&&this.infoData[index].yhZghImg!='undefined'&&this.infoData[index].yhZghImg!='unll'){
  263. this.$set(this.form,'proveImg',this.infoData[index].yhZghImg);
  264. }else{
  265. this.$set(this.form,'proveImg',[]);
  266. }
  267. }else if(this.infoData[index].isZg == 1){
  268. this.$set(this.form,'zmClMs',this.infoData[index].zmClMs);
  269. if(this.infoData[index].zmClImg&&this.infoData[index].zmClImg!='undefined'&&this.infoData[index].zmClImg!='unll'){
  270. this.$set(this.form,'proveImg',this.infoData[index].zmClImg);
  271. }else{
  272. this.$set(this.form,'proveImg',[]);
  273. }
  274. }else{
  275. this.$set(this.form,'proveImg',[]);
  276. }
  277. this.open = true;
  278. },
  279. //关闭
  280. cancel(){
  281. this.open = false;
  282. },
  283. //确定按钮
  284. submitForm(){
  285. this.$refs["form"].validate(valid => {
  286. if (valid) {
  287. if(!this.form.proveImg[0]){
  288. this.msgError('请添加图片');
  289. return
  290. }
  291. if(this.dialogType == 1){
  292. //无法整改
  293. this.$set(this.infoData[this.dialogIndex],'isZg',1)
  294. this.$set(this.infoData[this.dialogIndex],'zmClMs',JSON.parse(JSON.stringify(this.form.zmClMs)))
  295. this.$set(this.infoData[this.dialogIndex],'zmClImg',JSON.parse(JSON.stringify(this.form.proveImg)))
  296. }else if(this.dialogType == 2){
  297. //整改
  298. if(this.newData.zgType == 0){
  299. //一般整改s
  300. this.$set(this.infoData[this.dialogIndex],'isZg',0)
  301. this.$set(this.infoData[this.dialogIndex],'zgMs',JSON.parse(JSON.stringify(this.form.zgMs)))
  302. this.$set(this.infoData[this.dialogIndex],'yhZghImg',JSON.parse(JSON.stringify(this.form.proveImg)))
  303. }else if(this.newData.zgType == 1){
  304. //重大整改
  305. this.$set(this.infoData[this.dialogIndex],'isZg',0)
  306. this.$set(this.infoData[this.dialogIndex],'zgYyfx',JSON.parse(JSON.stringify(this.form.zgYyfx)))
  307. this.$set(this.infoData[this.dialogIndex],'zgCs',JSON.parse(JSON.stringify(this.form.zgCs)))
  308. this.$set(this.infoData[this.dialogIndex],'yhZghImg',JSON.parse(JSON.stringify(this.form.proveImg)))
  309. }
  310. }
  311. this.open = false;
  312. }
  313. });
  314. },
  315. //返回
  316. backPage(){
  317. this.$parent.auditButton(1);
  318. },
  319. //上传
  320. handleAvatarSuccess(res, file) {
  321. console.log(this.form)
  322. console.log(this.form.proveImg)
  323. this.form.proveImg.push(res.data.url);
  324. this.$forceUpdate()
  325. },
  326. beforeAvatarUpload(file) {
  327. let type = false;
  328. // console.log('file',file);
  329. if (file.type == 'image/png' || file.type == 'image/jpeg' || file.type == 'image/gif') {
  330. type = true;
  331. }else{
  332. this.$message.error('只能上传png/jpeg/gif格式图片');
  333. type = false;
  334. }
  335. return type;
  336. },
  337. },
  338. }
  339. </script>
  340. <style scoped lang="scss">
  341. .CheckRecordInfoUp{
  342. flex:1;
  343. display: flex;
  344. flex-direction: column;
  345. overflow: hidden;
  346. .CheckRecordInfoUp-page{
  347. flex:1;
  348. display: flex;
  349. flex-direction: column;
  350. overflow-y: scroll;
  351. .center-for-box{
  352. margin-top:20px;
  353. border:1px solid #dedede;
  354. padding:20px;
  355. position: relative;
  356. .position-left-p{
  357. position: absolute;
  358. left:0;
  359. top:0;
  360. line-height:30px;
  361. padding:0 10px;
  362. text-align: center;
  363. background: #dedede;
  364. font-size:16px;
  365. color:#999;
  366. }
  367. p{
  368. margin:0;
  369. font-weight:500;
  370. }
  371. .center-for-top-box{
  372. display: flex;
  373. .center-for-left-box{
  374. width:500px;
  375. .for-title-p{
  376. margin-top:20px;
  377. line-height:20px;
  378. font-size:16px;
  379. margin-bottom:10px;
  380. }
  381. .for-text-box{
  382. display: flex;
  383. font-size:14px;
  384. p:nth-child(1){
  385. width:80px;
  386. line-height:30px;
  387. }
  388. p:nth-child(2){
  389. flex:1;
  390. padding-top:5px;
  391. line-height:20px;
  392. }
  393. }
  394. }
  395. .center-for-right-box{
  396. margin-left:40px;
  397. flex:1;
  398. .for-img-max-box{
  399. display: flex;
  400. .for-img-max-title-p{
  401. line-height:80px;
  402. width:120px;
  403. }
  404. .for-img-box{
  405. flex:1;
  406. img{
  407. cursor: pointer;
  408. height:80px;
  409. width:80px;
  410. margin:0 10px 10px 0;
  411. }
  412. }
  413. }
  414. }
  415. }
  416. .center-for-bottom-box{
  417. display: flex;
  418. p:nth-child(1){
  419. flex:1;
  420. }
  421. p:nth-child(2){
  422. width:100px;
  423. margin-right:40px;
  424. }
  425. p:nth-child(3){
  426. width:100px;
  427. }
  428. p:nth-child(4){
  429. flex:1;
  430. }
  431. }
  432. }
  433. }
  434. .bottom-button-box{
  435. display: flex;
  436. height:60px;
  437. padding:20px 0 0;
  438. p{
  439. width:90px!important;
  440. }
  441. p:nth-child(1){
  442. flex:1;
  443. }
  444. p:nth-child(3){
  445. margin-left:20px;
  446. }
  447. p:nth-child(4){
  448. flex:1;
  449. }
  450. }
  451. }
  452. </style>