index.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  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="daoda(item)">到达现场</van-button>
  86. </div>
  87. </van-col>
  88. </van-row>
  89. <van-row v-if="item.status == 2 && ((item.tblTaskLogList??[]).filter(i=>i.taskStatus==-1).length>0)">
  90. <van-col span="24">
  91. <div style="text-align:right">
  92. <van-button type="primary" size="small" @click.stop="czfk(item)">处置反馈</van-button>
  93. </div>
  94. </van-col>
  95. </van-row>
  96. </div>
  97. </div>
  98. </div>
  99. </div>
  100. </van-list>
  101. </van-pull-refresh>
  102. </div>
  103. </div>
  104. </div>
  105. </template>
  106. <script setup>
  107. import { defineComponent, ref, onMounted, watch, computed } from "vue";
  108. import { useDict } from "@/utils/dict";
  109. import router from "../../../router";
  110. import {
  111. listTask,
  112. getTask,
  113. delTask,
  114. addTask,
  115. updateTask,
  116. ddTask,
  117. } from "@/api/system/task";
  118. import { Toast } from "vant";
  119. const tasklist = ref([]);
  120. const loading = ref(false);
  121. const finished = ref(false);
  122. const refreshing = ref(false);
  123. const { task_status, task_event_category, task_event_type,task_type } = useDict(
  124. "task_status",
  125. "task_event_category",
  126. "task_event_type",
  127. "task_type"
  128. );
  129. const bodyheight = ref(0);
  130. bodyheight.value = document.body.clientHeight - 48 - 46;
  131. const value1 = ref(0);
  132. const value2 = ref("0");
  133. const option1 = [
  134. { text: "我的", value: 0 },
  135. { text: "全部", value: 1 },
  136. ];
  137. const option2 = computed(() => {
  138. return [{ text: "全部", value: "0" }].concat(
  139. task_status.value.map((i) => {
  140. return { text: i.label, value: i.value };
  141. })
  142. );
  143. });
  144. const gotodetail = (item) => {
  145. router.push(`/mb/task/detail/${item.taskId}`);
  146. };
  147. const pagec = ref(1);
  148. const onLoad = () => {
  149. if (refreshing.value) {
  150. tasklist.value = [];
  151. refreshing.value = false;
  152. pagec.value = 1;
  153. }
  154. var p = { pageSize: 10, pageNum: pagec.value++ };
  155. if (value2.value !== "0") {
  156. p["status"] = parseInt(value2.value);
  157. }
  158. listTask(p).then((res) => {
  159. // finished.value = true;
  160. loading.value = false;
  161. tasklist.value = tasklist.value.concat(res.rows);
  162. if (res.total <= tasklist.value.length) {
  163. finished.value = true;
  164. }
  165. });
  166. };
  167. watch(
  168. () => value2.value,
  169. () => {
  170. refreshing.value = true;
  171. onLoad();
  172. }
  173. );
  174. const onRefresh = () => {
  175. // 清空列表数据
  176. finished.value = false;
  177. loading.value = true;
  178. refreshing.value = true;
  179. onLoad();
  180. };
  181. const onClickLeft = () => {
  182. router.back();
  183. };
  184. const onClickRight = () => {
  185. router.push("/mb/task/add")
  186. };
  187. const daoda = (item) => {
  188. ddTask({
  189. taskId: item.taskId,
  190. taskStatus: -1,
  191. logDes: JSON.stringify({"desc":"到达"})
  192. }).then(res => {
  193. Toast.success("成功");
  194. onRefresh();
  195. })
  196. }
  197. const czfk = (item) => {
  198. localStorage.setItem("currenttask", JSON.stringify(item));
  199. router.push(`/mb/task/disposal?id=${item.taskId}`)
  200. }
  201. </script>
  202. <style lang="scss">
  203. body {
  204. position: fixed;
  205. width: 100%;
  206. top: -1px;
  207. }
  208. .listcontent {
  209. overflow-y: auto;
  210. .item {
  211. background: #fff;
  212. border: 1px solid rgba(209, 217, 221, 0.4);
  213. padding: 10px 15px;
  214. font-size: 10px;
  215. border-radius: 5px;
  216. .header {
  217. color: #3d6dc5;
  218. font-weight: bold;
  219. position: relative;
  220. padding-bottom: 8px;
  221. border-bottom: 1px solid rgba(209, 217, 221, 0.4);
  222. .time {
  223. position: absolute;
  224. right: 0;
  225. top: 0;
  226. color: #283247;
  227. opacity: 0.7;
  228. font-weight: 400;
  229. }
  230. }
  231. .body {
  232. padding-top: 10px;
  233. padding-bottom: 10px;
  234. position: relative;
  235. color: #283247;
  236. opacity: 0.8;
  237. .status {
  238. position: absolute;
  239. top: 10px;
  240. color: #dc2828;
  241. right: 0px;
  242. font-weight: bold;
  243. }
  244. .van-col {
  245. margin: 3px 0;
  246. }
  247. }
  248. }
  249. }
  250. </style>