feat(P1-2): 预算三法并存落地 — 增量/零基/弹性均可应用
按任总观点: 三个方法都体现功能, 具体用哪个取决于用户场景 - 后端: POST /budget/apply-method 把所选方法结果写入预算计划(version标注方法) 增量95.5万(上月×1.05) / 零基71.4万(成本砍半压缩) / 弹性58.7万(收入联动) - 前端: 确认选择改为真正调用apply-method(原来只弹提示不落地) - 场景提示: 增量=稳定快速编 / 零基=成本优化 / 弹性=收入波动大
This commit is contained in:
@@ -178,6 +178,7 @@ export const budgetApi = {
|
||||
autoDecompose: (data: any) => api.post('/budget/auto-decompose', data),
|
||||
deviationReport: (params?: any) => api.get('/budget/deviation-report', { params }),
|
||||
methodComparison: (data: any) => api.post('/budget/method-comparison', data),
|
||||
applyMethod: (data: any) => api.post('/budget/apply-method', data),
|
||||
// 版本管理
|
||||
versions: (params?: any) => api.get('/budget/versions', { params }),
|
||||
versionSubmit: (data: any) => api.post('/budget/versions/submit', data),
|
||||
|
||||
@@ -669,10 +669,23 @@ async function refreshMethodComparison() {
|
||||
} catch { ElMessage.error('加载预算方法对比失败') }
|
||||
}
|
||||
|
||||
function confirmMethod() {
|
||||
async function confirmMethod() {
|
||||
const m = selectedMethodDetail.value
|
||||
if (m) {
|
||||
ElMessage.success(`已选择「${m.name}」,预算结果:${m.result_value} 万`)
|
||||
if (!m) return
|
||||
try {
|
||||
const r: any = await budgetApi.applyMethod({
|
||||
method: m.id,
|
||||
year: currentYear,
|
||||
entity: 'hanke',
|
||||
entity_id: getEntityId(),
|
||||
last_month_budget: 91,
|
||||
current_revenue: 122,
|
||||
})
|
||||
ElMessage.success(r.message || `已应用「${m.name}」`)
|
||||
// 刷新预算列表
|
||||
loadBudget()
|
||||
} catch (e: any) {
|
||||
ElMessage.error(e?.response?.data?.detail || e?.message || '应用失败')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user