feat: add budget update functionality and enhance budget management UI
- Implemented UpdateAsync method in BudgetController for updating budget details. - Created UpdateBudgetDto for handling budget update requests. - Added BudgetCard component for displaying budget information with progress tracking. - Developed BudgetEditPopup component for creating and editing budget entries. - Introduced BudgetSummary component for summarizing budget statistics by period. - Enhanced budget period display logic in BudgetDto to support various timeframes.
This commit is contained in:
@@ -31,7 +31,14 @@ public class BudgetDto
|
||||
: entity.SelectedCategories.Split(','),
|
||||
IsStopped = entity.IsStopped,
|
||||
StartDate = entity.StartDate.ToString("yyyy-MM-dd"),
|
||||
Period = entity.Type == BudgetPeriodType.Longterm ? "长期" : $"{start:yyyy-MM-dd} ~ {end:yyyy-MM-dd}"
|
||||
Period = entity.Type switch
|
||||
{
|
||||
BudgetPeriodType.Longterm => "长期",
|
||||
BudgetPeriodType.Year => $"{start:yy}年",
|
||||
BudgetPeriodType.Month => $"{start:yy}年第{start.Month}月",
|
||||
BudgetPeriodType.Week => $"{start:yy}年第{System.Globalization.CultureInfo.CurrentCulture.Calendar.GetWeekOfYear(start, System.Globalization.CalendarWeekRule.FirstDay, DayOfWeek.Monday)}周",
|
||||
_ => $"{start:yyyy-MM-dd} ~ {end:yyyy-MM-dd}"
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -45,3 +52,10 @@ public class CreateBudgetDto
|
||||
public string[] SelectedCategories { get; set; } = Array.Empty<string>();
|
||||
public DateTime? StartDate { get; set; }
|
||||
}
|
||||
|
||||
public class UpdateBudgetDto : CreateBudgetDto
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public bool IsStopped { get; set; }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user