feat(platform): add vehicle service overview
This commit is contained in:
@@ -19,6 +19,13 @@ const sourceCapabilities: Array<{ key: keyof Pick<VehicleSourceStatus, 'hasRealt
|
||||
{ key: 'hasMileage', label: '里程' }
|
||||
];
|
||||
|
||||
const coverageStatusText: Record<string, string> = {
|
||||
online: '全部在线',
|
||||
partial: '部分在线',
|
||||
offline: '全部离线',
|
||||
no_data: '暂无来源'
|
||||
};
|
||||
|
||||
export function VehicleDetail({
|
||||
vin,
|
||||
protocol,
|
||||
@@ -78,6 +85,7 @@ export function VehicleDetail({
|
||||
const summary = detail?.realtimeSummary;
|
||||
const latest = detail?.realtime?.[0];
|
||||
const resolution = detail?.resolution;
|
||||
const overview = detail?.serviceOverview;
|
||||
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 : '-';
|
||||
@@ -156,6 +164,24 @@ export function VehicleDetail({
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{overview ? (
|
||||
<Card bordered title="车辆服务概览" style={{ marginTop: 16 }}>
|
||||
<Descriptions
|
||||
row
|
||||
data={[
|
||||
{ key: '服务车辆', value: [overview.plate, overview.vin].filter(Boolean).join(' / ') || '-' },
|
||||
{ key: '在线来源', value: `${overview.onlineSourceCount}/${overview.sourceCount}` },
|
||||
{ key: '覆盖状态', value: <Tag color={overview.coverageStatus === 'online' ? 'green' : overview.coverageStatus === 'partial' ? 'orange' : 'grey'}>{coverageStatusText[overview.coverageStatus] ?? overview.coverageStatus}</Tag> },
|
||||
{ key: '主来源', value: overview.primaryProtocol || '-' },
|
||||
{ key: '最后上报', value: overview.lastSeen || '-' },
|
||||
{ key: '数据规模', value: `历史 ${overview.historyCount} / RAW ${overview.rawCount} / 里程 ${overview.mileageCount}` },
|
||||
{ key: '实时来源', value: overview.realtimeCount },
|
||||
{ key: '质量问题', value: <Tag color={overview.qualityIssueCount > 0 ? 'orange' : 'green'}>{overview.qualityIssueCount}</Tag> }
|
||||
]}
|
||||
/>
|
||||
</Card>
|
||||
) : null}
|
||||
|
||||
<Card bordered style={{ marginTop: 16 }}>
|
||||
<div className="vp-vehicle-summary">
|
||||
<Descriptions
|
||||
|
||||
Reference in New Issue
Block a user