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}