diff --git a/vehicle-data-platform/apps/web/src/pages/Vehicles.tsx b/vehicle-data-platform/apps/web/src/pages/Vehicles.tsx index 67d30346..ab63124f 100644 --- a/vehicle-data-platform/apps/web/src/pages/Vehicles.tsx +++ b/vehicle-data-platform/apps/web/src/pages/Vehicles.tsx @@ -960,6 +960,57 @@ export function Vehicles({ onClick: () => onOpenQuality?.(serviceScopeFilters) } ]; + const totalVehicleCount = summary?.totalVehicles ?? pagination.total; + const onlineRate = totalVehicleCount > 0 ? `${(((summary?.onlineVehicles ?? 0) / totalVehicleCount) * 100).toFixed(1)}%` : '-'; + const currentPageServiceableCount = rows.filter((row) => row.bindingStatus === 'bound' && row.sourceCount > 0).length; + const pendingVehicleCount = (summary?.noDataVehicles ?? 0) + (summary?.unboundVehicles ?? 0); + const fleetCommandItems = [ + { + label: '在线率', + value: onlineRate, + detail: `${(summary?.onlineVehicles ?? 0).toLocaleString()} / ${totalVehicleCount.toLocaleString()} 辆在线,先进入地图看车辆分布。`, + action: '车辆地图', + color: (summary?.onlineVehicles ?? 0) > 0 ? 'green' as const : 'orange' as const, + disabled: !onOpenMap, + onClick: () => onOpenMap?.({ ...serviceScopeFilters, online: 'online' }) + }, + { + label: '可服务车辆', + value: `${currentPageServiceableCount.toLocaleString()} 辆`, + detail: '当前页可归并到车辆服务的车辆,可直接查看实时状态和来源证据。', + action: '实时监控', + color: currentPageServiceableCount > 0 ? 'blue' as const : 'orange' as const, + disabled: !onOpenRealtime, + onClick: () => onOpenRealtime?.({ ...serviceScopeFilters, online: 'online' }) + }, + { + label: '待处理车辆', + value: `${pendingVehicleCount.toLocaleString()} 辆`, + detail: '无来源或未绑定车辆优先进入告警闭环,避免客户查不到车。', + action: '告警通知', + color: pendingVehicleCount > 0 ? 'orange' as const : 'green' as const, + disabled: !onOpenQuality, + onClick: () => onOpenQuality?.(serviceScopeFilters) + }, + { + label: '当前交付', + value: `${rows.length.toLocaleString()} 辆`, + detail: '把当前筛选结果导出为车辆清单,再按时间窗交付轨迹和历史证据。', + action: '数据导出', + color: rows.length > 0 ? 'blue' as const : 'grey' as const, + disabled: rows.length === 0, + onClick: exportVehicles + }, + { + label: '轨迹复盘', + value: filters.keyword?.trim() ? '单车可回放' : '先选车辆', + detail: filters.keyword?.trim() ? '当前已进入单车范围,可直接复盘历史轨迹。' : '先锁定 VIN、车牌或手机号,再进入轨迹回放。', + action: '轨迹回放', + color: filters.keyword?.trim() ? 'green' as const : 'grey' as const, + disabled: !onOpenHistory || !filters.keyword?.trim(), + onClick: () => onOpenHistory?.({ ...serviceScopeFilters, tab: 'location' }) + } + ]; useEffect(() => { setFilters(initialFilters); @@ -1068,6 +1119,36 @@ export function Vehicles({ return (
+
+
+ + 客户车队指挥台 + {filters.keyword?.trim() ? '单车服务' : '车辆池'} + 0 ? 'orange' : 'green'}>{pendingVehicleCount.toLocaleString()} 待处理 + + 从车辆池直接判断运营状态:哪些车在线、哪些车可服务、哪些车要回放、统计、导出或触发告警。 + + 车队指挥台把实时地图、轨迹回放、里程统计、历史导出和告警通知放在同一组入口里;协议来源只保留为证据和筛选条件。 + +
+
+ {fleetCommandItems.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 ae199fb9..04c6bc87 100644 --- a/vehicle-data-platform/apps/web/src/styles/global.css +++ b/vehicle-data-platform/apps/web/src/styles/global.css @@ -3594,6 +3594,99 @@ button.vp-realtime-command-item:focus-visible { line-height: 20px; } +.vp-fleet-command-center { + margin-bottom: 16px; + border: 1px solid rgba(22, 100, 255, 0.18); + border-radius: var(--vp-radius); + background: #fff; + display: grid; + grid-template-columns: minmax(300px, 0.58fr) minmax(0, 1.42fr); + overflow: hidden; + box-shadow: var(--vp-shadow-sm); +} + +.vp-fleet-command-copy { + padding: 18px; + border-right: 1px solid var(--vp-border); + background: #f6f9ff; + display: grid; + gap: 12px; + align-content: start; +} + +.vp-fleet-command-copy strong { + color: var(--vp-text); + font-size: 20px; + font-weight: 700; + line-height: 28px; + word-break: break-word; +} + +.vp-fleet-command-copy span { + color: var(--vp-text-muted); + font-size: 13px; + line-height: 20px; +} + +.vp-fleet-command-grid { + padding: 14px; + display: grid; + grid-template-columns: repeat(5, minmax(0, 1fr)); + gap: 10px; +} + +.vp-fleet-command-item { + min-height: 148px; + padding: 12px; + border: 1px solid var(--vp-border); + 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-fleet-command-item:disabled { + cursor: not-allowed; + opacity: 0.62; +} + +.vp-fleet-command-item:not(:disabled):hover, +.vp-fleet-command-item:not(:disabled):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-fleet-command-item strong { + color: var(--vp-text); + font-size: 20px; + font-weight: 700; + line-height: 26px; + word-break: break-word; +} + +.vp-fleet-command-item span { + color: var(--vp-text-muted); + font-size: 12px; + line-height: 18px; + word-break: break-word; +} + +.vp-fleet-command-item em { + color: var(--vp-primary); + font-size: 13px; + font-style: normal; + font-weight: 700; + line-height: 20px; +} + .vp-customer-vehicle-service-hub { margin-bottom: 16px; border: 1px solid rgba(22, 100, 255, 0.18); @@ -10370,6 +10463,8 @@ button.vp-realtime-command-item:focus-visible { .vp-service-entry-grid, .vp-current-service-board, .vp-current-service-grid, + .vp-fleet-command-center, + .vp-fleet-command-grid, .vp-customer-vehicle-service-hub, .vp-customer-vehicle-service-grid, .vp-alert-closure-timeline, 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 5f7720b0..034d5eeb 100644 --- a/vehicle-data-platform/apps/web/src/test/App.test.tsx +++ b/vehicle-data-platform/apps/web/src/test/App.test.tsx @@ -2233,6 +2233,13 @@ test('shows vehicle service result summary on vehicle list filters', async () => render(); expect(await screen.findByText('当前车辆结果')).toBeInTheDocument(); + expect(screen.getByText('客户车队指挥台')).toBeInTheDocument(); + expect(screen.getByText('从车辆池直接判断运营状态:哪些车在线、哪些车可服务、哪些车要回放、统计、导出或触发告警。')).toBeInTheDocument(); + expect(screen.getByRole('button', { name: '客户车队指挥台 在线率 40.3% 车辆地图' })).toBeInTheDocument(); + expect(screen.getByRole('button', { name: '客户车队指挥台 可服务车辆 2 辆 实时监控' })).toBeInTheDocument(); + expect(screen.getByRole('button', { name: '客户车队指挥台 待处理车辆 13 辆 告警通知' })).toBeInTheDocument(); + expect(screen.getByRole('button', { name: '客户车队指挥台 当前交付 2 辆 数据导出' })).toBeInTheDocument(); + expect(screen.getByRole('button', { name: '客户车队指挥台 轨迹复盘 先选车辆 轨迹回放' })).toBeInTheDocument(); expect(screen.getByText('客户车辆服务台')).toBeInTheDocument(); expect(screen.getByText('三个接入源最终服务同一辆车,客户从这里进入找车、实时、轨迹、统计、导出和告警。')).toBeInTheDocument(); expect(screen.getByRole('button', { name: '客户车辆服务台 车辆池 181 车辆 找车' })).toBeInTheDocument();