From af4d721eeb084f0bbb6aa84577281401e0fde746 Mon Sep 17 00:00:00 2001 From: lingniu Date: Mon, 6 Jul 2026 00:48:20 +0800 Subject: [PATCH] feat(platform): add customer vehicle service dashboard --- .../apps/web/src/pages/Dashboard.tsx | 87 ++++++++++++++ .../apps/web/src/styles/global.css | 113 ++++++++++++++++++ .../apps/web/src/test/App.test.tsx | 8 ++ 3 files changed, 208 insertions(+) diff --git a/vehicle-data-platform/apps/web/src/pages/Dashboard.tsx b/vehicle-data-platform/apps/web/src/pages/Dashboard.tsx index e1315d30..74f6ffa6 100644 --- a/vehicle-data-platform/apps/web/src/pages/Dashboard.tsx +++ b/vehicle-data-platform/apps/web/src/pages/Dashboard.tsx @@ -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 (
+
+
+ + 客户车辆服务驾驶舱 + {amapConfigured ? '高德地图可用' : '坐标预览'} + 0 ? 'orange' : 'green'}>{formatCount(summary?.issueVehicles)} 告警 + + + 客户进来先看车辆,不先看协议。 + + + 把实时地图、轨迹回放、里程统计、历史导出和告警通知收敛成一个可交付的车辆服务入口。 + +
+ + {formatCount(serviceSummary?.onlineVehicles ?? summary?.onlineVehicles)} + 在线车辆 + + + {dayRangeText(timeMonitorScopeValue.dateFrom, timeMonitorScopeValue.dateTo)} + 服务时间窗 + + + {focusVehicle?.label ?? '暂无重点车辆'} + 今日重点 + +
+
+
+ {customerVehicleServiceDashboardItems.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 647dc736..d2b1dc88 100644 --- a/vehicle-data-platform/apps/web/src/styles/global.css +++ b/vehicle-data-platform/apps/web/src/styles/global.css @@ -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, 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 2fd9fb8a..c8581439 100644 --- a/vehicle-data-platform/apps/web/src/test/App.test.tsx +++ b/vehicle-data-platform/apps/web/src/test/App.test.tsx @@ -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();