index.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <template>
  2. <div class="asj-container">
  3. <div class="overview-top">
  4. <div v-for="tab of tabs" :key="tab.name" :class="['asj-tab', { active: tabActiveName === tab.name }]" @click="tabActiveName = tab.name">
  5. {{ tab.label }}
  6. </div>
  7. </div>
  8. <component :is="tabsComponents[tabActiveName]"></component>
  9. </div>
  10. </template>
  11. <script lang="ts" setup>
  12. import {onBeforeMount, provide, Ref, ref} from 'vue'
  13. import {usePublicData} from '/@/stores/publicData'
  14. import {storeToRefs} from 'pinia'
  15. import {GetAllPortfolios} from '/@/views/adManage/portfolios/api'
  16. import Total from './total/index.vue'
  17. import Hour from '/@/views/adManage/ad-overview/hourly/index.vue'
  18. import Daily from '/@/views/adManage/ad-overview/daily/index.vue'
  19. import Weekly from '/@/views/adManage/ad-overview/weekly/index.vue'
  20. import Monthly from '/@/views/adManage/ad-overview/monthly/index.vue'
  21. // const shopInfo = useShopInfo()
  22. const publicData = usePublicData()
  23. const selectedPortfolios: Ref<string[]> = ref([])
  24. const portfolios: Ref<Portfolio[]> = ref([])
  25. const { dateRange } = storeToRefs(publicData)
  26. const tabActiveName = ref('Total')
  27. const tabs = [
  28. { label: '总览', name: 'Total' },
  29. { label: '按小时', name: 'Hour' },
  30. { label: '按日', name: 'Daily' },
  31. { label: '按周', name: 'Weekly' },
  32. { label: '按月', name: 'Monthly' },
  33. ]
  34. const tabsComponents: any = {
  35. Total,
  36. Hour,
  37. Daily,
  38. Weekly,
  39. Monthly,
  40. }
  41. provide('dateRange', dateRange)
  42. onBeforeMount(async () => {
  43. const resp: APIResponseData = await GetAllPortfolios()
  44. portfolios.value = resp.data
  45. })
  46. </script>
  47. <style scoped>
  48. ::v-deep(.el-table .el-table__header-wrapper .cell) {
  49. border-right: 1px solid rgb(218, 221, 223);
  50. }
  51. </style>