feat(platform): link mileage rows to raw evidence

This commit is contained in:
lingniu
2026-07-04 12:14:08 +08:00
parent 2465bd7f16
commit 2991a01738
3 changed files with 117 additions and 3 deletions

View File

@@ -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>
)