historyDetailsTopTube.vue 16 KB

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