personCheckDataDetail.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. <template>
  2. <div class="log">
  3. <PageMain class="vh100">
  4. <div class='btn-box'>
  5. <el-button type="primary" plain class='query-btn'
  6. @click='dialogShow'>{{selectedKeys.length?`已选${selectedKeys.length}项`:'筛选条件'}}</el-button>
  7. <div class='query-btn'>
  8. <DowButton @endAnim='downloadFile'></DowButton>
  9. </div>
  10. </div>
  11. <QueryForm :option="listOption" @query='query' @delSelect='delSelect' ref='queryFormRef'></QueryForm>
  12. <!-- 表格 -->
  13. <ComplexTable :tableData="tableData" :showSelect='false' :columns="listOption.columns" :showIndex="false"
  14. :columnwidth="120" :pageInfo="pageInfo" @getList="getList" :showOperation='false'>
  15. <template v-slot:search="scope">
  16. <Sort :scope="scope.slotData" :globalSortKey="globalSortKey" :globalSortOrder="globalSortOrder"
  17. @update:sort="handleSortUpdate"></Sort>
  18. </template>
  19. <template #customSlot="{ bodyCell: { scope, column } }">
  20. <template v-if="column.prop == 'checkDuration'">
  21. {{ scope.row.checkDuration }} s
  22. </template>
  23. </template>
  24. </ComplexTable>
  25. <FilterDialog :show='isShow' @close='isShow=false' @sure='filterSure' ref='filterDialogRef' @selectedKeys='selected'
  26. routerKey='routerKey'>
  27. </FilterDialog>
  28. </PageMain>
  29. </div>
  30. </template>
  31. <script setup lang="ts">
  32. import { useRouter } from "vue-router";
  33. import api from "@/api";
  34. import QueryForm from "../../components/queryForm.vue";
  35. import FilterDialog from "../../components/filterDialog.vue";
  36. import DowButton from "../../components/button.vue";
  37. import Sort from "../../components/sort.vue";
  38. import useUserStore from "@/store/modules/message";
  39. import PageInfo from "@/api/types/agreementTypes";
  40. import { ElMessage } from "element-plus";
  41. const router = useRouter();
  42. const userStore = useUserStore();
  43. const isShow = ref(false);
  44. const isSort = ref();
  45. const pageInfo = ref({
  46. pageNum: 1,
  47. pageSize: 10,
  48. sizes: [10, 20, 30, 40, 50],
  49. total: 0,
  50. });
  51. const listOption = reactive({
  52. rowKey: "salesmanReportDetId",
  53. //查询
  54. queryFormFields: [],
  55. // 表格列
  56. columns: [
  57. {
  58. prop: "orderNo",
  59. label: "订单号",
  60. width: "",
  61. },
  62. {
  63. prop: "licenseNo",
  64. label: "车牌号",
  65. width: "180",
  66. },
  67. {
  68. prop: "orderTypeName",
  69. label: "订单类型",
  70. width: "180",
  71. },
  72. {
  73. prop: "submitCheckTime",
  74. label: "提交审核时间",
  75. width: "180",
  76. },
  77. {
  78. prop: "checkTime",
  79. label: "审核时间",
  80. width: "180",
  81. },
  82. {
  83. prop: "checkResult",
  84. label: "审核结果",
  85. width: "180",
  86. },
  87. {
  88. prop: "checkDuration",
  89. label: "审核时长",
  90. width: "180",
  91. align: "right",
  92. sortable: true,
  93. component: "customSlot",
  94. },
  95. {
  96. prop: "checkUserName",
  97. label: "审核人",
  98. width: "180",
  99. },
  100. {
  101. prop: "checkUserPhone",
  102. label: "手机号",
  103. width: "180",
  104. },
  105. ],
  106. });
  107. const selectedKeys = ref([]);
  108. const selected = function (val) {
  109. selectedKeys.value = val;
  110. };
  111. //查询数据
  112. const phone = JSON.parse(localStorage.getItem("userInfo")).username;
  113. //获取默认选择数据
  114. const queryFormRes = ref();
  115. const routerKey = ref("salesmanReportDetail");
  116. const defaultList = ref();
  117. const pageHiddenList = ref([]); //页面不显示的数据
  118. const initDefaultList = async () => {
  119. const { data } = await api.manageApi.getSearchDefaultList({
  120. routerKey: routerKey.value,
  121. userId: phone,
  122. });
  123. listOption.queryFormFields = data.filter((e) => e.showFlag);
  124. pageHiddenList.value = data.filter((e) => !e.showFlag);
  125. defaultList.value = data.map((e) => e.id);
  126. selectedKeys.value = defaultList.value;
  127. queryFormRes.value = queryFormRef.value?.initDefaultSaveForm();
  128. queryList();
  129. };
  130. //删除
  131. const filterDialogRef = ref();
  132. const delSelect = (id) => {
  133. listOption.queryFormFields = listOption.queryFormFields.filter(
  134. (item) => item.id != id
  135. );
  136. filterDialogRef.value.initList(
  137. [...listOption.queryFormFields, ...pageHiddenList.value],
  138. defaultList.value
  139. );
  140. };
  141. //打开dialogShow
  142. const dialogShow = function () {
  143. isShow.value = true;
  144. filterDialogRef.value.initList(
  145. [...listOption.queryFormFields, ...pageHiddenList.value],
  146. defaultList.value
  147. );
  148. };
  149. //确定
  150. const queryFormRef = ref();
  151. const filterSure = (item, index) => {
  152. isShow.value = false;
  153. const secondGroupIds = item.list.map((item) => item.id);
  154. const oldList = listOption.queryFormFields.filter((item) =>
  155. secondGroupIds.includes(item.id)
  156. );
  157. const firstGroupIds = listOption.queryFormFields.map((item) => item.id);
  158. let newList = item.list.filter((item) => !firstGroupIds.includes(item.id));
  159. //过滤掉默认不显示的数据
  160. const hiddenList = new Set(pageHiddenList.value.map((item) => item.id));
  161. const filterList = newList.filter((item) => !hiddenList.has(item.id));
  162. listOption.queryFormFields = [...oldList, ...filterList];
  163. queryFormRef.value?.initDefaultSaveForm();
  164. selectedKeys.value = item.list.filter((item) => item.id);
  165. };
  166. const globalSortKey = ref("");
  167. const globalSortOrder = ref<"asc" | "desc">("asc");
  168. // 处理子组件传递的排序更新
  169. const handleSortUpdate = (sortInfo: {
  170. key: string;
  171. order: string;
  172. name: string;
  173. }) => {
  174. globalSortKey.value = sortInfo.key;
  175. globalSortOrder.value = sortInfo.order;
  176. queryList();
  177. };
  178. //查询
  179. const query = (item) => {
  180. queryFormRes.value = item;
  181. queryList();
  182. };
  183. //数据查询
  184. const tableData = ref([]);
  185. const queryList = async () => {
  186. let query = { ...queryFormRes.value };
  187. const { data } = await api.manageApi.personCheckDataDetailPageList({
  188. pageNo: pageInfo.value.pageNum,
  189. pageSize: pageInfo.value.pageSize,
  190. routerKey: routerKey.value,
  191. userId: phone,
  192. orderType: globalSortKey.value
  193. ? globalSortKey.value + " " + globalSortOrder.value
  194. : "",
  195. ...query,
  196. });
  197. tableData.value = data.records;
  198. pageInfo.value.pageNum = data.current;
  199. pageInfo.value.pageSize = data.size;
  200. pageInfo.value.total = data.total;
  201. };
  202. //分页事件
  203. function getList(item: PageInfo) {
  204. pageInfo.value.pageNum = item.pageNum;
  205. pageInfo.value.pageSize = item.pageSize;
  206. queryList();
  207. }
  208. //导出
  209. const downloadFile = async () => {
  210. let query = { ...queryFormRes.value };
  211. const { data, msg } = await api.manageApi.personCheckDataDetailToTa({
  212. pageNo: pageInfo.value.pageNum,
  213. pageSize: pageInfo.value.pageSize,
  214. routerKey: routerKey.value,
  215. userId: phone,
  216. orderType: globalSortKey.value
  217. ? globalSortKey.value + " " + globalSortOrder.value
  218. : "",
  219. ...query,
  220. });
  221. ElMessage({
  222. message: msg,
  223. type: "success",
  224. });
  225. userStore.count++;
  226. };
  227. onMounted(() => {
  228. initDefaultList();
  229. });
  230. </script>
  231. <style scoped lang="scss">
  232. .log {
  233. .query-btn {
  234. margin-left: 20px;
  235. }
  236. .btn-box {
  237. padding-bottom: 15px;
  238. margin-bottom: 24px;
  239. border-bottom: 1px solid #eeeeee;
  240. display: flex;
  241. justify-content: flex-end;
  242. }
  243. }
  244. :deep(.caret-wrapper) {
  245. display: none !important;
  246. }
  247. </style>