feat(platform): add vehicle service dossier

This commit is contained in:
lingniu
2026-07-04 22:17:41 +08:00
parent ea18a058ac
commit b3b4e2203a
3 changed files with 223 additions and 10 deletions

View File

@@ -522,6 +522,65 @@ export function VehicleDetail({
}
return actions;
}, [activeProtocol, detail?.sourceStatus, displayLookupKey, hasResolvedVIN, missingProtocols, onOpenQuality, onOpenRealtime, onOpenVehicles, qualityCount, resolvedVIN]);
const serviceAssetItems = [
{
label: '实时',
value: formatCompactNumber(overview?.realtimeCount ?? detail?.realtime?.length ?? 0),
detail: evidenceSourceCount > 0 ? `${evidenceOnlineSourceCount}/${evidenceSourceCount} 来源在线` : '暂无来源',
color: evidenceOnlineSourceCount > 0 ? 'green' as const : 'orange' as const
},
{
label: '轨迹',
value: formatCompactNumber(overview?.historyCount ?? detail?.history?.total ?? 0),
detail: evidenceLocatedSourceCount > 0 ? `${evidenceLocatedSourceCount} 个位置来源` : '暂无位置',
color: (overview?.historyCount ?? detail?.history?.total ?? 0) > 0 ? 'blue' as const : 'grey' as const
},
{
label: 'RAW',
value: formatCompactNumber(overview?.rawCount ?? detail?.raw?.total ?? 0),
detail: latestRaw?.frameType || '解析字段',
color: (overview?.rawCount ?? detail?.raw?.total ?? 0) > 0 ? 'blue' as const : 'grey' as const
},
{
label: '里程',
value: formatCompactNumber(overview?.mileageCount ?? detail?.mileage?.total ?? 0),
detail: formatCompactNumber(evidenceMileageDelta, ' km 差异'),
color: isFiniteNumber(evidenceMileageDelta) && Math.abs(evidenceMileageDelta) > 1 ? 'orange' as const : 'green' as const
},
{
label: '告警',
value: qualityCount.toLocaleString(),
detail: priorityQualityIssue ? qualityIssueLabel(priorityQualityIssue.issueType) : '暂无告警',
color: qualityCount > 0 ? 'orange' as const : 'green' as const
}
];
const copyVehicleServiceDossier = () => {
if (!detail) {
Toast.warning('当前没有可复制的车辆服务档案');
return;
}
const vehicleName = [archivePlate, displayVIN].filter((item) => item && item !== '-').join(' / ') || displayLookupKey;
const lines = [
'【车辆服务档案】',
`车辆:${vehicleName}`,
`查询关键词:${displayLookupKey}`,
`当前范围:${scopeText}`,
`档案完整度:${archiveCompleteness}${archiveMissingLabels.length > 0 ? `${archiveMissingLabels.join('、')}` : ''}`,
`主来源:${overview?.primaryProtocol || summary?.primaryProtocol || '-'}`,
`来源在线:${evidenceSourceCount > 0 ? `${evidenceOnlineSourceCount}/${evidenceSourceCount}` : '-'}`,
`服务状态:${serviceStatus?.title ?? serviceConclusion.status}`,
`服务说明:${serviceStatus?.detail ?? serviceConclusion.risk}`,
`资产概览:${serviceAssetItems.map((item) => `${item.label} ${item.value}`).join(' / ')}`,
`一致性:${consistencyTitle}`,
`下一步:${serviceActions[0]?.label ?? serviceConclusion.nextStep}`,
`车辆服务:${vehicleServiceURL(vehicleServiceHash('detail'))}`,
`实时监控:${vehicleServiceURL(vehicleServiceHash('realtime'))}`,
`轨迹回放:${vehicleServiceURL(vehicleServiceHash('history'))}`,
`RAW证据${vehicleServiceURL(vehicleServiceHash('history-query', { tab: 'raw', includeFields: 'true' }))}`,
`里程统计:${vehicleServiceURL(vehicleServiceHash('mileage'))}`
];
copyText(lines.join('\n'), '车辆服务档案');
};
const copyVehicleOperationsSummary = () => {
if (!detail) {
Toast.warning('当前没有可复制的运营摘要');
@@ -777,6 +836,56 @@ export function VehicleDetail({
</div>
) : null}
<Card
bordered
title={<Space><span></span><Button size="small" disabled={!detail} icon={<IconCopy />} onClick={copyVehicleServiceDossier}></Button></Space>}
style={{ marginTop: 16 }}
>
<div className="vp-service-dossier">
<div className="vp-service-dossier-main">
<Space wrap>
<Tag color={hasResolvedVIN ? 'green' : 'orange'}>{hasResolvedVIN ? '已解析 VIN' : '待维护身份'}</Tag>
<Tag color={activeProtocol ? 'blue' : 'green'}>{scopeText}</Tag>
<Tag color={serviceConclusion.color}>{serviceStatus?.title ?? serviceConclusion.status}</Tag>
</Space>
<Typography.Title heading={4} style={{ margin: 0 }}>
{[archivePlate, displayVIN].filter((item) => item && item !== '-').join(' / ') || displayLookupKey}
</Typography.Title>
<div className="vp-service-dossier-meta">
{[
{ label: '手机号', value: archivePhone || '-' },
{ label: 'OEM', value: archiveOEM || '-' },
{ label: '主来源', value: overview?.primaryProtocol || summary?.primaryProtocol || '-' },
{ label: '最后上报', value: lastSeen },
{ label: '档案完整度', value: archiveCompleteness },
{ label: '下一步', value: serviceActions[0]?.label ?? serviceConclusion.nextStep }
].map((item) => (
<div key={item.label}>
<span>{item.label}</span>
<strong>{item.value}</strong>
</div>
))}
</div>
</div>
<div className="vp-service-dossier-assets">
{serviceAssetItems.map((item) => (
<div key={item.label} className="vp-service-dossier-asset">
<Tag color={item.color}>{item.label}</Tag>
<strong>{item.value}</strong>
<Typography.Text type="secondary">{item.detail}</Typography.Text>
</div>
))}
</div>
</div>
{archiveMissingLabels.length > 0 ? (
<div className="vp-service-dossier-missing">
{archiveMissingLabels.map((label) => (
<Tag key={label} color="orange">{label}</Tag>
))}
</div>
) : null}
</Card>
{overview ? (
<Card bordered title="车辆服务概览" style={{ marginTop: 16 }}>
<Descriptions