From e4ffd027be40d7f9c8a49464d7486985c3746dcc Mon Sep 17 00:00:00 2001 From: kkfluous Date: Thu, 26 Mar 2026 15:11:12 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=BA=93=E5=AD=98=E6=80=BB=E6=95=B0?= =?UTF-8?q?=E5=8C=85=E5=90=AB=E5=BC=82=E5=8A=A8=E8=BD=A6=E8=BE=86=EF=BC=8C?= =?UTF-8?q?=E6=80=BB=E8=AE=A1=E8=A1=8C=E6=94=B9=E4=B8=BA=E7=B4=AF=E5=8A=A0?= =?UTF-8?q?=E8=AE=A1=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - getStats 的 inventory 统计包含 Inventory + Abnormal - 总计行所有列改为从各车型数据累加,不再使用 SUMMARY Co-Authored-By: Claude Opus 4.6 (1M context) --- src/App.tsx | 16 ++++++++-------- src/server/routes/vehicles.ts | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 21b9e38..55ded30 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -346,17 +346,17 @@ export default function App() { 总计 - {SUMMARY.totalAssets} - {SUMMARY.inventory.total} + {processedData.reduce((s, t) => s + t.totalAssets, 0)} + {processedData.reduce((s, t) => s + t.totalInventory, 0)} {['嘉兴', '广东', '北京', '新疆', '其他'].map((reg) => { - const val = processedData.reduce((sum, t) => sum + (t.inventoryRegions?.[reg] || 0), 0); + const val = processedData.reduce((s, t) => s + (t.inventoryRegions?.[reg] || 0), 0); return {val || ''}; })} - {SUMMARY.pendingDelivery || ''} - {SUMMARY.operating.total} - {SUMMARY.weeklyDelivered || ''} - {SUMMARY.weeklyReturned || ''} - {SUMMARY.weeklyReplaced || ''} + {processedData.reduce((s, t) => s + t.pending, 0) || ''} + {processedData.reduce((s, t) => s + t.totalOperating, 0)} + {processedData.reduce((s, t) => s + t.weeklyDelivered, 0) || ''} + {processedData.reduce((s, t) => s + t.weeklyReturned, 0) || ''} + {processedData.reduce((s, t) => s + t.weeklyReplaced, 0) || ''} diff --git a/src/server/routes/vehicles.ts b/src/server/routes/vehicles.ts index 034a78f..f0cd88e 100644 --- a/src/server/routes/vehicles.ts +++ b/src/server/routes/vehicles.ts @@ -320,9 +320,9 @@ function getStats(list: Vehicle[], weeklyIds?: WeeklyTruckIds) { const strIds = list.map((v) => String(v.id)); return { total: list.length, - inventory: list.filter((v) => v.status === 'Inventory').length, + inventory: list.filter((v) => v.status === 'Inventory' || v.status === 'Abnormal').length, inventoryRegions: getRegionCounts( - list.filter((v) => v.status === 'Inventory'), + list.filter((v) => v.status === 'Inventory' || v.status === 'Abnormal'), REGIONS, ), pending: list.filter((v) => v.status === 'Pending').length,