historyDetailsTopTube.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670
  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. let flag = false;
  141. for (let i in response.data.zEngineeringNodeBo.zEngineeringInfoBoList) {
  142. if (response.data.zEngineeringNodeBo.zEngineeringInfoBoList[i].createBy == this.$user
  143. .state.name) {
  144. flag = true;
  145. break;
  146. }
  147. }
  148. if (flag) {
  149. this.hideButton = false;
  150. this.dataJson = response.data;
  151. this.title = response.data.zEngineeringNodeBo.type;
  152. this.enginType = response.data.enginType;
  153. this.enginClassification = response.data.enginClassification;
  154. } else {
  155. this.hideButton = true;
  156. this.$modal.msg("暂无本人历史信息")
  157. }
  158. } else {
  159. this.hideButton = true;
  160. this.$modal.msg("暂无历史信息")
  161. }
  162. });
  163. }
  164. },
  165. methods: {
  166. //关闭弹窗
  167. closeDict(e) {
  168. this.openDict = false
  169. },
  170. remove(index, key) {
  171. uni.showModal({
  172. title: '提示',
  173. content: '是否删除该图片或视频?',
  174. success: (res) => {
  175. if (res.confirm) {
  176. this.dataJson.zEngineeringNodeBo
  177. .zEngineeringInfoBoList[key]
  178. .zEngiineeringPhotoBoList.splice(index, 1)
  179. }
  180. }
  181. })
  182. },
  183. choose(index1, index) {
  184. this.dataIndex = index1;
  185. let _this = this;
  186. uni.showActionSheet({
  187. title: '上传',
  188. itemList: ['图片', '视频'],
  189. success: (res) => {
  190. if (res.tapIndex == 0) {
  191. this.chooseimage()
  192. } else {
  193. this.choosevideo()
  194. }
  195. }
  196. })
  197. },
  198. chooseimage() {
  199. let _this = this;
  200. uni.chooseImage({
  201. sizeType: ['album', 'camera'],
  202. success(resp) {
  203. resp.tempFiles.forEach((item, index) => {
  204. const task = uni.uploadFile({
  205. url: _this.$HTTP + `/obs`,
  206. filePath: item.path,
  207. name: 'file',
  208. formData: {},
  209. header: _this.headers,
  210. success: res => {
  211. let data = JSON.parse(res.data);
  212. if (![200].includes(data.code)) {
  213. _this.$modal.msg(data.msg)
  214. } else {
  215. if (_this.progress === 100) {
  216. _this.dataJson.zEngineeringNodeBo
  217. .zEngineeringInfoBoList[_this.dataIndex]
  218. .zEngiineeringPhotoBoList.push(data.data.url);
  219. _this.$modal.msg('上传成功!')
  220. _this.photo = false;
  221. }
  222. }
  223. },
  224. fail: e => {
  225. _this.$modal.msg('上传失败!')
  226. },
  227. complete: res => {
  228. uni.hideLoading();
  229. _this.uploading = false;
  230. }
  231. });
  232. task.onProgressUpdate(res => {
  233. _this.progress = res.progress;
  234. uni.showLoading({
  235. title: '上传中'
  236. })
  237. if (_this.progress != 100) {
  238. _this.loading = false
  239. } else {
  240. _this.loading = true
  241. }
  242. });
  243. })
  244. },
  245. })
  246. },
  247. bindTextAreaBlur(e, index) {
  248. this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList[index].remark = e;
  249. },
  250. choosevideo() {
  251. let _this = this;
  252. uni.chooseVideo({
  253. sourceType: ['album', 'camera'],
  254. maxDuration: 30,
  255. success(resp) {
  256. const task = uni.uploadFile({
  257. url: _this.$HTTP + `/obs`,
  258. filePath: resp.tempFilePath,
  259. name: 'file',
  260. formData: {},
  261. header: _this.headers,
  262. success: res => {
  263. let data = JSON.parse(res.data);
  264. if (![200].includes(res.statusCode)) {
  265. this.uploadError(index, data);
  266. } else {
  267. //上传成功
  268. if (_this.progress === 100) {
  269. _this.dataJson.zEngineeringNodeBo
  270. .zEngineeringInfoBoList[_this.dataIndex]
  271. .zEngiineeringPhotoBoList.push(data.data.url);
  272. _this.$modal.msg('上传成功!')
  273. _this.photo = false;
  274. }
  275. }
  276. },
  277. fail: e => {
  278. _this.$modal.msg('上传失败!')
  279. this.uploadError(index, e);
  280. },
  281. complete: res => {
  282. uni.hideLoading();
  283. _this.uploading = false;
  284. }
  285. });
  286. task.onProgressUpdate(res => {
  287. _this.progress = res.progress;
  288. uni.showLoading({
  289. title: '上传中'
  290. })
  291. if (_this.progress != 100) {
  292. _this.loading = false
  293. } else {
  294. _this.loading = true
  295. }
  296. });
  297. },
  298. })
  299. },
  300. showPhoto(index, arr) {
  301. // uni.previewImage({
  302. // current: index,
  303. // urls: arr,
  304. // })
  305. let newArr = [];
  306. arr.forEach((item, index) => {
  307. if (item.substring(item.length - 3) == 'png' || item.substring(item.length - 3) == 'jpg' ||
  308. item.substring(item.length - 4) == 'jpeg') {
  309. newArr.push(item)
  310. }
  311. });
  312. uni.previewImage({
  313. current: index,
  314. urls: newArr,
  315. })
  316. },
  317. //关闭弹窗
  318. close(e) {
  319. this.open = false
  320. },
  321. // 截取小数点前的字符串
  322. getIntegerPart(numStr, i) {
  323. return numStr.toString().split('.')[i] == undefined ? '0' : numStr.toString().split('.')[i];
  324. },
  325. setInfoBoNumber(key, number, i) {
  326. let Ynumber = this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList[key].zEngineeringMaterialBo[0]
  327. .number;
  328. let resAry = Ynumber.toString().split('.');
  329. resAry[i] = number
  330. this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList[key].zEngineeringMaterialBo[0].number = resAry
  331. .join('.');
  332. },
  333. changeSelectDict(item, index) {
  334. this.openDict = false;
  335. if (this.chooseType == 'door') {
  336. this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList[this.dataIndex].zEngineeringMaterialBo[0]
  337. .visitType = item.dictValue;
  338. }
  339. },
  340. pickerShow(e, index) {
  341. this.dataIndex = index;
  342. this.chooseType = e;
  343. if (e == 'cz') {
  344. this.open = true;
  345. // if (this.type == '阀管') {
  346. // getEnginMaterialQualityList("民用工程", this.enginType, this.enginClassification, this.title, "灶具管厂家")
  347. // .then(response => {
  348. // this.selectList = response.data;
  349. // });
  350. // } else {
  351. this.getFSDJLevel();
  352. // }
  353. }
  354. if (e == 'gg') {
  355. this.open = true;
  356. //根据材质ID 获取规格数据
  357. getEnginSpecificationsList(this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList[this.dataIndex]
  358. .zEngineeringMaterialBo[0]
  359. .materialQuality).then(res => {
  360. this.selectList = res.data
  361. })
  362. }
  363. },
  364. isEmpty(str) {
  365. return (!str || 0 === str.length);
  366. },
  367. changeSelect(item, index) {
  368. this.open = false;
  369. if (this.chooseType == 'cz') {
  370. this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList[this.dataIndex].zEngineeringMaterialBo[0]
  371. .materialQuality = item.id;
  372. this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList[this.dataIndex].zEngineeringMaterialBo[0]
  373. .materialQualityName = item.name;
  374. this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList[this.dataIndex].zEngineeringMaterialBo[0]
  375. .specifications = '';
  376. this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList[this.dataIndex].zEngineeringMaterialBo[0]
  377. .specificationsName = '';
  378. } else if (this.chooseType == 'gg') {
  379. this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList[this.dataIndex].zEngineeringMaterialBo[0]
  380. .specifications = item.id;
  381. this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList[this.dataIndex].zEngineeringMaterialBo[0]
  382. .specificationsName = item.name;
  383. }
  384. },
  385. getFSDJLevel() {
  386. getEnginMaterialQualityList("顶管工程").then(
  387. response => {
  388. this.selectList = response.data;
  389. this.$forceUpdate();
  390. });
  391. },
  392. isEdit(item) {
  393. var isShow = item.createBy == this.$user.state.name;
  394. return isShow;
  395. },
  396. submit() {
  397. let isSubmit = true;
  398. this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList.forEach((res) => {
  399. if (res.createBy == this.$user.state.name) {
  400. if (res.zEngineeringMaterialBo[0].specifications == '') {
  401. this.$modal.msg("请选择规格");
  402. isSubmit = false;
  403. }
  404. if (res.zEngineeringMaterialBo[0].number == '') {
  405. this.$modal.msg("请输入米数");
  406. isSubmit = false;
  407. }
  408. if (this.getIntegerPart(res.zEngineeringMaterialBo[0].number, 0) == '') {
  409. this.$modal.msg("请输入米数");
  410. isSubmit = false;
  411. }
  412. }
  413. if (res.zEngiineeringPhotoBoList.length == 0) {
  414. this.$modal.msg("请上传照片");
  415. isSubmit = false;
  416. }
  417. })
  418. if (!isSubmit) {
  419. return
  420. }
  421. PutTopPipeWork(this.dataJson).then(
  422. response => {
  423. if (response.code == '200') {
  424. uni.hideLoading()
  425. uni.showToast({
  426. title: response.msg,
  427. icon: 'none',
  428. duration: 2000
  429. });
  430. setTimeout(function() {
  431. uni.navigateBack();
  432. }, 1000)
  433. }
  434. });
  435. }
  436. }
  437. }
  438. </script>
  439. <style lang="scss">
  440. .uni-media-list-body {
  441. background: #fff;
  442. border: 1px solid #eee;
  443. border-radius: 40rpx;
  444. margin: 20rpx;
  445. padding: 10rpx 0 40rpx;
  446. box-shadow: 0 0 5px #eee;
  447. }
  448. .uni-media-list-text-top {
  449. display: flex;
  450. align-items: center;
  451. justify-content: space-between;
  452. padding: 10px;
  453. position: relative;
  454. }
  455. .to-right-icon {
  456. width: 15px;
  457. height: 15px;
  458. position: absolute;
  459. top: 50%;
  460. transform: translateY(-50%);
  461. }
  462. .share {
  463. width: 100%;
  464. height: 100%;
  465. }
  466. .tit-text {
  467. color: #4f535a;
  468. margin-right: 20rpx;
  469. }
  470. .normal-text {}
  471. .cz-style {
  472. background: #e8f4f9;
  473. margin: 20rpx;
  474. padding: 10rpx;
  475. border-radius: 20rpx;
  476. border: 1px solid #d4e3f0;
  477. }
  478. .uni-media-list-text-top {
  479. font-size: 14px;
  480. color: #696969;
  481. padding: 20rpx 20rpx;
  482. border-bottom: 1px solid #eee;
  483. display: flex;
  484. align-items: center;
  485. }
  486. .share-box {
  487. width: 100%;
  488. height: 100%;
  489. position: fixed;
  490. top: 0rpx;
  491. left: 0rpx;
  492. bottom: 0rpx;
  493. right: 0rpx;
  494. background-color: rgba(0, 0, 0, 0.4);
  495. transition: .3s;
  496. z-index: 999;
  497. }
  498. // 进入分享动画
  499. .share-show {
  500. transition: all 0.3s ease;
  501. transform: translateY(0%) !important;
  502. border-radius: 20px 20px 0px 0px;
  503. }
  504. .scroll-Y {
  505. height: 58vh;
  506. }
  507. // 离开分享动画
  508. .share-item {
  509. position: fixed;
  510. left: 0;
  511. bottom: 0;
  512. width: 100%;
  513. height: 70%;
  514. background-color: #FFFFFF;
  515. transition: all 0.3s ease;
  516. transform: translateY(100%);
  517. z-index: 1999;
  518. .share-to {
  519. // width: 100%;
  520. height: 30px;
  521. display: flex;
  522. justify-content: center;
  523. margin: 30rpx 0 !important;
  524. align-items: center;
  525. }
  526. .content {
  527. width: 100%;
  528. height: auto;
  529. display: flex;
  530. flex-wrap: wrap;
  531. .block {
  532. width: 100%;
  533. display: flex;
  534. flex-direction: column;
  535. justify-content: center;
  536. align-items: left;
  537. height: auto;
  538. image {
  539. width: 80rpx;
  540. height: 80rpx;
  541. }
  542. text {
  543. margin-top: 16rpx;
  544. font-size: 28rpx;
  545. color: #606266;
  546. }
  547. }
  548. }
  549. .cancel {
  550. width: 100%;
  551. height: 3rem;
  552. display: flex;
  553. justify-content: center;
  554. align-items: center;
  555. border-top: 1rpx solid #E4E7ED;
  556. }
  557. }
  558. .uni-media-list-text-top {
  559. display: flex;
  560. align-items: center;
  561. justify-content: space-between;
  562. padding: 10px;
  563. position: relative;
  564. }
  565. .uni-list {
  566. border: 1xp solid #eee;
  567. }
  568. .to-right-icon {
  569. width: 15px;
  570. height: 15px;
  571. position: absolute;
  572. top: 50%;
  573. transform: translateY(-50%);
  574. }
  575. .text {
  576. font-size: 16px;
  577. color: #333;
  578. }
  579. </style>