detail.vue 20 KB

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