historyDetailsMouth.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606
  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" @blur="bindText($event.target.value,key)"
  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. bindText(e, index) {
  141. if (this.title == '管道压力') {
  142. this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList[index].constructAccordingDrawings = e;
  143. } else {
  144. this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList[index].constructAddre = e;
  145. }
  146. },
  147. bindTextAreaBlur(e, index) {
  148. this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList[index].remark = e;
  149. },
  150. removeht(index, key, type) {
  151. uni.showModal({
  152. title: '提示',
  153. content: '是否删除该图片或视频?',
  154. success: (res) => {
  155. if (res.confirm) {
  156. if (type == 'other') {
  157. this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList[key]
  158. .zEngiineeringPhotoBoList
  159. .splice(index, 1)
  160. }
  161. }
  162. }
  163. })
  164. },
  165. choose(type, index) {
  166. this.dataIndex = index;
  167. let _this = this;
  168. uni.showActionSheet({
  169. title: '上传',
  170. itemList: ['图片', '视频'],
  171. success: (res) => {
  172. if (res.tapIndex == 0) {
  173. this.chooseimage(type)
  174. } else {
  175. this.choosevideo(type)
  176. }
  177. }
  178. })
  179. },
  180. chooseimage(e) {
  181. let _this = this;
  182. uni.chooseImage({
  183. sizeType: ['album', 'camera'],
  184. success(resp) {
  185. resp.tempFiles.forEach((item, index) => {
  186. const task = uni.uploadFile({
  187. url: _this.$HTTP + `/obs`,
  188. filePath: item.path,
  189. name: 'file',
  190. formData: {},
  191. header: _this.headers,
  192. success: res => {
  193. let data = JSON.parse(res.data);
  194. if (![200].includes(data.code)) {
  195. _this.$modal.msg(data.msg)
  196. } else {
  197. if (_this.progress === 100) {
  198. if (e == 'other') {
  199. _this.dataJson.zEngineeringNodeBo
  200. .zEngineeringInfoBoList[_this.dataIndex]
  201. .zEngiineeringPhotoBoList.push(data.data
  202. .url);
  203. }
  204. _this.$modal.msg('上传成功!')
  205. }
  206. }
  207. },
  208. fail: e => {
  209. _this.$modal.msg('上传失败!')
  210. },
  211. complete: res => {
  212. uni.hideLoading();
  213. _this.uploading = false;
  214. }
  215. });
  216. task.onProgressUpdate(res => {
  217. _this.progress = res.progress;
  218. uni.showLoading({
  219. title: '上传中'
  220. })
  221. if (_this.progress != 100) {
  222. _this.loading = false
  223. } else {
  224. _this.loading = true
  225. }
  226. });
  227. })
  228. },
  229. })
  230. },
  231. choosevideo(e) {
  232. let _this = this;
  233. uni.chooseVideo({
  234. sourceType: ['album', 'camera'],
  235. maxDuration: 30,
  236. success(resp) {
  237. const task = uni.uploadFile({
  238. url: _this.$HTTP + `/obs`,
  239. filePath: resp.tempFilePath,
  240. name: 'file',
  241. formData: {},
  242. header: _this.headers,
  243. success: res => {
  244. let data = JSON.parse(res.data);
  245. if (![200].includes(res.statusCode)) {
  246. this.uploadError(index, data);
  247. } else {
  248. //上传成功
  249. if (_this.progress === 100) {
  250. if (e == 'other') {
  251. _this.dataJson.zEngineeringNodeBo
  252. .zEngineeringInfoBoList[_this.dataIndex]
  253. .zEngiineeringPhotoBoList.push(data.data.url);
  254. }
  255. _this.$modal.msg('上传成功!')
  256. }
  257. }
  258. },
  259. fail: e => {
  260. _this.$modal.msg('上传失败!')
  261. this.uploadError(index, e);
  262. },
  263. complete: res => {
  264. uni.hideLoading();
  265. _this.uploading = false;
  266. }
  267. });
  268. task.onProgressUpdate(res => {
  269. _this.progress = res.progress;
  270. uni.showLoading({
  271. title: '上传中'
  272. })
  273. if (_this.progress != 100) {
  274. _this.loading = false
  275. } else {
  276. _this.loading = true
  277. }
  278. });
  279. },
  280. })
  281. },
  282. showPhoto(index, arr) {
  283. let newArr = [];
  284. arr.forEach((item, index) => {
  285. if (item.substring(item.length - 3) == 'png' || item.substring(item.length - 3) == 'jpg' ||
  286. item.substring(item.length - 4) == 'jpeg') {
  287. newArr.push(item)
  288. }
  289. });
  290. uni.previewImage({
  291. current: index,
  292. urls: newArr,
  293. })
  294. },
  295. isEmpty(str) {
  296. return (!str || 0 === str.length);
  297. },
  298. isEdit(item) {
  299. var isShow = item.createBy == this.$user.state.name;
  300. return isShow;
  301. },
  302. submit() {
  303. let isSubmit = true;
  304. this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList.forEach((res) => {
  305. if (res.createBy == this.$user.state.name) {
  306. if (this.title == '原有管线压力' && this.isEmpty(res.constructAddre)) {
  307. this.$modal.msg(this.placeholder)
  308. isSubmit = false;
  309. } else if (this.title == '管道压力' && this.isEmpty(res.constructAccordingDrawings)) {
  310. this.$modal.msg(this.placeholder)
  311. isSubmit = false;
  312. }
  313. if (res.zEngiineeringPhotoBoList.length == 0) {
  314. this.$modal.msg("请上传照片");
  315. isSubmit = false;
  316. }
  317. }
  318. })
  319. if (!isSubmit) {
  320. return
  321. }
  322. SubmitMouth('put', this.dataJson).then(
  323. response => {
  324. if (response.code == '200') {
  325. uni.hideLoading()
  326. uni.showToast({
  327. title: response.msg,
  328. icon: 'none',
  329. duration: 2000
  330. });
  331. setTimeout(function() {
  332. uni.navigateBack();
  333. }, 1000)
  334. }
  335. });
  336. }
  337. }
  338. }
  339. </script>
  340. <style lang="scss">
  341. .uni-media-list-body {
  342. background: #fff;
  343. border: 1px solid #eee;
  344. border-radius: 40rpx;
  345. margin: 20rpx;
  346. padding: 10rpx 0 40rpx;
  347. box-shadow: 0 0 5px #eee;
  348. }
  349. .uni-media-list-text-top {
  350. display: flex;
  351. align-items: center;
  352. justify-content: space-between;
  353. padding: 10px;
  354. position: relative;
  355. }
  356. .to-right-icon {
  357. width: 15px;
  358. height: 15px;
  359. position: absolute;
  360. top: 50%;
  361. transform: translateY(-50%);
  362. }
  363. .share {
  364. width: 100%;
  365. height: 100%;
  366. }
  367. .tit-text {
  368. color: #4f535a;
  369. margin-right: 20rpx;
  370. }
  371. .normal-text {}
  372. .cz-style {
  373. background: #e8f4f9;
  374. margin: 20rpx;
  375. padding: 10rpx;
  376. border-radius: 20rpx;
  377. border: 1px solid #d4e3f0;
  378. }
  379. .uni-media-list-text-top {
  380. font-size: 14px;
  381. color: #696969;
  382. padding: 20rpx 20rpx;
  383. border-bottom: 1px solid #eee;
  384. display: flex;
  385. align-items: center;
  386. }
  387. .share-box {
  388. width: 100%;
  389. height: 100%;
  390. position: fixed;
  391. top: 0rpx;
  392. left: 0rpx;
  393. bottom: 0rpx;
  394. right: 0rpx;
  395. background-color: rgba(0, 0, 0, 0.4);
  396. transition: .3s;
  397. z-index: 999;
  398. }
  399. // 进入分享动画
  400. .share-show {
  401. transition: all 0.3s ease;
  402. transform: translateY(0%) !important;
  403. border-radius: 20px 20px 0px 0px;
  404. }
  405. .scroll-Y {
  406. height: 58vh;
  407. }
  408. // 离开分享动画
  409. .share-item {
  410. position: fixed;
  411. left: 0;
  412. bottom: 0;
  413. width: 100%;
  414. height: 70%;
  415. background-color: #FFFFFF;
  416. transition: all 0.3s ease;
  417. transform: translateY(100%);
  418. z-index: 1999;
  419. .share-to {
  420. width: 100%;
  421. height: 30px;
  422. display: flex;
  423. justify-content: center;
  424. margin: 30rpx 0;
  425. align-items: center;
  426. }
  427. .content {
  428. width: 100%;
  429. height: auto;
  430. display: flex;
  431. flex-wrap: wrap;
  432. .block {
  433. width: 100%;
  434. display: flex;
  435. flex-direction: column;
  436. justify-content: center;
  437. align-items: left;
  438. height: auto;
  439. image {
  440. width: 80rpx;
  441. height: 80rpx;
  442. }
  443. text {
  444. margin-top: 16rpx;
  445. font-size: 28rpx;
  446. color: #606266;
  447. }
  448. }
  449. }
  450. .cancel {
  451. width: 100%;
  452. height: 3rem;
  453. display: flex;
  454. justify-content: center;
  455. align-items: center;
  456. border-top: 1rpx solid #E4E7ED;
  457. }
  458. }
  459. .uni-media-list-text-top {
  460. display: flex;
  461. align-items: center;
  462. justify-content: space-between;
  463. padding: 10px;
  464. position: relative;
  465. }
  466. .uni-list {
  467. border: 1xp solid #eee;
  468. }
  469. .to-right-icon {
  470. width: 15px;
  471. height: 15px;
  472. position: absolute;
  473. top: 50%;
  474. transform: translateY(-50%);
  475. }
  476. .text {
  477. font-size: 16px;
  478. color: #333;
  479. }
  480. .tj-btn {
  481. height: 69rpx;
  482. background: #3184f0;
  483. border-radius: 6rpx;
  484. font-size: 25rpx;
  485. font-weight: 400;
  486. color: #FFFFFF;
  487. line-height: 69rpx;
  488. margin: 40rpx 70rpx;
  489. }
  490. .sc-btn {
  491. height: 69rpx;
  492. background: #f0686b;
  493. border-radius: 6rpx;
  494. font-size: 25rpx;
  495. font-weight: 400;
  496. color: #FFFFFF;
  497. line-height: 69rpx;
  498. margin: 40rpx;
  499. }
  500. // .gesture-area {
  501. // //加浮动弹窗
  502. // width: 100%;
  503. // height: 100%;
  504. // }
  505. </style>