index.vue 6.6 KB

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