diff --git a/src/modules/scheduling/SuggestionDetail.tsx b/src/modules/scheduling/SuggestionDetail.tsx index 2b4b175..7cbd35f 100644 --- a/src/modules/scheduling/SuggestionDetail.tsx +++ b/src/modules/scheduling/SuggestionDetail.tsx @@ -1,6 +1,6 @@ import { useState } from 'react'; import { - X, MapPin, AlertTriangle, CheckCircle, Send, ArrowRight, + X, MapPin, AlertTriangle, CheckCircle, Send, ArrowDown, ArrowUp, } from 'lucide-react'; import { motion } from 'motion/react'; import { sendNotify } from './api'; @@ -18,6 +18,10 @@ function fmtKm(value: number): string { return value.toLocaleString(); } +function fmtRate(rate: number): string { + return (rate * 100).toFixed(1) + '%'; +} + export default function SuggestionDetail({ suggestion: s, onClose, onNotifySuccess }: Props) { const [sending, setSending] = useState(false); const [sentPlates, setSentPlates] = useState>(new Set()); @@ -48,18 +52,25 @@ export default function SuggestionDetail({ suggestion: s, onClose, onNotifySucce }; return ( -
+
e.stopPropagation()} className="bg-white rounded-t-2xl sm:rounded-2xl shadow-2xl w-full sm:max-w-lg overflow-hidden flex flex-col max-h-[92vh] sm:max-h-[85vh] sm:mx-4" > - {/* Header */} -
- - {isRescue ? '抢救低里程车辆' : '释放已达标车辆'} - -
@@ -67,43 +78,43 @@ export default function SuggestionDetail({ suggestion: s, onClose, onNotifySucce {/* Body */}
- {/* Current Vehicle — compact header */} -
-
+ {/* Current Vehicle */} +
+
{v.plateNumber} - {v.vehicleType} -
-
- = 1 ? 'text-emerald-600' : v.completionRate >= 0.5 ? 'text-amber-600' : 'text-rose-600'}`}> - {(v.completionRate * 100).toFixed(1)}% - + {v.vehicleType}
+ = 1 ? 'text-emerald-600' : v.completionRate >= 0.5 ? 'text-amber-600' : 'text-rose-600'}`}> + {fmtRate(v.completionRate)} +
- {/* Key metrics in a single compact row */} -
- {v.targetName} - | - 本年已跑 {fmtKm(v.currentYearMileage)} km - 本年考核 {fmtKm(v.yearTarget)} km - {v.region} -
-
- 客户 {v.customer || '-'} - 日均 {Math.round(v.customerAvgDaily)} km +
+
+ {v.targetName} + | + 已跑 {fmtKm(v.currentYearMileage)} + 考核 {fmtKm(v.yearTarget)} km + {v.region} +
+
+ 客户 {v.customer || '-'} + 日均 {Math.round(v.customerAvgDaily)} km +
- {/* Reason — one line */} -
- {s.reason} + {/* Reason */} +
+ 建议: + {s.reason}
{/* Candidates */}
-
- 推荐替换车辆 +
+ 推荐替换 {s.candidates.length} 辆可选
@@ -111,58 +122,60 @@ export default function SuggestionDetail({ suggestion: s, onClose, onNotifySucce {s.candidates.map(c => { const sent = sentPlates.has(c.plateNumber); return ( -
- {/* Candidate header row */} -
+
+ {/* Header */} +
{c.plateNumber} {c.vehicleType} {c.targetName || '库存'}
{c.canQualifyAfterSwap ? ( - - 换后可达标 + + 可达标 ) : ( - + 需关注 )}
- {/* Metrics row — compact inline */} -
-
-
当前
-
{fmtKm(c.totalMileage)}
-
-
-
考核
-
{c.yearTarget ? fmtKm(c.yearTarget) : '-'}
-
-
-
缺口
-
{fmtKm(c.mileageGap)}
-
-
-
区域
-
{c.region}
-
-
-
换后
-
{fmtKm(c.predictedAfterSwap)}
+ {/* Metrics — compact table style */} +
+
+
+
当前
+
{fmtKm(c.totalMileage)}
+
+
+
考核
+
{c.yearTarget ? fmtKm(c.yearTarget) : '-'}
+
+
+
缺口
+
{fmtKm(c.mileageGap)}
+
+
+
区域
+
{c.region}
+
+
+
换后
+
{fmtKm(c.predictedAfterSwap)}
+
{/* Action */} -
+