-
-
-
-
+
+
+
+
+
@@ -66,15 +67,14 @@
+
+
+
-
-
@@ -226,7 +229,6 @@ const overallStats = computed(() => {
}
return {
- week: getStatsForType(BudgetPeriodType.Week),
month: getStatsForType(BudgetPeriodType.Month),
year: getStatsForType(BudgetPeriodType.Year)
}
@@ -274,10 +276,8 @@ const formatMoney = (val) => {
const getPeriodLabel = (type) => {
const map = {
- [BudgetPeriodType.Week]: '本周',
[BudgetPeriodType.Month]: '本月',
- [BudgetPeriodType.Year]: '本年',
- [BudgetPeriodType.Longterm]: '长期'
+ [BudgetPeriodType.Year]: '本年'
}
return map[type] || '周期'
}
@@ -298,18 +298,11 @@ const getIncomeProgressColor = (budget) => {
const refDateMap = {}
const handleSwitchPeriod = async (budget, direction) => {
- if (budget.type === BudgetPeriodType.Longterm) {
- showToast('长期预算不支持切换周期')
- return
- }
-
// 获取或初始化该预算的参考日期
let currentRefDate = refDateMap[budget.id] || new Date()
const date = new Date(currentRefDate)
- if (budget.type === BudgetPeriodType.Week) {
- date.setDate(date.getDate() + direction * 7)
- } else if (budget.type === BudgetPeriodType.Month) {
+ if (budget.type === BudgetPeriodType.Month) {
date.setMonth(date.getMonth() + direction)
} else if (budget.type === BudgetPeriodType.Year) {
date.setFullYear(date.getFullYear() + direction)
@@ -362,6 +355,27 @@ const handleToggleStop = async (budget) => {
diff --git a/WebApi/Controllers/BudgetController.cs b/WebApi/Controllers/BudgetController.cs
index d5cf307..288d1ec 100644
--- a/WebApi/Controllers/BudgetController.cs
+++ b/WebApi/Controllers/BudgetController.cs
@@ -181,7 +181,6 @@ public class BudgetController(
factor = b.Type switch
{
BudgetPeriodType.Month => 12,
- BudgetPeriodType.Week => 52,
BudgetPeriodType.Year => 1,
_ => 0
};
@@ -191,7 +190,6 @@ public class BudgetController(
factor = b.Type switch
{
BudgetPeriodType.Month => 1,
- BudgetPeriodType.Week => 52m / 12m,
BudgetPeriodType.Year => 1m / 12m,
_ => 0
};
diff --git a/WebApi/Controllers/Dto/BudgetDto.cs b/WebApi/Controllers/Dto/BudgetDto.cs
index 31e5a5a..29e31e2 100644
--- a/WebApi/Controllers/Dto/BudgetDto.cs
+++ b/WebApi/Controllers/Dto/BudgetDto.cs
@@ -35,10 +35,8 @@ public class BudgetDto
StartDate = entity.StartDate.ToString("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}"
},
PeriodStart = start,