feat(platform): add unified vehicle service view
This commit is contained in:
@@ -554,6 +554,58 @@ export function VehicleDetail({
|
||||
color: qualityCount > 0 ? 'orange' as const : 'green' as const
|
||||
}
|
||||
];
|
||||
const unifiedVehicleServiceItems = [
|
||||
{
|
||||
label: '车辆身份',
|
||||
value: hasResolvedVIN ? displayVIN : displayLookupKey,
|
||||
detail: archivePlate || archivePhone || archiveOEM || '待补身份',
|
||||
color: hasResolvedVIN ? 'green' as const : 'orange' as const
|
||||
},
|
||||
{
|
||||
label: '服务状态',
|
||||
value: serviceStatus?.title ?? serviceConclusion.status,
|
||||
detail: serviceStatus?.detail ?? serviceConclusion.risk,
|
||||
color: serviceConclusion.color
|
||||
},
|
||||
{
|
||||
label: '实时主来源',
|
||||
value: overview?.primaryProtocol || summary?.primaryProtocol || '-',
|
||||
detail: evidenceSourceCount > 0 ? `${evidenceOnlineSourceCount}/${evidenceSourceCount} 来源在线` : '暂无来源',
|
||||
color: evidenceOnlineSourceCount > 0 ? 'green' as const : 'orange' as const
|
||||
},
|
||||
{
|
||||
label: '业务可用性',
|
||||
value: online ? '在线可用' : hasResolvedVIN ? '离线待查' : '待绑定',
|
||||
detail: lastSeen === '-' ? '无最后上报' : `最后上报 ${lastSeen}`,
|
||||
color: online ? 'green' as const : 'orange' as const
|
||||
}
|
||||
];
|
||||
const copyUnifiedVehicleService = () => {
|
||||
if (!detail) {
|
||||
Toast.warning('当前没有可复制的统一车辆服务摘要');
|
||||
return;
|
||||
}
|
||||
const vehicleName = [archivePlate, displayVIN].filter((item) => item && item !== '-').join(' / ') || displayLookupKey;
|
||||
const lines = [
|
||||
'【统一车辆服务摘要】',
|
||||
`车辆:${vehicleName}`,
|
||||
`当前范围:${scopeText}`,
|
||||
`车辆身份:${hasResolvedVIN ? displayVIN : '待绑定'}`,
|
||||
`服务状态:${serviceStatus?.title ?? serviceConclusion.status}`,
|
||||
`服务说明:${serviceStatus?.detail ?? serviceConclusion.risk}`,
|
||||
`实时主来源:${overview?.primaryProtocol || summary?.primaryProtocol || '-'}`,
|
||||
`来源在线:${evidenceSourceCount > 0 ? `${evidenceOnlineSourceCount}/${evidenceSourceCount}` : '-'}`,
|
||||
`业务可用性:${online ? '在线可用' : hasResolvedVIN ? '离线待查' : '待绑定'}`,
|
||||
`数据资产:实时 ${overview?.realtimeCount ?? detail.realtime.length} / 轨迹 ${overview?.historyCount ?? detail.history.total ?? 0} / RAW ${overview?.rawCount ?? detail.raw.total ?? 0} / 里程 ${overview?.mileageCount ?? detail.mileage.total ?? 0} / 告警 ${overview?.qualityIssueCount ?? qualityCount}`,
|
||||
`下一步:${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 copyVehicleServiceDossier = () => {
|
||||
if (!detail) {
|
||||
Toast.warning('当前没有可复制的车辆服务档案');
|
||||
@@ -836,6 +888,42 @@ export function VehicleDetail({
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
<Card
|
||||
bordered
|
||||
title={<Space><span>统一车辆服务视图</span><Button size="small" disabled={!detail} icon={<IconCopy />} onClick={copyUnifiedVehicleService}>复制归一摘要</Button></Space>}
|
||||
style={{ marginTop: 16 }}
|
||||
>
|
||||
<div className="vp-unified-service-board">
|
||||
<div className="vp-unified-service-main">
|
||||
<Space wrap>
|
||||
<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>
|
||||
<Typography.Text type="secondary">
|
||||
{serviceStatus?.detail ?? serviceConclusion.risk}
|
||||
</Typography.Text>
|
||||
<div className="vp-unified-service-actions">
|
||||
<Button size="small" theme="solid" type="primary" disabled={!hasResolvedVIN} onClick={() => onOpenRealtime(resolvedVIN, activeProtocol)}>实时监控</Button>
|
||||
<Button size="small" theme="light" disabled={!hasResolvedVIN} onClick={() => onOpenHistory(resolvedVIN, activeProtocol)}>轨迹回放</Button>
|
||||
<Button size="small" theme="light" disabled={!hasResolvedVIN} onClick={() => onOpenRaw(resolvedVIN, activeProtocol)}>历史 RAW</Button>
|
||||
<Button size="small" theme="light" disabled={!hasResolvedVIN} onClick={() => onOpenMileage(resolvedVIN, activeProtocol)}>统计查询</Button>
|
||||
</div>
|
||||
</div>
|
||||
<div className="vp-unified-service-grid">
|
||||
{unifiedVehicleServiceItems.map((item) => (
|
||||
<div key={item.label} className="vp-unified-service-item">
|
||||
<Tag color={item.color}>{item.label}</Tag>
|
||||
<strong>{item.value}</strong>
|
||||
<Typography.Text type="secondary">{item.detail}</Typography.Text>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
<Card
|
||||
bordered
|
||||
title={<Space><span>车辆服务档案总览</span><Button size="small" disabled={!detail} icon={<IconCopy />} onClick={copyVehicleServiceDossier}>复制档案</Button></Space>}
|
||||
|
||||
Reference in New Issue
Block a user