diff --git a/ecom-dmb-frontend/apps/web-antd/src/views/dashboard/company-overview/index.vue b/ecom-dmb-frontend/apps/web-antd/src/views/dashboard/company-overview/index.vue index 66b9b984..84983f27 100644 --- a/ecom-dmb-frontend/apps/web-antd/src/views/dashboard/company-overview/index.vue +++ b/ecom-dmb-frontend/apps/web-antd/src/views/dashboard/company-overview/index.vue @@ -56,7 +56,10 @@ const activeTimeRange = ref< >('30days'); // 自定义日期范围 -const customDateRange = ref<[dayjs.Dayjs, dayjs.Dayjs] | undefined>(undefined); +const customDateRange = ref<[dayjs.Dayjs, dayjs.Dayjs] | undefined>([ + dateRange.value[0], + dateRange.value[1], +]); const lastRequestKey = ref(''); const isSyncingRouteQuery = ref(false); @@ -96,6 +99,7 @@ const switchTimeRange = ( } dateRange.value = [startDate, endDate]; + customDateRange.value = [startDate, endDate]; }; // 自定义日期范围变化 @@ -133,25 +137,25 @@ const setTimeRangeTypeByDates = ( if (daysDiff === 0 && startDate.isSame(today, 'day')) { activeTimeRange.value = 'today'; - customDateRange.value = undefined; + customDateRange.value = [startDate, endDate]; return; } if (daysDiff === 0 && startDate.isSame(dayjs().subtract(1, 'day'), 'day')) { activeTimeRange.value = 'yesterday'; - customDateRange.value = undefined; + customDateRange.value = [startDate, endDate]; return; } if (isEndDateToday && isStartDate7DaysAgo) { activeTimeRange.value = '7days'; - customDateRange.value = undefined; + customDateRange.value = [startDate, endDate]; return; } if (isEndDateToday && isStartDate30DaysAgo) { activeTimeRange.value = '30days'; - customDateRange.value = undefined; + customDateRange.value = [startDate, endDate]; return; } diff --git a/ecom-dmb-frontend/apps/web-antd/src/views/ecommerce/shop/overview/index.vue b/ecom-dmb-frontend/apps/web-antd/src/views/ecommerce/shop/overview/index.vue index aa31e61f..230996d2 100644 --- a/ecom-dmb-frontend/apps/web-antd/src/views/ecommerce/shop/overview/index.vue +++ b/ecom-dmb-frontend/apps/web-antd/src/views/ecommerce/shop/overview/index.vue @@ -54,7 +54,10 @@ const activeTimeRange = ref< >('7days'); // 自定义日期范围 -const customDateRange = ref<[dayjs.Dayjs, dayjs.Dayjs] | undefined>(undefined); +const customDateRange = ref<[dayjs.Dayjs, dayjs.Dayjs] | undefined>([ + dateRange.value[0], + dateRange.value[1], +]); const lastRequestKey = ref(''); const isSyncingRouteQuery = ref(false); @@ -94,6 +97,7 @@ const switchTimeRange = ( } dateRange.value = [startDate, endDate]; + customDateRange.value = [startDate, endDate]; }; // 自定义日期范围变化 @@ -130,25 +134,25 @@ const setTimeRangeTypeByDates = ( if (daysDiff === 0 && startDate.isSame(today, 'day')) { activeTimeRange.value = 'today'; - customDateRange.value = undefined; + customDateRange.value = [startDate, endDate]; return; } if (daysDiff === 0 && startDate.isSame(dayjs().subtract(1, 'day'), 'day')) { activeTimeRange.value = 'yesterday'; - customDateRange.value = undefined; + customDateRange.value = [startDate, endDate]; return; } if (isEndDateToday && isStartDate7DaysAgo) { activeTimeRange.value = '7days'; - customDateRange.value = undefined; + customDateRange.value = [startDate, endDate]; return; } if (isEndDateToday && isStartDate30DaysAgo) { activeTimeRange.value = '30days'; - customDateRange.value = undefined; + customDateRange.value = [startDate, endDate]; return; }