infoPage.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513
  1. <template>
  2. <div class="snapshotManagement-infoPage" v-loading.fullscreen.lock="loading">
  3. <div class="title-box">
  4. <p>随手拍详情</p>
  5. <p class="add-button-one-90" @click="outButton" style="width:100px;margin-right:10px;">返回</p>
  6. </div>
  7. <div class="content-box scrollbar-box">
  8. <div class="info-box">
  9. <div class="info-box-text">
  10. <p>学院</p>
  11. <p>{{infoData.deptName}}</p>
  12. </div>
  13. <div class="info-box-text">
  14. <p>实验室</p>
  15. <p>{{infoData.subName}}</p>
  16. </div>
  17. <div class="info-box-text">
  18. <p>隐患描述</p>
  19. <p>{{infoData.hazardDescribe}}</p>
  20. </div>
  21. <div class="info-box-img">
  22. <p>隐患照片</p>
  23. <div>
  24. <img :src="imgItem.fileUrl" @click="lookImg(infoData.yhDtoList,index)"
  25. v-for="(imgItem,index) in infoData.yhDtoList" :key="index">
  26. </div>
  27. </div>
  28. <div class="info-box-text-two">
  29. <div class="left-box">
  30. <p>上报人</p>
  31. <p>{{infoData.createName}}</p>
  32. </div>
  33. <div class="right-box">
  34. <p>上报时间</p>
  35. <p>{{infoData.createTime}}</p>
  36. </div>
  37. </div>
  38. </div>
  39. <div class="type-box" v-if="infoData.rectifyStatus == 1 || infoData.rectifyStatus == 2">
  40. <div class="info-box-type">
  41. <p>整改结果</p>
  42. <p>{{infoData.rectifyStatus == 1?'已整改':(infoData.rectifyStatus == 2?'暂无法整改':'')}}</p>
  43. </div>
  44. <div class="info-box-text">
  45. <p>{{infoData.rectifyStatus == 1?'整改措施':(infoData.rectifyStatus == 2?'原因描述':'')}}</p>
  46. <p>{{infoData.rectifyDescribe}}</p>
  47. </div>
  48. <div class="info-box-img">
  49. <p>上传照片</p>
  50. <div>
  51. <img :src="imgItem.fileUrl" @click="lookImg(infoData.zgDtoList,index)"
  52. v-for="(imgItem,index) in infoData.zgDtoList" :key="index">
  53. <p v-if="!infoData.zgDtoList[0]" style="font-size:14px;color:#999;">未上传照片</p>
  54. </div>
  55. </div>
  56. <div class="info-box-text-two">
  57. <div class="left-box">
  58. <p>整改人</p>
  59. <p>{{infoData.rectifyPeople}}</p>
  60. </div>
  61. <div class="right-box">
  62. <p>整改时间</p>
  63. <p>{{infoData.rectifyTime}}</p>
  64. </div>
  65. </div>
  66. </div>
  67. <div class="up-data-box" v-if="infoData.rectifyStatus == 0 && infoData.rectifyGentle">
  68. <el-form ref="addDialogForm" :model="upFormData" :rules="rules" label-width="140px">
  69. <el-form-item label="整改结果:" prop="rectifyStatus">
  70. <el-radio-group v-model="upFormData.rectifyStatus" style="margin-top:5px;">
  71. <el-radio :label="1">已整改</el-radio>
  72. <el-radio :label="2">暂无法整改</el-radio>
  73. </el-radio-group>
  74. </el-form-item>
  75. <el-form-item :label="upFormData.rectifyStatus==1?'整改措施:':(upFormData.rectifyStatus==2?'原因描述:':'')" prop="rectifyDescribe">
  76. <el-input
  77. type="textarea"
  78. :autosize="{ minRows: 4, maxRows: 4}"
  79. :placeholder="upFormData.rectifyStatus==1?'请输入整改措施':(upFormData.rectifyStatus==2?'请输入原因描述':'')"
  80. v-model="upFormData.rectifyDescribe"
  81. maxlength="100"
  82. resize="none"
  83. show-word-limit
  84. style="width:548px;">
  85. </el-input>
  86. </el-form-item>
  87. <el-form-item label="上传照片:" prop="imgDtoList">
  88. <div class="snapshotManagement-for-img-box" v-for="(img,imgIndex) in upFormData.imgDtoList" :key="imgIndex">
  89. <img class="for-img" :src="img.fileUrl">
  90. <p class="for-del-button el-icon-circle-close" @click="delImg(imgIndex)"></p>
  91. </div>
  92. <el-upload
  93. v-if="upFormData.imgDtoList.length<5"
  94. style="display: inline-block;overflow: hidden"
  95. class="avatar-uploader"
  96. :action="uploadImgUrl"
  97. :show-file-list="false"
  98. :on-success="(res)=>handleAvatarSuccess(res)"
  99. :headers="headers"
  100. :before-upload="(res)=>beforeAvatarUpload(res)">
  101. <p class="el-icon-plus up-img-p" style="display: inline-block"></p>
  102. </el-upload>
  103. <p class="dialog-material-text">支持jpg/png/bmp/gif格式,最多上传5张</p>
  104. </el-form-item>
  105. </el-form>
  106. </div>
  107. </div>
  108. <div class="button-box dialog-footer-box" v-if="infoData.rectifyStatus == 0 && infoData.rectifyGentle">
  109. <p class="dialog-footer-button-null"></p>
  110. <p class="dialog-footer-button-info" @click="outButton">取消</p>
  111. <p class="dialog-footer-button-primary" @click="upDataButton">确定</p>
  112. <p class="dialog-footer-button-null"></p>
  113. </div>
  114. <lookImgDialog ref="lookImgDialog"></lookImgDialog>
  115. </div>
  116. </template>
  117. <script>
  118. import { findById,clapApprove } from '@/api/safetyCheck/index'
  119. import lookImgDialog from '@/components/lookImgDialog/lookImgDialog.vue'
  120. import { getToken } from "@/utils/auth";
  121. export default {
  122. name: 'infoPage',
  123. props:{
  124. infoPropsData:{},
  125. },
  126. components: {
  127. lookImgDialog
  128. },
  129. data(){
  130. return{
  131. loading:false,
  132. uploadImgUrl: this.uploadUrl(), // 上传的图片服务器地址
  133. headers: {
  134. Authorization: "Bearer " + getToken(),
  135. },
  136. infoData:{},
  137. upFormData:{
  138. rectifyStatus:1,
  139. rectifyDescribe:"",
  140. imgDtoList:[],
  141. },
  142. upDataName:"",
  143. rules:{
  144. rectifyStatus: [
  145. { required: true, message: "请选择整改结果", trigger: "change" },
  146. ],
  147. }
  148. }
  149. },
  150. created(){
  151. this.findById();
  152. },
  153. mounted(){
  154. },
  155. methods:{
  156. //提交整改
  157. upDataButton(){
  158. let self = this;
  159. this.$refs["addDialogForm"].validate(valid => {
  160. if (valid) {
  161. this.$confirm('确定提交?', "警告", {
  162. confirmButtonText: "确定",
  163. cancelButtonText: "取消",
  164. type: "warning"
  165. }).then(function() {
  166. let obj = JSON.parse(JSON.stringify(self.upFormData))
  167. obj.id = self.infoPropsData.id;
  168. clapApprove(obj).then(response => {
  169. self.msgSuccess(response.msg)
  170. self.$parent.goPage(4);
  171. })
  172. }).then(() => {
  173. }).catch(() => {});
  174. }
  175. })
  176. },
  177. //查询详情
  178. findById(){
  179. findById({id:this.infoPropsData.id}).then(response => {
  180. this.$set(this,'infoData',response.data);
  181. })
  182. },
  183. outButton(){
  184. this.$parent.goPage(1);
  185. },
  186. lookImg(list,index){
  187. for(let i=0;i<list.length;i++){
  188. list[i].name = list[i].fileName;
  189. list[i].url = list[i].fileUrl;
  190. }
  191. this.$refs.lookImgDialog.lookImgDialogOpen(1,list,index);
  192. },
  193. /*==========上传相关==========*/
  194. handleAvatarSuccess(res) {
  195. this.$set(this,'loading',false);
  196. if(this.upFormData.imgDtoList.length>4){
  197. this.msgError('最多只可上传5张')
  198. return
  199. }
  200. let suffixName= this.upDataName.split('.')[this.upDataName.split('.').length - 2]
  201. //判断文件名中是否有逗号和分号
  202. if(suffixName.indexOf(',')==-1 && suffixName.indexOf(';')==-1){
  203. }else{
  204. this.msgError('文件名里包含逗号或分号,请修改后重新上传!')
  205. return
  206. }
  207. let obj ={
  208. fileName:this.upDataName,
  209. fileUrl:res.data.url,
  210. };
  211. this.upFormData.imgDtoList.push(obj);
  212. this.$forceUpdate()
  213. },
  214. beforeAvatarUpload(file) {
  215. if(this.upFormData.imgDtoList.length>4){
  216. this.msgError('最多只可上传5张')
  217. return false
  218. }
  219. let type = false;
  220. if (file.type == 'image/png' || file.type == 'image/jpeg' || file.type == 'image/gif' || file.type == 'image/bmp') {
  221. if(file.size> 2100000){
  222. this.msgError('上传图片大小不能超过2M')
  223. return false
  224. }
  225. this.$set(this,'loading',true);
  226. this.upDataName = file.name;
  227. type = true;
  228. }else{
  229. this.msgError('仅支持jpg/png/bmp/gif格式')
  230. type = false;
  231. }
  232. return type;
  233. },
  234. //删除照片
  235. delImg(imgIndex){
  236. this.upFormData.imgDtoList.splice(imgIndex,1);
  237. },
  238. }
  239. }
  240. </script>
  241. <style scoped lang="scss">
  242. .snapshotManagement-infoPage{
  243. flex: 1;
  244. display: flex !important;
  245. flex-direction: column;
  246. overflow: hidden;
  247. *{
  248. font-weight:500;
  249. }
  250. .title-box{
  251. border-bottom:1px solid #dedede;
  252. display: flex;
  253. p:nth-child(1){
  254. line-height:80px;
  255. margin-left:30px;
  256. flex:1;
  257. color:#0045AF;
  258. }
  259. p:nth-child(2){
  260. width:70px;
  261. height:40px;
  262. line-height:40px;
  263. margin:20px 30px;
  264. }
  265. }
  266. .content-box{
  267. flex:1;
  268. .info-box{
  269. margin:0 32px;
  270. padding:40px 50px;
  271. .info-box-text{
  272. display: flex;
  273. margin-bottom:20px;
  274. p:nth-child(1){
  275. width:70px;
  276. font-size:16px;
  277. color:#333;
  278. margin-right:30px;
  279. line-height:40px;
  280. text-align: right;
  281. }
  282. p:nth-child(2){
  283. padding:12px 20px;
  284. background-color: #F5F5F5;
  285. width:953px;
  286. border-radius:4px;
  287. font-size:14px;
  288. color:#333;
  289. }
  290. }
  291. .info-box-img{
  292. display: flex;
  293. margin-bottom:20px;
  294. p:nth-child(1){
  295. width:70px;
  296. font-size:16px;
  297. color:#333;
  298. margin-right:30px;
  299. line-height:40px;
  300. text-align: right;
  301. }
  302. div{
  303. img{
  304. width:80px;
  305. height:80px;
  306. border-radius:4px;
  307. margin-right:10px;
  308. cursor: pointer;
  309. }
  310. }
  311. }
  312. .info-box-text-two{
  313. display: flex;
  314. .left-box{
  315. display: flex;
  316. p:nth-child(1){
  317. width:70px;
  318. font-size:16px;
  319. color:#333;
  320. margin-right:30px;
  321. line-height:40px;
  322. text-align: right;
  323. }
  324. p:nth-child(2){
  325. padding:12px 20px;
  326. background-color: #F5F5F5;
  327. width:425px;
  328. border-radius:4px;
  329. font-size:14px;
  330. color:#333;
  331. }
  332. }
  333. .right-box{
  334. display: flex;
  335. p:nth-child(1){
  336. width:90px;
  337. font-size:16px;
  338. color:#333;
  339. margin-right:13px;
  340. line-height:40px;
  341. text-align: right;
  342. }
  343. p:nth-child(2){
  344. padding:12px 20px;
  345. background-color: #F5F5F5;
  346. width:425px;
  347. border-radius:4px;
  348. font-size:14px;
  349. color:#333;
  350. }
  351. }
  352. }
  353. }
  354. .type-box{
  355. margin:0 32px;
  356. padding:40px 50px;
  357. border-top: 1px dashed #D8D8D8;
  358. .info-box-type{
  359. display: flex;
  360. margin-bottom:20px;
  361. p:nth-child(1){
  362. width:70px;
  363. font-size:16px;
  364. color:#333;
  365. margin-right:30px;
  366. line-height:40px;
  367. text-align: right;
  368. }
  369. p:nth-child(2){
  370. padding:12px 20px;
  371. font-size:14px;
  372. color:#0183FA;
  373. }
  374. }
  375. .info-box-text{
  376. display: flex;
  377. margin-bottom:20px;
  378. p:nth-child(1){
  379. width:70px;
  380. font-size:16px;
  381. color:#333;
  382. margin-right:30px;
  383. line-height:40px;
  384. text-align: right;
  385. }
  386. p:nth-child(2){
  387. padding:12px 20px;
  388. background-color: #F5F5F5;
  389. width:953px;
  390. border-radius:4px;
  391. font-size:14px;
  392. color:#333;
  393. }
  394. }
  395. .info-box-img{
  396. display: flex;
  397. margin-bottom:20px;
  398. p:nth-child(1){
  399. width:70px;
  400. font-size:16px;
  401. color:#333;
  402. margin-right:30px;
  403. line-height:40px;
  404. text-align: right;
  405. }
  406. div{
  407. img{
  408. width:80px;
  409. height:80px;
  410. border-radius:4px;
  411. margin-right:10px;
  412. cursor: pointer;
  413. }
  414. }
  415. }
  416. .info-box-text-two{
  417. display: flex;
  418. .left-box{
  419. display: flex;
  420. p:nth-child(1){
  421. width:70px;
  422. font-size:16px;
  423. color:#333;
  424. margin-right:30px;
  425. line-height:40px;
  426. text-align: right;
  427. }
  428. p:nth-child(2){
  429. padding:12px 20px;
  430. background-color: #F5F5F5;
  431. width:425px;
  432. border-radius:4px;
  433. font-size:14px;
  434. color:#333;
  435. }
  436. }
  437. .right-box{
  438. display: flex;
  439. p:nth-child(1){
  440. width:90px;
  441. font-size:16px;
  442. color:#333;
  443. margin-right:13px;
  444. line-height:40px;
  445. text-align: right;
  446. }
  447. p:nth-child(2){
  448. padding:12px 20px;
  449. background-color: #F5F5F5;
  450. width:425px;
  451. border-radius:4px;
  452. font-size:14px;
  453. color:#333;
  454. }
  455. }
  456. }
  457. }
  458. .up-data-box{
  459. margin:0 32px;
  460. padding:40px 50px;
  461. border-top: 1px dashed #D8D8D8;
  462. }
  463. }
  464. .up-data-box{
  465. .snapshotManagement-for-img-box{
  466. width:80px;
  467. height:80px;
  468. border-radius:4px;
  469. display: inline-block;
  470. overflow: hidden;
  471. margin-right:20px;
  472. position: relative;
  473. .for-img{
  474. width:80px;
  475. height:80px;
  476. display: inline-block;
  477. overflow: hidden;
  478. }
  479. .for-del-button{
  480. background: rgba(0,0,0,0.7);
  481. width:20px;
  482. height:20px;
  483. line-height: 20px;
  484. text-align: center;
  485. color:#fff;
  486. border-bottom-left-radius:4px;
  487. cursor: pointer;
  488. position: absolute;
  489. top:0;
  490. right:0;
  491. }
  492. }
  493. .up-img-p{
  494. height:80px;
  495. width:80px;
  496. line-height:80px;
  497. text-align: center;
  498. font-size:16px;
  499. border-radius:4px;
  500. border:1px dashed #E0E0E0;
  501. }
  502. }
  503. .button-box{
  504. padding:20px;
  505. display: flex;
  506. }
  507. }
  508. </style>