You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
1.7 KiB

2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
  1. <!-- UserStatistics.vue -->
  2. <template>
  3. <div class="user-statistics">
  4. <!-- 用户统计数据搜索组件 -->
  5. <UserStatisticsSearch @search="handleSearch" />
  6. <!-- 用户统计数据表格组件 -->
  7. <UserStatisticsTable
  8. ref="userStatisticsTable"
  9. :users="userStatistics"
  10. @page-changed="handlePageChanged"
  11. @data-loaded="handleDataLoaded"
  12. />
  13. </div>
  14. </template>
  15. <script>
  16. import UserStatisticsSearch from '@/components/UserStatistics/UserStatisticsSearch.vue'
  17. import UserStatisticsTable from '@/components/UserStatistics/UserStatisticsTable.vue'
  18. export default {
  19. name: 'UserStatistics',
  20. components: {
  21. UserStatisticsSearch,
  22. UserStatisticsTable
  23. },
  24. data() {
  25. return {
  26. userStatistics: [],
  27. filters: {
  28. type: '',
  29. startDate: '',
  30. endDate: '',
  31. userName: '',
  32. jingwangId: '',
  33. role: ''
  34. },
  35. page: 1,
  36. pageSize: 10,
  37. total: 0
  38. }
  39. },
  40. methods: {
  41. // 处理搜索事件
  42. handleSearch(filters) {
  43. this.filters = filters
  44. this.page = 1
  45. this.$refs.userStatisticsTable.fetchUserStatistics(1, filters);
  46. },
  47. // 处理分页变化
  48. handlePageChanged(page) {
  49. this.page = page;
  50. this.$refs.userStatisticsTable.fetchUserStatistics(page, this.filters);
  51. },
  52. // 处理数据加载完成事件
  53. handleDataLoaded(data) {
  54. this.userStatistics = data.list;
  55. this.total = data.total;
  56. }
  57. },
  58. async mounted() {
  59. // 页面加载时初始化数据
  60. await this.$refs.userStatisticsTable.fetchUserStatistics(1, this.filters);
  61. }
  62. }
  63. </script>
  64. <style scoped>
  65. .user-statistics {
  66. padding: 20px;
  67. }
  68. </style>