cache for store chard

This commit is contained in:
Timi
2026-08-24 18:32:48 +08:00
parent 6235cb3e3d
commit fe5d190308
8 changed files with 102 additions and 23 deletions
@@ -9,7 +9,6 @@
<script setup lang="ts">
import { Time } from "timi-web";
import EventAPI from "@/api/EventAPI";
import StoreChartAPI from "@/api/StoreChartAPI";
import type { CustomerDailyStatView } from "@/types/Customer";
import type { EventItem } from "@/types/EventItem";
@@ -63,7 +62,7 @@ async function loadSummaryData(): Promise<void> {
}
const requestId = ++summaryRequestId;
eventList.value = await EventAPI.listValid();
eventList.value = await StoreChartAPI.listValidEvents();
const eventIdList = getEventIdList();
const [customerStatList, recordDailyStatList] = await Promise.all([
StoreChartAPI.customerDailyStat({
@@ -12,7 +12,6 @@
</template>
<script setup lang="ts">
import EventAPI from "@/api/EventAPI";
import StoreChartAPI from "@/api/StoreChartAPI";
import EventRecordCalendar, { type EventRecordCalendarListPayload } from "@/components/EventRecordCalendar.vue";
import type { EventItem } from "@/types/EventItem";
@@ -44,7 +43,7 @@ onMounted(async () => {
});
async function loadEvents(): Promise<void> {
eventList.value = await EventAPI.listValid();
eventList.value = await StoreChartAPI.listValidEvents();
const eventIdList = getEventIdList();
selectedEventIdList.value = selectedEventIdList.value.length ? selectedEventIdList.value.filter(item => eventIdList.includes(item)) : eventIdList;
}
@@ -41,7 +41,6 @@
<script setup lang="ts">
import { Time } from "timi-web";
import type { EChartsOption } from "echarts";
import EventAPI from "@/api/EventAPI";
import StoreChartAPI from "@/api/StoreChartAPI";
import ChartRangeSlider from "@/components/ChartRangeSlider.vue";
import type { EventItem } from "@/types/EventItem";
@@ -107,7 +106,7 @@ onMounted(async () => {
});
async function loadEvents(): Promise<void> {
numberEventList.value = (await EventAPI.listValid()).filter(item => item.valueType === "NUMBER");
numberEventList.value = (await StoreChartAPI.listValidEvents()).filter(item => item.valueType === "NUMBER");
if (!selectedEventId.value) {
selectedEventId.value = numberEventList.value[0]?.id;
}
@@ -20,8 +20,6 @@
<script setup lang="ts">
import { Time } from "timi-web";
import type { EChartsOption, MarkAreaComponentOption } from "echarts";
import EventAPI from "@/api/EventAPI";
import StoreAPI from "@/api/StoreAPI";
import StoreChartAPI from "@/api/StoreChartAPI";
import ChartRangeSlider from "@/components/ChartRangeSlider.vue";
import type { EventItem } from "@/types/EventItem";
@@ -131,7 +129,7 @@ onBeforeUnmount(() => {
});
async function loadEvents(): Promise<void> {
eventList.value = await EventAPI.listValid();
eventList.value = await StoreChartAPI.listValidEvents();
}
async function loadDailyStat(): Promise<void> {
@@ -203,7 +201,7 @@ async function loadRestDays(): Promise<void> {
}
try {
const list = await StoreAPI.businessDayCalendar(storeId, getDateValue(dateList[0]), getDateValue(dateList[dateList.length - 1]));
const list = await StoreChartAPI.businessDayCalendar(storeId, getDateValue(dateList[0]), getDateValue(dateList[dateList.length - 1]));
if (requestId === restDayRequestId) {
restDaySet.value = new Set(getRestDayList(list));
}
@@ -12,7 +12,6 @@
<script setup lang="ts">
import { Time } from "timi-web";
import type { EChartsOption } from "echarts";
import EventAPI from "@/api/EventAPI";
import StoreChartAPI from "@/api/StoreChartAPI";
import type { EventItem } from "@/types/EventItem";
import type { StoreEventRecordDailyStatView } from "@/types/Store";
@@ -111,7 +110,7 @@ onBeforeUnmount(() => {
});
async function loadEvents(): Promise<void> {
eventList.value = await EventAPI.listValid();
eventList.value = await StoreChartAPI.listValidEvents();
}
async function loadDailyStat(): Promise<void> {