feat(platform): add fleet operations cockpit

This commit is contained in:
lingniu
2026-07-05 17:35:30 +08:00
parent 2c6fca90d2
commit 8dda3c0b85
3 changed files with 154 additions and 0 deletions

View File

@@ -1426,6 +1426,48 @@ export function Dashboard({
onClick: () => onOpenQuality()
}
];
const modernFleetOperations = [
{
label: 'Live Map',
value: `${formatCount(serviceSummary?.onlineVehicles ?? summary?.onlineVehicles)} 在线`,
detail: `有效定位 ${commandLocatedCount.toLocaleString()} 辆,先确认车辆在哪里。`,
action: '打开地图',
color: 'green' as const,
onClick: () => onOpenMap({ online: 'online' })
},
{
label: 'Route Replay',
value: `${formatCount(summary?.activeToday)} 活跃`,
detail: `时间窗 ${dayRangeText(timeMonitorScopeValue.dateFrom, timeMonitorScopeValue.dateTo)},用于客户复盘。`,
action: '回放轨迹',
color: 'blue' as const,
onClick: openTimeMonitorHistory
},
{
label: 'Mileage',
value: `${formatCount(serviceSummary?.totalVehicles)} 车辆`,
detail: '按车辆口径查询区间里程、日统计和异常断点。',
action: '查统计',
color: 'blue' as const,
onClick: openTimeMonitorMileage
},
{
label: 'Export',
value: `${formatCount(summary?.frameToday)} 今日数据`,
detail: '位置、原始记录和字段证据按车辆与时间裁剪交付。',
action: '导出数据',
color: 'blue' as const,
onClick: openTimeMonitorRaw
},
{
label: 'Alerts',
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 customerQuestionActions = [
{
question: '这辆车现在在哪里?',
@@ -1623,6 +1665,32 @@ export function Dashboard({
<div className="vp-page">
<PageHeader title="车辆服务工作台" description="面向客户的车辆地图、实时监控、轨迹回放、统计查询、自定义时间窗复盘、历史查询、告警通知和数据导出" />
<Spin spinning={loading}>
<section className="vp-customer-cockpit" aria-label="现代车队运营台">
<div className="vp-customer-cockpit-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>
</div>
<div className="vp-customer-cockpit-actions">
{modernFleetOperations.map((item) => (
<button
key={item.label}
type="button"
className="vp-customer-cockpit-action"
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>
<Card bordered className="vp-fleet-monitor" bodyStyle={{ padding: 0 }}>
<div className="vp-fleet-monitor-map">
<div className="vp-fleet-monitor-copy">

View File

@@ -895,6 +895,78 @@ body {
margin-bottom: 16px;
overflow: hidden;
border-color: rgba(22, 100, 255, 0.18);
border: 1px solid rgba(22, 100, 255, 0.16);
border-radius: var(--vp-radius);
background: #ffffff;
display: grid;
grid-template-columns: minmax(280px, 0.62fr) minmax(0, 1.38fr);
}
.vp-customer-cockpit-summary {
padding: 18px;
border-right: 1px solid var(--vp-border);
background: #f8fbff;
display: grid;
gap: 12px;
align-content: center;
}
.vp-customer-cockpit-summary .semi-typography {
color: var(--vp-text);
line-height: 28px;
}
.vp-customer-cockpit-actions {
padding: 14px;
display: grid;
grid-template-columns: repeat(5, minmax(0, 1fr));
gap: 10px;
}
.vp-customer-cockpit-action {
min-height: 142px;
padding: 12px;
border: 1px solid var(--vp-border);
border-radius: var(--vp-radius);
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-cockpit-action:hover,
.vp-customer-cockpit-action: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-cockpit-action strong {
color: var(--vp-text);
font-size: 18px;
font-weight: 700;
line-height: 24px;
word-break: break-word;
}
.vp-customer-cockpit-action span {
color: var(--vp-text-muted);
font-size: 12px;
line-height: 18px;
}
.vp-customer-cockpit-action em {
color: var(--vp-primary);
font-size: 15px;
font-style: normal;
font-weight: 600;
line-height: 22px;
}
.vp-customer-cockpit .semi-card-body {
@@ -7762,6 +7834,8 @@ button.vp-realtime-command-item:focus-visible {
.vp-map-ops-board,
.vp-map-ops-readiness,
.vp-map-ops-work,
.vp-customer-cockpit,
.vp-customer-cockpit-actions,
.vp-customer-cockpit .semi-card-body,
.vp-customer-cockpit-metrics,
.vp-customer-cockpit-trust,
@@ -7919,6 +7993,11 @@ button.vp-realtime-command-item:focus-visible {
grid-template-columns: 1fr;
}
.vp-customer-cockpit-summary {
border-right: 0;
border-bottom: 1px solid var(--vp-border);
}
.vp-customer-cockpit-workflow {
grid-template-columns: 1fr;
}

View File

@@ -797,6 +797,13 @@ test('dashboard exposes vehicle data center capability matrix', async () => {
await renderDashboard();
expect(screen.getByText('车辆服务工作台')).toBeInTheDocument();
expect(screen.getByText('现代车队运营台')).toBeInTheDocument();
expect(screen.getByText('一屏完成车辆地图、轨迹回放、里程统计、数据导出和告警闭环。')).toBeInTheDocument();
expect(screen.getByRole('button', { name: '现代车队运营台 Live Map 208 在线 打开地图' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '现代车队运营台 Route Replay 4 活跃 回放轨迹' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '现代车队运营台 Mileage 1,033 车辆 查统计' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '现代车队运营台 Export 1,286,320 今日数据 导出数据' })).toBeInTheDocument();
expect(screen.getByRole('button', { name: '现代车队运营台 Alerts 7 告警 通知闭环' })).toBeInTheDocument();
expect(screen.getByText('车辆监控中心')).toBeInTheDocument();
expect(screen.getByText('先看车在哪里,再处理轨迹、统计、告警和导出')).toBeInTheDocument();
expect(screen.getByText('客户主流程围绕车辆本身:地图看车、实时状态、时间窗复盘、统计查询、历史数据导出和告警通知。接入来源只作为追溯证据。')).toBeInTheDocument();