feat(platform): add vehicle detail workbench

This commit is contained in:
lingniu
2026-07-04 19:49:24 +08:00
parent ea76ac22da
commit 9e38112ece
2 changed files with 103 additions and 3 deletions

View File

@@ -450,6 +450,63 @@ export function VehicleDetail({
}
return actions;
}, [activeProtocol, detail?.sourceStatus, displayLookupKey, hasResolvedVIN, missingProtocols, onOpenQuality, onOpenRealtime, onOpenVehicles, qualityCount, resolvedVIN]);
const detailWorkbench = [
{
title: '实时定位',
value: lastSeen,
meta: evidenceSourceCount > 0 ? `${evidenceOnlineSourceCount}/${evidenceSourceCount} 来源在线` : '暂无来源',
color: online ? 'green' as const : 'orange' as const,
detail: '查看该车最新位置、速度、SOC、总里程和多来源实时字段。',
disabled: !hasResolvedVIN,
actions: [
{ label: '查看实时', onClick: () => onOpenRealtime(resolvedVIN, activeProtocol) }
]
},
{
title: '轨迹回放',
value: `${formatCompactNumber(overview?.historyCount ?? detail?.history?.total ?? 0)} 条历史`,
meta: evidenceLocatedSourceCount > 0 ? `${evidenceLocatedSourceCount} 个位置来源` : '暂无位置',
color: evidenceLocatedSourceCount > 0 ? 'blue' as const : 'grey' as const,
detail: '回放历史轨迹,复核定位断点、速度变化和里程连续性。',
disabled: !hasResolvedVIN,
actions: [
{ label: '打开轨迹', onClick: () => onOpenHistory(resolvedVIN, activeProtocol) }
]
},
{
title: 'RAW 证据',
value: `${formatCompactNumber(overview?.rawCount ?? detail?.raw?.total ?? 0)}`,
meta: latestRaw?.frameType || '解析字段',
color: (overview?.rawCount ?? detail?.raw?.total ?? 0) > 0 ? 'blue' as const : 'grey' as const,
detail: '查看原始报文和解析字段,定位协议解析、来源转发和字段缺失问题。',
disabled: !hasResolvedVIN,
actions: [
{ label: '查看 RAW', onClick: () => onOpenRaw(resolvedVIN, activeProtocol) }
]
},
{
title: '告警处置',
value: `${qualityCount.toLocaleString()}`,
meta: priorityQualityIssue ? qualityIssueLabel(priorityQualityIssue.issueType) : '暂无告警',
color: qualityCount > 0 ? 'orange' as const : 'green' as const,
detail: '进入告警队列处理断链、VIN 缺失、字段缺失和来源不一致。',
disabled: !hasResolvedVIN && qualityCount <= 0,
actions: [
{ label: '查看告警', onClick: () => onOpenQuality?.(qualityFiltersForCurrentVehicle()) }
]
},
{
title: '里程复核',
value: `${formatCompactNumber(overview?.mileageCount ?? detail?.mileage?.total ?? 0)} 条统计`,
meta: formatCompactNumber(evidenceMileageDelta, ' km 差异'),
color: isFiniteNumber(evidenceMileageDelta) && Math.abs(evidenceMileageDelta) > 1 ? 'orange' as const : 'green' as const,
detail: '核对统计口径,确认区间总值、每日里程与来源证据是否闭合。',
disabled: !hasResolvedVIN,
actions: [
{ label: '查看里程', onClick: () => onOpenMileage(resolvedVIN, activeProtocol) }
]
}
];
const qualityTable = (
<Table
loading={loading}
@@ -584,6 +641,36 @@ export function VehicleDetail({
</div>
</Card>
<Card bordered title="单车服务作业台" style={{ marginTop: 16 }}>
<div className="vp-workbench-grid">
{detailWorkbench.map((item) => (
<div key={item.title} className="vp-workbench-item">
<div className="vp-workbench-head">
<Tag color={item.color}>{item.title}</Tag>
<Typography.Text type="secondary">{item.meta}</Typography.Text>
</div>
<div className="vp-workbench-value">{item.value}</div>
<Typography.Text type="secondary">{item.detail}</Typography.Text>
<Space wrap>
{item.actions.map((action) => (
<Button
key={action.label}
size="small"
theme="light"
type="primary"
disabled={item.disabled || (item.title === '告警处置' && !onOpenQuality)}
aria-label={`单车作业台 ${item.title} ${action.label}`}
onClick={action.onClick}
>
{action.label}
</Button>
))}
</Space>
</div>
))}
</div>
</Card>
{overview || consistency ? (
<Card bordered title="车辆服务证据链" style={{ marginTop: 16 }}>
<div className="vp-evidence-grid">