snapshotDetail.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603
  1. <!-- 随手拍-详情 -->
  2. <template>
  3. <view class="examine">
  4. <scroll-view scroll-y @scrolltolower="scrollGet" class="info-max-box">
  5. <view class="basics">
  6. <view class="grade">
  7. <text>学院:</text>
  8. <text>{{item.deptName}}</text>
  9. </view>
  10. <view class="grade">
  11. <text>实验室:</text>
  12. <text>{{item.subName}}</text>
  13. </view>
  14. <view class="project">
  15. <view class="project_t">隐患描述:</view>
  16. <view class="project_b">{{item.hazardDescribe}}</view>
  17. </view>
  18. <view class="picture">
  19. <view class="picture_t">隐患照片:</view>
  20. <view class="picture_b" @click="lockImg(item.yhDtoList)">
  21. <img :src="baseUrl+item.fileUrl" v-for="(item,index) in item.yhDtoList" />
  22. </view>
  23. </view>
  24. <view class="grade">
  25. <text>上报时间:</text>
  26. <text>{{item.createTime}}</text>
  27. </view>
  28. <view class="grade" style="border:none;">
  29. <text>上报人:</text>
  30. <text>{{item.createName}}</text>
  31. </view>
  32. </view>
  33. <!-- 待整改 -->
  34. <view v-if="rectifyStatus==0 && item.rectifyGentle">
  35. <view class="await">
  36. <view class="result">
  37. <view class="result_l">整改结果</view>
  38. <view class="result_r">
  39. <view v-for="(item,index) in resultArray" :key="index" @click="tabClick(index)">
  40. <text :class="resultIndex==index?'checked':'result_r_l' "></text>
  41. <text class="result_r_r">{{item}}</text>
  42. </view>
  43. </view>
  44. </view>
  45. <view class="describe">
  46. <view class="describe_l">{{describeTitle}}:</view>
  47. <textarea class="describe_r" type="text" v-model="form.rectifyDescribe" maxlength="50"
  48. placeholder="请输入描述内容" placeholder-style="font-size:28rpx;color:#999;"></textarea>
  49. </view>
  50. <view class="check-for-img-max-box">
  51. <view class="left-title-p">隐患照片(最多上传5张):</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_safetyExamine/images/icon_ssp_closure.png"
  56. @click="delImg(imgIndex)">
  57. </view>
  58. <img class="add-button" src="@/pages_safetyExamine/images/icon_07.png"
  59. @click="selectImage()" v-if="form.imgDtoList.length<5">
  60. </view>
  61. </view>
  62. </view>
  63. </view>
  64. <!-- 隐患整改 -->
  65. <view class="basics" v-if="rectifyStatus==1 || rectifyStatus==2">
  66. <view class="small_title">隐患整改</view>
  67. <view class="grade">
  68. <text>整改结果:</text>
  69. <text style="color: #0183FA;">{{item.rectifyStatus==1?'已整改':'暂无法整改'}}</text>
  70. </view>
  71. <view class="project">
  72. <view class="project_t">整改措施:</view>
  73. <view class="project_b">{{item.rectifyDescribe}}</view>
  74. </view>
  75. <view class="picture">
  76. <view class="picture_t">上传照片:</view>
  77. <view class="picture_b" @click="lockImg(item.zgDtoList)">
  78. <img :src="baseUrl+item.fileUrl" v-for="(item,index) in item.zgDtoList" />
  79. </view>
  80. </view>
  81. <view class="grade">
  82. <text>整改时间:</text>
  83. <text>{{item.rectifyTime}}</text>
  84. </view>
  85. <view class="grade" style="border:none;">
  86. <text>整改人:</text>
  87. <text>{{item.rectifyPeople}}</text>
  88. </view>
  89. </view>
  90. </scroll-view>
  91. <view v-if="rectifyStatus==0 && item.rectifyGentle" class="bottom_btn" @click="submitForm()">提交</view>
  92. </view>
  93. </template>
  94. <script>
  95. import {
  96. config
  97. } from '@/api/request/config.js'
  98. import {
  99. checkClapById,
  100. checkClapRectify
  101. } from '@/pages_safetyExamine/api/index.js'
  102. export default {
  103. name: "rectifyList",
  104. components: {
  105. },
  106. data() {
  107. return {
  108. baseUrl: config.base_url,
  109. id: '',
  110. rectifyStatus: '', //整改状态,0是待整改,1是已整改,2是暂无法整改
  111. pageType: 1,
  112. form: {
  113. id: '',
  114. rectifyStatus: 1, //0待整改 1已整改 2暂无法整改
  115. rectifyDescribe: '',
  116. imgDtoList: [],
  117. },
  118. item: {},
  119. describeTitle: '整改措施',
  120. resultIndex: 0,
  121. resultArray: ['已整改', '暂无法整改'],
  122. }
  123. },
  124. onLoad(option) {
  125. console.log(option.id)
  126. if (option.id) {
  127. this.id = option.id
  128. }
  129. if (option.pageType) {
  130. this.pageType = option.pageType
  131. }
  132. if (option.rectifyStatus) {
  133. this.rectifyStatus = option.rectifyStatus
  134. if (option.rectifyStatus == 0) {
  135. uni.setNavigationBarTitle({
  136. title: '待整改'
  137. })
  138. } else if (option.rectifyStatus == 1) {
  139. uni.setNavigationBarTitle({
  140. title: '已整改'
  141. })
  142. } else if (option.rectifyStatus == 2) {
  143. uni.setNavigationBarTitle({
  144. title: '暂无法整改'
  145. })
  146. }
  147. }
  148. },
  149. onShow() {
  150. },
  151. mounted() {
  152. this.checkClapById();
  153. },
  154. methods: {
  155. //整改结果
  156. tabClick(index) {
  157. this.resultIndex = index;
  158. if (index == 0) {
  159. this.describeTitle = '整改措施';
  160. this.form.rectifyStatus = 1;
  161. } else if (index == 1) {
  162. this.describeTitle = '原因描述';
  163. this.form.rectifyStatus = 2;
  164. }
  165. },
  166. //滚动事件
  167. scrollGet() {},
  168. handleClick(doType) {
  169. let self = this;
  170. if (doType == 'subBtn') { //提交
  171. }
  172. },
  173. //查看图片
  174. lockImg(list) {
  175. console.log(list)
  176. if (!list[0]) {
  177. return
  178. }
  179. let urlList = [];
  180. for (let i = 0; i < list.length; i++) {
  181. urlList.push(this.baseUrl + list[i].fileUrl)
  182. }
  183. wx.previewImage({
  184. urls: urlList, //需要预览的图片http链接列表,多张的时候,url直接写在后面就行了
  185. current: '', // 当前显示图片的http链接,默认是第一个
  186. success: function(res) {},
  187. fail: function(res) {},
  188. complete: function(res) {},
  189. })
  190. },
  191. // 图片上传
  192. selectImage() {
  193. let self = this;
  194. if (this.form.imgDtoList.length > 4) {
  195. uni.showToast({
  196. title: '最多上传5张图片',
  197. icon: "none",
  198. mask: true,
  199. duration: 2000
  200. });
  201. return
  202. }
  203. wx.chooseImage({
  204. count: 1,
  205. sizeType: ["original", "compressed"],
  206. sourceType: ["album", "camera"],
  207. success: function(res) {
  208. let tempFilePaths = res.tempFilePaths[0];
  209. self.uploadImg(tempFilePaths);
  210. }
  211. });
  212. },
  213. async uploadImg(tempFilePaths) {
  214. var self = this;
  215. uni.showLoading({
  216. title: '上传中',
  217. mask: true
  218. });
  219. uni.uploadFile({
  220. url: config.base_url + '/system/file/upload', //仅为示例,非真实的接口地址
  221. header: {
  222. 'Authorization': uni.getStorageSync('token')
  223. },
  224. filePath: tempFilePaths,
  225. name: 'file',
  226. formData: {
  227. 'user': 'test'
  228. },
  229. success: (uploadFileRes) => {
  230. let res = JSON.parse(uploadFileRes.data);
  231. if (res.code == 200) {
  232. this.form.imgDtoList.push({
  233. 'fileUrl': res.data.url,
  234. 'fileName': res.data.name
  235. });
  236. console.log(res.data.url)
  237. } else {
  238. uni.showToast({
  239. title: res.msg,
  240. icon: "none",
  241. mask: true,
  242. duration: 2000
  243. });
  244. }
  245. },
  246. fail: err => {},
  247. complete: () => {
  248. uni.hideLoading()
  249. }
  250. });
  251. },
  252. //删除图片
  253. delImg(minIndex) {
  254. this.form.imgDtoList.splice(minIndex, 1);
  255. this.$forceUpdate();
  256. },
  257. //随手拍详情
  258. async checkClapById() {
  259. let _this = this;
  260. const {
  261. data
  262. } = await checkClapById({
  263. id: this.id
  264. });
  265. if (data.code == 200) {
  266. _this.item = data.data;
  267. _this.form.id = data.data.id;
  268. }
  269. },
  270. //提交
  271. async submitForm() {
  272. let _this = this;
  273. const {
  274. data
  275. } = await checkClapRectify(_this.form);
  276. if (data.code == 200) {
  277. uni.showToast({
  278. title: '提交成功',
  279. icon: "none",
  280. mask: true,
  281. duration: 2000
  282. });
  283. uni.redirectTo({
  284. url: '/pages_safetyExamine/views/snapshotManage/snapshotList?pageType=' + this.pageType
  285. });
  286. }
  287. },
  288. }
  289. }
  290. </script>
  291. <style lang="stylus" scoped>
  292. .examine {
  293. height: 100%;
  294. display flex;
  295. box-sizing: border-box;
  296. .info-max-box {
  297. flex: 1;
  298. overflow: scroll;
  299. padding-bottom: 128rpx;
  300. box-sizing: border-box;
  301. }
  302. .basics {
  303. width: 690rpx;
  304. background: #FFFFFF;
  305. border-radius: 20rpx;
  306. padding: 30rpx 30rpx 32rpx;
  307. box-sizing: border-box;
  308. margin: 20rpx 30rpx;
  309. .small_title {
  310. font-size: 30rpx;
  311. font-family: PingFang SC-Medium, PingFang SC;
  312. font-weight: 400;
  313. color: #333333;
  314. line-height: 80rpx;
  315. border-bottom: 1rpx solid #D8D8D8;
  316. }
  317. .grade {
  318. height: 80rpx;
  319. display: flex;
  320. justify-content: space-between;
  321. border-bottom: 1rpx solid #D8D8D8;
  322. >text:nth-of-type(1) {
  323. font-size: 28rpx;
  324. font-family: PingFang SC-Medium, PingFang SC;
  325. font-weight: 400;
  326. color: #666666;
  327. line-height: 80rpx;
  328. width: 140rpx;
  329. }
  330. >text:nth-of-type(2) {
  331. flex: 1;
  332. font-size: 28rpx;
  333. font-family: PingFang SC-Medium, PingFang SC;
  334. font-weight: 400;
  335. color: #333333;
  336. line-height: 80rpx;
  337. text-align: right;
  338. }
  339. }
  340. .project {
  341. .project_t {
  342. font-size: 30rpx;
  343. font-family: PingFang SC-Medium, PingFang SC;
  344. font-weight: 400;
  345. color: #333333;
  346. line-height: 80rpx;
  347. }
  348. .project_b {
  349. min-height: 158rpx;
  350. font-size: 28rpx;
  351. font-family: PingFang SC-Medium, PingFang SC;
  352. font-weight: 400;
  353. color: #333333;
  354. line-height: 40rpx;
  355. padding: 20rpx 14rpx;
  356. box-sizing: border-box;
  357. background: #F5F5F5;
  358. border-radius: 20rpx 20rpx 20rpx 20rpx;
  359. }
  360. .project_b2 {
  361. font-size: 26rpx;
  362. font-family: PingFang SC-Medium, PingFang SC;
  363. font-weight: 400;
  364. color: #666666;
  365. line-height: 26rpx;
  366. margin-top: 14rpx;
  367. text-align: right;
  368. }
  369. }
  370. .picture {
  371. .picture_t {
  372. font-size: 30rpx;
  373. font-family: PingFang SC-Medium, PingFang SC;
  374. font-weight: 400;
  375. color: #333333;
  376. line-height: 80rpx;
  377. }
  378. .picture_b {
  379. display: flex;
  380. justify-content: flex-start;
  381. flex-wrap: wrap;
  382. >img {
  383. width: 200rpx;
  384. height: 200rpx;
  385. border-radius: 10rpx 10rpx 10rpx 10rpx;
  386. margin-right: 14rpx;
  387. margin-bottom: 10rpx;
  388. }
  389. >img:nth-of-type(3n+3) {
  390. margin-right: 0rpx;
  391. }
  392. }
  393. }
  394. }
  395. /* 待整改 */
  396. .await {
  397. width: 690rpx;
  398. background: #FFFFFF;
  399. border-radius: 20rpx;
  400. padding: 30rpx 30rpx 32rpx;
  401. box-sizing: border-box;
  402. margin: 20rpx 30rpx;
  403. /* 整改结果 */
  404. .result {
  405. display: flex;
  406. justify-content: flex-start;
  407. border-bottom: 1rpx solid #D8D8D8;
  408. .result_l {
  409. width: 146rpx;
  410. text-align: left;
  411. font-size: 30rpx;
  412. font-family: PingFang SC-Medium, PingFang SC;
  413. font-weight: 400;
  414. color: #333333;
  415. line-height: 80rpx;
  416. }
  417. .result_r {
  418. width: 486rpx;
  419. height: 80rpx;
  420. padding-left: 20rpx;
  421. box-sizing: border-box;
  422. display: flex;
  423. justify-content: flex-end;
  424. align-items: center;
  425. >view {
  426. display: flex;
  427. justify-content: flex-start;
  428. align-items: center;
  429. margin-right: 24rpx;
  430. .result_r_l {
  431. display: inline-block;
  432. width: 30rpx;
  433. height: 30rpx;
  434. border-radius: 50%;
  435. border: 1rpx solid #E0E0E0;
  436. margin-right: 14rpx;
  437. }
  438. .result_r_r {
  439. font-size: 30rpx;
  440. font-family: PingFang SC-Medium, PingFang SC;
  441. font-weight: 400;
  442. color: #333333;
  443. line-height: 80rpx;
  444. }
  445. .checked {
  446. display: inline-block;
  447. width: 30rpx;
  448. height: 30rpx;
  449. border-radius: 50%;
  450. border: 1rpx solid #0183FA;
  451. margin-right: 14rpx;
  452. position: relative;
  453. }
  454. .checked::after {
  455. content: '';
  456. position: absolute;
  457. top: 5rpx;
  458. left: 5rpx;
  459. width: 20rpx;
  460. height: 20rpx;
  461. border-radius: 50%;
  462. background: #0183FA;
  463. }
  464. }
  465. }
  466. }
  467. /* 原因描述 */
  468. .describe {
  469. .describe_l {
  470. width: 158rpx;
  471. text-align: left;
  472. font-size: 30rpx;
  473. font-family: PingFang SC-Medium, PingFang SC;
  474. font-weight: 400;
  475. color: #333333;
  476. line-height: 80rpx;
  477. }
  478. .describe_r {
  479. width: 630rpx;
  480. height: 158rpx;
  481. border-radius: 20rpx 20rpx 20rpx 20rpx;
  482. opacity: 1;
  483. border: 1rpx solid #E0E0E0;
  484. padding: 20rpx 14rpx;
  485. box-sizing: border-box;
  486. font-size: 30rpx;
  487. font-family: PingFang SC-Medium, PingFang SC;
  488. font-weight: 400;
  489. color: #333333;
  490. line-height: 34rpx;
  491. }
  492. }
  493. /* 上传照片 */
  494. .check-for-img-max-box {
  495. .left-title-p {
  496. width: 100%;
  497. text-align: left;
  498. font-size: 30rpx;
  499. font-family: PingFang SC-Medium, PingFang SC;
  500. font-weight: 400;
  501. color: #333333;
  502. line-height: 80rpx;
  503. }
  504. .right-img-box {
  505. .img-box {
  506. display inline-block;
  507. height: 200rpx;
  508. width: 200rpx;
  509. position relative;
  510. margin: 0 14rpx 20rpx 0;
  511. border-radius 10rpx;
  512. overflow hidden;
  513. .img-data {
  514. height: 200rpx;
  515. width: 200rpx;
  516. }
  517. .position-img {
  518. position absolute;
  519. right: 0;
  520. top: 0;
  521. width: 36rpx;
  522. height: 36rpx;
  523. }
  524. }
  525. .img-box:nth-of-type(3n+3) {
  526. margin-right: 0rpx;
  527. }
  528. .add-button {
  529. margin: 0 0rpx 20rpx 0;
  530. border-radius 10rpx;
  531. overflow hidden;
  532. display inline-block;
  533. height: 200rpx;
  534. width: 200rpx;
  535. }
  536. }
  537. }
  538. }
  539. .bottom_btn {
  540. position: fixed;
  541. bottom: 26rpx;
  542. left: 30rpx;
  543. font-size: 30rpx;
  544. font-family: PingFang SC-Medium, PingFang SC;
  545. font-weight: 400;
  546. color: #FFFFFF;
  547. line-height: 90rpx;
  548. width: 690rpx;
  549. height: 90rpx;
  550. background: #0183FA;
  551. border-radius: 20rpx;
  552. text-align: center;
  553. }
  554. }
  555. </style>