historyDetailsTopTube.vue 18 KB

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