feat(platform-web): keep protocol when opening vehicle rows

This commit is contained in:
lingniu
2026-07-04 01:22:41 +08:00
parent 5f84139c00
commit 55834a4651
5 changed files with 98 additions and 16 deletions

View File

@@ -76,15 +76,15 @@ export function VehicleDetail({
const identity = detail?.identity;
const summary = detail?.realtimeSummary;
const latest = detail?.realtime[0];
const latest = detail?.realtime?.[0];
const resolution = detail?.resolution;
const resolvedVIN = resolution?.vin || detail?.vin || summary?.vin || identity?.vin || latest?.vin || query.keyword;
const hasResolvedVIN = resolution?.resolved ?? detail?.lookupResolved ?? isLikelyVIN(resolvedVIN);
const displayVIN = hasResolvedVIN ? resolvedVIN : '-';
const displayLookupKey = resolution?.lookupKey || detail?.lookupKey || query.keyword;
const protocols = useMemo(() => resolution?.protocols?.length ? resolution.protocols : detail?.sources ?? [], [detail?.sources, resolution?.protocols]);
const latestRaw = detail?.raw.items[0];
const qualityCount = detail?.quality.total ?? 0;
const latestRaw = detail?.raw?.items?.[0];
const qualityCount = detail?.quality?.total ?? 0;
const online = resolution?.online || summary?.online || identity?.online || false;
const lastSeen = resolution?.lastSeen || summary?.lastSeen || latest?.lastSeen || '-';
const formKey = `${query.keyword}-${query.protocol ?? ''}`;
@@ -93,7 +93,7 @@ export function VehicleDetail({
loading={loading}
pagination={false}
rowKey={(row?: QualityIssueRow) => `${row?.protocol ?? ''}-${row?.issueType ?? ''}-${row?.lastSeen ?? ''}`}
dataSource={detail?.quality.items ?? []}
dataSource={detail?.quality?.items ?? []}
columns={[
{ title: '来源', dataIndex: 'protocol', width: 130 },
{ title: '问题', dataIndex: 'issueType', width: 150 },
@@ -260,7 +260,7 @@ export function VehicleDetail({
loading={loading}
pagination={false}
rowKey="deviceTime"
dataSource={detail?.history.items ?? []}
dataSource={detail?.history?.items ?? []}
columns={[
{ title: '来源', dataIndex: 'protocol', width: 130 },
{ title: '经度', dataIndex: 'longitude', width: 120 },
@@ -277,7 +277,7 @@ export function VehicleDetail({
loading={loading}
pagination={false}
rowKey="id"
dataSource={detail?.raw.items ?? []}
dataSource={detail?.raw?.items ?? []}
columns={[
{ title: '来源', dataIndex: 'protocol', width: 130 },
{ title: '帧类型', dataIndex: 'frameType', width: 190 },
@@ -294,7 +294,7 @@ export function VehicleDetail({
loading={loading}
pagination={false}
rowKey="date"
dataSource={detail?.mileage.items ?? []}
dataSource={detail?.mileage?.items ?? []}
columns={[
{ title: '日期', dataIndex: 'date', width: 130 },
{ title: '来源', dataIndex: 'source', width: 130 },