historyDetailsCourtyard.vue 18 KB

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