feat(platform): link records to vehicle service
This commit is contained in:
@@ -27,7 +27,12 @@ function formatKm(value: number) {
|
||||
return Number.isFinite(value) ? value.toLocaleString(undefined, { maximumFractionDigits: 1 }) : '0';
|
||||
}
|
||||
|
||||
export function Mileage() {
|
||||
function canOpenVehicle(vin?: string) {
|
||||
const value = vin?.trim();
|
||||
return Boolean(value && value !== 'unknown');
|
||||
}
|
||||
|
||||
export function Mileage({ onOpenVehicle }: { onOpenVehicle: (vin: string) => void }) {
|
||||
const [rows, setRows] = useState<DailyMileageRow[]>([]);
|
||||
const [summary, setSummary] = useState<MileageSummary>(emptySummary);
|
||||
const [loading, setLoading] = useState(true);
|
||||
@@ -121,7 +126,14 @@ export function Mileage() {
|
||||
{ title: '结束里程', dataIndex: 'endMileageKm' },
|
||||
{ title: '日里程', dataIndex: 'dailyMileageKm' },
|
||||
{ title: '来源', dataIndex: 'source' },
|
||||
{ title: '异常', render: (_: unknown, row: DailyMileageRow) => row.anomalySeverity ? <Tag color="orange">{row.anomalySeverity}</Tag> : <Tag color="green">正常</Tag> }
|
||||
{ title: '异常', render: (_: unknown, row: DailyMileageRow) => row.anomalySeverity ? <Tag color="orange">{row.anomalySeverity}</Tag> : <Tag color="green">正常</Tag> },
|
||||
{
|
||||
title: '操作',
|
||||
width: 110,
|
||||
render: (_: unknown, row: DailyMileageRow) => (
|
||||
<Button disabled={!canOpenVehicle(row.vin)} onClick={() => onOpenVehicle(row.vin)}>车辆服务</Button>
|
||||
)
|
||||
}
|
||||
]}
|
||||
/>
|
||||
</Card>
|
||||
|
||||
Reference in New Issue
Block a user