feat(platform): add customer vehicle service dashboard

This commit is contained in:
lingniu
2026-07-06 00:48:20 +08:00
parent b8199dcb5a
commit af4d721eeb
3 changed files with 208 additions and 0 deletions

View File

@@ -2385,11 +2385,98 @@ export function Dashboard({
onClick: () => onOpenRealtime({ online: 'online' })
}
];
const customerVehicleServiceDashboardItems = [
{
question: '车辆在哪里',
value: `${commandLocatedCount.toLocaleString()} 有定位`,
detail: '进入实时地图查看车辆分布、在线状态、最后上报和当前位置。',
action: '打开地图',
color: commandLocatedCount > 0 ? 'green' as const : 'orange' as const,
onClick: () => onOpenMap({ online: 'online' })
},
{
question: '轨迹能否回放',
value: `${formatCount(summary?.activeToday)} 活跃`,
detail: '按车辆和自定义时间窗回放路线、速度、停驶和里程断点。',
action: '轨迹回放',
color: 'blue' as const,
onClick: openTimeMonitorHistory
},
{
question: '里程怎么算',
value: `${formatCount(serviceSummary?.totalVehicles)} 车辆`,
detail: '查询区间里程、每日里程和统计闭合情况,支撑 BI 口径复核。',
action: '统计查询',
color: 'blue' as const,
onClick: openTimeMonitorMileage
},
{
question: '数据怎么导出',
value: `${formatCount(summary?.frameToday)} 今日数据`,
detail: '按车辆、时间和字段裁剪导出位置历史、原始记录和解析证据。',
action: '历史导出',
color: 'blue' as const,
onClick: openTimeMonitorRaw
},
{
question: '异常谁处理',
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 } : {})
}
];
return (
<div className="vp-page">
<PageHeader title="车辆服务工作台" description="面向客户的车辆地图、实时监控、轨迹回放、统计查询、自定义时间窗复盘、历史查询、告警通知和数据导出" />
<Spin spinning={loading}>
<section className="vp-customer-vehicle-service-dashboard" aria-label="客户车辆服务驾驶舱">
<div className="vp-customer-vehicle-service-dashboard-copy">
<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={3} style={{ margin: 0 }}>
</Typography.Title>
<Typography.Text type="secondary">
</Typography.Text>
<div className="vp-customer-vehicle-service-dashboard-status" aria-label="客户车辆服务驾驶舱状态">
<span>
<strong>{formatCount(serviceSummary?.onlineVehicles ?? summary?.onlineVehicles)}</strong>
线
</span>
<span>
<strong>{dayRangeText(timeMonitorScopeValue.dateFrom, timeMonitorScopeValue.dateTo)}</strong>
</span>
<span>
<strong>{focusVehicle?.label ?? '暂无重点车辆'}</strong>
</span>
</div>
</div>
<div className="vp-customer-vehicle-service-dashboard-grid">
{customerVehicleServiceDashboardItems.map((item) => (
<button
key={item.question}
type="button"
className="vp-customer-vehicle-service-dashboard-item"
onClick={item.onClick}
aria-label={`客户车辆服务驾驶舱 ${item.question} ${item.value} ${item.action}`}
>
<Tag color={item.color}>{item.question}</Tag>
<strong>{item.value}</strong>
<span>{item.detail}</span>
<em>{item.action}</em>
</button>
))}
</div>
</section>
<section className="vp-vehicle-service-cockpit" aria-label="车辆服务驾驶舱">
<div className="vp-vehicle-service-cockpit-copy">
<Space wrap>

View File

@@ -2185,6 +2185,116 @@ body {
overflow: hidden;
}
.vp-customer-vehicle-service-dashboard {
margin-bottom: 16px;
border: 1px solid rgba(22, 100, 255, 0.2);
border-radius: 8px;
background: #ffffff;
display: grid;
grid-template-columns: minmax(320px, 0.7fr) minmax(0, 1.3fr);
overflow: hidden;
}
.vp-customer-vehicle-service-dashboard-copy {
min-width: 0;
padding: 22px;
border-right: 1px solid var(--vp-border);
background: linear-gradient(180deg, #f7faff 0%, #ffffff 100%);
display: grid;
gap: 14px;
align-content: center;
}
.vp-customer-vehicle-service-dashboard-copy .semi-typography {
line-height: 26px;
}
.vp-customer-vehicle-service-dashboard-status {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 8px;
}
.vp-customer-vehicle-service-dashboard-status span {
min-width: 0;
padding: 10px;
border: 1px solid rgba(22, 100, 255, 0.12);
border-radius: 8px;
background: #ffffff;
color: var(--vp-text-muted);
font-size: 12px;
line-height: 18px;
display: grid;
gap: 4px;
}
.vp-customer-vehicle-service-dashboard-status strong {
color: var(--vp-text);
font-size: 14px;
line-height: 18px;
font-weight: 800;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.vp-customer-vehicle-service-dashboard-grid {
min-width: 0;
padding: 14px;
display: grid;
grid-template-columns: repeat(5, minmax(0, 1fr));
gap: 10px;
}
.vp-customer-vehicle-service-dashboard-item {
min-width: 0;
min-height: 164px;
padding: 12px;
border: 1px solid rgba(22, 100, 255, 0.14);
border-radius: 8px;
background: #fbfcff;
color: inherit;
cursor: pointer;
font: inherit;
text-align: left;
display: grid;
gap: 8px;
align-content: start;
transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}
.vp-customer-vehicle-service-dashboard-item:hover,
.vp-customer-vehicle-service-dashboard-item:focus-visible {
border-color: rgba(22, 100, 255, 0.42);
background: #f5f9ff;
box-shadow: 0 0 0 3px rgba(22, 100, 255, 0.08);
outline: none;
}
.vp-customer-vehicle-service-dashboard-item strong {
color: var(--vp-text);
font-size: 19px;
line-height: 24px;
font-weight: 800;
word-break: break-word;
}
.vp-customer-vehicle-service-dashboard-item span {
color: var(--vp-text-muted);
font-size: 12px;
line-height: 18px;
word-break: break-word;
}
.vp-customer-vehicle-service-dashboard-item em {
align-self: end;
color: var(--vp-primary);
font-size: 12px;
font-style: normal;
font-weight: 800;
line-height: 18px;
}
.vp-vehicle-service-cockpit-copy {
padding: 20px;
border-right: 1px solid var(--vp-border);
@@ -12439,6 +12549,9 @@ button.vp-realtime-command-item:focus-visible {
.vp-dispatch-operations-highlights,
.vp-customer-delivery-workbench,
.vp-customer-delivery-workbench-grid,
.vp-customer-vehicle-service-dashboard,
.vp-customer-vehicle-service-dashboard-grid,
.vp-customer-vehicle-service-dashboard-status,
.vp-vehicle-service-cockpit,
.vp-vehicle-service-cockpit-grid,
.vp-customer-platform-blueprint,

View File

@@ -1355,6 +1355,14 @@ test('dashboard exposes vehicle data center capability matrix', async () => {
await renderDashboard();
expect(screen.getByText('车辆服务工作台')).toBeInTheDocument();
expect(screen.getByRole('region', { name: '客户车辆服务驾驶舱' })).toBeInTheDocument();
expect(screen.getByText('客户进来先看车辆,不先看协议。')).toBeInTheDocument();
expect(screen.getByText('把实时地图、轨迹回放、里程统计、历史导出和告警通知收敛成一个可交付的车辆服务入口。')).toBeInTheDocument();
expect(screen.getByRole('button', { name: '客户车辆服务驾驶舱 车辆在哪里 0 有定位 打开地图' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '客户车辆服务驾驶舱 轨迹能否回放 4 活跃 轨迹回放' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '客户车辆服务驾驶舱 里程怎么算 1,033 车辆 统计查询' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '客户车辆服务驾驶舱 数据怎么导出 1,286,320 今日数据 历史导出' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '客户车辆服务驾驶舱 异常谁处理 7 告警 告警通知' })).toBeInTheDocument();
expect(screen.getByText('客户车辆服务中台蓝图')).toBeInTheDocument();
expect(screen.getByText('参考主流车联网平台的信息架构,把 Live Map、Route Replay、Geofence Alerts、Reports Export 和 Vehicle Health 收敛成客户可直接使用的车辆服务。')).toBeInTheDocument();
expect(screen.getByRole('button', { name: '客户车辆服务中台蓝图 实时地图 208 在线 打开地图' })).toBeInTheDocument();