From dd1834477d25b4391a13629ab0faa3631540536b Mon Sep 17 00:00:00 2001 From: kkfluous Date: Wed, 1 Apr 2026 21:26:31 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E6=8A=A5=E8=A1=A8=E5=AE=8C=E6=88=90=E7=8E=87=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E5=92=8C=E9=A1=B9=E7=9B=AE=E5=90=8D=E7=A7=B0=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.6 (1M context) --- src/modules/mileage/StatisticsView.tsx | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/modules/mileage/StatisticsView.tsx b/src/modules/mileage/StatisticsView.tsx index d494ea8..aa5152e 100644 --- a/src/modules/mileage/StatisticsView.tsx +++ b/src/modules/mileage/StatisticsView.tsx @@ -12,6 +12,20 @@ import { import type { TargetSummary, TargetVehicle, TrendPoint } from './types'; import { fetchTargets, fetchTargetVehicles, fetchTrend } from './api'; +function shortTargetName(name: string): string { + // Extract the number and a short description + const match = name.match(/(\d+)[辆台](.+)/); + if (!match) return name; + const count = match[1]; + let desc = match[2]; + // Simplify common patterns + desc = desc.replace('4.5T普货', '普货'); + desc = desc.replace('4.5T冷链车', '冷藏车'); + desc = desc.replace('4.5T冷链', '冷藏车'); + desc = desc.replace('18T', '18T'); + return `${count}台${desc}`; +} + export default function StatisticsView() { const [targets, setTargets] = useState([]); const [trendData, setTrendData] = useState([]); @@ -56,7 +70,7 @@ export default function StatisticsView() { : 'bg-slate-50 landscape:bg-slate-800 text-slate-500 landscape:text-slate-400 hover:bg-slate-100 landscape:hover:bg-slate-700' }`} > - {target.targetName} + {shortTargetName(target.targetName)} ))} @@ -208,7 +222,7 @@ export default function StatisticsView() {
完成率: - = 90 ? 'text-emerald-500' : 'text-blue-500'}`}>{target.avgCompletion}% + = 90 ? 'text-emerald-500' : 'text-blue-500'}`}>{target.avgCompletion.toFixed(1)}%
达标: @@ -426,7 +440,7 @@ export default function StatisticsView() { style={{ width: `${target.avgCompletion}%` }} />
- {target.avgCompletion}% + {target.avgCompletion.toFixed(1)}%
{target.period}