feat: 移除预算相关的停止状态属性和相关功能,简化预算管理逻辑
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 24s
Docker Build & Deploy / Deploy to Production (push) Successful in 11s
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 1s
Docker Build & Deploy / WeChat Notification (push) Successful in 1s

This commit is contained in:
2026-01-10 17:38:22 +08:00
parent 037bad2d9b
commit b757f18765
8 changed files with 5 additions and 78 deletions

View File

@@ -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)

View File

@@ -78,12 +78,6 @@
plain
@click.stop="$emit('click', budget)"
/>
<van-button
:icon="budget.isStopped ? 'play' : 'pause'"
size="small"
plain
@click.stop="$emit('toggle-stop', budget)"
/>
</template>
</slot>
@@ -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')

View File

@@ -11,7 +11,6 @@
<van-form style="margin-top: 12px;">
<van-cell-group inset>
<van-cell title="记录时间" :value="formatDate(transaction.createTime)" />
</van-cell-group>

View File

@@ -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 @@
<script setup>
import { ref, computed, onMounted, watch } from 'vue'
import { showToast, showConfirmDialog } from 'vant'
import { getBudgetList, deleteBudget, toggleStopBudget, getBudgetStatistics, getCategoryStats } from '@/api/budget'
import { getBudgetList, deleteBudget, getBudgetStatistics, getCategoryStats } from '@/api/budget'
import { BudgetPeriodType, BudgetCategory } from '@/constants/enums'
import BudgetCard from '@/components/Budget/BudgetCard.vue'
import BudgetSummary from '@/components/Budget/BudgetSummary.vue'
@@ -332,19 +330,6 @@ const handleDelete = (budget) => {
}
}).catch(() => {})
}
const handleToggleStop = async (budget) => {
try {
const res = await toggleStopBudget(budget.id)
if (res.success) {
showToast(budget.isStopped ? '已恢复' : '已停止')
fetchBudgetList()
}
} catch (err) {
showToast('操作失败')
console.error('切换预算状态失败', err)
}
}
</script>
<style scoped>