diff --git a/client/src/api/budget.ts b/client/src/api/budget.ts index 18725b3..0900a3e 100644 --- a/client/src/api/budget.ts +++ b/client/src/api/budget.ts @@ -14,6 +14,6 @@ export function getBudget(month?: string, group_id?: number | null) { } /** 设置预算 */ -export function setBudget(amount: number, month: string) { - return request({ url: '/budget', method: 'POST', data: { amount, month } }) +export function setBudget(amount: number, month: string, group_id?: number | null) { + return request({ url: '/budget', method: 'POST', data: { amount, month, group_id } }) } diff --git a/client/src/api/stats.ts b/client/src/api/stats.ts index fcdbf5c..1e7e9a3 100644 --- a/client/src/api/stats.ts +++ b/client/src/api/stats.ts @@ -43,6 +43,19 @@ export function getTrend(month?: string, type: string = 'expense', group_id?: nu return request({ url: '/stats/trend', data: { month, type, group_id, period } }) } +/** 聚合统计(一次请求返回 overview + category + trend) */ +export interface DashboardData { + overview: Overview + category: CategoryStat[] + trend: TrendPoint[] + month: string +} + +/** 获取聚合统计数据 */ +export function getDashboard(params?: { month?: string; type?: string; period?: 'week' | 'month' | 'year'; group_id?: number | null }) { + return request({ url: '/stats/dashboard', data: params }) +} + /** 智能分类建议结果 */ export interface CategorySuggestion { category: { id: number; name: string; color: string } | null diff --git a/client/src/components/AmountEditor/AmountEditor.vue b/client/src/components/AmountEditor/AmountEditor.vue index c234653..f32c013 100644 --- a/client/src/components/AmountEditor/AmountEditor.vue +++ b/client/src/components/AmountEditor/AmountEditor.vue @@ -1,17 +1,17 @@