historyDetailsMouth.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615
  1. <template>
  2. <scroll-view>
  3. <view class="uni-media-list" v-for="(value, key) in dataJson.zEngineeringNodeBo.zEngineeringInfoBoList"
  4. :key="key" v-if="isEdit(value)">
  5. <view class="uni-media-list-body">
  6. <view>
  7. <view class="uni-media-list-text-top" v-if="value.zEngineeringReviewBo!=null">
  8. <view class="tit-text"
  9. v-if="value.zEngineeringReviewBo.reviewStatus==''||value.zEngineeringReviewBo==null">未审核
  10. </view>
  11. <view class="tit-text" v-if="value.zEngineeringReviewBo.reviewStatus=='0'" style="color: red;">未通过</view>
  12. <view class="tit-text" v-if="value.zEngineeringReviewBo.reviewStatus=='1'">通过</view>
  13. <view :style="value.zEngineeringReviewBo.reviewStatus=='0'?'color: red;':''">
  14. {{value.zEngineeringReviewBo.reviewContent}}</view>
  15. </view>
  16. <view class="uni-media-list-text-top">
  17. <view class="tit-text">施工时间:</view>{{value.constructTime}}
  18. </view>
  19. <view class="uni-list" v-if="title=='管道压力'||title=='原有管线压力'">
  20. <view class="container" style="border-bottom: 1px solid #f8f8f8;">
  21. <text>{{title}}</text>
  22. <input class="uni-input" type="digit"
  23. v-model="title=='管道压力'?value.constructAccordingDrawings:value.constructAddre"
  24. :placeholder="placeholder" maxlength="100" @blur="bindText($event.target.value,key)"
  25. style="margin-left: 10px;text-align: right;"></input>
  26. </view>
  27. </view>
  28. <view class="uni-media-list-text-top">
  29. <view class="uni-common-mt" style="width: 100%;">
  30. <text class="tit-text" style=" font-size: 13px;color:
  31. #000;margin-top: 5px;">施工内容:</text>
  32. <view style="width: 100%;box-sizing: border-box;">
  33. <textarea class="textarea" maxlength="255" placeholder-style="padding: 10rpx;"
  34. style="width: 100%;height: 100%;border: 1rpx solid #cccccc; border-radius: 15rpx;padding: 10rpx;line-height:normal;"
  35. auto-height :value="value.remark"
  36. @blur="bindTextAreaBlur($event.target.value,key)"></textarea>
  37. </view>
  38. </view>
  39. </view>
  40. <view class="" style="display: flex; flex-wrap: wrap;margin-top: 10px;">
  41. <image :src="loadImgSrc('updateimg.png')" mode=""
  42. style="width: 200rpx; height: 150rpx; margin: 0 12rpx;; " @click="choose('other',key)">
  43. </image>
  44. <view v-for="(item,index) in value.zEngiineeringPhotoBoList" :key="index"
  45. style="position: relative;">
  46. <view
  47. v-if="item.substring(item.length - 3) == 'png' || item.substring(item.length - 3) == 'jpg' || item.substring(item.length - 3) == 'jpeg'">
  48. <image :src="item" mode="" style="width: 200rpx; height: 200rpx; margin: 0 12rpx;"
  49. @click="showPhoto(index,value.zEngiineeringPhotoBoList)">
  50. </image>
  51. </view>
  52. <view v-else>
  53. <video :src="item" style="width: 200rpx; height: 200rpx; margin: 0 12rpx;"></video>
  54. </view>
  55. <view @click="removeht(index,key,'other')"
  56. style="position: absolute; top: 0; right: 14rpx; border-radius: 50%;">
  57. <image :src="loadImgSrc('icon_close.png')" style=" width: 15px; height: 15px;">
  58. </image>
  59. </view>
  60. </view>
  61. </view>
  62. </view>
  63. </view>
  64. </view>
  65. </view>
  66. <view class="action-btn" v-if="hideButton==false">
  67. <button @click="submit" class="btn cu-btn block bg-blue lg round">确认</button>
  68. </view>
  69. </scroll-view>
  70. </template>
  71. <script>
  72. import {
  73. getDicts
  74. } from "@/api/system/dict/data";
  75. import {
  76. getToken
  77. } from '../../utils/auth';
  78. import user from '@/store/modules/user'
  79. import {
  80. getHistoryMouthDetails,
  81. SubmitMouth,
  82. } from '@/api/common'
  83. export default {
  84. data() {
  85. return {
  86. // playVideo: false,//视频播放放大
  87. // playVideoSrc:'',
  88. selectZbfList: [],
  89. dictOptions: [],
  90. openDict: false,
  91. dataIndex: 0, //数据用第几条
  92. selectIndex: 0, //材质规格用的第几条
  93. imageIndex: 0,
  94. headers: {
  95. Authorization: "Bearer " + getToken()
  96. },
  97. nodeId: '',
  98. type: '',
  99. title: '',
  100. dataJson: '',
  101. enginClassification: '',
  102. enginType: '',
  103. enginClassValue: '',
  104. selectList: [],
  105. open: false,
  106. selectType: '',
  107. hideButton: false,
  108. placeholder: '',
  109. }
  110. },
  111. onLoad(options) {
  112. if ('params' in options) {
  113. let e = JSON.parse(decodeURIComponent(options.params));
  114. this.nodeId = e.id;
  115. this.type = e.type;
  116. getHistoryMouthDetails(this.nodeId, this.type).then(response => {
  117. if (response.data.zEngineeringNodeBo != null) {
  118. let flag = false;
  119. for (let i in response.data.zEngineeringNodeBo.zEngineeringInfoBoList) {
  120. if (response.data.zEngineeringNodeBo.zEngineeringInfoBoList[i].createBy == this.$user
  121. .state.name) {
  122. flag = true;
  123. break;
  124. }
  125. }
  126. if (flag) {
  127. this.hideButton = false;
  128. this.dataJson = response.data;
  129. this.title = response.data.zEngineeringNodeBo.type;
  130. this.placeholder = '请输入' + response.data.zEngineeringNodeBo.type;
  131. // this.enginType = response.data.enginType;
  132. // this.enginClassification = response.data.enginClassification;
  133. } else {
  134. this.hideButton = true;
  135. this.$modal.msg("暂无本人历史信息")
  136. }
  137. } else {
  138. this.hideButton = true;
  139. this.$modal.msg("暂无历史信息")
  140. }
  141. });
  142. }
  143. },
  144. methods: {
  145. //关闭弹窗
  146. close(e) {
  147. this.open = false
  148. },
  149. bindText(e, index) {
  150. if (this.title == '管道压力') {
  151. this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList[index].constructAccordingDrawings = e;
  152. } else {
  153. this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList[index].constructAddre = e;
  154. }
  155. },
  156. bindTextAreaBlur(e, index) {
  157. this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList[index].remark = e;
  158. },
  159. removeht(index, key, type) {
  160. uni.showModal({
  161. title: '提示',
  162. content: '是否删除该图片或视频?',
  163. success: (res) => {
  164. if (res.confirm) {
  165. if (type == 'other') {
  166. this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList[key]
  167. .zEngiineeringPhotoBoList
  168. .splice(index, 1)
  169. }
  170. }
  171. }
  172. })
  173. },
  174. choose(type, index) {
  175. this.dataIndex = index;
  176. let _this = this;
  177. uni.showActionSheet({
  178. title: '上传',
  179. itemList: ['图片', '视频'],
  180. success: (res) => {
  181. if (res.tapIndex == 0) {
  182. this.chooseimage(type)
  183. } else {
  184. this.choosevideo(type)
  185. }
  186. }
  187. })
  188. },
  189. chooseimage(e) {
  190. let _this = this;
  191. uni.chooseImage({
  192. sizeType: ['album', 'camera'],
  193. success(resp) {
  194. resp.tempFiles.forEach((item, index) => {
  195. const task = uni.uploadFile({
  196. url: _this.$HTTP + `/obs`,
  197. filePath: item.path,
  198. name: 'file',
  199. formData: {},
  200. header: _this.headers,
  201. success: res => {
  202. let data = JSON.parse(res.data);
  203. if (![200].includes(data.code)) {
  204. _this.$modal.msg(data.msg)
  205. } else {
  206. if (_this.progress === 100) {
  207. if (e == 'other') {
  208. _this.dataJson.zEngineeringNodeBo
  209. .zEngineeringInfoBoList[_this.dataIndex]
  210. .zEngiineeringPhotoBoList.push(data.data
  211. .url);
  212. }
  213. _this.$modal.msg('上传成功!')
  214. }
  215. }
  216. },
  217. fail: e => {
  218. _this.$modal.msg('上传失败!')
  219. },
  220. complete: res => {
  221. uni.hideLoading();
  222. _this.uploading = false;
  223. }
  224. });
  225. task.onProgressUpdate(res => {
  226. _this.progress = res.progress;
  227. uni.showLoading({
  228. title: '上传中'
  229. })
  230. if (_this.progress != 100) {
  231. _this.loading = false
  232. } else {
  233. _this.loading = true
  234. }
  235. });
  236. })
  237. },
  238. })
  239. },
  240. choosevideo(e) {
  241. let _this = this;
  242. uni.chooseVideo({
  243. sourceType: ['album', 'camera'],
  244. maxDuration: 30,
  245. success(resp) {
  246. const task = uni.uploadFile({
  247. url: _this.$HTTP + `/obs`,
  248. filePath: resp.tempFilePath,
  249. name: 'file',
  250. formData: {},
  251. header: _this.headers,
  252. success: res => {
  253. let data = JSON.parse(res.data);
  254. if (![200].includes(res.statusCode)) {
  255. this.uploadError(index, data);
  256. } else {
  257. //上传成功
  258. if (_this.progress === 100) {
  259. if (e == 'other') {
  260. _this.dataJson.zEngineeringNodeBo
  261. .zEngineeringInfoBoList[_this.dataIndex]
  262. .zEngiineeringPhotoBoList.push(data.data.url);
  263. }
  264. _this.$modal.msg('上传成功!')
  265. }
  266. }
  267. },
  268. fail: e => {
  269. _this.$modal.msg('上传失败!')
  270. this.uploadError(index, e);
  271. },
  272. complete: res => {
  273. uni.hideLoading();
  274. _this.uploading = false;
  275. }
  276. });
  277. task.onProgressUpdate(res => {
  278. _this.progress = res.progress;
  279. uni.showLoading({
  280. title: '上传中'
  281. })
  282. if (_this.progress != 100) {
  283. _this.loading = false
  284. } else {
  285. _this.loading = true
  286. }
  287. });
  288. },
  289. })
  290. },
  291. showPhoto(index, arr) {
  292. let newArr = [];
  293. arr.forEach((item, index) => {
  294. if (item.substring(item.length - 3) == 'png' || item.substring(item.length - 3) == 'jpg' ||
  295. item.substring(item.length - 4) == 'jpeg') {
  296. newArr.push(item)
  297. }
  298. });
  299. uni.previewImage({
  300. current: index,
  301. urls: newArr,
  302. })
  303. },
  304. isEmpty(str) {
  305. return (!str || 0 === str.length);
  306. },
  307. isEdit(item) {
  308. var isShow = item.createBy == this.$user.state.name;
  309. return isShow;
  310. },
  311. submit() {
  312. let isSubmit = true;
  313. this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList.forEach((res) => {
  314. if (res.createBy == this.$user.state.name) {
  315. if (this.title == '原有管线压力' && this.isEmpty(res.constructAddre)) {
  316. this.$modal.msg(this.placeholder)
  317. isSubmit = false;
  318. } else if (this.title == '管道压力' && this.isEmpty(res.constructAccordingDrawings)) {
  319. this.$modal.msg(this.placeholder)
  320. isSubmit = false;
  321. }
  322. if (res.zEngiineeringPhotoBoList.length == 0) {
  323. this.$modal.msg("请上传照片");
  324. isSubmit = false;
  325. }
  326. }
  327. })
  328. if (!isSubmit) {
  329. return
  330. }
  331. SubmitMouth('put', this.dataJson).then(
  332. response => {
  333. if (response.code == '200') {
  334. uni.hideLoading()
  335. uni.showToast({
  336. title: response.msg,
  337. icon: 'none',
  338. duration: 2000
  339. });
  340. setTimeout(function() {
  341. uni.navigateBack();
  342. }, 1000)
  343. }
  344. });
  345. }
  346. }
  347. }
  348. </script>
  349. <style lang="scss">
  350. .uni-media-list-body {
  351. background: #fff;
  352. border: 1px solid #eee;
  353. border-radius: 40rpx;
  354. margin: 20rpx;
  355. padding: 10rpx 0 40rpx;
  356. box-shadow: 0 0 5px #eee;
  357. }
  358. .uni-media-list-text-top {
  359. display: flex;
  360. align-items: center;
  361. justify-content: space-between;
  362. padding: 10px;
  363. position: relative;
  364. }
  365. .to-right-icon {
  366. width: 15px;
  367. height: 15px;
  368. position: absolute;
  369. top: 50%;
  370. transform: translateY(-50%);
  371. }
  372. .share {
  373. width: 100%;
  374. height: 100%;
  375. }
  376. .tit-text {
  377. color: #4f535a;
  378. margin-right: 20rpx;
  379. }
  380. .normal-text {}
  381. .cz-style {
  382. background: #e8f4f9;
  383. margin: 20rpx;
  384. padding: 10rpx;
  385. border-radius: 20rpx;
  386. border: 1px solid #d4e3f0;
  387. }
  388. .uni-media-list-text-top {
  389. font-size: 14px;
  390. color: #696969;
  391. padding: 20rpx 20rpx;
  392. border-bottom: 1px solid #eee;
  393. display: flex;
  394. align-items: center;
  395. }
  396. .share-box {
  397. width: 100%;
  398. height: 100%;
  399. position: fixed;
  400. top: 0rpx;
  401. left: 0rpx;
  402. bottom: 0rpx;
  403. right: 0rpx;
  404. background-color: rgba(0, 0, 0, 0.4);
  405. transition: .3s;
  406. z-index: 999;
  407. }
  408. // 进入分享动画
  409. .share-show {
  410. transition: all 0.3s ease;
  411. transform: translateY(0%) !important;
  412. border-radius: 20px 20px 0px 0px;
  413. }
  414. .scroll-Y {
  415. height: 58vh;
  416. }
  417. // 离开分享动画
  418. .share-item {
  419. position: fixed;
  420. left: 0;
  421. bottom: 0;
  422. width: 100%;
  423. height: 70%;
  424. background-color: #FFFFFF;
  425. transition: all 0.3s ease;
  426. transform: translateY(100%);
  427. z-index: 1999;
  428. .share-to {
  429. width: 100%;
  430. height: 30px;
  431. display: flex;
  432. justify-content: center;
  433. margin: 30rpx 0;
  434. align-items: center;
  435. }
  436. .content {
  437. width: 100%;
  438. height: auto;
  439. display: flex;
  440. flex-wrap: wrap;
  441. .block {
  442. width: 100%;
  443. display: flex;
  444. flex-direction: column;
  445. justify-content: center;
  446. align-items: left;
  447. height: auto;
  448. image {
  449. width: 80rpx;
  450. height: 80rpx;
  451. }
  452. text {
  453. margin-top: 16rpx;
  454. font-size: 28rpx;
  455. color: #606266;
  456. }
  457. }
  458. }
  459. .cancel {
  460. width: 100%;
  461. height: 3rem;
  462. display: flex;
  463. justify-content: center;
  464. align-items: center;
  465. border-top: 1rpx solid #E4E7ED;
  466. }
  467. }
  468. .uni-media-list-text-top {
  469. display: flex;
  470. align-items: center;
  471. justify-content: space-between;
  472. padding: 10px;
  473. position: relative;
  474. }
  475. .uni-list {
  476. border: 1xp solid #eee;
  477. }
  478. .to-right-icon {
  479. width: 15px;
  480. height: 15px;
  481. position: absolute;
  482. top: 50%;
  483. transform: translateY(-50%);
  484. }
  485. .text {
  486. font-size: 16px;
  487. color: #333;
  488. }
  489. .tj-btn {
  490. height: 69rpx;
  491. background: #3184f0;
  492. border-radius: 6rpx;
  493. font-size: 25rpx;
  494. font-weight: 400;
  495. color: #FFFFFF;
  496. line-height: 69rpx;
  497. margin: 40rpx 70rpx;
  498. }
  499. .sc-btn {
  500. height: 69rpx;
  501. background: #f0686b;
  502. border-radius: 6rpx;
  503. font-size: 25rpx;
  504. font-weight: 400;
  505. color: #FFFFFF;
  506. line-height: 69rpx;
  507. margin: 40rpx;
  508. }
  509. // .gesture-area {
  510. // //加浮动弹窗
  511. // width: 100%;
  512. // height: 100%;
  513. // }
  514. </style>