historyDetailsTopTube.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720
  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: 100rpx; height: 100rpx; margin: 0 12rpx;"
  71. @click="showPhoto(index,value.zEngiineeringPhotoBoList)">
  72. </image>
  73. </view>
  74. <view v-else>
  75. <video :src="item" style="width: 100rpx; height: 100rpx; 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: 30,
  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. return numStr.toString().split('.')[i] == undefined ? '0' : numStr.toString().split('.')[i];
  346. },
  347. setInfoBoNumber(key, index, number, i) {
  348. let Ynumber = this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList[key].zEngineeringMaterialBo[index]
  349. .number;
  350. let resAry = Ynumber.toString().split('.');
  351. resAry[i] = number
  352. this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList[key].zEngineeringMaterialBo[index].number = resAry
  353. .join('.');
  354. },
  355. changeSelectDict(item, index) {
  356. this.openDict = false;
  357. if (this.chooseType == 'door') {
  358. this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList[this.dataIndex].zEngineeringMaterialBo[0]
  359. .visitType = item.dictValue;
  360. }
  361. },
  362. pickerShow(e, index, indexTwo) {
  363. this.dataIndex = index;
  364. this.selectIndex = indexTwo; //材质规格 第几条
  365. this.chooseType = e;
  366. if (e == 'cz') {
  367. this.open = true;
  368. // if (this.type == '阀管') {
  369. // getEnginMaterialQualityList("民用工程", this.enginType, this.enginClassification, this.title, "灶具管厂家")
  370. // .then(response => {
  371. // this.selectList = response.data;
  372. // });
  373. // } else {
  374. this.getFSDJLevel();
  375. // }
  376. }
  377. if (e == 'gg') {
  378. if (this.isEmpty(this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList[this.dataIndex]
  379. .zEngineeringMaterialBo[this.selectIndex].materialQuality)) {
  380. this.$modal.msg('请选择材质')
  381. } else {
  382. this.open = true;
  383. getEnginSpecificationsList(this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList[this.dataIndex]
  384. .zEngineeringMaterialBo[this.selectIndex].materialQuality).then(res => {
  385. this.selectList = res.data
  386. })
  387. }
  388. }
  389. },
  390. isEmpty(str) {
  391. return (!str || 0 === str.length);
  392. },
  393. changeSelect(item, index) {
  394. this.open = false;
  395. if (this.chooseType == 'cz') {
  396. this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList[this.dataIndex].zEngineeringMaterialBo[this
  397. .selectIndex]
  398. .materialQuality = item.id;
  399. this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList[this.dataIndex].zEngineeringMaterialBo[this
  400. .selectIndex]
  401. .materialQualityName = item.name;
  402. this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList[this.dataIndex].zEngineeringMaterialBo[this
  403. .selectIndex]
  404. .specifications = '';
  405. this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList[this.dataIndex].zEngineeringMaterialBo[this
  406. .selectIndex]
  407. .specificationsName = '';
  408. } else if (this.chooseType == 'gg') {
  409. this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList[this.dataIndex].zEngineeringMaterialBo[this
  410. .selectIndex]
  411. .specifications = item.id;
  412. this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList[this.dataIndex].zEngineeringMaterialBo[this
  413. .selectIndex]
  414. .specificationsName = item.name;
  415. }
  416. },
  417. getFSDJLevel() {
  418. getEnginMaterialQualityList("顶管工程").then(
  419. response => {
  420. this.selectList = response.data;
  421. this.$forceUpdate();
  422. });
  423. },
  424. isEdit(item) {
  425. var isShow = item.createBy == this.$user.state.name;
  426. return isShow;
  427. },
  428. submit() {
  429. let isSubmit = true;
  430. this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList.forEach((res) => {
  431. if (res.createBy == this.$user.state.name) {
  432. // if (res.zEngineeringMaterialBo[0].specifications == '') {
  433. // this.$modal.msg("请选择规格");
  434. // isSubmit = false;
  435. // }
  436. // if (res.zEngineeringMaterialBo[0].number == '') {
  437. // this.$modal.msg("请输入米数");
  438. // isSubmit = false;
  439. // }
  440. // if (this.getIntegerPart(res.zEngineeringMaterialBo[0].number, 0) == '') {
  441. // this.$modal.msg("请输入米数");
  442. // isSubmit = false;
  443. // }
  444. res.zEngineeringMaterialBo.forEach((itme) => {
  445. if (itme.specifications == '') {
  446. this.$modal.msg("请选择规格");
  447. isSubmit = false;
  448. }
  449. if (itme.number == '') {
  450. this.$modal.msg("请输入米数");
  451. isSubmit = false;
  452. }
  453. if (this.getIntegerPart(itme.number, 0) == '') {
  454. this.$modal.msg("请输入米数");
  455. isSubmit = false;
  456. }
  457. })
  458. if (res.zEngiineeringPhotoBoList.length == 0) {
  459. this.$modal.msg("请上传照片");
  460. isSubmit = false;
  461. }
  462. }
  463. })
  464. if (!isSubmit) {
  465. return
  466. }
  467. PutTopPipeWork(this.dataJson).then(
  468. response => {
  469. if (response.code == '200') {
  470. uni.hideLoading()
  471. uni.showToast({
  472. title: response.msg,
  473. icon: 'none',
  474. duration: 2000
  475. });
  476. setTimeout(function() {
  477. uni.navigateBack();
  478. }, 1000)
  479. }
  480. });
  481. }
  482. }
  483. }
  484. </script>
  485. <style lang="scss">
  486. .uni-media-list-body {
  487. background: #fff;
  488. border: 1px solid #eee;
  489. border-radius: 40rpx;
  490. margin: 20rpx;
  491. padding: 10rpx 0 40rpx;
  492. box-shadow: 0 0 5px #eee;
  493. }
  494. .uni-media-list-text-top {
  495. display: flex;
  496. align-items: center;
  497. justify-content: space-between;
  498. padding: 10px;
  499. position: relative;
  500. }
  501. .to-right-icon {
  502. width: 15px;
  503. height: 15px;
  504. position: absolute;
  505. top: 50%;
  506. transform: translateY(-50%);
  507. }
  508. .share {
  509. width: 100%;
  510. height: 100%;
  511. }
  512. .tit-text {
  513. color: #4f535a;
  514. margin-right: 20rpx;
  515. }
  516. .normal-text {}
  517. .cz-style {
  518. background: #e8f4f9;
  519. margin: 20rpx;
  520. padding: 10rpx;
  521. border-radius: 20rpx;
  522. border: 1px solid #d4e3f0;
  523. }
  524. .uni-media-list-text-top {
  525. font-size: 14px;
  526. color: #696969;
  527. padding: 20rpx 20rpx;
  528. border-bottom: 1px solid #eee;
  529. display: flex;
  530. align-items: center;
  531. }
  532. .share-box {
  533. width: 100%;
  534. height: 100%;
  535. position: fixed;
  536. top: 0rpx;
  537. left: 0rpx;
  538. bottom: 0rpx;
  539. right: 0rpx;
  540. background-color: rgba(0, 0, 0, 0.4);
  541. transition: .3s;
  542. z-index: 999;
  543. }
  544. // 进入分享动画
  545. .share-show {
  546. transition: all 0.3s ease;
  547. transform: translateY(0%) !important;
  548. border-radius: 20px 20px 0px 0px;
  549. }
  550. .scroll-Y {
  551. height: 58vh;
  552. }
  553. // 离开分享动画
  554. .share-item {
  555. position: fixed;
  556. left: 0;
  557. bottom: 0;
  558. width: 100%;
  559. height: 70%;
  560. background-color: #FFFFFF;
  561. transition: all 0.3s ease;
  562. transform: translateY(100%);
  563. z-index: 1999;
  564. .share-to {
  565. // width: 100%;
  566. height: 30px;
  567. display: flex;
  568. justify-content: center;
  569. margin: 30rpx 0 !important;
  570. align-items: center;
  571. }
  572. .content {
  573. width: 100%;
  574. height: auto;
  575. display: flex;
  576. flex-wrap: wrap;
  577. .block {
  578. width: 100%;
  579. display: flex;
  580. flex-direction: column;
  581. justify-content: center;
  582. align-items: left;
  583. height: auto;
  584. image {
  585. width: 80rpx;
  586. height: 80rpx;
  587. }
  588. text {
  589. margin-top: 16rpx;
  590. font-size: 28rpx;
  591. color: #606266;
  592. }
  593. }
  594. }
  595. .cancel {
  596. width: 100%;
  597. height: 3rem;
  598. display: flex;
  599. justify-content: center;
  600. align-items: center;
  601. border-top: 1rpx solid #E4E7ED;
  602. }
  603. }
  604. .uni-media-list-text-top {
  605. display: flex;
  606. align-items: center;
  607. justify-content: space-between;
  608. padding: 10px;
  609. position: relative;
  610. }
  611. .uni-list {
  612. border: 1xp solid #eee;
  613. }
  614. .to-right-icon {
  615. width: 15px;
  616. height: 15px;
  617. position: absolute;
  618. top: 50%;
  619. transform: translateY(-50%);
  620. }
  621. .text {
  622. font-size: 16px;
  623. color: #333;
  624. }
  625. </style>