LogForm.vue 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <template>
  2. <div class="log-form">
  3. <BasicTable
  4. :columns="logColumns"
  5. :data-source="logList"
  6. :row-key="(row) => row.code"
  7. :pagination="{
  8. total: total,
  9. pageSize: pageSize,
  10. currentPage: pageNum,
  11. hideOnSinglePage: !logList,
  12. }"
  13. :tableSetting="{
  14. size: false,
  15. redo: false,
  16. fullscreen: false,
  17. striped: false,
  18. setting: false,
  19. }"
  20. :striped="true"
  21. ref="tableRef"
  22. @page-num-change="handlePageNumChange"
  23. @page-size-change="handlePageSizeChange"
  24. >
  25. <template #empty>
  26. <div class="empty-content flex flex-col items-center">
  27. <span class="empty-text">暂无推送记录</span>
  28. </div>
  29. </template>
  30. </BasicTable>
  31. </div>
  32. </template>
  33. <script lang="ts" setup>
  34. import { ref, onMounted } from 'vue';
  35. import { BasicTable } from '@/components/Table';
  36. import { logColumns } from '../overviewColumns';
  37. import { logData } from '../type';
  38. import { queryPushRecords, queryPushRecordsParams } from '../api/index';
  39. import { storeToRefs } from 'pinia';
  40. import useFormList from '../store/useFormList';
  41. const formStore = useFormList();
  42. const { type } = storeToRefs(formStore);
  43. const props = defineProps<{
  44. statisticType: number;
  45. }>();
  46. const logList = ref<logData[]>();
  47. const total = ref<number>(0);
  48. const pageSize = ref<number>(10);
  49. const pageNum = ref<number>(1);
  50. const getLoglist = (pageNum, pageSize) => {
  51. const params: queryPushRecordsParams = {
  52. pageNum: pageNum,
  53. pageSize: pageSize,
  54. statisticType: props.statisticType,
  55. type: type.value,
  56. };
  57. queryPushRecords(params).then((res) => {
  58. logList.value = res.reportPushRecords;
  59. total.value = res.total;
  60. });
  61. };
  62. const handlePageNumChange = (num) => {
  63. pageNum.value = num;
  64. getLoglist(pageNum.value, pageSize.value);
  65. };
  66. const handlePageSizeChange = (size) => {
  67. pageNum.value = 1;
  68. pageSize.value = size;
  69. getLoglist(pageNum.value, pageSize.value);
  70. };
  71. onMounted(() => {
  72. getLoglist(pageNum.value, pageSize.value);
  73. });
  74. </script>
  75. <style lang="scss" scoped>
  76. ::v-deep .s-table {
  77. .el-table__body-wrapper {
  78. overflow-y: auto;
  79. }
  80. }
  81. </style>