historyDetailsMouth.vue 13 KB

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