index.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  1. <template>
  2. <div>
  3. <van-nav-bar
  4. title="热线工单"
  5. left-text="返回"
  6. left-arrow
  7. @click-left="onClickLeft"
  8. @click-right="onClickRight"
  9. >
  10. <template #right>
  11. <van-icon name="plus" />
  12. </template>
  13. </van-nav-bar>
  14. <div class="body">
  15. <van-dropdown-menu>
  16. <van-dropdown-item v-model="value1" :options="option1" />
  17. <van-dropdown-item v-model="value2" :options="option2" />
  18. </van-dropdown-menu>
  19. <div class="listcontent" :style="`height:${bodyheight}px`">
  20. <van-pull-refresh v-model="refreshing" @refresh="onRefresh">
  21. <van-list
  22. v-model:loading="loading"
  23. :finished="finished"
  24. finished-text="没有更多了"
  25. @load="onLoad"
  26. >
  27. <div
  28. style="padding: 10px 10px; padding-bottom: 0"
  29. v-for="item in tasklist"
  30. >
  31. <div class="item" @click="gotodetail(item)">
  32. <div>
  33. <div class="header">
  34. <div>任务编号:{{ item.taskCode }}</div>
  35. <div class="time">{{ item.taskTime }}</div>
  36. </div>
  37. <div class="body">
  38. <div class="status">
  39. {{
  40. task_status.filter(
  41. (i) =>
  42. i.value.toString() ===
  43. (item.status ?? "").toString()
  44. )[0]?.label ?? "-"
  45. }}
  46. </div>
  47. <van-row>
  48. <van-col span="12"
  49. ><div>
  50. 工单来源:{{
  51. task_type.filter(
  52. (i) =>
  53. i.value.toString() ===
  54. (item.taskType ?? "").toString()
  55. )[0]?.label ?? "-"
  56. }}
  57. </div></van-col
  58. >
  59. <van-col span="12"
  60. ><div>
  61. 事件类型:{{
  62. task_event_type.filter(
  63. (i) =>
  64. i.value.toString() ===
  65. (item.taskEventType ?? "").toString()
  66. )[0]?.label ?? "-"
  67. }}
  68. </div></van-col
  69. >
  70. <van-col span="12">
  71. <div>联系人:{{ item.taskReporter }}</div></van-col
  72. >
  73. <van-col span="12"
  74. ><div>
  75. 联系方式:{{ item.taskComplainConnect }}
  76. </div></van-col
  77. >
  78. <van-col span="24"
  79. ><div>任务内容: {{ item.taskContent }}</div></van-col
  80. >
  81. </van-row>
  82. <van-row v-if="item.status == 2 && ((item.tblTaskLogList??[]).filter(i=>i.taskStatus==-1).length<1)">
  83. <van-col span="24">
  84. <div style="text-align:right">
  85. <van-button type="primary" size="small" @click.stop="receivetask(item)">接收任务</van-button>
  86. </div>
  87. </van-col>
  88. </van-row>
  89. <van-row v-if="item.status == 2 && (gettaskitemlogdes(item,-1)??{}).zyfzr === getters.userId">
  90. <van-col span="24">
  91. <div style="text-align:right">
  92. <van-button v-if="(gettaskitemlogdes(item,-1)??{}).ddxctime ==='' " type="primary" size="small" @click.stop="daoda(item)" style="margin-right:10px">到达现场</van-button>
  93. <van-button v-if="(gettaskitemlogdes(item,-1)??{}).ddxctime !=='' " type="primary" size="small" @click.stop="bhfk(item)" style="margin-right:10px">驳回反馈</van-button>
  94. <van-button v-if="(gettaskitemlogdes(item,-1)??{}).ddxctime !=='' " type="primary" size="small" @click.stop="czfk(item)">处置反馈</van-button>
  95. </div>
  96. </van-col>
  97. </van-row>
  98. </div>
  99. </div>
  100. </div>
  101. </div>
  102. </van-list>
  103. </van-pull-refresh>
  104. </div>
  105. </div>
  106. </div>
  107. </template>
  108. <script setup>
  109. import { defineComponent, ref, onMounted, watch, computed } from "vue";
  110. import { useDict } from "@/utils/dict";
  111. import router from "../../../router";
  112. import {
  113. listTask,
  114. getTask,
  115. delTask,
  116. addTask,
  117. updateTask,
  118. ddTask,
  119. } from "@/api/system/task";
  120. import { Toast } from "vant";
  121. import moment from "moment";
  122. const tasklist = ref([]);
  123. const loading = ref(false);
  124. const finished = ref(false);
  125. const refreshing = ref(false);
  126. const { task_status, task_event_category, task_event_type,task_type } = useDict(
  127. "task_status",
  128. "task_event_category",
  129. "task_event_type",
  130. "task_type"
  131. );
  132. const bodyheight = ref(0);
  133. bodyheight.value = document.body.clientHeight - 48 - 46;
  134. const value1 = ref(0);
  135. const value2 = ref("0");
  136. const option1 = [
  137. { text: "我的", value: 0 },
  138. { text: "全部", value: 1 },
  139. ];
  140. const option2 = computed(() => {
  141. return [{ text: "全部", value: "0" }].concat(
  142. task_status.value.map((i) => {
  143. return { text: i.label, value: i.value };
  144. })
  145. );
  146. });
  147. const gotodetail = (item) => {
  148. router.push(`/mb/task/detail/${item.taskId}`);
  149. };
  150. const pagec = ref(1);
  151. const onLoad = () => {
  152. if (refreshing.value) {
  153. tasklist.value = [];
  154. refreshing.value = false;
  155. pagec.value = 1;
  156. }
  157. var p = { pageSize: 10, pageNum: pagec.value++ };
  158. if (value2.value !== "0") {
  159. p["status"] = parseInt(value2.value);
  160. }
  161. listTask(p).then((res) => {
  162. // finished.value = true;
  163. loading.value = false;
  164. tasklist.value = tasklist.value.concat(res.rows);
  165. if (res.total <= tasklist.value.length) {
  166. finished.value = true;
  167. }
  168. });
  169. };
  170. watch(
  171. () => value2.value,
  172. () => {
  173. refreshing.value = true;
  174. onLoad();
  175. }
  176. );
  177. const onRefresh = () => {
  178. // 清空列表数据
  179. finished.value = false;
  180. loading.value = true;
  181. refreshing.value = true;
  182. onLoad();
  183. };
  184. const onClickLeft = () => {
  185. router.back();
  186. };
  187. const onClickRight = () => {
  188. router.push("/mb/task/add")
  189. };
  190. const xyobj = ref({
  191. bzxytime: "",
  192. ddxctime: "",
  193. czwctime: "",
  194. zysc: "",
  195. clsc: "",
  196. zyfzr: "",
  197. zyrs: 0,
  198. carxh: "",
  199. carnumber: "",
  200. gls: "",
  201. });
  202. const store = useStore();
  203. const getters = computed(() => store.getters);
  204. const gettaskitemlogdes = (item, status) => {
  205. var templist = {};
  206. var list = item.tblTaskLogList;
  207. for (var i in list) {
  208. var log = list[i];
  209. if (templist.hasOwnProperty(log.taskStatus + "")) {
  210. if (
  211. moment(templist[log.taskStatus + ""].createTime).unix() -
  212. moment(log.createTime).unix() <
  213. 0
  214. ) {
  215. templist[log.taskStatus + ""] = log;
  216. }
  217. } else {
  218. templist[log.taskStatus + ""] = log;
  219. }
  220. }
  221. var lists = [];
  222. for (var i in templist) {
  223. lists.push(templist[i]);
  224. }
  225. if (templist[status + ""] == null || templist[status + ""] == undefined || templist[status + ""] == "") return null;
  226. return JSON.parse(templist[status + ""].logDes);
  227. }
  228. const receivetask = (item) => {
  229. var logc = gettaskitemlogdes(item, -1);
  230. if (logc !=null) {
  231. xyobj.value = logc;
  232. }
  233. xyobj.value.bzxytime = moment().format("YYYY-MM-DD HH:mm:ss");
  234. xyobj.value.zyfzr = getters.value.userId;
  235. console.log(xyobj.value)
  236. ddTask({
  237. taskId: item.taskId,
  238. taskStatus: -1,
  239. logDes: JSON.stringify(xyobj.value)
  240. }).then(res => {
  241. Toast.success("成功");
  242. onRefresh();
  243. })
  244. }
  245. const daoda = (item) => {
  246. var logc = gettaskitemlogdes(item, -1);
  247. if (logc !=null) {
  248. xyobj.value = logc;
  249. }
  250. xyobj.value.ddxctime = moment().format("YYYY-MM-DD HH:mm:ss");
  251. xyobj.value.zyfzr = getters.value.userId;
  252. ddTask({
  253. taskId: item.taskId,
  254. taskStatus: -1,
  255. logDes: JSON.stringify(xyobj.value)
  256. }).then(res => {
  257. Toast.success("成功");
  258. onRefresh();
  259. })
  260. }
  261. const czfk = (item) => {
  262. localStorage.setItem("currenttask", JSON.stringify(item));
  263. router.push(`/mb/task/disposal?id=${item.taskId}`)
  264. }
  265. const bhfk = (item) => {
  266. localStorage.setItem("currenttask", JSON.stringify(item));
  267. router.push(`/mb/task/disposal?bh=1&id=${item.taskId}`)
  268. }
  269. </script>
  270. <style lang="scss">
  271. body {
  272. position: fixed;
  273. width: 100%;
  274. top: -1px;
  275. }
  276. .listcontent {
  277. overflow-y: auto;
  278. .item {
  279. background: #fff;
  280. border: 1px solid rgba(209, 217, 221, 0.4);
  281. padding: 10px 15px;
  282. font-size: 10px;
  283. border-radius: 5px;
  284. .header {
  285. color: #3d6dc5;
  286. font-weight: bold;
  287. position: relative;
  288. padding-bottom: 8px;
  289. border-bottom: 1px solid rgba(209, 217, 221, 0.4);
  290. .time {
  291. position: absolute;
  292. right: 0;
  293. top: 0;
  294. color: #283247;
  295. opacity: 0.7;
  296. font-weight: 400;
  297. }
  298. }
  299. .body {
  300. padding-top: 10px;
  301. padding-bottom: 10px;
  302. position: relative;
  303. color: #283247;
  304. opacity: 0.8;
  305. .status {
  306. position: absolute;
  307. top: 10px;
  308. color: #dc2828;
  309. right: 0px;
  310. font-weight: bold;
  311. }
  312. .van-col {
  313. margin: 3px 0;
  314. }
  315. }
  316. }
  317. }
  318. </style>