feat: 添加预算服务,包含预算的CRUD操作、进度查询及相关工具函数

This commit is contained in:
2026-02-02 15:54:13 +08:00
parent a4631eebd2
commit 8083d7125f

View File

@@ -139,8 +139,14 @@ export async function updateBudget(id: number, data: Partial<BudgetFormInput>):
if (data.categoryId !== undefined) payload.category_id = data.categoryId;
if (data.accountId !== undefined) payload.account_id = data.accountId;
if (data.isRolling !== undefined) payload.is_rolling = data.isRolling;
if (data.startDate !== undefined) payload.start_date = `${data.startDate}T00:00:00Z`;
if (data.endDate !== undefined) payload.end_date = data.endDate ? `${data.endDate}T23:59:59Z` : null;
if (data.startDate !== undefined) {
const dateStr = data.startDate.split('T')[0];
payload.start_date = `${dateStr}T00:00:00Z`;
}
if (data.endDate !== undefined) {
const dateStr = data.endDate ? data.endDate.split('T')[0] : null;
payload.end_date = dateStr ? `${dateStr}T23:59:59Z` : null;
}
const response = await api.put<ApiResponse<ApiBudget>>(`/budgets/${id}`, payload);
if (!response.data) {