From 8dda3c0b85c8e7362d1cbf9301ec4c83826c7666 Mon Sep 17 00:00:00 2001 From: lingniu Date: Sun, 5 Jul 2026 17:35:30 +0800 Subject: [PATCH] feat(platform): add fleet operations cockpit --- .../apps/web/src/pages/Dashboard.tsx | 68 ++++++++++++++++ .../apps/web/src/styles/global.css | 79 +++++++++++++++++++ .../apps/web/src/test/App.test.tsx | 7 ++ 3 files changed, 154 insertions(+) diff --git a/vehicle-data-platform/apps/web/src/pages/Dashboard.tsx b/vehicle-data-platform/apps/web/src/pages/Dashboard.tsx index c447f081..b647ff62 100644 --- a/vehicle-data-platform/apps/web/src/pages/Dashboard.tsx +++ b/vehicle-data-platform/apps/web/src/pages/Dashboard.tsx @@ -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({
+
+
+ + 现代车队运营台 + {amapConfigured ? '地图可用' : '坐标预览'} + 0 ? 'orange' : 'green'}>{formatCount(summary?.issueVehicles)} 告警 + + 一屏完成车辆地图、轨迹回放、里程统计、数据导出和告警闭环。 +
+
+ {modernFleetOperations.map((item) => ( + + ))} +
+
diff --git a/vehicle-data-platform/apps/web/src/styles/global.css b/vehicle-data-platform/apps/web/src/styles/global.css index 9266b433..60b96fc6 100644 --- a/vehicle-data-platform/apps/web/src/styles/global.css +++ b/vehicle-data-platform/apps/web/src/styles/global.css @@ -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; } diff --git a/vehicle-data-platform/apps/web/src/test/App.test.tsx b/vehicle-data-platform/apps/web/src/test/App.test.tsx index 89a348be..2c06a1aa 100644 --- a/vehicle-data-platform/apps/web/src/test/App.test.tsx +++ b/vehicle-data-platform/apps/web/src/test/App.test.tsx @@ -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();