refactor(scheduling): rewrite terminology to match core business logic

Core story: 里程高的车换下来,里程少的车换上去。

- Summary cards: "里程高·需换下" / "里程低·需换走" / "替换建议"
- List tags: "换下" (amber) / "换走" (blue) with matching color bars
- Detail modal title: "里程高·换下此车" / "里程低·换走此车"
- Candidate section: explains WHY these vehicles are recommended
  - 换下: "以下车辆里程缺口大,换到该高里程客户处可加速达标"
  - 换走: "以下车辆里程已充足,可调给当前客户,将此车换走给高里程客户冲刺"
- Reason text: states current situation + clear action recommendation
  with specific numbers (已跑, 缺口, 日均, 完成率)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
kkfluous
2026-04-16 21:23:35 +08:00
parent 1a5a1c1514
commit 48fa3bc73f
4 changed files with 33 additions and 16 deletions

View File

@@ -3,6 +3,11 @@ import type {
CandidateVehicle, VehicleClassification, SchedulingSummary,
} from './types.js';
function fmtKmSimple(v: number): string {
if (v >= 10000) return (v / 10000).toFixed(1) + '万';
return Math.round(v).toLocaleString();
}
// ---------------------------------------------------------------------------
// 1. Vehicle type compatibility
// ---------------------------------------------------------------------------
@@ -105,7 +110,10 @@ export function generateSuggestions(
})
.slice(0, 5);
const reason = `${vehicle.customer}日均里程仅 ${Math.round(vehicle.customerAvgDaily)} KM该车达标概率 ${Math.round((vehicle.predictedYearEnd / vehicle.yearTarget) * 100)}%,建议替换为已达标车辆,将此车调配给高里程客户。`;
const yearRate = vehicle.yearTarget > 0 ? Math.round((vehicle.currentYearMileage / vehicle.yearTarget) * 100) : 0;
const gap = Math.max(0, vehicle.yearTarget - vehicle.currentYearMileage);
const reason = `该车在客户「${vehicle.customer}」处日均仅 ${Math.round(vehicle.customerAvgDaily)} km本年完成率 ${yearRate}%,还差 ${fmtKmSimple(gap)} km 达标,按当前速度年底无法完成。`
+ `\n建议将此车调配给高里程客户冲刺达标同时从库存调一辆已达标的车给当前客户。`;
suggestions.push({
id: `hopeless-${vehicle.plateNumber}`,
@@ -156,7 +164,8 @@ export function generateSuggestions(
.slice(0, 5);
const yearRate = vehicle.yearTarget > 0 ? Math.round((vehicle.currentYearMileage / vehicle.yearTarget) * 100) : 0;
const reason = `${vehicle.customer}日均里程 ${Math.round(vehicle.customerAvgDaily)} KM高里程该车本年完成率 ${yearRate}%,建议换上里程缺口大的车辆以加速达标`;
const reason = `该车在客户「${vehicle.customer}」处已达标(完成率 ${yearRate}%),客户日均 ${Math.round(vehicle.customerAvgDaily)} km属于高里程客户`
+ `\n建议将此车换下换上一辆里程少的车利用该客户的高日均里程帮助新车快速达标。`;
suggestions.push({
id: `qualified-${vehicle.plateNumber}`,