snapshotRectification.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631
  1. <!-- 随手拍隐患项整改 -->
  2. <template>
  3. <view class="snapshotDetail">
  4. <scroll-view scroll-y @scrolltolower="scrollGet" class="info-max-box">
  5. <view class="tip">整改期限2024-10-06(逾期未完成整改关闭实验室)</view>
  6. <view class="items" v-if="newData.hazardCheckName!=''">
  7. <view class="items-t" >
  8. <view class="items-t-r">{{newData.hazardCheckCode}} {{newData.hazardCheckName}}</view>
  9. </view>
  10. <view class="items-b" >< {{newData.hazardCheckCode2}}
  11. {{newData.hazardCheckName2}} < {{newData.hazardCheckCode1}} {{newData.hazardCheckName1}}</view>
  12. </view>
  13. <view class="items-number" v-if="newData.hazardCheckName!=''">此检查项在当前实验室累计出现<text>{{newData.hazardCheckNum}}</text>次隐患</view>
  14. <view class="list">
  15. <view class="list-li" v-if="newData.hazardCheckName!=''">
  16. <view>检查要点</view>
  17. <view>
  18. <img src="@/pages_safetyCheck/images/icon_06.png">
  19. </view>
  20. </view>
  21. <view v-if="newData.hazardCheckName!=''" class="hidden-content">{{newData.hazardCheckPoint}}
  22. </view>
  23. <view class="list-li">
  24. <view>检查隐患</view>
  25. <view style="color: #FF8C00;">
  26. <img src="@/pages_safetyCheck/images/icon_06.png">
  27. </view>
  28. </view>
  29. <view class="hidden-content">{{newData.hazardDescribe}}
  30. </view>
  31. <view class="photo">
  32. <img v-for="(item,index) in newData.yhDtoList" :src="baseUrl+item.fileUrl">
  33. </view>
  34. <view class="list-li">
  35. <view>姓名:</view>
  36. <view>{{newData.createName}}</view>
  37. </view>
  38. <view class="list-li">
  39. <view>时间:</view>
  40. <view>{{newData.createTime}}</view>
  41. </view>
  42. <view class="list-li">
  43. <view>隐患整改</view>
  44. <view>
  45. <img src="@/pages_safetyCheck/images/icon_06.png">
  46. </view>
  47. </view>
  48. <textarea class="describe" type="text" v-model="form.rectifyDescribe" maxlength="200"
  49. placeholder="请填写整改措施" placeholder-style="font-size:24rpx;color:#999;"></textarea>
  50. <view class="check-for-img-max-box">
  51. <view class="left-title-p"></view>
  52. <view class="right-img-box">
  53. <view class="img-box" v-for="(imgUrl,imgIndex) in form.imgDtoList" :key="imgIndex">
  54. <img class="img-data" :src="baseUrl+imgUrl.fileUrl">
  55. <img class="position-img" src="@/pages_safetyCheck/images/icon_ssp_closure.png"
  56. @click="delImg(imgIndex)">
  57. </view>
  58. <img class="add-button" src="@/pages_safetyCheck/images/img_ssp_pz@1x.png"
  59. @click="selectImage()" v-if="form.imgDtoList.length<5">
  60. </view>
  61. </view>
  62. <view class="list-li-tow">
  63. <view>整改方案(上传文件)</view>
  64. <view @click="selectFile()">
  65. <img src="@/pages_safetyCheck/images/icon_aqjc_sc.png">
  66. </view>
  67. </view>
  68. <view class="file-li" v-if="form.rectifyProjectName">
  69. <img src="@/pages_safetyCheck/images/icon_djc_wj.png">
  70. <view>{{form.rectifyProjectName}}</view>
  71. <img src="@/pages_safetyCheck/images/icon_yybz_sc.png">
  72. </view>
  73. </view>
  74. </scroll-view>
  75. <view class="sub-btn">
  76. <view @click="submitForm(2)">暂无法整改</view>
  77. <view @click="submitForm(1)">完成整改</view>
  78. </view>
  79. </view>
  80. </template>
  81. <script>
  82. import {
  83. config
  84. } from '@/api/request/config.js'
  85. import {
  86. securityAppCheckPhotoUpdate,
  87. } from '@/pages_safetyCheck/api/index.js'
  88. export default {
  89. name: "snapshotDetail",
  90. components: {
  91. },
  92. data() {
  93. return {
  94. baseUrl: config.base_url,
  95. inspectionItems: 0, //0有检查项 1无检查项
  96. form: {
  97. imgDtoList: [],
  98. rectifyProjectName:'',
  99. rectifyProjectUrl:'',
  100. },
  101. newData: {},
  102. }
  103. },
  104. onLoad(option) {
  105. console.log(option.infoData)
  106. this.$set(this, 'newData', JSON.parse(decodeURIComponent(option.infoData)));
  107. console.log(this.newData)
  108. },
  109. onShow() {
  110. },
  111. mounted() {
  112. },
  113. methods: {
  114. //滚动事件
  115. scrollGet() {},
  116. /******文件上传******/
  117. selectFile() {
  118. let self = this;
  119. wx.chooseMessageFile({
  120. count: 1,
  121. type: 'file',
  122. success (res) {
  123. console.log(res)
  124. // tempFilePath可以作为img标签的src属性显示图片
  125. const tempFilePaths = res.tempFiles[0].path
  126. self.form.rectifyProjectName=res.tempFiles[0].name
  127. self.uploadFile(tempFilePaths);
  128. }
  129. })
  130. },
  131. async uploadFile(tempFilePaths) {
  132. var self = this;
  133. uni.showLoading({
  134. title: '上传中',
  135. mask: true
  136. });
  137. uni.uploadFile({
  138. url: config.base_url + '/system/file/upload', //仅为示例,非真实的接口地址
  139. header: {
  140. 'Authorization': uni.getStorageSync('token')
  141. },
  142. filePath: tempFilePaths,
  143. name: 'file',
  144. formData: {
  145. 'user': 'test'
  146. },
  147. success: (uploadFileRes) => {
  148. let res = JSON.parse(uploadFileRes.data);
  149. console.log(res)
  150. if (res.code == 200) {
  151. self.form.rectifyProjectUrl=res.data.url;
  152. } else {
  153. uni.showToast({
  154. title: res.msg,
  155. icon: "none",
  156. mask: true,
  157. duration: 2000
  158. });
  159. }
  160. },
  161. fail: err => {},
  162. complete: () => {
  163. uni.hideLoading()
  164. }
  165. });
  166. },
  167. /******图片上传******/
  168. selectImage() {
  169. let self = this;
  170. if (this.form.imgDtoList.length > 4) {
  171. uni.showToast({
  172. title: '最多上传5张图片',
  173. icon: "none",
  174. mask: true,
  175. duration: 2000
  176. });
  177. return
  178. }
  179. wx.chooseImage({
  180. count: 1,
  181. sizeType: ["original", "compressed"],
  182. sourceType: ["album", "camera"],
  183. success: function(res) {
  184. let tempFilePaths = res.tempFilePaths[0];
  185. console.log(tempFilePaths)
  186. self.uploadImg(tempFilePaths);
  187. }
  188. });
  189. },
  190. async uploadImg(tempFilePaths) {
  191. var self = this;
  192. uni.showLoading({
  193. title: '上传中',
  194. mask: true
  195. });
  196. uni.uploadFile({
  197. url: config.base_url + '/system/file/upload', //仅为示例,非真实的接口地址
  198. header: {
  199. 'Authorization': uni.getStorageSync('token')
  200. },
  201. filePath: tempFilePaths,
  202. name: 'file',
  203. formData: {
  204. 'user': 'test'
  205. },
  206. success: (uploadFileRes) => {
  207. let res = JSON.parse(uploadFileRes.data);
  208. if (res.code == 200) {
  209. this.form.imgDtoList.push({
  210. 'fileUrl': res.data.url,
  211. 'fileName': res.data.name
  212. });
  213. console.log(res.data.url)
  214. } else {
  215. uni.showToast({
  216. title: res.msg,
  217. icon: "none",
  218. mask: true,
  219. duration: 2000
  220. });
  221. }
  222. },
  223. fail: err => {},
  224. complete: () => {
  225. uni.hideLoading()
  226. }
  227. });
  228. },
  229. //删除图片
  230. delImg(minIndex) {
  231. this.form.imgDtoList.splice(minIndex, 1);
  232. this.$forceUpdate();
  233. },
  234. //整改/暂无法整改
  235. async submitForm(status) {
  236. let self = this;
  237. if (status ==2 && this.form.rectifyProjectUrl=='') {
  238. uni.showToast({
  239. title: '请上传整改方案!',
  240. icon: "none",
  241. mask: true,
  242. duration: 2000
  243. });
  244. return
  245. }
  246. let obj={
  247. photoId:this.newData.photoId,
  248. rectifyStatus:status,//1已整改2暂无法整改
  249. rectifyDescribe:this.form.rectifyDescribe,
  250. imgDtoList:this.form.imgDtoList,
  251. rectifyProjectName:this.form.rectifyProjectName,
  252. rectifyProjectUrl:this.form.rectifyProjectUrl,
  253. }
  254. const {
  255. data
  256. } = await securityAppCheckPhotoUpdate(obj);
  257. if (data.code == 200) {
  258. uni.showToast({
  259. title: '提交成功',
  260. icon: "none",
  261. mask: true,
  262. duration: 2000
  263. });
  264. let infoData=this.newData;
  265. uni.navigateTo({
  266. url: '/pages_safetyCheck/views/snapshotManage/snapshotDetail?infoData=' + encodeURIComponent(JSON.stringify(infoData))
  267. });
  268. }
  269. },
  270. }
  271. }
  272. </script>
  273. <style lang="stylus" scoped>
  274. .snapshotDetail {
  275. height: 100%;
  276. display flex;
  277. box-sizing: border-box;
  278. padding-bottom: 160rpx;
  279. box-sizing: border-box;
  280. #bgColor-A {
  281. color: #FFD400;
  282. }
  283. #bgColor-B {
  284. color: #FF8C00;
  285. }
  286. #bgColor-C {
  287. color: #E11608;
  288. }
  289. .tip {
  290. width: 750rpx;
  291. height: 80rpx;
  292. background: rgba(255, 140, 0, 0.2);
  293. font-weight: normal;
  294. font-size: 28rpx;
  295. color: #FF8C00;
  296. line-height: 80rpx;
  297. text-align: center;
  298. }
  299. .items {
  300. width: 690rpx;
  301. min-height: 165rpx;
  302. background: #FFFFFF;
  303. border-radius: 20rpx 20rpx 20rpx 20rpx;
  304. margin: 20rpx 0 0 30rpx;
  305. .items-li {
  306. display: flex;
  307. justify-content: space-between;
  308. align-items: center;
  309. padding: 0 30rpx;
  310. box-sizing: border-box;
  311. border-bottom: 1rpx solid #E0E0E0;
  312. >view:nth-of-type(1) {
  313. font-size: 30rpx;
  314. color: #333333;
  315. line-height: 80rpx;
  316. text-align: left;
  317. }
  318. >view:nth-of-type(2) {
  319. font-size: 28rpx;
  320. color: #666666;
  321. line-height: 80rpx;
  322. text-align: left;
  323. display: flex;
  324. justify-content: space-between;
  325. align-items: center;
  326. }
  327. }
  328. .items-t {
  329. border-bottom: 1rpx solid #E0E0E0;
  330. height: 80rpx;
  331. display: flex;
  332. justify-content: flex-start;
  333. align-items: center;
  334. padding: 0 30rpx;
  335. box-sizing: border-box;
  336. .items-t-l {
  337. width: 175rpx;
  338. height: 50rpx;
  339. background: #E11608;
  340. border-radius: 50rpx 50rpx 50rpx 50rpx;
  341. font-size: 30rpx;
  342. color: #FFFFFF;
  343. line-height: 50rpx;
  344. text-align: center;
  345. margin-right: 14rpx;
  346. }
  347. .items-t-r {
  348. font-size: 30rpx;
  349. color: #333333;
  350. line-height: 42rpx;
  351. text-align: left;
  352. }
  353. }
  354. .items-b {
  355. padding: 0 30rpx;
  356. box-sizing: border-box;
  357. height: 80rpx;
  358. font-size: 28rpx;
  359. color: #666666;
  360. line-height: 80rpx;
  361. text-align: left;
  362. }
  363. }
  364. .items-number {
  365. font-size: 24rpx;
  366. color: #3D3D3D;
  367. line-height: 34rpx;
  368. text-align: right;
  369. margin: 20rpx 60rpx 0 0;
  370. >text {
  371. font-size: 24rpx;
  372. color: #FF0000;
  373. line-height: 34rpx;
  374. text-align: right;
  375. }
  376. }
  377. .list {
  378. width: 690rpx;
  379. margin: 20rpx 30rpx 0;
  380. background: #FFFFFF;
  381. border-radius: 20rpx 20rpx 20rpx 20rpx;
  382. .list-li {
  383. display: flex;
  384. justify-content: space-between;
  385. align-items: center;
  386. padding: 0 30rpx;
  387. box-sizing: border-box;
  388. border-bottom: 1rpx solid #E0E0E0;
  389. >view:nth-of-type(1) {
  390. font-size: 30rpx;
  391. color: #333333;
  392. line-height: 80rpx;
  393. text-align: left;
  394. }
  395. >view:nth-of-type(2) {
  396. font-size: 28rpx;
  397. color: #666666;
  398. line-height: 80rpx;
  399. text-align: left;
  400. display: flex;
  401. justify-content: space-between;
  402. align-items: center;
  403. >img {
  404. width: 24rpx;
  405. height: 12rpx;
  406. margin-left: 10rpx;
  407. }
  408. }
  409. }
  410. .list-li-tow {
  411. display: flex;
  412. justify-content: space-between;
  413. align-items: center;
  414. padding: 0 30rpx;
  415. box-sizing: border-box;
  416. border-top: 1rpx solid #E0E0E0;
  417. border-bottom: 1rpx solid #E0E0E0;
  418. >view:nth-of-type(1) {
  419. font-size: 30rpx;
  420. color: #333333;
  421. line-height: 80rpx;
  422. text-align: left;
  423. }
  424. >view:nth-of-type(2) {
  425. font-size: 28rpx;
  426. color: #666666;
  427. line-height: 80rpx;
  428. text-align: left;
  429. display: flex;
  430. justify-content: space-between;
  431. align-items: center;
  432. >img {
  433. width: 30rpx;
  434. height: 28rpx;
  435. margin-left: 10rpx;
  436. }
  437. }
  438. }
  439. .file-li {
  440. display: flex;
  441. justify-content: space-between;
  442. align-items: center;
  443. padding: 0 30rpx;
  444. box-sizing: border-box;
  445. >img:nth-of-type(1) {
  446. width: 30rpx;
  447. height: 30rpx;
  448. }
  449. >view {
  450. flex: 1;
  451. font-size: 28rpx;
  452. color: #333333;
  453. line-height: 80rpx;
  454. text-align: left;
  455. margin: 0 92rpx 0 16rpx;
  456. overflow: hidden;
  457. text-overflow: ellipsis;
  458. white-space: nowrap;
  459. }
  460. >img:nth-of-type(2) {
  461. width: 30rpx;
  462. height: 30rpx;
  463. }
  464. }
  465. .hidden-content {
  466. width: 630rpx;
  467. min-height: 200rpx;
  468. background: #F5F5F5;
  469. border-radius: 20rpx 20rpx 20rpx 20rpx;
  470. margin: 20rpx 30rpx 0;
  471. padding: 20rpx;
  472. box-sizing: border-box;
  473. font-size: 28rpx;
  474. color: #666666;
  475. line-height: 39rpx;
  476. text-align: left;
  477. }
  478. .photo {
  479. display: flex;
  480. justify-content: flex-start;
  481. flex-wrap: wrap;
  482. margin-top: 20rpx;
  483. padding: 0 30rpx;
  484. box-sizing: border-box;
  485. >img {
  486. width: 150rpx;
  487. height: 150rpx;
  488. border-radius: 10rpx 10rpx 10rpx 10rpx;
  489. margin: 0 10rpx 10rpx 0;
  490. }
  491. }
  492. .describe {
  493. width: 636rpx;
  494. height: 120rpx;
  495. border-radius: 10rpx 10rpx 10rpx 10rpx;
  496. border: 1rpx solid #E0E0E0;
  497. margin: 20rpx 0 0 28rpx;
  498. padding: 12rpx 16rpx;
  499. box-sizing: border-box;
  500. }
  501. .check-for-img-max-box {
  502. margin: 20px 28rpx;
  503. .left-title-p {
  504. width: 100%;
  505. text-align: left;
  506. font-size: 30rpx;
  507. font-family: PingFang SC-Medium, PingFang SC;
  508. font-weight: 400;
  509. color: #333333;
  510. line-height: 80rpx;
  511. }
  512. .right-img-box {
  513. .img-box {
  514. display inline-block;
  515. height: 150rpx;
  516. width: 150rpx;
  517. position relative;
  518. margin: 0 14rpx 20rpx 0;
  519. border-radius 10rpx;
  520. overflow hidden;
  521. .img-data {
  522. height: 150rpx;
  523. width: 150rpx;
  524. }
  525. .position-img {
  526. position absolute;
  527. right: 0;
  528. top: 0;
  529. width: 36rpx;
  530. height: 36rpx;
  531. }
  532. }
  533. .img-box:nth-of-type(3n+3) {
  534. margin-right: 0rpx;
  535. }
  536. .add-button {
  537. margin: 0 0rpx 20rpx 0;
  538. border-radius 10rpx;
  539. overflow hidden;
  540. display inline-block;
  541. height: 150rpx;
  542. width: 150rpx;
  543. }
  544. }
  545. }
  546. .list-li:last-of-type {
  547. border: none;
  548. }
  549. }
  550. }
  551. .sub-btn {
  552. display: flex;
  553. justify-content: center;
  554. position: fixed;
  555. left: 30rpx;
  556. bottom: 30rpx;
  557. >view:nth-of-type(1) {
  558. width: 345rpx;
  559. height: 100rpx;
  560. background: #FF8C00;
  561. border-radius: 50rpx 0rpx 0rpx 50rpx;
  562. font-size: 30rpx;
  563. color: #FFFFFF;
  564. line-height: 100rpx;
  565. text-align: center;
  566. }
  567. >view:nth-of-type(2) {
  568. width: 345rpx;
  569. height: 100rpx;
  570. background: #0183FA;
  571. border-radius: 0rpx 50rpx 50rpx 0rpx;
  572. font-size: 30rpx;
  573. color: #FFFFFF;
  574. line-height: 100rpx;
  575. text-align: center;
  576. }
  577. }
  578. </style>