From 718101c58a86c30daa73a167ede49f7298fcd87e Mon Sep 17 00:00:00 2001 From: freedakgmail Date: Thu, 30 Jul 2026 14:30:54 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=88=A9=E6=B6=A6?= =?UTF-8?q?=E7=80=91=E5=B8=83=E5=9B=BE=E6=9F=B1=E5=AD=90=E9=AB=98=E5=BA=A6?= =?UTF-8?q?=20-=20cost=E9=A1=B9base=E6=94=B9=E4=B8=BA=E6=89=A3=E9=99=A4?= =?UTF-8?q?=E5=90=8E=E4=BD=8D=E7=BD=AE=EF=BC=8Cvalue=E4=B8=BA=E5=87=8F?= =?UTF-8?q?=E5=B0=91=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/pages/BossPage.tsx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/client/src/pages/BossPage.tsx b/client/src/pages/BossPage.tsx index 7249283..d72f09f 100644 --- a/client/src/pages/BossPage.tsx +++ b/client/src/pages/BossPage.tsx @@ -102,12 +102,15 @@ export function BossPage() { // 瀑布图累计计算 let cumulative = 0 const waterfallChart = waterfallSteps.map((step) => { - if (step.type === 'total' || step.type === 'profit') { + if (step.type === 'total') { cumulative = step.value - return { name: step.name, base: 0, value: step.value, fill: step.type === 'profit' ? '#22c55e' : '#3b82f6' } + return { name: step.name, base: 0, value: step.value, fill: '#3b82f6' } + } else if (step.type === 'profit') { + return { name: step.name, base: 0, value: step.value, fill: '#22c55e' } } else { - const base = cumulative + step.value - const result = { name: step.name, base, value: -step.value, fill: '#ef4444' } + const decrease = Math.abs(step.value) + const base = cumulative - decrease + const result = { name: step.name, base, value: decrease, fill: '#ef4444' } cumulative = base return result }