数据分析ui补充完善,接入数据库

This commit is contained in:
comlibmb
2026-02-01 20:17:37 +08:00
parent 6716398175
commit 19970db288
19 changed files with 393 additions and 435 deletions

View File

@@ -12,8 +12,19 @@ function safeNumber(v: any): number {
return isFinite(n) ? n : 0
}
export async function fetchDashboardTrend(period: string): Promise<TrendData> {
const { startIso, endIso } = computeDateRange(period)
export async function fetchDashboardTrend(period: string, range?: { start: string; end: string } | null): Promise<TrendData> {
let startIso: string;
let endIso: string;
if (range != null && range.start && range.end) {
startIso = range.start;
endIso = range.end;
} else {
const computedRange = computeDateRange(period)
startIso = computedRange.startIso
endIso = computedRange.endIso
}
const p_start_date = toDateOnly(startIso)
const p_end_date = toDateOnly(endIso)