historyDetailsTopTube.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643
  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. },
  293. //关闭弹窗
  294. close(e) {
  295. this.open = false
  296. },
  297. // 截取小数点前的字符串
  298. getIntegerPart(numStr, i) {
  299. return numStr.toString().split('.')[i] == undefined ? '0' : numStr.toString().split('.')[i];
  300. },
  301. setInfoBoNumber(key, number, i) {
  302. let Ynumber = this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList[key].zEngineeringMaterialBo[0]
  303. .number;
  304. let resAry = Ynumber.toString().split('.');
  305. resAry[i] = number
  306. this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList[key].zEngineeringMaterialBo[0].number = resAry
  307. .join('.');
  308. },
  309. changeSelectDict(item, index) {
  310. this.openDict = false;
  311. if (this.chooseType == 'door') {
  312. this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList[this.dataIndex].zEngineeringMaterialBo[0]
  313. .visitType = item.dictValue;
  314. }
  315. },
  316. pickerShow(e, index) {
  317. this.dataIndex = index;
  318. this.chooseType = e;
  319. if (e == 'cz') {
  320. this.open = true;
  321. // if (this.type == '阀管') {
  322. // getEnginMaterialQualityList("民用工程", this.enginType, this.enginClassification, this.title, "灶具管厂家")
  323. // .then(response => {
  324. // this.selectList = response.data;
  325. // });
  326. // } else {
  327. this.getFSDJLevel();
  328. // }
  329. }
  330. if (e == 'gg') {
  331. this.open = true;
  332. //根据材质ID 获取规格数据
  333. getEnginSpecificationsList(this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList[this.dataIndex]
  334. .zEngineeringMaterialBo[0]
  335. .materialQuality).then(res => {
  336. this.selectList = res.data
  337. })
  338. }
  339. },
  340. isEmpty(str) {
  341. return (!str || 0 === str.length);
  342. },
  343. changeSelect(item, index) {
  344. this.open = false;
  345. if (this.chooseType == 'cz') {
  346. this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList[this.dataIndex].zEngineeringMaterialBo[0]
  347. .materialQuality = item.id;
  348. this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList[this.dataIndex].zEngineeringMaterialBo[0]
  349. .materialQualityName = item.name;
  350. this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList[this.dataIndex].zEngineeringMaterialBo[0]
  351. .specifications = '';
  352. this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList[this.dataIndex].zEngineeringMaterialBo[0]
  353. .specificationsName = '';
  354. } else if (this.chooseType == 'gg') {
  355. this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList[this.dataIndex].zEngineeringMaterialBo[0]
  356. .specifications = item.id;
  357. this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList[this.dataIndex].zEngineeringMaterialBo[0]
  358. .specificationsName = item.name;
  359. }
  360. },
  361. getFSDJLevel() {
  362. getEnginMaterialQualityList("顶管工程").then(
  363. response => {
  364. this.selectList = response.data;
  365. this.$forceUpdate();
  366. });
  367. },
  368. isEdit(item) {
  369. var isShow = item.createBy == this.$user.state.name;
  370. return isShow;
  371. },
  372. submit() {
  373. let isSubmit = true;
  374. this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList.forEach((res) => {
  375. if (res.createBy == this.$user.state.name) {
  376. if (res.zEngineeringMaterialBo[0].specifications == '') {
  377. this.$modal.msg("请选择规格");
  378. isSubmit = false;
  379. }
  380. if (res.zEngineeringMaterialBo[0].number == '') {
  381. this.$modal.msg("请输入米数");
  382. isSubmit = false;
  383. }
  384. if (this.getIntegerPart(res.zEngineeringMaterialBo[0].number, 0) == '') {
  385. this.$modal.msg("请输入米数");
  386. isSubmit = false;
  387. }
  388. }
  389. if (res.zEngiineeringPhotoBoList.length == 0) {
  390. this.$modal.msg("请上传照片");
  391. isSubmit = false;
  392. }
  393. })
  394. if (!isSubmit) {
  395. return
  396. }
  397. PutTopPipeWork(this.dataJson).then(
  398. response => {
  399. if (response.code == '200') {
  400. uni.hideLoading()
  401. uni.showToast({
  402. title: response.msg,
  403. icon: 'none',
  404. duration: 2000
  405. });
  406. setTimeout(function() {
  407. uni.navigateBack();
  408. }, 1000)
  409. }
  410. });
  411. }
  412. }
  413. }
  414. </script>
  415. <style lang="scss">
  416. .uni-media-list-body {
  417. background: #fff;
  418. border: 1px solid #eee;
  419. border-radius: 40rpx;
  420. margin: 20rpx;
  421. padding: 10rpx 0 40rpx;
  422. box-shadow: 0 0 5px #eee;
  423. }
  424. .uni-media-list-text-top {
  425. display: flex;
  426. align-items: center;
  427. justify-content: space-between;
  428. padding: 10px;
  429. position: relative;
  430. }
  431. .to-right-icon {
  432. width: 15px;
  433. height: 15px;
  434. position: absolute;
  435. top: 50%;
  436. transform: translateY(-50%);
  437. }
  438. .share {
  439. width: 100%;
  440. height: 100%;
  441. }
  442. .tit-text {
  443. color: #4f535a;
  444. margin-right: 20rpx;
  445. }
  446. .normal-text {}
  447. .cz-style {
  448. background: #e8f4f9;
  449. margin: 20rpx;
  450. padding: 10rpx;
  451. border-radius: 20rpx;
  452. border: 1px solid #d4e3f0;
  453. }
  454. .uni-media-list-text-top {
  455. font-size: 14px;
  456. color: #696969;
  457. padding: 20rpx 20rpx;
  458. border-bottom: 1px solid #eee;
  459. display: flex;
  460. align-items: center;
  461. }
  462. .share-box {
  463. width: 100%;
  464. height: 100%;
  465. position: fixed;
  466. top: 0rpx;
  467. left: 0rpx;
  468. bottom: 0rpx;
  469. right: 0rpx;
  470. background-color: rgba(0, 0, 0, 0.4);
  471. transition: .3s;
  472. z-index: 999;
  473. }
  474. // 进入分享动画
  475. .share-show {
  476. transition: all 0.3s ease;
  477. transform: translateY(0%) !important;
  478. border-radius: 20px 20px 0px 0px;
  479. }
  480. .scroll-Y {
  481. height: 58vh;
  482. }
  483. // 离开分享动画
  484. .share-item {
  485. position: fixed;
  486. left: 0;
  487. bottom: 0;
  488. width: 100%;
  489. height: 70%;
  490. background-color: #FFFFFF;
  491. transition: all 0.3s ease;
  492. transform: translateY(100%);
  493. z-index: 1999;
  494. .share-to {
  495. // width: 100%;
  496. height: 30px;
  497. display: flex;
  498. justify-content: center;
  499. margin: 30rpx 0 !important;
  500. align-items: center;
  501. }
  502. .content {
  503. width: 100%;
  504. height: auto;
  505. display: flex;
  506. flex-wrap: wrap;
  507. .block {
  508. width: 100%;
  509. display: flex;
  510. flex-direction: column;
  511. justify-content: center;
  512. align-items: left;
  513. height: auto;
  514. image {
  515. width: 80rpx;
  516. height: 80rpx;
  517. }
  518. text {
  519. margin-top: 16rpx;
  520. font-size: 28rpx;
  521. color: #606266;
  522. }
  523. }
  524. }
  525. .cancel {
  526. width: 100%;
  527. height: 3rem;
  528. display: flex;
  529. justify-content: center;
  530. align-items: center;
  531. border-top: 1rpx solid #E4E7ED;
  532. }
  533. }
  534. .uni-media-list-text-top {
  535. display: flex;
  536. align-items: center;
  537. justify-content: space-between;
  538. padding: 10px;
  539. position: relative;
  540. }
  541. .uni-list {
  542. border: 1xp solid #eee;
  543. }
  544. .to-right-icon {
  545. width: 15px;
  546. height: 15px;
  547. position: absolute;
  548. top: 50%;
  549. transform: translateY(-50%);
  550. }
  551. .text {
  552. font-size: 16px;
  553. color: #333;
  554. }
  555. </style>