diff --git a/vehicle-data-platform/apps/web/src/pages/Dashboard.tsx b/vehicle-data-platform/apps/web/src/pages/Dashboard.tsx index c8bd93d2..bc214fb8 100644 --- a/vehicle-data-platform/apps/web/src/pages/Dashboard.tsx +++ b/vehicle-data-platform/apps/web/src/pages/Dashboard.tsx @@ -246,30 +246,40 @@ export function Dashboard({ const capabilities = [ { title: '实时监控', + status: `在线 ${formatCount(serviceSummary?.onlineVehicles ?? summary?.onlineVehicles)}`, + color: 'green' as const, description: '按车辆聚合最新位置、在线状态和多来源实时字段,支持地图态势查看。', action: '查看在线车辆', onClick: () => onOpenRealtime({ online: 'online' }) }, { title: '轨迹回放', + status: `有效定位 ${formatCount(commandLocatedCount)}`, + color: commandLocatedCount > 0 ? 'blue' as const : 'grey' as const, description: '围绕车辆回放历史位置轨迹,结合高德线路和 RAW 证据定位异常。', action: '打开轨迹', onClick: () => onOpenHistory() }, { title: '历史数据查询', + status: `今日帧 ${formatCount(summary?.frameToday)}`, + color: 'blue' as const, description: '查询位置历史、RAW 帧和解析字段,为车辆问题复盘提供证据链。', action: '查询历史', onClick: () => onOpenHistory({ tab: 'raw' }) }, { title: '告警事件触发与通知', + status: `告警 ${formatCount(summary?.issueVehicles)}`, + color: (summary?.issueVehicles ?? 0) > 0 ? 'orange' as const : 'green' as const, description: '围绕断链、无来源、VIN 缺失、字段缺失形成告警和通知闭环。', action: '查看告警', onClick: () => onOpenQuality() }, { title: '统计查询', + status: `统计车辆 ${formatCount(serviceSummary?.totalVehicles)}`, + color: 'green' as const, description: '提供里程等运营统计查询,保证区间总值与每日统计口径闭合。', action: '查看统计', onClick: () => onOpenMileage() @@ -311,6 +321,7 @@ export function Dashboard({ {item.title} {item.description} + {item.status} diff --git a/vehicle-data-platform/apps/web/src/styles/global.css b/vehicle-data-platform/apps/web/src/styles/global.css index add70652..4987744f 100644 --- a/vehicle-data-platform/apps/web/src/styles/global.css +++ b/vehicle-data-platform/apps/web/src/styles/global.css @@ -720,6 +720,10 @@ body { line-height: 20px; } +.vp-capability-status { + justify-self: start; +} + .vp-capability-item .semi-button { justify-self: start; } 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 784da571..8b230e1a 100644 --- a/vehicle-data-platform/apps/web/src/test/App.test.tsx +++ b/vehicle-data-platform/apps/web/src/test/App.test.tsx @@ -387,6 +387,11 @@ test('dashboard exposes vehicle data center capability matrix', async () => { expect(screen.getAllByText('历史数据查询').length).toBeGreaterThanOrEqual(1); expect(screen.getAllByText('告警事件触发与通知').length).toBeGreaterThanOrEqual(1); expect(screen.getAllByText('统计查询').length).toBeGreaterThanOrEqual(1); + expect(screen.getAllByText('在线 208').length).toBeGreaterThanOrEqual(1); + expect(screen.getAllByText('有效定位 0').length).toBeGreaterThanOrEqual(1); + expect(screen.getAllByText('今日帧 1,286,320').length).toBeGreaterThanOrEqual(1); + expect(screen.getAllByText('告警 7').length).toBeGreaterThanOrEqual(1); + expect(screen.getAllByText('统计车辆 1,033').length).toBeGreaterThanOrEqual(1); fireEvent.click(screen.getByRole('button', { name: '能力入口 实时监控' })); expect(window.location.hash).toBe('#/realtime?online=online'); @@ -540,7 +545,7 @@ test('dashboard exposes vehicle command center map actions', async () => { expect(await screen.findByText('车辆态势指挥台')).toBeInTheDocument(); expect(screen.getByText('在线 1 / 2')).toBeInTheDocument(); - expect(screen.getByText('有效定位 1')).toBeInTheDocument(); + expect(screen.getAllByText('有效定位 1').length).toBeGreaterThanOrEqual(1); expect(screen.getByText('降级/离线 2')).toBeInTheDocument(); fireEvent.click(screen.getByRole('button', { name: '处理高优先级告警' })); expect(window.location.hash).toBe('#/quality?issueType=NO_SOURCE');