snapshotRectification.vue 13 KB

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