index.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. <template>
  2. <div>
  3. <van-nav-bar
  4. title="热线工单"
  5. left-text="返回"
  6. left-arrow
  7. @click-left="onClickLeft"
  8. />
  9. <div class="body">
  10. <van-dropdown-menu>
  11. <van-dropdown-item v-model="value1" :options="option1" />
  12. <van-dropdown-item v-model="value2" :options="option2" />
  13. </van-dropdown-menu>
  14. <div class="listcontent" :style="`height:${bodyheight}px`">
  15. <van-pull-refresh v-model="refreshing" @refresh="onRefresh">
  16. <van-list
  17. v-model:loading="loading"
  18. :finished="finished"
  19. finished-text="没有更多了"
  20. @load="onLoad"
  21. >
  22. <div
  23. style="padding: 10px 10px; padding-bottom: 0"
  24. v-for="item in tasklist"
  25. >
  26. <div class="item" @click="gotodetail(item)">
  27. <div>
  28. <div class="header">
  29. <div>任务编号:{{ item.taskCode }}</div>
  30. <div class="time">{{ item.taskTime }}</div>
  31. </div>
  32. <div class="body">
  33. <div class="status">{{task_status.filter(
  34. (i) => i.value.toString() === (item.status??"").toString()
  35. )[0]?.label ?? "-"}}</div>
  36. <van-row>
  37. <van-col span="24"
  38. ><div>
  39. 热线类型:{{
  40. task_event_type.filter(
  41. (i) =>
  42. i.value.toString() ===
  43. (item.taskEventType??"").toString()
  44. )[0]?.label ?? "-"
  45. }}
  46. </div></van-col
  47. >
  48. <van-col span="12"> <div>联系人:{{item.taskReporter}}</div></van-col>
  49. <van-col span="12"><div>联系方式:{{item.taskComplainConnect}}</div></van-col>
  50. <van-col span="24"
  51. ><div>任务内容: {{ item.taskContent }}</div></van-col
  52. >
  53. </van-row>
  54. </div>
  55. </div>
  56. </div>
  57. </div>
  58. </van-list>
  59. </van-pull-refresh>
  60. </div>
  61. </div>
  62. </div>
  63. </template>
  64. <script setup>
  65. import { defineComponent, ref, onMounted, watch, computed } from "vue";
  66. import { useDict } from "@/utils/dict";
  67. import router from "../../../router";
  68. import {
  69. listTask,
  70. getTask,
  71. delTask,
  72. addTask,
  73. updateTask,
  74. } from "@/api/system/task";
  75. const tasklist = ref([]);
  76. const loading = ref(false);
  77. const finished = ref(false);
  78. const refreshing = ref(false);
  79. const { task_status, task_event_category, task_event_type } = useDict(
  80. "task_status",
  81. "task_event_category",
  82. "task_event_type"
  83. );
  84. const bodyheight = ref(0);
  85. bodyheight.value = document.body.clientHeight - 48 - 46;
  86. const value1 = ref(0);
  87. const value2 = ref("0");
  88. const option1 = [
  89. { text: "我的", value: 0 },
  90. { text: "全部", value: 1 },
  91. ];
  92. const option2 = computed(() => {
  93. return [{ text: "全部", value: "0" }].concat(task_status.value.map((i) => {
  94. return { text: i.label, value: i.value };
  95. }));
  96. });
  97. const gotodetail = (item) => {
  98. router.push(`/mb/task/detail/${item.taskId}`);
  99. }
  100. const pagec = ref(1);
  101. const onLoad = () => {
  102. if (refreshing.value) {
  103. tasklist.value = [];
  104. refreshing.value = false;
  105. pagec.value = 1;
  106. }
  107. var p = { pageSize: 10, pageNum: pagec.value++ };
  108. if (value2.value !== '0') {
  109. p['status'] =parseInt(value2.value)
  110. }
  111. listTask(p).then((res) => {
  112. // finished.value = true;
  113. loading.value = false;
  114. tasklist.value = tasklist.value.concat(res.rows);
  115. if (res.total <= tasklist.value.length) {
  116. finished.value = true;
  117. }
  118. });
  119. };
  120. watch(() => value2.value, () => {
  121. refreshing.value = true;
  122. onLoad();
  123. })
  124. const onRefresh = () => {
  125. // 清空列表数据
  126. finished.value = false;
  127. loading.value = true;
  128. refreshing.value = true;
  129. onLoad();
  130. };
  131. const onClickLeft = () => {
  132. router.back();
  133. };
  134. </script>
  135. <style lang="scss">
  136. body {
  137. position: fixed;
  138. width: 100%;
  139. top: -1px;
  140. }
  141. .listcontent {
  142. overflow-y: auto;
  143. .item {
  144. background: #fff;
  145. border: 1px solid rgba(209, 217, 221,0.4);
  146. padding: 10px 15px;
  147. font-size: 10px;
  148. border-radius: 5px;
  149. .header {
  150. color: #3d6dc5;
  151. font-weight: bold;
  152. position: relative;
  153. padding-bottom: 8px;
  154. border-bottom: 1px solid rgba(209, 217, 221,0.4);
  155. .time {
  156. position: absolute;
  157. right: 0;
  158. top: 0;
  159. color: #283247;
  160. opacity: 0.7;
  161. font-weight: 400;
  162. }
  163. }
  164. .body {
  165. padding-top: 10px;
  166. padding-bottom: 10px;
  167. position: relative;
  168. color: #283247;
  169. opacity: 0.8;
  170. .status {
  171. position: absolute;
  172. top: 10px;
  173. color: #dc2828;
  174. right: 0px;
  175. font-weight: bold;
  176. }
  177. .van-col {
  178. margin: 3px 0;
  179. }
  180. }
  181. }
  182. }
  183. </style>