diff --git a/Entity/BudgetRecord.cs b/Entity/BudgetRecord.cs index 83a1f06..b890bd3 100644 --- a/Entity/BudgetRecord.cs +++ b/Entity/BudgetRecord.cs @@ -30,11 +30,6 @@ public class BudgetRecord : BaseEntity /// public string SelectedCategories { get; set; } = string.Empty; - /// - /// 是否停止 - /// - public bool IsStopped { get; set; } = false; - /// /// 开始日期 /// diff --git a/Service/BudgetService.cs b/Service/BudgetService.cs index 879f77b..03f2435 100644 --- a/Service/BudgetService.cs +++ b/Service/BudgetService.cs @@ -161,9 +161,9 @@ public class BudgetService( Count = 0 }; - // 获取当前分类下所有未停止的预算 + // 获取当前分类下所有预算 var relevant = budgets - .Where(b => b.Category == category && !b.IsStopped) + .Where(b => b.Category == category) .ToList(); if (relevant.Count == 0) @@ -409,8 +409,6 @@ public class BudgetService( private async Task CalculateCurrentAmountAsync(BudgetRecord budget, DateTime? now = null) { - if (budget.IsStopped) return 0; - var referenceDate = now ?? DateTime.Now; var (startDate, endDate) = GetPeriodRange(budget.StartDate, budget.Type, referenceDate); @@ -468,7 +466,7 @@ public class BudgetService( foreach (var b in allBudgets) { - if (b.IsStopped || b.Category == BudgetCategory.Savings) continue; + if (b.Category == BudgetCategory.Savings) continue; // 折算系数:根据当前请求的 periodType (Year 或 Month),将预算 b 的 Limit 折算过来 decimal factor = 1.0m; @@ -589,7 +587,6 @@ public record BudgetResult public decimal Current { get; set; } public BudgetCategory Category { get; set; } public string[] SelectedCategories { get; set; } = Array.Empty(); - public bool IsStopped { get; set; } public string StartDate { get; set; } = string.Empty; public string Period { get; set; } = string.Empty; public DateTime? PeriodStart { get; set; } @@ -617,7 +614,6 @@ public record BudgetResult SelectedCategories = string.IsNullOrEmpty(entity.SelectedCategories) ? Array.Empty() : entity.SelectedCategories.Split(','), - IsStopped = entity.IsStopped, StartDate = entity.StartDate.ToString("yyyy-MM-dd"), Period = entity.Type switch { diff --git a/Web/src/api/budget.js b/Web/src/api/budget.js index ffb15b3..ebbaae2 100644 --- a/Web/src/api/budget.js +++ b/Web/src/api/budget.js @@ -60,18 +60,6 @@ export function deleteBudget(id) { }) } -/** - * 切换预算状态 (停止/恢复) - * @param {number} id 预算ID - */ -export function toggleStopBudget(id) { - return request({ - url: '/Budget/ToggleStop', - method: 'post', - params: { id } - }) -} - /** * 获取分类统计信息(月度和年度) * @param {string} category 分类 (Expense/Income/Savings) diff --git a/Web/src/components/Budget/BudgetCard.vue b/Web/src/components/Budget/BudgetCard.vue index 7885ae6..28bec8c 100644 --- a/Web/src/components/Budget/BudgetCard.vue +++ b/Web/src/components/Budget/BudgetCard.vue @@ -78,12 +78,6 @@ plain @click.stop="$emit('click', budget)" /> - @@ -196,7 +190,7 @@ const props = defineProps({ } }) -const emit = defineEmits(['toggle-stop', 'switch-period', 'click']) +const emit = defineEmits(['switch-period', 'click']) const isExpanded = ref(props.budget.category === 2) const transitionName = ref('slide-left') diff --git a/Web/src/components/TransactionDetail.vue b/Web/src/components/TransactionDetail.vue index a5d1b09..299d7de 100644 --- a/Web/src/components/TransactionDetail.vue +++ b/Web/src/components/TransactionDetail.vue @@ -11,7 +11,6 @@ - diff --git a/Web/src/views/BudgetView.vue b/Web/src/views/BudgetView.vue index 14679c1..6830ecc 100644 --- a/Web/src/views/BudgetView.vue +++ b/Web/src/views/BudgetView.vue @@ -34,7 +34,6 @@ :progress-color="getProgressColor(budget)" :percent-class="{ 'warning': (budget.current / budget.limit) > 0.8 }" :period-label="getPeriodLabel(budget.type)" - @toggle-stop="handleToggleStop" @switch-period="(dir) => handleSwitchPeriod(budget, dir)" @click="budgetEditRef.open({ data: budget, @@ -86,7 +85,6 @@ :progress-color="getIncomeProgressColor(budget)" :percent-class="{ 'income': (budget.current / budget.limit) >= 1 }" :period-label="getPeriodLabel(budget.type)" - @toggle-stop="handleToggleStop" @switch-period="(dir) => handleSwitchPeriod(budget, dir)" @click="budgetEditRef.open({ data: budget, @@ -175,7 +173,7 @@