snapshotRectification.vue 13 KB

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