feat(platform): link locations to raw evidence
This commit is contained in:
@@ -118,7 +118,8 @@ export function History({
|
||||
initialFilters = {},
|
||||
onFiltersChange,
|
||||
onOpenVehicle,
|
||||
onOpenMileage
|
||||
onOpenMileage,
|
||||
onOpenRaw
|
||||
}: {
|
||||
initialVin: string;
|
||||
initialProtocol?: string;
|
||||
@@ -127,6 +128,7 @@ export function History({
|
||||
onFiltersChange?: (filters: HistoryFilters, tab?: HistoryTabKey) => void;
|
||||
onOpenVehicle: (vin: string, protocol?: string) => void;
|
||||
onOpenMileage?: (filters: Record<string, string>) => void;
|
||||
onOpenRaw?: (filters: Record<string, string>) => void;
|
||||
}) {
|
||||
const initialHistoryFilters = mergeInitialFilters(initialVin, initialProtocol, initialFilters);
|
||||
const [filters, setFilters] = useState<HistoryFilters>(initialHistoryFilters);
|
||||
@@ -294,6 +296,16 @@ export function History({
|
||||
...(day ? { dateFrom: day, dateTo: nextDate(day) } : {})
|
||||
});
|
||||
};
|
||||
const openLocationRaw = (row: HistoryLocationRow) => {
|
||||
if (!canOpenVehicle(row.vin)) return;
|
||||
const day = dateOnly(row.deviceTime || row.serverTime || row.lastSeen);
|
||||
onOpenRaw?.({
|
||||
keyword: row.vin,
|
||||
protocol: row.protocol,
|
||||
...(day ? { dateFrom: day, dateTo: nextDate(day) } : {}),
|
||||
includeFields: 'true'
|
||||
});
|
||||
};
|
||||
const openRawMileage = (row: RawFrameRow) => {
|
||||
if (!canOpenVehicle(row.vin)) return;
|
||||
const day = dateOnly(row.deviceTime || row.serverTime);
|
||||
@@ -465,11 +477,12 @@ export function History({
|
||||
{ title: '入库时间', dataIndex: 'serverTime', width: 190 },
|
||||
{
|
||||
title: '操作',
|
||||
width: 190,
|
||||
width: 280,
|
||||
render: (_: unknown, row: HistoryLocationRow) => (
|
||||
<Space>
|
||||
<Space wrap>
|
||||
<Button disabled={!canOpenVehicle(row.vin)} onClick={() => onOpenVehicle(row.vin, row.protocol)}>车辆服务</Button>
|
||||
<Button disabled={!canOpenVehicle(row.vin) || !onOpenMileage} onClick={() => openLocationMileage(row)}>核对里程</Button>
|
||||
<Button disabled={!canOpenVehicle(row.vin) || !onOpenRaw} onClick={() => openLocationRaw(row)}>核对 RAW</Button>
|
||||
</Space>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user