index.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <template>
  2. <div class="container">
  3. <div class="card-box">
  4. <div class="left-box">
  5. <a-card class="count-card no-border">
  6. <CountPage :data></CountPage>
  7. </a-card>
  8. <a-card class="list-card no-border">
  9. <ListPage
  10. :data
  11. :pageObj="pageObj"
  12. @paginationFun="paginationFun"
  13. ></ListPage>
  14. </a-card>
  15. </div>
  16. <a-card class="right-card">
  17. <TreePage :data></TreePage>
  18. </a-card>
  19. </div>
  20. </div>
  21. </template>
  22. <script lang="ts" setup name="HomePage">
  23. import { ref } from 'vue';
  24. import { useIntervalFn } from '@vueuse/core';
  25. import type { AlarmTotalRes } from '@/api/home';
  26. import { fetchHomeAlarmTotal } from '@/api/home';
  27. import { SizeProps, Pagination } from '@/types/global';
  28. import ListPage from './list/index.vue';
  29. import CountPage from './count/index.vue';
  30. import TreePage from './tree/index.vue';
  31. const data = ref<AlarmTotalRes>({} as AlarmTotalRes);
  32. const pageObj = ref<Pagination>({
  33. current: 1,
  34. pageSize: 20,
  35. });
  36. const getData = () => {
  37. const { current, pageSize } = pageObj.value;
  38. fetchHomeAlarmTotal({ pageIndex: current, pageSize }).then(res => {
  39. data.value = res;
  40. });
  41. };
  42. function paginationFun(value: number) {
  43. pageObj.value.current = value;
  44. getData();
  45. }
  46. const { pause, resume, isActive } = useIntervalFn(() => {
  47. /* your function */
  48. getData();
  49. }, 10 * 1000);
  50. getData();
  51. </script>
  52. <style lang="less" scoped>
  53. .container {
  54. padding: 10px;
  55. .card-box {
  56. display: flex;
  57. flex-direction: row;
  58. justify-content: space-between;
  59. width: 100%;
  60. }
  61. .left-box {
  62. width: 46%;
  63. }
  64. .list-card {
  65. :deep(.arco-card-body) {
  66. padding: 0;
  67. }
  68. }
  69. .right-card {
  70. width: 54%;
  71. margin-left: 10px;
  72. }
  73. .count-card {
  74. margin-bottom: 10px;
  75. }
  76. :deep(.arco-card-bordered) {
  77. border: none;
  78. }
  79. }
  80. </style>