feat(platform): link records to vehicle service
This commit is contained in:
@@ -21,7 +21,12 @@ const defaultFilters: HistoryFilters = {
|
||||
|
||||
const defaultPage = { items: [], total: 0, limit: 10, offset: 0 };
|
||||
|
||||
export function History() {
|
||||
function canOpenVehicle(vin?: string) {
|
||||
const value = vin?.trim();
|
||||
return Boolean(value && value !== 'unknown');
|
||||
}
|
||||
|
||||
export function History({ onOpenVehicle }: { onOpenVehicle: (vin: string) => void }) {
|
||||
const [filters, setFilters] = useState<HistoryFilters>(defaultFilters);
|
||||
const [locations, setLocations] = useState<Page<HistoryLocationRow>>(defaultPage);
|
||||
const [rawFrames, setRawFrames] = useState<Page<RawFrameRow>>(defaultPage);
|
||||
@@ -143,7 +148,14 @@ export function History() {
|
||||
{ title: '速度 km/h', dataIndex: 'speedKmh', width: 120 },
|
||||
{ title: '总里程 km', dataIndex: 'totalMileageKm', width: 130 },
|
||||
{ title: '设备时间', dataIndex: 'deviceTime', width: 190 },
|
||||
{ title: '入库时间', dataIndex: 'serverTime', width: 190 }
|
||||
{ title: '入库时间', dataIndex: 'serverTime', width: 190 },
|
||||
{
|
||||
title: '操作',
|
||||
width: 110,
|
||||
render: (_: unknown, row: HistoryLocationRow) => (
|
||||
<Button disabled={!canOpenVehicle(row.vin)} onClick={() => onOpenVehicle(row.vin)}>车辆服务</Button>
|
||||
)
|
||||
}
|
||||
]}
|
||||
/>
|
||||
</Tabs.TabPane>
|
||||
@@ -169,7 +181,16 @@ export function History() {
|
||||
{ title: '大小 B', dataIndex: 'rawSizeBytes', width: 100 },
|
||||
{ title: '设备时间', dataIndex: 'deviceTime', width: 190 },
|
||||
{ title: '入库时间', dataIndex: 'serverTime', width: 190 },
|
||||
{ title: '操作', width: 100, render: (_: unknown, row: RawFrameRow) => <Button onClick={() => setSelectedRaw(row)}>字段</Button> }
|
||||
{
|
||||
title: '操作',
|
||||
width: 200,
|
||||
render: (_: unknown, row: RawFrameRow) => (
|
||||
<Space>
|
||||
<Button onClick={() => setSelectedRaw(row)}>字段</Button>
|
||||
<Button disabled={!canOpenVehicle(row.vin)} onClick={() => onOpenVehicle(row.vin)}>车辆服务</Button>
|
||||
</Space>
|
||||
)
|
||||
}
|
||||
]}
|
||||
/>
|
||||
</Tabs.TabPane>
|
||||
|
||||
Reference in New Issue
Block a user