detail.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631
  1. <template>
  2. <div class="repair-detail-box">
  3. <div
  4. :class="[
  5. 'repair-content',
  6. detailStatus === 'unAcceptance' ? 'fixed-page-content' : 'page-content',
  7. ]"
  8. >
  9. <div class="white-box page-1">
  10. <div class="cell-item">
  11. <p class="label">当前企业</p>
  12. <p class="tit">{{ detail.companyName }}</p>
  13. </div>
  14. <!-- <div class="cell-item">
  15. <p class="label">您是想</p>
  16. <div class="tit">{{ detail.type === "1" ? "报事" : "咨询" }}</div>
  17. </div> -->
  18. <div class="cell-item">
  19. <p class="label">快捷选择</p>
  20. <div class="tit">{{ detail.serviceType }}</div>
  21. </div>
  22. <div class="block-cell-item">
  23. <p class="label">工单描述</p>
  24. <div class="tit">
  25. <div class="textarea">
  26. {{ !detail.description ? "暂无" : detail.description }}
  27. </div>
  28. </div>
  29. </div>
  30. </div>
  31. <div class="white-box page-2">
  32. <!-- <div class="cell-item">
  33. <p class="label">位置</p>
  34. <div class="tit">{{ detail.position === "1" ? "室内" : "公区" }}</div>
  35. </div> -->
  36. <div class="block-cell-item">
  37. <p class="label">补充说明</p>
  38. <div class="tit">
  39. <ul class="annex-list-box">
  40. <li
  41. class="annex-item"
  42. v-for="(item, index) in explainAnnexList"
  43. :key="index"
  44. >
  45. {{ item }}
  46. <img :src="item" alt="" />
  47. </li>
  48. </ul>
  49. </div>
  50. </div>
  51. <div class="cell-item flex-item">
  52. <p class="label">联系方式</p>
  53. <p class="tit tel-box">
  54. <span>{{ detail.contact }}</span>
  55. <!-- {{ detail.phone }} -->
  56. <TelNum
  57. :num="detail.contact"
  58. :showTel="false"
  59. v-if="detail.contact && detail.contact.length > 0"
  60. />
  61. </p>
  62. </div>
  63. <div class="cell-item flex-item">
  64. <p class="label">报事人</p>
  65. <p class="tit tel-box">
  66. <span>{{ userId2 }}</span>
  67. <!-- {{ detail.phone }} -->
  68. <TelNum :num="detail.phone" :showTel="false" />
  69. </p>
  70. </div>
  71. <div class="cell-item">
  72. <p class="label">报事时间</p>
  73. <p class="tit">{{ detail.createdAt }}</p>
  74. </div>
  75. </div>
  76. <div class="white-box page-3 form-part" style="padding-bottom: 120px">
  77. <div class="custom-item-tit">
  78. <p class="tit">处理情况</p>
  79. </div>
  80. <div class="block-cell-item">
  81. <p class="label">处理进展</p>
  82. <div>
  83. <van-steps
  84. :active="stepActive"
  85. :active-color="'#6600FF'"
  86. :steps="processSteps"
  87. >
  88. </van-steps>
  89. </div>
  90. </div>
  91. <div class="cell-item">
  92. <p class="label">派单人</p>
  93. <p class="tit">{{ dispatchUserId2 }}</p>
  94. </div>
  95. <div class="cell-item">
  96. <p class="label">派单时间</p>
  97. <p class="tit">{{ detail.dispatchTime }}</p>
  98. </div>
  99. <div class="block-cell-item">
  100. <p class="label">备注</p>
  101. <div class="tit">
  102. <div class="textarea">
  103. {{ detail.remark == "null" ? "暂无" : detail.remark }}
  104. </div>
  105. </div>
  106. </div>
  107. <div class="block-cell-item">
  108. <p class="label">
  109. 处理后拍照<span class="tips">(支持图片上传限20M内,最多6张)</span>
  110. </p>
  111. <div class="tit" v-if="detail.status === 'acceptance'">
  112. <van-uploader
  113. @delete="deleteRYXXZP"
  114. :file-list="handleUrlList"
  115. :max-count="6"
  116. @after-read="afterRead"
  117. :show-upload="true"
  118. >
  119. </van-uploader>
  120. </div>
  121. <div class="tit" v-else>
  122. <ul class="annex-list-box">
  123. <li
  124. class="annex-item"
  125. v-for="(item, index) in handleUrlList"
  126. :key="index"
  127. >
  128. <img :src="item.url" alt="" />
  129. </li>
  130. </ul>
  131. </div>
  132. </div>
  133. <div class="custom-item-tit">
  134. <p class="tit">处理说明</p>
  135. </div>
  136. <div class="custom-textarea-box">
  137. <uni-easyinput
  138. :disabled="detail.status !== 'acceptance'"
  139. type="textarea"
  140. class="bgcF9F9F9 height218rpx"
  141. v-model="detail.handleExplain"
  142. autoHeight
  143. placeholder="请填写"
  144. show-word-limit
  145. >
  146. </uni-easyinput>
  147. </div>
  148. <div class="cell-item">
  149. <p class="label">结案人</p>
  150. <p class="tit">{{ handleUserId2 }}</p>
  151. </div>
  152. <div class="cell-item">
  153. <p class="label">结案时间</p>
  154. <p class="tit">{{ detail.handleTime ? detail.handleTime : "" }}</p>
  155. </div>
  156. </div>
  157. </div>
  158. <div
  159. class="repair-bottom bottom-button"
  160. v-if="detail.status === 'acceptance'"
  161. >
  162. <button class="btn" @click="onConfirm">提交</button>
  163. </div>
  164. </div>
  165. </template>
  166. <script>
  167. import TelNum from "../../subPackages/components/tel-number";
  168. import vanRate from "../../../wxcomponents/weapp/dist/rate";
  169. import {
  170. editRepair,
  171. getRepairDispatchById,
  172. getByCodes,
  173. getUserLocalStorageInfo,
  174. } from "@/js_sdk/http";
  175. // import Base from '@/pages/base/base'
  176. // import { editRepair } from '@/service/api_repair'
  177. // import { Toast } from 'vant'
  178. // import auth from '@/service/auth'
  179. // import axios from 'axios'
  180. export default {
  181. components: {
  182. TelNum,
  183. vanRate,
  184. },
  185. data() {
  186. return {
  187. handleUserId2: "",
  188. userId2: "",
  189. dispatchUserId2: "",
  190. dic_key: ["QUICK_SELECTION", "REPAIR_STATUS"],
  191. dic_SelectList: {},
  192. detailId: "", // 详情id
  193. handleUrlList: [],
  194. fileUrls: [],
  195. handleUrls: [],
  196. detailStatus: "1", // 1 待派单 2已派单
  197. explainAnnexList: [], // 说明附件 type image、图片 video、视频
  198. processedAnnexList: [], // 附件 type image、图片 video、视频
  199. stepActive: 0, // 当前处理到哪一步
  200. processSteps: [
  201. {
  202. id: 1,
  203. status: 1,
  204. text: "上报",
  205. },
  206. {
  207. id: 2,
  208. status: 1,
  209. text: "已受理",
  210. },
  211. {
  212. id: 3,
  213. status: 1,
  214. text: "已处理",
  215. },
  216. // {
  217. // id: 4,
  218. // status: 0,
  219. // text: "评价",
  220. // },
  221. ], // 处理流程
  222. evaluateVal: 0, // 评分
  223. id: "",
  224. detail: {},
  225. fileUrlList: [],
  226. params: {
  227. id: "",
  228. handleUrl: "",
  229. handleTime: "",
  230. status: "processed",
  231. },
  232. };
  233. },
  234. onLoad(option) {
  235. this.id = option.id;
  236. this.getByCodes();
  237. },
  238. methods: {
  239. async getByCodes() {
  240. let data = await getByCodes(JSON.stringify(this.dic_key));
  241. this.dic_SelectList = this.$common.handleDicList(data);
  242. this.getDetailById();
  243. },
  244. onSelect(val) {
  245. this.value = val.text;
  246. this.params.handleUserId = val.value + "-" + val.text;
  247. this.showPicker = false;
  248. },
  249. onConfirm(value) {
  250. if (!this.detail.handleExplain || this.detail.handleExplain.length == 0) {
  251. this.$showToast("请填写处理说明");
  252. return;
  253. }
  254. this.params.id = this.id;
  255. // handleUrlList
  256. this.params.handleTime = this.detail.handleTime;
  257. // this.params.handleUrlList = this.params.handleUrlList.join(",");
  258. let handleUrlList = [];
  259. if (this.handleUrlList && this.handleUrlList.length > 0) {
  260. handleUrlList = this.handleUrlList.map((e) => {
  261. return e.id;
  262. });
  263. }
  264. this.params.handleExplain = this.detail.handleExplain;
  265. this.params.updatedBy = getUserLocalStorageInfo().user.id;
  266. this.params.handleUrl = handleUrlList.join(",");
  267. editRepair(this.params).then((res) => {
  268. this.$showToast("结案成功");
  269. uni.switchTab({
  270. url: "/pages/index/index",
  271. });
  272. // this.$router.push({ path: "/repairprocessing-app" });
  273. });
  274. },
  275. getDetailById() {
  276. const _this = this;
  277. getRepairDispatchById(_this.id).then((res) => {
  278. console.log(res.data);
  279. if (res.data) {
  280. let det = _this.getItemJson(res.data);
  281. this.detail = det;
  282. this.detail.handleExplain = det.handleExplain;
  283. if (det.userId != null && det.userId !== "") {
  284. const test = det.userId.split("-");
  285. this.detail.phone = test[2];
  286. this.userId2 = test[1] + "-" + test[2];
  287. }
  288. if (det.dispatchUserId != null && det.dispatchUserId !== "") {
  289. const test = det.dispatchUserId.split("-");
  290. console.log(test);
  291. this.dispatchUserId2 = test[1] + "-" + test[2];
  292. }
  293. if (det.handleUserId != null && det.handleUserId !== "") {
  294. // const test = det.handleUserId.split("-");
  295. // console.log(test);
  296. this.handleUserId2 = det.handleUserName;
  297. }
  298. this.handleUrlList = det.handleUrlList;
  299. console.log("asodmqowndonq", this.handleUrlList);
  300. this.explainAnnexList = det.fileUrlViewList;
  301. // this.processedAnnexList = det.handleUrlList;
  302. this.detailStatus = det.status;
  303. this.params.remark = det.remark;
  304. }
  305. });
  306. },
  307. getItemJson: function (item) {
  308. const fileUrls = item.fileUrl ? item.fileUrl.split(",") : [];
  309. const fileUrlViews = [];
  310. if (fileUrls !== null && fileUrls.length > 0) {
  311. fileUrls.forEach((item) => {
  312. item =
  313. this.$constant.BASE_URI + "/wx/fileController/download/" + item;
  314. fileUrlViews.push(item);
  315. });
  316. }
  317. item.fileUrlViewList = fileUrlViews;
  318. if (!item.handleTime) {
  319. item.handleTime = this.$common.transServDate(new Date());
  320. }
  321. const handleUrls = item.handleUrl ? item.handleUrl.split(",") : [];
  322. const handleUrlViews = [];
  323. if (handleUrls !== null && handleUrls.length > 0) {
  324. handleUrls.forEach((item) => {
  325. handleUrlViews.push({
  326. url:
  327. this.$constant.BASE_URI + "/wx/fileController/download/" + item,
  328. isImage: true,
  329. });
  330. });
  331. }
  332. item.handleUrlList = handleUrlViews;
  333. console.log(item);
  334. item.serviceType =
  335. this.dic_SelectList.QUICK_SELECTION[item.serviceType - 1].label;
  336. switch (item.status) {
  337. case "unAcceptance":
  338. this.stepActive = 0;
  339. break;
  340. case "acceptance":
  341. this.stepActive = 1;
  342. break;
  343. case "evaluated":
  344. this.stepActive = 3;
  345. break;
  346. case "processed":
  347. this.stepActive = 2;
  348. break;
  349. }
  350. return item;
  351. },
  352. afterRead(event) {
  353. let that = this;
  354. const { file } = event.detail;
  355. try {
  356. uni.uploadFile({
  357. url: that.$constant.BASE_URI + "/wx/fileController/upload",
  358. filePath: file.url,
  359. name: "file",
  360. formData: { user: "test" },
  361. success(res) {
  362. // 上传完成需要更新 fileList
  363. let { data } = JSON.parse(res.data);
  364. console.log(data[0]);
  365. that.handleUrlList.push({
  366. id: data[0],
  367. url:
  368. that.$constant.BASE_URI + "/FileController/download/" + data[0],
  369. isImage: true,
  370. });
  371. that.handleUrlList = [...that.handleUrlList];
  372. that.$forceUpdate();
  373. console.log(that.fileUrlList);
  374. },
  375. fail(res) {},
  376. });
  377. } catch (error) {}
  378. },
  379. beforeDelete(file, detail) {
  380. // this.handleImagUrlList = []
  381. const vm = this;
  382. // name.index代表图片的索引
  383. vm.handleUrls.splice(detail.index, 1);
  384. return (file, name) => {
  385. const fileIndex = name.index;
  386. vm.handleUrls[detail.index].splice(fileIndex, 1);
  387. };
  388. },
  389. /**
  390. * 上传图片
  391. */
  392. uploadImg(file) {
  393. const _this = this;
  394. const formParam = new FormData(); // 创建form对象
  395. formParam.append("file", file.file); // 通过append向form对象添加数据
  396. console.log(formParam.get("file")); // FormData私有类对象,访问不到,可以通过get判断值是否传进去
  397. // upload(formParam).then((res) => {
  398. //
  399. // })
  400. const config = {
  401. headers: {
  402. "Content-Type": "multipart/form-data",
  403. "MVVM-Key": String(new Date().getTime()),
  404. xx: "anything",
  405. }, // 这里是重点,需要和后台沟通好请求头,Content-Type不一定是这个值
  406. }; // 添加请求头
  407. return new Promise((resolve, reject) => {
  408. axios
  409. .post(
  410. "/smartParkH5Server/wx/fileController/upload",
  411. formParam,
  412. config
  413. )
  414. .then((response) => {
  415. let files = response.data.data.substring(
  416. 1,
  417. response.data.data.length
  418. );
  419. files = files.substring(0, files.length - 1);
  420. _this.handleUrls.push(_this.$common.castEval(files));
  421. })
  422. .catch((err, x) => {
  423. reject(err, x);
  424. });
  425. });
  426. },
  427. },
  428. };
  429. </script>
  430. <style lang="scss" >
  431. .bottom-button {
  432. position: fixed;
  433. bottom: 0;
  434. left: 0;
  435. width: 100%;
  436. z-index: 100;
  437. height: 160rpx;
  438. padding: 35rpx 30rpx;
  439. background-color: #fff;
  440. display: flex;
  441. align-items: center;
  442. justify-content: center;
  443. box-sizing: border-box;
  444. .btn {
  445. height: 100%;
  446. line-height: 80rpx;
  447. width: 100%;
  448. color: #fff;
  449. background-color: #6600ff;
  450. font-size: 34rpx;
  451. border-radius: 10rpx;
  452. }
  453. }
  454. .repair-detail-box {
  455. .page-4 {
  456. .evaluate-box {
  457. padding: 20rpx 30rpx;
  458. background: $page-color-base;
  459. border: 1rpx solid #ebedf0;
  460. border-radius: 100rpx;
  461. display: flex;
  462. align-items: center;
  463. justify-content: space-between;
  464. box-sizing: border-box;
  465. }
  466. }
  467. width: 100%;
  468. height: 100%;
  469. .page-1 {
  470. .textarea {
  471. padding: 20rpx;
  472. border-radius: 10rpx;
  473. background: $page-color-base;
  474. box-sizing: border-box;
  475. }
  476. }
  477. .page-3 {
  478. padding-bottom: 100rpx;
  479. .input-item {
  480. padding: 0;
  481. }
  482. .custom-item-tit {
  483. height: 13.333vw;
  484. font-size: 4.267vw;
  485. color: #333;
  486. padding: 2.667vw 0;
  487. position: relative;
  488. display: -webkit-box;
  489. display: -ms-flexbox;
  490. display: flex;
  491. -webkit-box-pack: justify;
  492. -ms-flex-pack: justify;
  493. justify-content: space-between;
  494. -webkit-box-align: center;
  495. -ms-flex-align: center;
  496. align-items: center;
  497. -webkit-box-sizing: border-box;
  498. box-sizing: border-box;
  499. .tit {
  500. &::after {
  501. content: "";
  502. width: 0.8vw;
  503. height: 90%;
  504. background-color: #976dec;
  505. border-radius: 0.4vw;
  506. position: absolute;
  507. left: 0;
  508. top: 50%;
  509. -webkit-transform: translateY(-50%);
  510. transform: translateY(-50%);
  511. }
  512. }
  513. }
  514. .tit {
  515. padding-left: 2.667vw;
  516. position: relative;
  517. }
  518. }
  519. .page-4 {
  520. .custom-item-tit {
  521. height: 13.333vw;
  522. font-size: 4.267vw;
  523. color: #333;
  524. padding: 2.667vw 0;
  525. position: relative;
  526. display: -webkit-box;
  527. display: -ms-flexbox;
  528. display: flex;
  529. -webkit-box-pack: justify;
  530. -ms-flex-pack: justify;
  531. justify-content: space-between;
  532. -webkit-box-align: center;
  533. -ms-flex-align: center;
  534. align-items: center;
  535. -webkit-box-sizing: border-box;
  536. box-sizing: border-box;
  537. .tit {
  538. &::after {
  539. content: "";
  540. width: 0.8vw;
  541. height: 90%;
  542. background-color: #976dec;
  543. border-radius: 0.4vw;
  544. position: absolute;
  545. left: 0;
  546. top: 50%;
  547. -webkit-transform: translateY(-50%);
  548. transform: translateY(-50%);
  549. }
  550. }
  551. }
  552. .tit {
  553. padding-left: 2.667vw;
  554. position: relative;
  555. }
  556. s .evaluate-box {
  557. padding: 20px 30px;
  558. background: $page-color-base;
  559. border: 1px solid #ebedf0;
  560. border-radius: 100px;
  561. display: flex;
  562. align-items: center;
  563. justify-content: space-between;
  564. box-sizing: border-box;
  565. }
  566. }
  567. .annex-list-box {
  568. display: flex;
  569. // flex-wrap: wrap;
  570. // justify-content: space-between;
  571. &::after {
  572. display: block;
  573. content: "";
  574. width: 30%;
  575. height: 0px;
  576. }
  577. .annex-item {
  578. width: 240rpx;
  579. height: 240rpx;
  580. border: 1px solid $text4;
  581. margin-bottom: 20px;
  582. position: relative;
  583. overflow: hidden;
  584. > img {
  585. width: 240rpx;
  586. height: 240rpx;
  587. position: absolute;
  588. top: 0;
  589. left: 0;
  590. right: 0;
  591. bottom: 0;
  592. margin: auto;
  593. display: block;
  594. }
  595. video {
  596. width: 100%;
  597. height: 100%;
  598. }
  599. }
  600. }
  601. .tel-box {
  602. display: flex;
  603. align-items: center;
  604. /deep/ .custom-tel-component {
  605. margin-left: 20px;
  606. }
  607. }
  608. }
  609. </style>
  610. <style lang="scss">
  611. .image-repairDispatch-box {
  612. .van-image-preview__close-icon {
  613. color: #fff;
  614. font-size: 64px;
  615. }
  616. }
  617. </style>s