feat(platform): link mileage rows to raw evidence
This commit is contained in:
@@ -99,7 +99,8 @@ export function Mileage({
|
||||
initialFilters = {},
|
||||
onFiltersChange,
|
||||
onOpenVehicle,
|
||||
onOpenHistory
|
||||
onOpenHistory,
|
||||
onOpenRaw
|
||||
}: {
|
||||
initialVin: string;
|
||||
initialProtocol?: string;
|
||||
@@ -107,6 +108,7 @@ export function Mileage({
|
||||
onFiltersChange?: (filters: Record<string, string>) => void;
|
||||
onOpenVehicle: (vin: string, protocol?: string) => void;
|
||||
onOpenHistory?: (filters: Record<string, string>) => void;
|
||||
onOpenRaw?: (filters: Record<string, string>) => void;
|
||||
}) {
|
||||
const [rows, setRows] = useState<DailyMileageRow[]>([]);
|
||||
const [summary, setSummary] = useState<MileageSummary>(emptySummary);
|
||||
@@ -170,6 +172,16 @@ export function Mileage({
|
||||
...(dateTo ? { dateTo } : {})
|
||||
});
|
||||
};
|
||||
const openMileageRawEvidence = (row: DailyMileageRow) => {
|
||||
const dateFrom = row.date?.trim() ?? '';
|
||||
const dateTo = nextDate(dateFrom);
|
||||
onOpenRaw?.({
|
||||
keyword: row.vin,
|
||||
protocol: row.source,
|
||||
...(dateFrom ? { dateFrom } : {}),
|
||||
...(dateTo ? { dateTo } : {})
|
||||
});
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
const nextFilters = mergeInitialFilters(initialVin, initialProtocol, initialFilters);
|
||||
@@ -338,10 +350,11 @@ export function Mileage({
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
width: 190,
|
||||
width: 270,
|
||||
render: (_: unknown, row: DailyMileageRow) => (
|
||||
<Space spacing={4} wrap>
|
||||
<Button disabled={!canOpenVehicle(row.vin) || !onOpenHistory} onClick={() => openMileageEvidence(row)}>核对轨迹</Button>
|
||||
<Button disabled={!canOpenVehicle(row.vin) || !onOpenRaw} onClick={() => openMileageRawEvidence(row)}>核对 RAW</Button>
|
||||
<Button disabled={!canOpenVehicle(row.vin)} onClick={() => onOpenVehicle(row.vin, row.source)}>车辆服务</Button>
|
||||
</Space>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user