EntryDetail.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <script setup lang="ts">
  2. import { reactive } from 'vue'
  3. import { VxeGridProps } from 'vxe-table'
  4. import DateRangePicker from "/@/components/DateRangePicker/index.vue";
  5. import dayjs from 'dayjs';
  6. const DailyEntryTime = ref(dayjs().format('YYYY-MM-DD')); // 使用dayjs获取当前日期并格式化为'YYYY-MM-DD'
  7. const shortcuts = [
  8. {
  9. text: 'Today',
  10. value: new Date(),
  11. },
  12. {
  13. text: 'Yesterday',
  14. value: () => {
  15. const date = new Date()
  16. date.setTime(date.getTime() - 3600 * 1000 * 24)
  17. return date
  18. },
  19. },
  20. {
  21. text: 'A week ago',
  22. value: () => {
  23. const date = new Date()
  24. date.setTime(date.getTime() - 3600 * 1000 * 24 * 7)
  25. return date
  26. },
  27. },
  28. ];
  29. //表格
  30. const tableColumns = [
  31. { type: 'seq', title: 'ID', width: 50 },
  32. { field: 'Name', title: '平台名称' },
  33. { field: 'Country', title: '国家' },
  34. { field: 'Brand', title: '品牌' },
  35. { field: 'Sales', title: '销售额' },
  36. { field: 'TotalAdSales', title: '广告销售额' },
  37. { field: 'AdSpend', title: '广告花费' },
  38. ]
  39. const gridOptions = reactive<VxeGridProps<RowVO>>({
  40. border: true,
  41. height: 300,
  42. align: null,
  43. columnConfig: {
  44. resizable: true,
  45. },
  46. columns: tableColumns,
  47. toolbarConfig: {
  48. slots: {
  49. buttons: 'toolbar_buttons',
  50. },
  51. },
  52. data: [{ Name: 10001, Country: 'Test1', Brand: 'T1', Sales: 'Develop', TotalAdSales: 11, AdSpend: 28 }],
  53. })
  54. </script>
  55. <template>
  56. <div>
  57. <div class="demo-date-picker">
  58. <div class="block">
  59. <span class="demonstration">日录入数据时间:</span>
  60. <el-date-picker
  61. v-model="DailyEntryTime"
  62. type="Date"
  63. :size="size"
  64. />
  65. </div>
  66. <div class="block">
  67. <span class="demonstration">销售额数据时间:</span>
  68. <el-date-picker
  69. v-model="SalesDataTime"
  70. type="Date"
  71. :size="size"
  72. />
  73. </div>
  74. <div class="block">
  75. <span class="demonstration">广告数据时间:</span>
  76. <el-date-picker
  77. v-model="AdDataTime"
  78. type="Date"
  79. :size="size"
  80. />
  81. </div>
  82. </div>
  83. <vxe-grid v-bind="gridOptions">
  84. <template #toolbar_buttons></template>
  85. </vxe-grid>
  86. </div>
  87. </template>
  88. <style scoped>
  89. .demo-date-picker {
  90. display: flex;
  91. width: 100%;
  92. padding: 0;
  93. flex-wrap: wrap;
  94. }
  95. .demo-date-picker .block:last-child {
  96. border-right: none;
  97. }
  98. .demo-date-picker .demonstration {
  99. color: var(--el-text-color-secondary);
  100. font-size: 14px;
  101. /*margin-bottom: 20px;*/
  102. margin:10px;
  103. }
  104. </style>