snapshotRectification.vue 14 KB

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