feat(platform): add customer vehicle service hub

This commit is contained in:
lingniu
2026-07-06 03:01:08 +08:00
parent e69d8ecd10
commit 53a6aff662
2 changed files with 81 additions and 0 deletions

View File

@@ -2399,6 +2399,48 @@ export function Dashboard({
onClick: openTimeMonitorAlerts
}
];
const customerVehicleServiceHubItems = [
{
label: '实时地图',
value: `${formatCount(serviceSummary?.onlineVehicles ?? summary?.onlineVehicles)} 在线`,
detail: '先确认车辆在哪里、是否在线、坐标是否可信。',
action: '看车在哪',
color: 'green' as const,
onClick: () => onOpenMap({ online: 'online' })
},
{
label: '轨迹回放',
value: `${formatCount(summary?.activeToday)} 活跃`,
detail: '按车辆和时间窗回放路线、停驶、速度和里程断点。',
action: '回放路线',
color: 'blue' as const,
onClick: openTimeMonitorHistory
},
{
label: '里程统计',
value: dayRangeText(timeMonitorScopeValue.dateFrom, timeMonitorScopeValue.dateTo),
detail: '核对区间里程、每日里程和客户 BI 统计口径。',
action: '核对里程',
color: 'blue' as const,
onClick: openTimeMonitorMileage
},
{
label: '数据导出',
value: `${formatCount(summary?.frameToday)} 今日数据`,
detail: '导出位置、原始记录、解析字段和告警说明。',
action: '交付证据',
color: 'blue' as const,
onClick: openTimeMonitorRaw
},
{
label: '告警通知',
value: `${formatCount(summary?.issueVehicles)} 告警`,
detail: highPriorityIssue ? `${qualityIssueLabel(highPriorityIssue.issueType)} / ${priorityIssueVehicleLabel(highPriorityIssue)}` : '没有高优先级异常时可直接说明无异常。',
action: '闭环通知',
color: (summary?.issueVehicles ?? 0) > 0 ? 'orange' as const : 'green' as const,
onClick: () => onOpenQuality(highPriorityIssue?.issueType ? { issueType: highPriorityIssue.issueType } : {})
}
];
const operationsEvidenceItems = [
{
label: '链路健康',
@@ -2533,6 +2575,37 @@ export function Dashboard({
</div>
</div>
</section>
<section className="vp-customer-vehicle-service-hub" aria-label="客户车辆服务中枢">
<div className="vp-customer-vehicle-service-summary">
<Space wrap>
<Tag color="blue"></Tag>
<Tag color={amapConfigured ? 'green' : 'orange'}>{amapConfigured ? '地图可用' : '坐标预览'}</Tag>
<Tag color={(summary?.issueVehicles ?? 0) > 0 ? 'orange' : 'green'}>{formatCount(summary?.issueVehicles)} </Tag>
</Space>
<Typography.Title heading={4} style={{ margin: 0 }}>
线
</Typography.Title>
<Typography.Text type="secondary">
</Typography.Text>
</div>
<div className="vp-customer-vehicle-service-grid">
{customerVehicleServiceHubItems.map((item) => (
<button
key={item.label}
type="button"
className="vp-customer-vehicle-service-item"
onClick={item.onClick}
aria-label={`客户车辆服务中枢 ${item.label} ${item.value} ${item.action}`}
>
<Tag color={item.color}>{item.label}</Tag>
<strong>{item.value}</strong>
<span>{item.detail}</span>
<em>{item.action}</em>
</button>
))}
</div>
</section>
<section className="vp-customer-map-situation" aria-label="车辆地图态势">
<div className="vp-customer-map-situation-map">
<VehicleMap

View File

@@ -834,6 +834,14 @@ test('dashboard prioritizes customer vehicle service command over data sources',
expect(screen.getByText('轨迹路径')).toBeInTheDocument();
expect(screen.getByText('区域围栏')).toBeInTheDocument();
expect(screen.getByText('地址解析')).toBeInTheDocument();
expect(await screen.findByText('客户车辆服务中枢')).toBeInTheDocument();
expect(screen.getByText('客户只关心车怎么服务:在哪里、是否在线、这段时间怎么跑、里程是否可信、异常是否已通知、数据能否交付。')).toBeInTheDocument();
expect(screen.getByRole('button', { name: '客户车辆服务中枢 实时地图 208 在线 看车在哪' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '客户车辆服务中枢 轨迹回放 4 活跃 回放路线' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '客户车辆服务中枢 里程统计 1 天窗口 核对里程' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '客户车辆服务中枢 数据导出 1,286,320 今日数据 交付证据' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '客户车辆服务中枢 告警通知 7 告警 闭环通知' })).toBeInTheDocument();
expect(screen.getByText('运维接入、队列、存储、协议解析降级为证据层,默认不打断客户主流程。')).toBeInTheDocument();
});
test('dashboard presents a customer dispatch operations home', async () => {