diff --git a/zlt-business/order-center/src/main/java/com/central/order/model/vo/TourismQrCodeDistanceVO.java b/zlt-business/order-center/src/main/java/com/central/order/model/vo/TourismQrCodeDistanceVO.java index e54fc500..66787a9d 100644 --- a/zlt-business/order-center/src/main/java/com/central/order/model/vo/TourismQrCodeDistanceVO.java +++ b/zlt-business/order-center/src/main/java/com/central/order/model/vo/TourismQrCodeDistanceVO.java @@ -27,6 +27,10 @@ public class TourismQrCodeDistanceVO { @Schema(description = "距离描述(如:120m、1.2km)") private String distanceDesc; + + @Schema(description = "价格") + private String price; + public String getDistanceDesc() { if (distance == null) { return "未知距离"; diff --git a/zlt-business/order-center/src/main/java/com/central/order/service/impl/TourismServiceImpl.java b/zlt-business/order-center/src/main/java/com/central/order/service/impl/TourismServiceImpl.java index 506b3d2d..91d95867 100644 --- a/zlt-business/order-center/src/main/java/com/central/order/service/impl/TourismServiceImpl.java +++ b/zlt-business/order-center/src/main/java/com/central/order/service/impl/TourismServiceImpl.java @@ -337,7 +337,6 @@ public class TourismServiceImpl extends SuperServiceImpl return Result.succeed(List.of(), "暂无数据"); } - Map codeIdToImageUrl = new HashMap<>(); Map deviceSnToLngLat = new HashMap<>(); List resultList = new ArrayList<>(); @@ -359,8 +358,9 @@ public class TourismServiceImpl extends SuperServiceImpl } vo.setQrCodeName(qrName); vo.setQrCode(qrCode.getCodeId()); + vo.setPrice(qrCode.getPrice()); - String imageUrl = resolveQrCodeImageUrl(qrCode.getCodeId(), codeIdToImageUrl); + String imageUrl = resolveQrCodeImageUrl(qrCode.getCodeId()); vo.setQrCodeImage(imageUrl); BigDecimal[] lngLat = resolveDeviceLngLat(qrCode.getDeviceSn(), deviceSnToLngLat); @@ -384,13 +384,10 @@ public class TourismServiceImpl extends SuperServiceImpl return Result.succeed(resultList, "获取成功"); } - private String resolveQrCodeImageUrl(String codeId, Map cache) { + private String resolveQrCodeImageUrl(String codeId) { if (codeId == null || codeId.trim().isEmpty()) { return null; } - if (cache.containsKey(codeId)) { - return cache.get(codeId); - } String imageUrl = null; try { @@ -413,8 +410,6 @@ public class TourismServiceImpl extends SuperServiceImpl } catch (Exception e) { log.warn("解析二维码图片失败: codeId={}, error={}", codeId, e.getMessage()); } - - cache.put(codeId, imageUrl); return imageUrl; } diff --git a/zlt-web/react-web-next/dist.zip b/zlt-web/react-web-next/dist.zip index a2b41bd0..0c0d50af 100644 Binary files a/zlt-web/react-web-next/dist.zip and b/zlt-web/react-web-next/dist.zip differ diff --git a/zlt-web/yingyan/REFACTOR_PLAN.md b/zlt-web/yingyan/REFACTOR_PLAN.md index d3e14975..c4927f8b 100644 --- a/zlt-web/yingyan/REFACTOR_PLAN.md +++ b/zlt-web/yingyan/REFACTOR_PLAN.md @@ -1,102 +1,69 @@ -# 无人机智慧城市管控平台重构计划 (Smart City UAV Platform Refactor Plan) - V2 +# 通用大屏 → 无人机智慧城市管控平台(重构计划表) -## 1. 重构目标 (Objectives) -将现有的“通用大屏”彻底改造为**“无人机智慧城市管控平台”**。核心逻辑由“监控无人机”转变为**“无人机赋能智慧城市”**——即重点展示无人机采集到的城市数据(环境、交通、违规、基础设施),而非无人机本身的状态。 +> 目标:在不改变现有功能与数据接口的前提下,把 `/dashboard` 的“通用监控大屏”升级为更符合“无人机赋能智慧城市”的首页大屏:维度更丰富、信息架构更清晰、视觉更高级、交互更顺手。 -- **视觉升级**:采用“未来城市/数字孪生”风格,深蓝/黑底色,霓虹光效。 -- **数据维度深化**:**去无人机化(运维层面),重城市治理化(业务层面)**。展示城市环境、网格治理、交通态势等业务指标。 -- **交互优化**:采用 CSS Grid 布局彻底解决挤压/留白问题。 -- **设备操控重构**:严格参考 `yingyan/src/pages/11.png` 的布局风格进行专业化重制。 +## 0. 约束与边界(必须遵守) +- 不改路由与入口:仍然使用 `/dashboard`,`进入监控视图` 仍然跳转 `/map3d?from=dashboard`。 +- 不改现有接口/聚合逻辑:继续使用 `src/services/dashboard.ts` 的 `getDeviceStats/getTaskStats/getTrendData` 等(允许新增“可选增强”接口或派生数据)。 +- 不影响海事行业:`/maritime` 不做联动修改(仅做必要的“命名展示”区分时除外)。 +- 无数据也要好看:任何新模块在数据缺失时要有优雅的“空态/占位”,避免空白或布局塌陷。 ---- +## 1. 目标体验(验收口径) +1. 首页一眼看懂:顶部为“城市态势总览”,中间为“数字孪生/空域态势”,两侧为“运行体征/事件处置”。 +2. 统计维度丰富:至少覆盖「设备运行」「任务执行」「城市网格治理」「AI识别事件」「环境/交通态势(可派生/可模拟)」五大类。 +3. 视觉统一:同一套色板、间距、描边、阴影、字体层级,避免“拼贴感”。 +4. 交互轻快:鼠标悬停、点击、筛选都有明确反馈;滚动区域可控且不抢焦点。 -## 2. 视觉与布局重设计 (Visual & Layout Redesign) +## 2. 信息架构与模块清单(Dashboard) -### 2.1 全局视觉主题 (Theme) -- **色调**:#050b14 (背景) + #00f0ff (科技蓝) + #00ff9d (生态绿) + #ffaa00 (警示橙)。 -- **质感**:玻璃拟态 (Glassmorphism) + 科技边框 (SVG Borders) + 动态扫描线。 +### 2.1 顶部(Header) +- 平台命名:`无人机智慧城市管控平台` +- 状态条:当前租户/范围、在线率、告警等级概览、当前时间(若页面本身不显示则放入大屏 Header) +- 快捷入口:进入 3D 监控、任务/设备(保持现有入口,不新增强绑定) -### 2.2 首页大屏布局 (Smart City Dashboard Layout) -采用 **左-中-右 (L-C-R)** 布局,侧重城市业务数据的可视化。 +### 2.2 左侧(城市运行体征) +- 城市网格治理(Radar):巡检覆盖、问题发现、处置效率、复核通过、重点区域关注 +- 环境感知(Line/Gauge/Liquid):PM2.5、噪声、热源异常趋势(允许派生/模拟,但要“稳定”) +- 交通与人流(Area/Heatmap):拥堵指数趋势、重点区域热度 TopN -#### **左侧 (25%) - 城市运行体征 (City Operations & Environment)** -*侧重:无人机采集的环境与基础设施数据* -- **顶部:城市网格化治理效能** - - 展示各行政网格的巡检覆盖率、问题发现率。 - - 可视化:雷达图 (Radar) 或 多色进度条。 -- **中部:空天地一体化环境监测** - - 展示无人机搭载传感器采集的空气质量 (PM2.5/PM10)、噪音热力分布。 - - 可视化:动态波浪曲线图 (Wave Line) 或 仪表盘。 -- **底部:交通拥堵与人流态势** - - 基于无人机视角的道路拥堵指数、重点区域人员密度。 - - 可视化:热力柱状图 或 渐变面积图。 +### 2.3 中间(全域态势 / 数字孪生入口) +- 核心态势 KPI(数字+发光强调):城市安全指数、今日识别事件、平均响应时长、闭环率 +- 数字孪生入口卡(保留进入 `/map3d`):升级为更“城市中枢”风格,增加图层提示文案(电子围栏/事件点位/航线) +- AI抓拍与隐患快照(Carousel/卡片流):违停、烟火、占道、河道漂浮物、工地未戴帽等(点击可弹出详情抽屉/弹窗) -#### **中间 (50%) - 全域数字孪生 (Digital Twin Center)** -*侧重:实时态势与AI成果展示* -- **主体:3D 城市数字沙盘** - - 加载城市 3D 模型/倾斜摄影模型。 - - 叠加数据层:AI 识别事件点位(火情、违停)、无人机实时轨迹、电子围栏。 -- **顶部悬浮:城市智理核心 KPI** - - 城市安全指数、今日AI识别事件总数、应急响应平均时间。 - - 样式:大型数字翻牌器 + 呼吸灯光效。 -- **底部悬浮:AI 缺陷/违规抓拍轮播 (Defect Carousel)** - - **(重点修改)** 替换原视频轮播。 - - 实时展示 AI 识别到的问题图片(如:路面破损、违章建筑、河道漂浮物)。 - - 交互:点击图片弹出详情与处理进度。 +### 2.4 右侧(事件处置与运行调度) +- 事件类型分布(Pie/RadialBar):按“城市治理事件”分类统计(与告警/任务派生映射) +- 实时事件流(List):分级(一般/重要/紧急)+ 来源(无人机/摄像头/机库)+ 处理状态(待确认/已派单/处理中/已闭环) +- 任务执行(保留原筛选逻辑):日/月/年切换 + 状态占比 + 近 7 日趋势 + 异常原因分析(原模块“换皮+换语义”) -#### **右侧 (25%) - 智能安防与事件处置 (Security & Response)** -*侧重:事件流转与处理* -- **顶部:AI 智能识别分类统计** - - 统计具体的违规类型:违停、乱堆物、未戴安全帽、明火烟雾等。 - - 可视化:3D 饼图 (3D Pie) 或 胶囊柱图。 -- **中部:实时预警事件流** - - 滚动展示最新的报警信息,按紧急程度(红/橙/黄)区分。 - - 样式:列表项带进入动画。 -- **底部:巡检任务/事件闭环率** - - 展示问题发现 -> 派单 -> 处置 -> 复核 的全流程数据。 - - 可视化:漏斗图 (Funnel) 或 双折线趋势图。 +## 3. 数据策略(不改功能前提下“做出新维度”) -### 2.3 设备操控页 (Control Page Refactor) -*参考目标:yingyan/src/pages/11.png* -- **布局核心**:**沉浸式第一视角 (FPV)**。 -- **底层**:实时视频流铺满全屏。 -- **顶层 UI (HUD 风格)**: - - **顶部栏**:透明底色,展示卫星数、信号强度、电池电压、飞行模式(定位/姿态)。 - - **左侧边栏**:任务航线列表、一键起飞/降落/返航按钮组。 - - **右侧边栏**:云台角度控制、变焦控制、AI 识别开关、拍照/录像。 - - **底部仪表盘**:飞行高度 (H)、距离 (D)、水平速度 (H.S)、垂直速度 (V.S) 的数字化仪表。 - - **左下角小窗**:地图/视频切换窗口。 +### 3.1 直接复用(已有) +- 设备:`DeviceStats.total/online/offline/fault/byType/onlineRate` +- 任务:`TaskStats.pending/running/completed/failed/successRate/todayNew` +- 趋势:`getTrendData(7)`(现为模拟,后续可接真实接口) +- 告警:`getMockAlerts()`(现为模拟) ---- +### 3.2 派生增强(推荐落地) +- 城市安全指数:由 `告警数量/等级` + `任务成功率` + `在线率` 计算得到(可解释、可复现)。 +- 事件类型分布:把告警/任务映射到“城市治理事件”类别(如:离线→关键设施告警、低电→保障能力风险)。 +- 网格治理/环境/交通:使用“可复现的稳定模拟”(基于 tenantId + 日期 hash),保证刷新时不跳变、截图时稳定。 -## 3. 技术实施步骤 (Implementation Steps) +## 4. 设计系统(落地规则) +- 色板:以 `--accent-blue/green/yellow/red` 为主,新增 1~2 个辅助色(紫/青)但必须有统一用途。 +- 卡片:统一玻璃拟态 + 细描边 + 角落高光;标题区高度统一;内容区保持最小可视高度。 +- 字体层级:KPI 数字使用等宽/半等宽(更有“仪表感”);正文保持 12~13px,标题 14~15px。 +- 动效:只用“微动效”(呼吸光、扫光、hover 抬升),避免大幅炫技影响可读性。 -### 第一阶段:布局重构与样式重置 (Layout & Style) -1. **Grid 布局落地**:在 `src/pages/dashboard/index.less` 中实现严格的 CSS Grid 布局,确保左中右三栏及内部卡片高度固定(例如 30%-35%-35% 分配),彻底消除挤压。 -2. **组件库封装**: - - `GlassCard`: 带科技边框的玻璃容器。 - - `NumberFlipper`: 数字翻牌器组件。 - - `AutoFitChart`: 基于 G2Plot 封装的自动适配图表组件。 +## 5. 实施里程碑(建议按顺序做) -### 第二阶段:数据可视化开发 (Data Visualization) -1. **左侧栏**:实现“网格治理雷达图”、“环境监测波形图”、“交通态势热力图”。 -2. **右侧栏**:实现“AI识别3D饼图”、“告警滚动列表”、“事件闭环漏斗图”。 -3. **中间栏**:实现“底部缺陷图片轮播组件”,支持自动滚动和点击预览。 +| 里程碑 | 目标 | 产出 | 涉及文件(示例) | 验收点 | +|---|---|---|---|---| +| M1 | 结构拆分 + 新布局骨架 | `Dashboard` 拆组件、三栏网格稳定 | `src/pages/dashboard/index.tsx`、`src/pages/dashboard/index.less`、`src/pages/dashboard/components/*` | 1920×1080 无挤压、无滚动条乱跳 | +| M2 | 智慧城市模块落地 | 城市 KPI/网格治理/环境交通/AI快照 | `src/services/dashboard.ts`(新增派生/稳定模拟)、`src/pages/dashboard/components/*` | 统计维度明显增加,空态不丑 | +| M3 | 视觉与交互精修 | 统一色板、排版、hover、空态、细节 | `src/global.less`(少量)、`src/pages/dashboard/*` | 一致性强、截图“像产品” | +| M4(可选) | 设备操控页 HUD 化 | 不改控制逻辑,只换布局与皮肤 |(按现有控制页位置确定)| 操控入口/功能不变、观感升级 | -### 第三阶段:地图与 3D 交互 (Map & 3D) -1. 优化地图图层样式,使其符合深色科技主题(隐藏过多无关POI,高亮路网和水系)。 -2. 添加模拟的 AI 识别点位和缺陷图片数据源。 - -### 第四阶段:设备操控页 (Device Control) -1. 重写 `src/pages/device/control`。 -2. 实现视频流背景 + 绝对定位的 HUD UI 组件。 -3. 复刻 `11.png` 中的关键交互元素(侧边工具栏、底部仪表数据)。 - ---- - -## 4. 数据模拟 (Mock Data) -由于涉及大量“智慧城市”新维度,需要重新生成 Mock 数据: -- **Mock_City_Grid**: 网格ID、覆盖率、得分。 -- **Mock_Environment**: 时间点、PM2.5、噪音dB。 -- **Mock_Traffic**: 道路名称、拥堵指数。 -- **Mock_AI_Events**: 事件类型、图片URL、置信度、坐标。 +## 6. 风险与回退 +- 风险:新增模块依赖“模拟/派生数据”可能被误认为真实数据;处理:在不显眼处提供“数据口径说明”(抽屉/帮助提示)。 +- 回退:保留原统计卡片/图表配置为独立组件,可随时切回(通过组件替换,不删代码)。 diff --git a/zlt-web/yingyan/dist.zip b/zlt-web/yingyan/dist.zip index 31458609..b2aa984c 100644 Binary files a/zlt-web/yingyan/dist.zip and b/zlt-web/yingyan/dist.zip differ diff --git a/zlt-web/yingyan/src/components/PlatformSwitcher/index.tsx b/zlt-web/yingyan/src/components/PlatformSwitcher/index.tsx index 8454a3e0..406bc2df 100644 --- a/zlt-web/yingyan/src/components/PlatformSwitcher/index.tsx +++ b/zlt-web/yingyan/src/components/PlatformSwitcher/index.tsx @@ -31,10 +31,10 @@ interface Platform { const platforms: Platform[] = [ { key: 'dashboard', - label: '通用监控大屏', + label: '无人机智慧城市', path: '/dashboard', icon: , - description: '设备监控与任务管理', + description: '城市态势与空地协同', theme: 'cyan', }, { diff --git a/zlt-web/yingyan/src/layouts/BlankLayout.less b/zlt-web/yingyan/src/layouts/BlankLayout.less index 5653ad81..58ddcdcc 100644 --- a/zlt-web/yingyan/src/layouts/BlankLayout.less +++ b/zlt-web/yingyan/src/layouts/BlankLayout.less @@ -1,6 +1,20 @@ .blank-layout { min-height: 100vh; background: var(--bg-primary); + /* Dashboard 高度自适应:同一份变量同时驱动 Header 与 Content,避免“减去固定像素”导致不同屏幕被遮挡 */ + --dashboard-header-h: 80px; +} + +@media (max-height: 900px) { + .blank-layout { + --dashboard-header-h: 64px; + } +} + +@media (max-height: 760px) { + .blank-layout { + --dashboard-header-h: 56px; + } } .blank-header { @@ -87,13 +101,36 @@ .blank-content { height: calc(100vh - 56px); + height: calc(100dvh - 56px); overflow: auto; background: var(--bg-primary); + min-height: 0; } .blank-content--dashboard { - height: calc(100vh - 80px); + height: calc(100vh - var(--dashboard-header-h)); + height: calc(100dvh - var(--dashboard-header-h)); overflow: hidden; + min-height: 0; + display: flex; + flex-direction: column; + + > * { + flex: 1; + min-height: 0; + } +} + +@media (max-height: 900px) { + .blank-content--dashboard { + overflow: hidden; + } +} + +@media (max-width: 1280px) { + .blank-content--dashboard { + overflow: hidden; + } } .blank-content--map3d { @@ -172,8 +209,8 @@ } .blank-header--dashboard { - height: 80px; - line-height: 80px; + height: var(--dashboard-header-h); + line-height: var(--dashboard-header-h); padding: 0 22px; background: linear-gradient(180deg, rgba(7, 10, 26, 0.92) 0%, rgba(7, 10, 26, 0.66) 100%) !important; border-bottom: none; diff --git a/zlt-web/yingyan/src/layouts/BlankLayout.tsx b/zlt-web/yingyan/src/layouts/BlankLayout.tsx index 4546fc5b..96768b51 100644 --- a/zlt-web/yingyan/src/layouts/BlankLayout.tsx +++ b/zlt-web/yingyan/src/layouts/BlankLayout.tsx @@ -101,7 +101,7 @@ const BlankLayout: React.FC<{ children?: React.ReactNode }> = ({ children }) =>
{isDashboard ? (
- 鹰眼管控平台 - 运营总览 + 无人机智慧城市管控平台
) : isMaritime ? ( diff --git a/zlt-web/yingyan/src/pages/dashboard/index.less b/zlt-web/yingyan/src/pages/dashboard/index.less index 151626ec..6c0dfc83 100644 --- a/zlt-web/yingyan/src/pages/dashboard/index.less +++ b/zlt-web/yingyan/src/pages/dashboard/index.less @@ -3,9 +3,12 @@ width: 100%; height: 100%; background: var(--bg-primary); - overflow: hidden; + overflow-x: hidden; + overflow-y: hidden; display: flex; flex-direction: column; + flex: 1; + min-height: 0; &::before { content: ''; @@ -34,28 +37,56 @@ /* Main Content Grid */ .dashboard-spin { + height: 100%; + display: block; + flex: 1; + min-height: 0; + + :global(.ant-spin-nested-loading) { height: 100%; - :global(.ant-spin-container) { - height: 100%; - display: flex; - flex-direction: column; - } + } + + :global(.ant-spin-container) { + height: 100%; + min-height: 0; + display: flex; + flex-direction: column; + } } +.dashboard-page::-webkit-scrollbar { + width: 6px; +} + +.dashboard-page::-webkit-scrollbar-thumb { + background: rgba(0, 212, 255, 0.18); + border-radius: 3px; +} + + .dashboard-content { flex: 1; padding: 16px 18px; - overflow: hidden; + overflow-x: hidden; + overflow-y: hidden; position: relative; z-index: 1; - height: 100%; + min-height: 0; + display: flex; + flex-direction: column; + box-sizing: border-box; } +/* 说明:通用大屏不做“整体缩放舞台”,避免在不同浏览器/缩放下出现渲染空白; + 屏幕适配沿用海事首页的思路:固定 100% 高度链路 + 内部网格自适应压缩。 */ + .dashboard-grid { display: grid; - grid-template-columns: 25% 50% 25%; - grid-template-rows: 100%; + grid-template-columns: minmax(0, 25%) minmax(0, 50%) minmax(0, 25%); + grid-template-rows: minmax(0, 1fr); gap: 14px; + flex: 1; + min-height: 0; height: 100%; width: 100%; } @@ -65,7 +96,131 @@ flex-direction: column; gap: 16px; height: 100%; - overflow: hidden; + min-height: 0; + overflow: visible; +} + +/* 宽度自适应:根据屏幕宽度逐级重排,避免笔记本/小屏左右被挤爆 */ +@media (max-width: 1680px) { + .dashboard-grid { + grid-template-columns: minmax(0, 28%) minmax(0, 44%) minmax(0, 28%); + } +} + +@media (max-width: 1440px) { + .dashboard-grid { + grid-template-columns: minmax(0, 30%) minmax(0, 40%) minmax(0, 30%); + gap: 10px; + } +} + +/* 说明:大屏场景保持三列结构,不做“改列/改行”的重排,避免造成视觉割裂与高度不可控。 */ + +.dashboard-page--smartcity { + /* 以视口为基准的密度系统:不写死屏幕尺寸,随窗口自动收缩/放大 */ + font-size: clamp(12px, 1.15vh, 14px); + --dash-pad-x: clamp(8px, 1.0vw, 14px); + --dash-pad-y: clamp(6px, 0.7vh, 10px); + --dash-gap: clamp(6px, 0.8vw, 10px); + --dash-head-h: clamp(28px, 3.1vh, 34px); + --dash-body-pad: clamp(6px, 0.8vh, 9px); + --dash-kpi-h: clamp(50px, 6.4vh, 76px); + --dash-kpi-num: clamp(16px, 2.4vh, 24px); + --dash-title: clamp(20px, 2.8vh, 24px); + --dash-sub: clamp(11px, 1.4vh, 12px); + + /* 关键:用变量控制“上大框/下内容”高度配比,随屏幕高度自动调整,不需要按某个分辨率写死 */ + --left-top-flex: 0.82; + --left-bottom-flex: 1.58; + --center-portal-flex: 1.18; + --center-bottom-flex: 1.62; + + .dashboard-content { + padding: var(--dash-pad-y) var(--dash-pad-x); + } + + .dashboard-grid { + gap: var(--dash-gap); + } + + .grid-col { + display: flex; + flex-direction: column; + gap: var(--dash-gap); + min-height: 0; + } + + .left-col, + .center-col, + .right-col { + min-height: 0; + } + + .panel-card, + .chart-wrapper { + min-height: 0; + } + + .panel-card :global(.ant-card-head) { + min-height: var(--dash-head-h); + } + + .panel-card :global(.ant-card-body) { + padding: var(--dash-body-pad); + } + + /* 按列控制高度配比:压缩上半区,给下半区留出空间,避免底部卡片“看不见” */ + .left-col .panel-card--left-tabs { flex: var(--left-top-flex); min-height: 0; } + .left-col .panel-card--events { flex: var(--left-bottom-flex); min-height: 0; } + + .center-col .kpi-strip { flex: 0 0 var(--dash-kpi-h); } + .center-col .twin-portal { flex: var(--center-portal-flex); min-height: 0; } + .center-col .panel-card--snap { flex: var(--center-bottom-flex); min-height: 0; } + + .right-col .panel-card--dispatch { flex: 1.1; } + .right-col .panel-card--right-tabs { flex: 1.9; } +} + + +/* 小屏/系统缩放下做“密度压缩”,避免底部裁切(不做整体缩放) */ +@media (max-height: 900px) { + .dashboard-page--smartcity { + overflow-y: hidden; + + /* 仅通过变量压缩密度,避免“写死高度”在不同电脑上失真 */ + --dash-pad-x: clamp(8px, 0.9vw, 12px); + --dash-pad-y: clamp(4px, 0.6vh, 8px); + --dash-gap: clamp(6px, 0.7vw, 9px); + --dash-head-h: clamp(28px, 3.0vh, 34px); + --dash-body-pad: clamp(6px, 0.8vh, 9px); + --dash-kpi-h: clamp(44px, 5.8vh, 66px); + --dash-kpi-num: clamp(14px, 2.0vh, 20px); + --dash-title: clamp(18px, 2.4vh, 22px); + + /* 小高度:进一步压缩“城市体征/孪生中枢”,确保底部卡片可见 */ + --left-top-flex: 0.68; + --left-bottom-flex: 1.72; + --center-portal-flex: 0.92; + --center-bottom-flex: 1.88; + } + + .panel-card :global(.ant-card-head) { + min-height: 36px; + } + + .panel-card :global(.ant-card-body) { + padding: 10px; + } +} + +@media (max-height: 760px) { + .dashboard-page--smartcity { + --dash-kpi-h: clamp(42px, 5.4vh, 60px); + --left-top-flex: 0.60; + --left-bottom-flex: 1.80; + --center-portal-flex: 0.80; + --center-bottom-flex: 2.00; + } } /* Panel Card Styles */ @@ -139,13 +294,13 @@ } .fill-bottom { - flex: 0.8; /* Slightly smaller than other sections if needed */ + flex: 1; } /* Alert List */ .alert-list-container { height: 100%; - overflow-y: auto; + overflow: hidden; &::-webkit-scrollbar { width: 4px; @@ -413,6 +568,894 @@ } } +/* Smart City New UI */ +.panel-title { + display: inline-flex; + align-items: center; + gap: 8px; + color: rgba(255, 255, 255, 0.92); + + :global(.anticon) { + color: rgba(0, 212, 255, 0.95); + } +} + +.panel-subtitle { + margin: -2px 0 8px; + font-size: var(--dash-sub, 12px); + color: rgba(255, 255, 255, 0.55); + letter-spacing: 0.2px; +} + +.panel-card--tight { + :global(.ant-card-body) { + padding-top: 10px; + } +} + +.kpi-strip { + display: grid; + grid-template-columns: repeat(5, 1fr); + gap: var(--dash-gap, 10px); + height: var(--dash-kpi-h, 96px); +} + +.kpi-tile { + position: relative; + border-radius: 10px; + padding: 12px 14px; + border: 1px solid rgba(0, 212, 255, 0.14); + background: + radial-gradient(circle at 20% 20%, rgba(0, 212, 255, 0.18), transparent 52%), + linear-gradient(180deg, rgba(19, 26, 61, 0.86), rgba(10, 14, 39, 0.74)); + box-shadow: 0 10px 26px rgba(0, 0, 0, 0.22); + overflow: hidden; + transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease; + + &:hover { + transform: translateY(-2px); + border-color: rgba(0, 212, 255, 0.26); + box-shadow: 0 14px 30px rgba(0, 0, 0, 0.28); + } + + &::after { + content: ''; + position: absolute; + top: -60%; + left: -40%; + width: 120%; + height: 120%; + background: radial-gradient(circle, rgba(255, 255, 255, 0.10), transparent 55%); + transform: rotate(18deg); + opacity: 0.45; + pointer-events: none; + } + + .kpi-tile__head { + display: flex; + align-items: center; + justify-content: space-between; + } + + .kpi-tile__label { + font-size: 12px; + color: rgba(255, 255, 255, 0.64); + letter-spacing: 0.4px; + } + + .kpi-tile__dot { + width: 7px; + height: 7px; + border-radius: 50%; + background: rgba(0, 212, 255, 0.95); + box-shadow: 0 0 10px rgba(0, 212, 255, 0.35); + } + + .kpi-tile__value { + margin-top: 6px; + display: inline-flex; + align-items: baseline; + gap: 6px; + } + + .kpi-tile__num { + font-size: var(--dash-kpi-num, 28px); + line-height: 1.1; + font-weight: 700; + color: rgba(255, 255, 255, 0.92); + font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace; + text-shadow: 0 0 18px rgba(0, 212, 255, 0.18); + } + + .kpi-tile__unit { + font-size: 12px; + color: rgba(255, 255, 255, 0.62); + } + + .kpi-tile__sub { + margin-top: 4px; + font-size: 12px; + color: rgba(255, 255, 255, 0.52); + } +} + +.kpi-tile--green .kpi-tile__dot { background: rgba(0, 255, 136, 0.92); box-shadow: 0 0 12px rgba(0, 255, 136, 0.32); } +.kpi-tile--yellow .kpi-tile__dot { background: rgba(255, 184, 0, 0.92); box-shadow: 0 0 12px rgba(255, 184, 0, 0.26); } +.kpi-tile--red .kpi-tile__dot { background: rgba(255, 71, 87, 0.92); box-shadow: 0 0 12px rgba(255, 71, 87, 0.26); } +.kpi-tile--purple .kpi-tile__dot { background: rgba(157, 78, 221, 0.92); box-shadow: 0 0 12px rgba(157, 78, 221, 0.26); } + +.twin-portal { + flex: 2; + position: relative; + border-radius: 14px; + border: 1px solid rgba(0, 212, 255, 0.28); + overflow: hidden; + background: + radial-gradient(circle at 30% 20%, rgba(0, 212, 255, 0.18), transparent 55%), + radial-gradient(circle at 80% 70%, rgba(0, 255, 136, 0.10), transparent 60%), + linear-gradient(180deg, rgba(6, 10, 24, 0.85), rgba(10, 14, 39, 0.62)); + box-shadow: 0 14px 34px rgba(0, 0, 0, 0.28); +} + +.twin-portal__grid { + position: absolute; + inset: 0; + background-image: + linear-gradient(rgba(0, 212, 255, 0.12) 1px, transparent 1px), + linear-gradient(90deg, rgba(0, 212, 255, 0.12) 1px, transparent 1px); + background-size: 80px 80px; + opacity: 0.22; + transform: perspective(520px) rotateX(18deg) scale(1.2); + animation: gridMove 20s linear infinite; +} + +.twin-portal__sweep { + position: absolute; + inset: 0; + pointer-events: none; + opacity: 0.9; + + &::before { + content: ''; + position: absolute; + left: 50%; + top: 50%; + width: 520px; + height: 520px; + transform: translate(-50%, -50%); + border-radius: 50%; + background: + repeating-radial-gradient(circle, rgba(0, 212, 255, 0.22) 0 1px, transparent 1px 28px), + radial-gradient(circle, rgba(0, 212, 255, 0.16), transparent 62%), + radial-gradient(circle, rgba(0, 255, 136, 0.10), transparent 70%); + filter: drop-shadow(0 0 18px rgba(0, 212, 255, 0.20)); + opacity: 0.6; + } + + &::after { + content: ''; + position: absolute; + left: 50%; + top: 50%; + width: 520px; + height: 520px; + transform: translate(-50%, -50%); + border-radius: 50%; + background: conic-gradient( + from 0deg, + rgba(0, 212, 255, 0.00) 0deg, + rgba(0, 212, 255, 0.30) 18deg, + rgba(0, 212, 255, 0.06) 45deg, + rgba(0, 212, 255, 0.00) 75deg, + rgba(0, 212, 255, 0.00) 360deg + ); + mix-blend-mode: screen; + animation: radarRotate 2.8s linear infinite; + opacity: 0.95; + } +} + +.twin-portal__overlay { + position: relative; + z-index: 2; + height: 100%; + padding: var(--dash-body-pad, 10px); + display: flex; + flex-direction: column; + justify-content: space-between; + min-height: 0; +} + +.twin-portal__top { + display: flex; + align-items: flex-start; + justify-content: space-between; + gap: 10px; +} + +.twin-portal__tags :global(.ant-tag) { + background: rgba(255, 255, 255, 0.06) !important; + border: 1px solid rgba(255, 255, 255, 0.12) !important; + color: rgba(255, 255, 255, 0.78) !important; +} + +.twin-portal__chips { + display: flex; + gap: 8px; + flex-wrap: wrap; + justify-content: flex-end; +} + +.chip { + display: inline-flex; + align-items: center; + gap: 6px; + padding: 4px 10px; + border-radius: 999px; + border: 1px solid rgba(0, 212, 255, 0.16); + background: rgba(0, 212, 255, 0.05); + color: rgba(255, 255, 255, 0.75); + font-size: 12px; + + :global(.anticon) { + color: rgba(0, 212, 255, 0.95); + } +} + +.twin-portal__center { + text-align: center; + margin-top: 4px; +} + +.twin-portal__title { + font-size: var(--dash-title, 24px); + font-weight: 700; + letter-spacing: 2px; + color: rgba(255, 255, 255, 0.94); + text-shadow: 0 0 14px rgba(0, 212, 255, 0.20); +} + +.twin-portal__desc { + margin-top: 6px; + font-size: clamp(12px, 1.5vh, 13px); + color: rgba(255, 255, 255, 0.65); + letter-spacing: 0.6px; +} + +.twin-portal__btn { + margin-top: 10px; + height: clamp(32px, 3.8vh, 38px); + padding: 0 clamp(16px, 2.0vw, 30px); + font-size: clamp(12px, 1.6vh, 14px); + background: linear-gradient(90deg, #00d4ff, #007aff) !important; + border: none !important; + box-shadow: 0 10px 24px rgba(0, 212, 255, 0.25); + transition: transform 0.25s ease, box-shadow 0.25s ease; + + &:hover { + transform: translateY(-1px); + box-shadow: 0 14px 32px rgba(0, 212, 255, 0.34); + } +} + +.twin-portal__bottom { + display: grid; + grid-template-columns: repeat(4, 1fr); + gap: var(--dash-gap, 10px); + margin-top: 6px; +} + +.mini-metric { + padding: 6px 8px; + border-radius: 10px; + background: rgba(255, 255, 255, 0.04); + border: 1px solid rgba(255, 255, 255, 0.08); + display: flex; + flex-direction: column; + gap: 4px; +} + +.mini-metric__label { + font-size: 12px; + color: rgba(255, 255, 255, 0.55); +} + +.mini-metric__value { + font-size: clamp(14px, 2.0vh, 18px); + font-weight: 700; + color: rgba(255, 255, 255, 0.90); + font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace; +} + +.mini-metric__value--warn { + color: rgba(255, 184, 0, 0.92); +} + +.panel-card--snap { + :global(.ant-card-body) { + padding: 10px 12px 12px; + } +} + +.snapshot-carousel { + height: 100%; + flex: 1; + min-height: 0; + + :global(.slick-dots) { + bottom: -2px; + } + + :global(.slick-dots li button) { + background: rgba(255, 255, 255, 0.25) !important; + } + + :global(.slick-dots li.slick-active button) { + background: rgba(0, 212, 255, 0.85) !important; + } +} + +.snapshot-grid { + display: grid; + grid-template-columns: repeat(2, 1fr); + gap: var(--dash-gap, 12px); +} + +.snapshot-card { + border-radius: 12px; + padding: 12px 12px 10px; + border: 1px solid rgba(0, 212, 255, 0.16); + background: + radial-gradient(circle at 20% 10%, rgba(0, 212, 255, 0.16), transparent 55%), + linear-gradient(180deg, rgba(19, 26, 61, 0.78), rgba(10, 14, 39, 0.62)); + box-shadow: 0 10px 26px rgba(0, 0, 0, 0.22); + transition: transform 0.18s ease, border-color 0.18s ease; + + &:hover { + transform: translateY(-2px); + border-color: rgba(0, 212, 255, 0.28); + } +} + +.snapshot-card__head { + display: flex; + justify-content: space-between; + align-items: center; + margin-bottom: 8px; +} + +.snapshot-card__tag { + font-size: 12px; + color: rgba(255, 255, 255, 0.72); + padding: 2px 8px; + border-radius: 999px; + background: rgba(0, 212, 255, 0.10); + border: 1px solid rgba(0, 212, 255, 0.18); +} + +.snapshot-card__time { + font-size: 12px; + color: rgba(255, 255, 255, 0.55); + font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace; +} + +.snapshot-card__title { + font-size: clamp(13px, 1.8vh, 16px); + font-weight: 700; + color: rgba(255, 255, 255, 0.92); + margin-bottom: 6px; +} + +.snapshot-card__meta { + display: flex; + justify-content: space-between; + gap: 10px; + font-size: 12px; + color: rgba(255, 255, 255, 0.62); +} + +.snapshot-card--critical { border-color: rgba(255, 71, 87, 0.26); } +.snapshot-card--warning { border-color: rgba(255, 184, 0, 0.24); } +.snapshot-card--normal { border-color: rgba(0, 212, 255, 0.16); } + +/* 机队态势 */ +.fleet-pane { + gap: var(--dash-gap, 12px); +} + +.fleet-metrics { + display: grid; + grid-template-columns: repeat(4, 1fr); + gap: var(--dash-gap, 12px); +} + +.fleet-metric { + padding: 10px 12px; + border-radius: 12px; + border: 1px solid rgba(255, 255, 255, 0.10); + background: + radial-gradient(circle at 25% 20%, rgba(0, 212, 255, 0.14), transparent 55%), + linear-gradient(180deg, rgba(19, 26, 61, 0.74), rgba(10, 14, 39, 0.62)); +} + +.fleet-metric__label { + font-size: 12px; + color: rgba(255, 255, 255, 0.58); +} + +.fleet-metric__value { + margin-top: 6px; + font-size: 22px; + font-weight: 800; + color: rgba(255, 255, 255, 0.92); + font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace; +} + +.fleet-metric__sub { + margin-top: 4px; + font-size: 12px; + color: rgba(255, 255, 255, 0.52); +} + +.fleet-split { + flex: 1; + min-height: 0; + display: grid; + grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr); + gap: var(--dash-gap, 12px); +} + +.fleet-split__left, +.fleet-split__right { + min-height: 0; + border-radius: 12px; + border: 1px solid rgba(255, 255, 255, 0.10); + background: rgba(255, 255, 255, 0.03); + padding: 10px 12px; + display: flex; + flex-direction: column; +} + +.region-list { + flex: 1; + min-height: 0; + overflow: hidden; + padding-right: 2px; + + &::-webkit-scrollbar { + width: 4px; + } + + &::-webkit-scrollbar-thumb { + background: rgba(0, 212, 255, 0.18); + border-radius: 2px; + } +} + +.region-item { + padding: 8px 10px 6px; + border-radius: 10px; + background: rgba(255, 255, 255, 0.02); + border: 1px solid rgba(255, 255, 255, 0.06); + margin-bottom: 8px; +} + +.region-item__head { + display: flex; + justify-content: space-between; + align-items: center; + gap: 10px; + margin-bottom: 6px; +} + +.region-item__name { + flex: 1; + min-width: 0; + font-size: 13px; + font-weight: 600; + color: rgba(255, 255, 255, 0.88); + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.region-item__meta { + display: inline-flex; + align-items: center; + gap: 8px; + flex: 0 0 auto; +} + +.region-item__tag { + margin-inline-end: 0 !important; + border: 1px solid rgba(255, 255, 255, 0.12) !important; + color: rgba(255, 255, 255, 0.86) !important; +} + +.region-item__time { + font-size: 12px; + color: rgba(255, 255, 255, 0.55); + font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace; +} + +.region-item__bar { + display: grid; + grid-template-columns: 1fr auto auto; + align-items: center; + gap: 8px; + + :global(.ant-progress) { + margin: 0; + } +} + +.region-item__pct { + width: 48px; + text-align: right; + font-size: 12px; + color: rgba(255, 255, 255, 0.72); + font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace; +} + +.region-item__pending { + font-size: 12px; + color: rgba(255, 255, 255, 0.52); + white-space: nowrap; +} + +/* 空域合规 */ +.airspace-pane { + gap: var(--dash-gap, 12px); +} + +.airspace-top { + display: grid; + grid-template-columns: 1.1fr 1fr; + gap: var(--dash-gap, 12px); + min-height: 0; +} + +.airspace-score { + display: flex; + align-items: center; + gap: 12px; + padding: 10px 12px; + border-radius: 12px; + border: 1px solid rgba(255, 255, 255, 0.10); + background: + radial-gradient(circle at 18% 24%, rgba(0, 255, 136, 0.10), transparent 55%), + linear-gradient(180deg, rgba(19, 26, 61, 0.72), rgba(10, 14, 39, 0.62)); + + :global(.ant-progress) { + flex: 0 0 auto; + } +} + +.airspace-score__meta { + display: flex; + flex-direction: column; + gap: 4px; + min-width: 0; +} + +.airspace-score__title { + font-size: 14px; + font-weight: 700; + color: rgba(255, 255, 255, 0.9); +} + +.airspace-score__sub { + font-size: 12px; + color: rgba(255, 255, 255, 0.55); +} + +.airspace-metrics { + display: grid; + grid-template-columns: repeat(2, 1fr); + gap: var(--dash-gap, 12px); +} + +.airspace-metric { + padding: 10px 12px; + border-radius: 12px; + border: 1px solid rgba(255, 255, 255, 0.10); + background: rgba(255, 255, 255, 0.03); +} + +.airspace-metric__val { + font-size: 22px; + font-weight: 800; + color: rgba(255, 255, 255, 0.92); + font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace; +} + +.airspace-metric__lbl { + margin-top: 4px; + font-size: 12px; + color: rgba(255, 255, 255, 0.55); +} + +.airspace-notes { + flex: 1; + min-height: 0; + padding: 10px 12px; + border-radius: 12px; + border: 1px solid rgba(255, 255, 255, 0.10); + background: rgba(255, 255, 255, 0.03); + display: flex; + flex-direction: column; + gap: 10px; +} + +.airspace-note { + display: flex; + gap: 10px; + align-items: flex-start; +} + +.airspace-note__dot { + width: 8px; + height: 8px; + border-radius: 50%; + margin-top: 6px; + background: rgba(0, 212, 255, 0.9); + box-shadow: 0 0 10px rgba(0, 212, 255, 0.25); + flex: 0 0 auto; +} + +.airspace-note__dot--warn { + background: rgba(255, 184, 0, 0.92); + box-shadow: 0 0 10px rgba(255, 184, 0, 0.25); +} + +.airspace-note__dot--ok { + background: rgba(0, 255, 136, 0.92); + box-shadow: 0 0 10px rgba(0, 255, 136, 0.25); +} + +.airspace-note__text { + font-size: 12px; + color: rgba(255, 255, 255, 0.62); + line-height: 1.35; +} + +@media (max-width: 1440px) { + .fleet-metrics { + grid-template-columns: repeat(2, 1fr); + } + + .fleet-split { + grid-template-columns: 1fr; + } + + .airspace-top { + grid-template-columns: 1fr; + } +} + +.event-list-container { + flex: 1; + min-height: 0; + overflow: hidden; + + &::-webkit-scrollbar { + width: 4px; + } + &::-webkit-scrollbar-thumb { + background: rgba(0, 212, 255, 0.22); + border-radius: 2px; + } +} + +.event-item { + padding: 10px 0 !important; + border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important; +} + +.event-item__row { + display: flex; + gap: 10px; + align-items: flex-start; + width: 100%; +} + +.event-item__badge { + width: 8px; + height: 8px; + border-radius: 50%; + margin-top: 6px; + box-shadow: 0 0 12px rgba(0, 0, 0, 0.22); + flex: 0 0 auto; +} + +.event-item__content { + flex: 1; + min-width: 0; +} + +.event-item__head { + display: flex; + justify-content: space-between; + gap: 10px; + margin-bottom: 4px; +} + +.event-item__title { + font-size: 13px; + font-weight: 600; + color: rgba(255, 255, 255, 0.92); + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.event-item__time { + font-size: 12px; + color: rgba(255, 255, 255, 0.55); + font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace; +} + +.event-item__meta { + display: flex; + flex-wrap: wrap; + gap: 6px; + align-items: center; + margin-bottom: 4px; +} + +.event-item__loc { + font-size: 12px; + color: rgba(255, 255, 255, 0.65); +} + +.event-item__tag { + margin-inline-end: 0 !important; + border: 1px solid rgba(255, 255, 255, 0.12) !important; + color: rgba(255, 255, 255, 0.82) !important; +} + +.event-item__desc { + font-size: 12px; + color: rgba(255, 255, 255, 0.56); + line-height: 1.3; +} + +.panel-card--dispatch { + :global(.ant-card-body) { + padding-top: 12px; + } +} + +.dispatch-grid { + display: grid; + grid-template-columns: 1fr 1fr; + gap: 10px; +} + +.dispatch-stat { + padding: 10px 12px; + border-radius: 10px; + background: rgba(255, 255, 255, 0.04); + border: 1px solid rgba(255, 255, 255, 0.08); +} + +.dispatch-stat__val { + font-size: 22px; + font-weight: 800; + color: rgba(255, 255, 255, 0.92); + font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace; +} + +.dispatch-stat__lbl { + margin-top: 4px; + font-size: 12px; + color: rgba(255, 255, 255, 0.55); +} + +.dispatch-stat__val--pending { color: rgba(255, 184, 0, 0.92); } +.dispatch-stat__val--running { color: rgba(0, 212, 255, 0.92); } +.dispatch-stat__val--done { color: rgba(0, 255, 136, 0.92); } +.dispatch-stat__val--fail { color: rgba(255, 71, 87, 0.92); } + +.dispatch-highlight { + grid-column: 1 / -1; + padding: 12px 14px; + border-radius: 12px; + border: 1px solid rgba(0, 255, 136, 0.18); + background: + radial-gradient(circle at 20% 20%, rgba(0, 255, 136, 0.12), transparent 55%), + linear-gradient(180deg, rgba(19, 26, 61, 0.78), rgba(10, 14, 39, 0.62)); + display: flex; + align-items: baseline; + justify-content: space-between; +} + +.dispatch-highlight__val { + font-size: clamp(26px, 3.6vh, 34px); + font-weight: 900; + color: rgba(0, 255, 136, 0.92); + letter-spacing: 1px; +} + +.dispatch-highlight__lbl { + font-size: 12px; + color: rgba(255, 255, 255, 0.60); +} + +.dispatch-trend { + margin-top: 12px; + min-height: 0; +} + +.dispatch-trend__title { + margin-bottom: 6px; + font-size: 12px; + color: rgba(255, 255, 255, 0.56); +} + +/* 旧的洞察卡片样式已合并到右侧 Tabs 卡片中(保留空定义避免历史引用报错) */ +.panel-card--insights {} + +/* Tabs 必须占满卡片剩余高度(否则看起来“框很大内容很小”,小屏还容易溢出被裁切) */ +.dash-tabs { + height: 100%; + min-height: 0; + display: flex; + flex-direction: column; + + :global(.ant-tabs-nav) { + margin: 0 0 8px; + } + + :global(.ant-tabs-nav::before) { + border-bottom-color: rgba(0, 212, 255, 0.12); + } + + :global(.ant-tabs-tab) { + color: rgba(255, 255, 255, 0.62); + } + + :global(.ant-tabs-tab.ant-tabs-tab-active .ant-tabs-tab-btn) { + color: rgba(255, 255, 255, 0.92); + } + + :global(.ant-tabs-ink-bar) { + background: rgba(0, 212, 255, 0.9); + } + + :global(.ant-tabs-content-holder) { + flex: 1; + min-height: 0; + } + + :global(.ant-tabs-content) { + height: 100%; + } + + :global(.ant-tabs-tabpane) { + height: 100%; + min-height: 0; + padding: 0; + } +} + +.tab-pane { + height: 100%; + min-height: 0; + display: flex; + flex-direction: column; +} + +.empty-holder { + height: 100%; + flex: 1; + min-height: 0; + display: flex; + align-items: center; + justify-content: center; + color: rgba(255, 255, 255, 0.55); +} + /* Animation Keyframes */ @keyframes gridMove { 0% { background-position: 0 0; } @@ -424,35 +1467,84 @@ 100% { transform: rotate(360deg); } } -/* Media Queries for Responsive adjustments on smaller screens (if needed) */ -@media (max-width: 1400px) { - .dashboard-grid { - grid-template-columns: 28% 44% 28%; +/* 响应式布局已在上方按 1680/1440/1280/960 统一收敛,避免重复规则互相覆盖。 */ + +/* 无滚动模式:通过“内容裁剪 + 密度压缩”保证一屏显示 */ +.dashboard-page--compact-1 { + .panel-subtitle { + margin-bottom: 6px; + } + + .snapshot-card { + padding: 10px 10px 8px; + } + + .fleet-metric { + padding: 8px 10px; + } + + .event-item__desc { + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; + overflow: hidden; } } -@media (max-width: 1200px) { - .dashboard-page { - height: auto; - overflow-y: auto; - } - - .dashboard-content { - height: auto; - overflow: visible; +.dashboard-page--compact-2 { + .panel-subtitle { + margin-bottom: 4px; } - .dashboard-grid { - grid-template-columns: 1fr; - grid-template-rows: auto; + .kpi-tile { + padding: 8px 10px; } - - .grid-col { - height: auto; - min-height: 400px; + + .snapshot-grid { + gap: 8px; } - - .map-portal-wrapper { - min-height: 300px; + + .snapshot-card { + padding: 8px 10px 6px; + + .snapshot-card__head { + margin-bottom: 6px; + } + + .snapshot-card__title { + margin-bottom: 4px; + } + } + + .fleet-metrics { + gap: 8px; + } + + .fleet-metric { + padding: 6px 8px; + + .fleet-metric__sub { + margin-top: 2px; + } + } + + .region-item { + padding: 6px 8px 4px; + margin-bottom: 6px; + } + + .event-item { + padding: 6px 0 !important; + } + + .event-item__desc { + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 1; + overflow: hidden; + } + + .twin-portal__bottom { + grid-template-columns: repeat(2, 1fr); } } diff --git a/zlt-web/yingyan/src/pages/dashboard/index.tsx b/zlt-web/yingyan/src/pages/dashboard/index.tsx index 445514ff..363dfc3c 100644 --- a/zlt-web/yingyan/src/pages/dashboard/index.tsx +++ b/zlt-web/yingyan/src/pages/dashboard/index.tsx @@ -1,26 +1,19 @@ -import React, { useState, useEffect, useCallback, useMemo } from 'react'; -import { Card, Button, List, Tag, Spin, message, DatePicker, Segmented, Space } from 'antd'; +import React, { useCallback, useEffect, useMemo, useState } from 'react'; +import { Button, Card, Carousel, DatePicker, Empty, List, Progress, Segmented, Space, Spin, Tabs, Tag, message } from 'antd'; import { - DesktopOutlined, - WarningOutlined, - RocketOutlined, + AimOutlined, + AlertOutlined, EnvironmentOutlined, - PieChartOutlined, - FieldTimeOutlined + RadarChartOutlined, + RocketOutlined, + SafetyCertificateOutlined, } from '@ant-design/icons'; -import { Line, Pie, Column, Area, Rose } from '@ant-design/plots'; +import { Column, Funnel, Heatmap, Line, Pie, Radar, RadialBar, Rose } from '@ant-design/plots'; import { history } from 'umi'; import dayjs from 'dayjs'; -import { - getDeviceStats, - getTaskStats, - getTrendData, - getMockAlerts, - DeviceStats, - TaskStats, - TrendItem, - AlertItem, -} from '@/services/dashboard'; +import type { AlertItem, DeviceStats, TaskStats, TrendItem } from '@/services/dashboard'; +import { getDeviceStats, getMockAlerts, getTaskStats, getTrendData } from '@/services/dashboard'; +import { buildSmartCityModels } from './smartCity'; import './index.less'; const Dashboard: React.FC = () => { @@ -36,42 +29,58 @@ const Dashboard: React.FC = () => { const [taskStatDate, setTaskStatDate] = useState(dayjs()); const [tenantId, setTenantId] = useState(); const [includeChildren, setIncludeChildren] = useState(true); + const [compactLevel, setCompactLevel] = useState<0 | 1 | 2>(0); useEffect(() => { - // 模拟年度数据 - const mockAnnual: any[] = []; - for (let i = 1; i <= 12; i++) { - mockAnnual.push({ - month: `${i}月`, - value: Math.floor(Math.random() * 500) + 100, - type: '任务总数', - }); - mockAnnual.push({ - month: `${i}月`, - value: Math.floor(Math.random() * 450) + 80, - type: '成功任务', - }); - } - setAnnualData(mockAnnual); - - // 模拟失败原因数据 - setFailureAnalysisData([ - { type: '信号丢失', value: 27 }, - { type: '电池不足', value: 25 }, - { type: '天气原因', value: 18 }, - { type: '机械故障', value: 15 }, - { type: '人为取消', value: 10 }, - { type: '其他', value: 5 }, - ]); - - // 任务类型分布数据 - setTaskTypeData([ - { type: '航线任务', value: 156 }, - { type: '一键起飞', value: 89 }, - { type: '手动控制', value: 45 }, - ]); + const calc = () => { + const height = window?.innerHeight || 0; + const next: 0 | 1 | 2 = height <= 760 ? 2 : height <= 900 ? 1 : 0; + setCompactLevel(next); + }; + calc(); + window.addEventListener('resize', calc); + return () => window.removeEventListener('resize', calc); }, []); + useEffect(() => { + const yearKey = dayjs().format('YYYY'); + const base = `${tenantId || 'default'}:${yearKey}`; + const seed = base.split('').reduce((acc, ch) => acc + ch.charCodeAt(0), 0) || 1; + const rng = (() => { + let s = seed >>> 0; + return () => { + s = (Math.imul(s, 1664525) + 1013904223) >>> 0; + return s / 4294967296; + }; + })(); + + const nextAnnual: any[] = []; + for (let i = 1; i <= 12; i++) { + const month = `${i}月`; + const total = Math.round(220 + rng() * 260 + (i % 3 === 0 ? 40 : 0)); + const closed = Math.round(total * (0.78 + rng() * 0.16)); + nextAnnual.push({ month, value: total, type: '巡检总量' }); + nextAnnual.push({ month, value: closed, type: '有效闭环' }); + } + setAnnualData(nextAnnual); + + setFailureAnalysisData([ + { type: '气象影响', value: 18 + Math.round(rng() * 8) }, + { type: '链路波动', value: 14 + Math.round(rng() * 10) }, + { type: '电量策略', value: 10 + Math.round(rng() * 10) }, + { type: '作业冲突', value: 8 + Math.round(rng() * 8) }, + { type: '识别误报', value: 6 + Math.round(rng() * 7) }, + { type: '其他', value: 4 + Math.round(rng() * 6) }, + ]); + + setTaskTypeData([ + { type: '网格巡检', value: 120 + Math.round(rng() * 80) }, + { type: '应急处置', value: 55 + Math.round(rng() * 45) }, + { type: '设施巡查', value: 70 + Math.round(rng() * 60) }, + { type: '夜间巡查', value: 40 + Math.round(rng() * 55) }, + ]); + }, [tenantId]); + useEffect(() => { const handler = (e: any) => { const nextTenantId = e?.detail?.tenantId as string | undefined; @@ -114,12 +123,7 @@ const Dashboard: React.FC = () => { }, [includeChildren, taskStatDate, taskStatType, tenantId]); useEffect(() => { - if (!tenantId) return; fetchData(); - }, [fetchData]); - - // 定时刷新和时间更新 - useEffect(() => { const dataTimer = setInterval(fetchData, 30000); return () => { clearInterval(dataTimer); @@ -141,219 +145,401 @@ const Dashboard: React.FC = () => { ]); }, [taskTrend]); - // 近7日任务完成数趋势数据 - const taskCompleteTrendData = useMemo(() => { - return taskTrend.map((t) => ({ - date: t.date, - value: t.completed || 0, - })); - }, [taskTrend]); - - const taskTrendConfig: any = { - data: taskTrendSeriesData, - xField: 'date', - yField: 'value', - seriesField: 'type', - smooth: true, - color: ['#00d4ff', '#00ff88', '#ffb800'], - areaStyle: { - fill: 'l(270) 0:#ffffff 0.5:#7ec2f3 1:#1890ff', - fillOpacity: 0.1, - }, - xAxis: { label: { style: { fill: 'rgba(255,255,255,0.65)' } }, grid: null }, - yAxis: { label: { style: { fill: 'rgba(255,255,255,0.65)' } }, grid: { line: { style: { stroke: 'rgba(255,255,255,0.1)' } } } }, - tooltip: { showMarkers: true }, - height: 180, - }; - - const pieConfig: any = { - data: deviceStats?.byType || [], - angleField: 'count', - colorField: 'name', - radius: 0.7, - innerRadius: 0.5, - label: { - text: (datum: any) => { - const name = datum?.name || ''; - const count = datum?.count ?? 0; - const data = (deviceStats?.byType || []) as { name: string; count: number }[]; - const total = data.reduce((sum, d) => sum + (d.count || 0), 0); - const percent = total > 0 ? ((count / total) * 100).toFixed(1) : 0; - return `${name} ${percent}%`; - }, - style: { fill: 'rgba(255,255,255,0.65)' }, - }, - legend: { position: 'bottom', itemValue: { style: { fill: 'rgba(255,255,255,0.65)' } }, itemName: { style: { fill: 'rgba(255,255,255,0.65)' } } }, - height: 200, - }; - - const columnConfig: any = { - data: taskTypeData, - xField: 'type', - yField: 'value', - seriesField: 'type', - color: ({ type }: any) => { - if(type === '航线任务') return '#00d4ff'; - if(type === '一键起飞') return '#00ff88'; - return '#ffb800'; - }, - label: { - text: (datum: any) => datum?.value?.toString() || '0', - style: { fill: '#fff' }, - }, - xAxis: { label: { style: { fill: 'rgba(255,255,255,0.65)' } } }, - yAxis: { label: { style: { fill: 'rgba(255,255,255,0.65)' } }, grid: { line: { style: { stroke: 'rgba(255,255,255,0.1)' } } } }, - legend: false, - height: 180, - }; - - const taskCompleteTrendConfig: any = { - data: taskCompleteTrendData, - xField: 'date', - yField: 'value', - smooth: true, - color: '#00ff88', - areaStyle: { fillOpacity: 0.15 }, - xAxis: { label: { style: { fill: 'rgba(255,255,255,0.65)' } }, grid: null }, - yAxis: { - label: { style: { fill: 'rgba(255,255,255,0.65)' } }, - grid: { line: { style: { stroke: 'rgba(255,255,255,0.08)' } } }, - }, - tooltip: { showMarkers: true }, - height: 160, - }; - - const areaConfig: any = { - data: annualData, - xField: 'month', - yField: 'value', - seriesField: 'type', - color: ['#00d4ff', '#00ff88'], - areaStyle: { fillOpacity: 0.3 }, - xAxis: { label: { style: { fill: 'rgba(255,255,255,0.65)' } } }, - yAxis: { label: { style: { fill: 'rgba(255,255,255,0.65)' } }, grid: { line: { style: { stroke: 'rgba(255,255,255,0.1)' } } } }, - legend: { position: 'top-right', itemName: { style: { fill: '#fff' } } }, - smooth: true, - height: 220, - }; - - const roseConfig: any = { - data: failureAnalysisData, - xField: 'type', - yField: 'value', - seriesField: 'type', - radius: 0.9, - label: { - text: (datum: any) => datum?.type || '', - style: { fill: '#fff' }, - }, - legend: { position: 'bottom', itemName: { style: { fill: 'rgba(255,255,255,0.65)' } } }, - height: 200, - }; - - const taskStatusPieConfig: any = { - data: [ - { name: '待执行', value: taskStats?.pending || 0 }, - { name: '执行中', value: taskStats?.running || 0 }, - { name: '已完成', value: taskStats?.completed || 0 }, - { name: '已失败', value: taskStats?.failed || 0 }, - ], - angleField: 'value', - colorField: 'name', - radius: 0.85, - innerRadius: 0.55, - label: { - text: (datum: any) => { - const name = datum?.name || ''; - const value = datum?.value ?? 0; - const total = (taskStats?.pending || 0) + (taskStats?.running || 0) + (taskStats?.completed || 0) + (taskStats?.failed || 0); - const percent = total > 0 ? ((value / total) * 100).toFixed(1) : 0; - return `${name} ${percent}%`; - }, - style: { fill: 'rgba(255,255,255,0.65)' }, - }, - legend: { position: 'bottom', itemValue: { style: { fill: 'rgba(255,255,255,0.65)' } }, itemName: { style: { fill: 'rgba(255,255,255,0.65)' } } }, - height: 190, - }; - - const getAlertColor = (level: string) => { - switch (level) { - case 'critical': return 'red'; - case 'error': return 'orange'; - case 'warning': return 'gold'; - default: return 'blue'; - } - }; - const taskPeriodText = useMemo(() => { if (taskStatType === 'day') return '当日'; if (taskStatType === 'month') return '当月'; return '当年'; }, [taskStatType]); - const taskNewLabel = useMemo(() => { - if (taskStatType === 'day') return '当日任务'; - if (taskStatType === 'month') return '当月任务'; - return '当年任务'; - }, [taskStatType]); - const datePickerFormat = useMemo(() => { if (taskStatType === 'day') return 'YYYY-MM-DD'; if (taskStatType === 'month') return 'YYYY-MM'; return 'YYYY'; }, [taskStatType]); + const smartModels = useMemo(() => { + return buildSmartCityModels({ tenantId, deviceStats, taskStats, taskTrend, alerts }); + }, [alerts, deviceStats, taskStats, taskTrend, tenantId]); + + const maxEvents = useMemo(() => { + if (compactLevel === 2) return 5; + if (compactLevel === 1) return 7; + return 9; + }, [compactLevel]); + + const visibleEvents = useMemo(() => { + return (smartModels.eventList || []).slice(0, maxEvents); + }, [maxEvents, smartModels.eventList]); + + const regionCoverageMax = useMemo(() => { + if (compactLevel === 2) return 2; + if (compactLevel === 1) return 4; + return 6; + }, [compactLevel]); + + const visibleRegionCoverage = useMemo(() => { + return (smartModels.regionCoverage || []).slice(0, regionCoverageMax); + }, [regionCoverageMax, smartModels.regionCoverage]); + + const snapshotsPerPage = useMemo(() => { + if (compactLevel === 2) return 2; + if (compactLevel === 1) return 3; + return 4; + }, [compactLevel]); + + const airspaceGaugeSize = useMemo(() => { + if (compactLevel === 2) return 118; + if (compactLevel === 1) return 140; + return 160; + }, [compactLevel]); + + const radarConfig: any = useMemo(() => { + return { + data: smartModels.gridRadarData, + xField: 'item', + yField: 'score', + seriesField: 'type', + area: { style: { fillOpacity: 0.12 } }, + point: { size: 2, style: { fill: '#00d4ff' } }, + color: ['#00d4ff'], + xAxis: { + grid: { line: { style: { stroke: 'rgba(255,255,255,0.08)' } } }, + label: { style: { fill: 'rgba(255,255,255,0.72)' } }, + }, + yAxis: { grid: { line: { style: { stroke: 'rgba(255,255,255,0.08)' } } }, label: false }, + legend: false, + autoFit: true, + }; + }, [smartModels.gridRadarData]); + + const envLineConfig: any = useMemo(() => { + return { + data: smartModels.envTrendData, + xField: 'time', + yField: 'value', + seriesField: 'type', + smooth: true, + color: ['#00ff88', '#00d4ff'], + xAxis: { label: { style: { fill: 'rgba(255,255,255,0.62)' } }, grid: null }, + yAxis: { + label: { style: { fill: 'rgba(255,255,255,0.62)' } }, + grid: { line: { style: { stroke: 'rgba(255,255,255,0.08)' } } }, + }, + legend: { position: 'top', itemName: { style: { fill: 'rgba(255,255,255,0.72)' } } }, + tooltip: { showMarkers: true }, + autoFit: true, + }; + }, [smartModels.envTrendData]); + + const trafficHeatmapConfig: any = useMemo(() => { + return { + data: smartModels.trafficHeatmapData, + xField: 'x', + yField: 'y', + colorField: 'value', + legend: { position: 'top', itemName: { style: { fill: 'rgba(255,255,255,0.72)' } } }, + tooltip: { formatter: (d: any) => ({ name: '热度', value: `${d.value}` }) }, + heatmapStyle: { stroke: 'rgba(255,255,255,0.08)', lineWidth: 1 }, + color: ['#0b1b2d', '#003a5a', '#00aaff', '#00ff88', '#ffb800', '#ff4757'], + xAxis: { label: false, grid: null, line: null }, + yAxis: { label: false, grid: null, line: null }, + autoFit: true, + }; + }, [smartModels.trafficHeatmapData]); + + const eventRadialConfig: any = useMemo(() => { + return { + data: smartModels.eventTypeData, + xField: 'type', + yField: 'value', + radius: 0.88, + innerRadius: 0.25, + colorField: 'type', + color: ['#00d4ff', '#00ff88', '#ffb800', '#9d4edd', '#ff4757', '#13c2c2'], + legend: false, + label: { style: { fill: 'rgba(255,255,255,0.72)' } }, + autoFit: true, + }; + }, [smartModels.eventTypeData]); + + const funnelConfig: any = useMemo(() => { + return { + data: smartModels.eventFunnelData, + xField: 'stage', + yField: 'value', + legend: false, + conversionTag: false, + tooltip: { + formatter: (d: any) => ({ name: d?.stage ?? d?.name ?? '阶段', value: d?.value ?? 0 }), + }, + label: { + formatter: (d: any) => { + const stage = d?.stage ?? d?.name ?? d?.type ?? '阶段'; + const value = d?.value ?? d?.count ?? 0; + return `${stage} ${value}`; + }, + content: (d: any) => { + const stage = d?.stage ?? d?.name ?? d?.type ?? '阶段'; + const value = d?.value ?? d?.count ?? 0; + return `${stage} ${value}`; + }, + style: { fill: 'rgba(255,255,255,0.78)', fontSize: 12 }, + }, + color: ['#00d4ff', '#00ff88', '#ffb800', '#9d4edd', '#00d4ff'], + autoFit: true, + }; + }, [smartModels.eventFunnelData]); + + const dispatchTrendConfig: any = useMemo(() => { + return { + data: taskTrendSeriesData, + xField: 'date', + yField: 'value', + seriesField: 'type', + smooth: true, + color: ['#00d4ff', '#00ff88', '#ffb800'], + xAxis: { label: { style: { fill: 'rgba(255,255,255,0.62)' } }, grid: null }, + yAxis: { + label: { style: { fill: 'rgba(255,255,255,0.62)' } }, + grid: { line: { style: { stroke: 'rgba(255,255,255,0.08)' } } }, + }, + legend: { position: 'top', itemName: { style: { fill: 'rgba(255,255,255,0.72)' } } }, + tooltip: { showMarkers: true }, + autoFit: true, + }; + }, [taskTrendSeriesData]); + + const terminalPieConfig: any = useMemo(() => { + const data = smartModels.terminalPieData || []; + return { + data, + angleField: 'count', + colorField: 'name', + radius: 0.8, + innerRadius: 0.58, + label: { + text: (datum: any) => { + const total = data.reduce((sum, d) => sum + (d.count || 0), 0); + const count = datum?.count ?? 0; + const percent = total > 0 ? ((count / total) * 100).toFixed(0) : '0'; + return `${datum?.name || ''} ${percent}%`; + }, + style: { fill: 'rgba(255,255,255,0.7)' }, + }, + legend: false, + autoFit: true, + }; + }, [smartModels.terminalPieData]); + + const droneStatusPieConfig: any = useMemo(() => { + const fleet = smartModels.fleet; + const total = fleet.droneInFlight + fleet.droneStandby + fleet.droneMaintenance; + if (!total) return {}; + return { + data: [ + { type: '在飞', value: fleet.droneInFlight }, + { type: '待命', value: fleet.droneStandby }, + { type: '维护', value: fleet.droneMaintenance }, + ], + angleField: 'value', + colorField: 'type', + radius: 0.92, + innerRadius: 0.62, + color: ['rgba(157, 78, 221, 0.95)', 'rgba(0, 212, 255, 0.9)', 'rgba(255, 184, 0, 0.92)'], + legend: false, + label: false, + statistic: { + title: false, + content: { + style: { color: 'rgba(255,255,255,0.88)', fontSize: 18, fontWeight: 700, whiteSpace: 'pre-line' }, + content: `${fleet.droneOnline}/${fleet.droneTotal}\n在线`, + }, + }, + autoFit: true, + }; + }, [ + smartModels.fleet.droneInFlight, + smartModels.fleet.droneMaintenance, + smartModels.fleet.droneOnline, + smartModels.fleet.droneStandby, + smartModels.fleet.droneTotal, + ]); + + const taskTypeColumnConfig: any = useMemo(() => { + return { + data: taskTypeData, + xField: 'type', + yField: 'value', + columnWidthRatio: 0.55, + color: ['#00d4ff'], + label: { style: { fill: 'rgba(255,255,255,0.85)' } }, + xAxis: { label: { style: { fill: 'rgba(255,255,255,0.62)' } } }, + yAxis: { + label: { style: { fill: 'rgba(255,255,255,0.62)' } }, + grid: { line: { style: { stroke: 'rgba(255,255,255,0.08)' } } }, + }, + legend: false, + autoFit: true, + }; + }, [taskTypeData]); + + const annualLineConfig: any = useMemo(() => { + return { + data: annualData, + xField: 'month', + yField: 'value', + seriesField: 'type', + smooth: true, + color: ['#00d4ff', '#00ff88'], + areaStyle: { fillOpacity: 0.12 }, + xAxis: { label: { style: { fill: 'rgba(255,255,255,0.62)' } } }, + yAxis: { + label: { style: { fill: 'rgba(255,255,255,0.62)' } }, + grid: { line: { style: { stroke: 'rgba(255,255,255,0.08)' } } }, + }, + legend: { position: 'top', itemName: { style: { fill: 'rgba(255,255,255,0.72)' } } }, + autoFit: true, + }; + }, [annualData]); + + const riskRoseConfig: any = useMemo(() => { + return { + data: failureAnalysisData, + xField: 'type', + yField: 'value', + seriesField: 'type', + radius: 0.85, + innerRadius: 0.25, + colorField: 'type', + color: ['#ffb800', '#00d4ff', '#00ff88', '#9d4edd', '#ff4757', '#13c2c2'], + label: { + content: (d: any) => `${d.type}\n${d.value}`, + style: { fill: 'rgba(255,255,255,0.72)' }, + }, + legend: false, + autoFit: true, + }; + }, [failureAnalysisData]); + + const severityColor = (severity: string) => { + if (severity === 'critical') return '#ff4757'; + if (severity === 'warning') return '#ffb800'; + return '#00d4ff'; + }; + + const statusTagColor = (status: string) => { + if (status === '已闭环') return '#00ff88'; + if (status === '处理中') return '#9d4edd'; + if (status === '已派单') return '#00d4ff'; + return 'rgba(255,255,255,0.25)'; + }; + + const regionRiskColor = (risk: string) => { + if (risk === 'critical') return '#ff4757'; + if (risk === 'warning') return '#ffb800'; + return '#00ff88'; + }; + + // 运营洞察已合并进右侧“事件处置与洞察”卡片的 Tabs,避免小屏纵向堆叠过高导致裁切。 + return ( -
-
+
+
- {/* 左侧栏:设备态势 */} + {/* 左侧栏:城市体征 */}
- -
- -
-
- - -
- -
-
- - -
- -
-
- - 实时告警} - className="panel-card glass-panel flex-grow" + + 城市运行体征 + + } + className="panel-card glass-panel panel-card--left-tabs" size="small" - extra={Live} > -
+ +
覆盖、发现、处置、复核一体化评分
+
+ +
+
+ ), + }, + { + key: 'env', + label: '环境感知', + children: ( +
+
空地协同采集 · 24 小时滚动
+
+ +
+
+ ), + }, + { + key: 'traffic', + label: '交通热力', + children: ( +
+
重点片区热度分布(网格化)
+
+ +
+
+ ), + }, + ]} + /> +
+ + + 城市事件流 + + } + className="panel-card glass-panel panel-card--events" + size="small" + extra={实时} + > +
}} renderItem={(item) => ( - -
-
- {item.level.toUpperCase().slice(0,1)} + +
+
+
+
+ {item.title} + {item.timeText}
-
-
- {item.deviceName || item.taskName} - {dayjs(item.timestamp).format('HH:mm')} -
-
{item.message}
+
+ {item.location} + + {item.status} + + + {item.source} +
+
{item.desc}
+
)} @@ -365,65 +551,297 @@ const Dashboard: React.FC = () => { {/* 中间栏:核心监控 */}
{/* 顶部KPI */} -
-
-
-
-
设备总数
-
{deviceStats?.total || 0}
+
+ {smartModels.kpis.map((kpi) => ( +
+
+ {kpi.label} +
-
-
-
-
-
景区总数
-
{deviceStats?.tourismCount || 0}
+
+ {kpi.value} + {kpi.unit ? {kpi.unit} : null}
-
-
-
-
-
{taskNewLabel}
-
{taskStats?.todayNew || 0}
-
-
-
-
-
-
执行成功率
-
{taskStats?.successRate || 0}%
-
-
+ {kpi.sub ?
{kpi.sub}
: null} +
+ ))}
{/* 地图/3D入口 */} -
-
-
-
-
- -

全域数字孪生监控中心

- +
+
+
+
+
+ {compactLevel === 2 ? ( +
+ 事件点位 + AI识别 +
+ ) : ( + <> +
+ 事件点位 + 航线叠加 + 电子围栏 + AI识别 +
+
+ + 安全态势 + + + 空域管理 + + + 数字孪生 + +
+ + )} +
+ +
+
全域数字孪生中枢
+
空地协同巡检 · 城市事件识别 · 应急快速响应
+ +
+ +
+
+ 在线无人机 + {smartModels.fleet.droneOnline}
-
+
+ 在飞架次 + {smartModels.fleet.droneInFlight} +
+ {compactLevel === 2 ? null : ( + <> +
+ 可用机库 + {smartModels.fleet.dockOnline} +
+
+ 合规指数 + + {smartModels.airspace.complianceIndex} + +
+ + )} +
+
- {/* 底部年度统计 */} - -
- -
+ + 无人机态势与AI洞察 + + } + className="panel-card glass-panel fill-bottom panel-card--snap" + size="small" + > + + + {new Array(Math.max(1, Math.ceil(smartModels.aiSnapshots.length / snapshotsPerPage))) + .fill(0) + .map((_, pageIdx) => { + const start = pageIdx * snapshotsPerPage; + const page = smartModels.aiSnapshots.slice(start, start + snapshotsPerPage); + return ( +
+
+ {page.map((s) => ( +
+
+ {s.tag} + {s.timeText} +
+
{s.title}
+
+ {s.location} + 置信度 {s.confidence}% +
+
+ ))} +
+
+ ); + })} +
+
+ ), + }, + { + key: 'fleet', + label: '机队态势', + children: ( +
+
+
+
平均电量
+
{smartModels.fleet.avgBattery}%
+
低电 {smartModels.fleet.lowBatteryAlerts} 起
+
+
+
飞行时长
+
{smartModels.fleet.flightHoursToday}h
+
今日累计
+
+
+
飞行里程
+
{smartModels.fleet.flightMileageToday}km
+
含航线复飞
+
+
+
可用机库
+
+ {smartModels.fleet.dockOnline}/{smartModels.fleet.dockTotal} +
+
在线/总量
+
+
+ +
+
+
机队状态占比
+
+ {Object.keys(droneStatusPieConfig).length ? ( + + ) : ( + + )} +
+
+
+
重点区域覆盖
+
+ {visibleRegionCoverage.map((r) => ( +
+
+ {r.name} + + + {r.risk === 'critical' ? '高风险' : r.risk === 'warning' ? '关注' : '正常'} + + {r.updatedAt} + +
+
+ + {r.coverage}% + 待处置 {r.pending} +
+
+ ))} +
+
+
+
+ ), + }, + { + key: 'airspace', + label: '空域合规', + children: ( +
+
+
+ +
+
合规指数
+
围栏/禁飞/审批综合
+
城市安全指数 {smartModels.airspace.safetyIndex}
+
+
+ +
+
+
{smartModels.airspace.geofenceTriggers}
+
围栏触发
+
+
+
{smartModels.airspace.noFlyWarnings}
+
禁飞预警
+
+
+
{smartModels.airspace.approvalsToday}
+
今日审批
+
+
+
{smartModels.airspace.approvalsPassRate}%
+
通过率
+
+
+
+ +
+
+ + 重点区域启用“低空走廊”,优先保障应急任务快速通行。 +
+ {compactLevel === 2 ? null : ( + <> +
+ + 围栏触发或禁飞预警上升时,建议自动降级为“复核模式”。 +
+
+ + 审批通过率稳定后,可扩大夜航与多机协同策略的投放比例。 +
+ + )} +
+
+ ), + }, + ]} + />
{/* 右侧栏:任务与运维 */}
+ {taskPeriodText}运行调度 + + } + className="panel-card glass-panel panel-card--dispatch" size="small" extra={ @@ -449,50 +867,141 @@ const Dashboard: React.FC = () => { } > -
-
-
{taskStats?.pending || 0}
-
待执行
-
-
-
{taskStats?.running || 0}
-
执行中
-
-
-
{taskStats?.completed || 0}
-
已完成
-
-
-
{taskStats?.failed || 0}
-
已失败
-
-
-
-
- {taskStats?.successRate || 0}% -
-
- {taskPeriodText}成功率 -
-
-
- - -
- +
+
+
{taskStats?.pending || 0}
+
待执行
+
+
+
{taskStats?.running || 0}
+
执行中
+
+
+
{taskStats?.completed || 0}
+
已完成
+
+
+
{taskStats?.failed || 0}
+
异常
+
+
+
{taskStats?.successRate || 0}%
+
成功率
+
- - - -
- +
+
近 7 日任务趋势
+
+ +
- + - -
- -
+ + 事件处置与洞察 + + } + className="panel-card glass-panel flex-grow panel-card--right-tabs" + size="small" + > + +
+ +
+
+ ), + }, + { + key: 'types', + label: '类型分布', + children: ( +
+
+ +
+
+ ), + }, + { + key: 'asset', + label: '资产构成', + children: smartModels.terminalPieData?.length ? ( +
+
+ +
+
+ ) : ( +
+
+ +
+
+ ), + }, + { + key: 'capacity', + label: '作业结构', + children: taskTypeData?.length ? ( +
+
+ +
+
+ ) : ( +
+
+ +
+
+ ), + }, + { + key: 'risk', + label: '风险画像', + children: failureAnalysisData?.length ? ( +
+
+ +
+
+ ) : ( +
+
+ +
+
+ ), + }, + { + key: 'year', + label: '年度趋势', + children: annualData?.length ? ( +
+
+ +
+
+ ) : ( +
+
+ +
+
+ ), + }, + ]} + />
diff --git a/zlt-web/yingyan/src/services/dashboard.ts b/zlt-web/yingyan/src/services/dashboard.ts index 95618872..bee36c85 100644 --- a/zlt-web/yingyan/src/services/dashboard.ts +++ b/zlt-web/yingyan/src/services/dashboard.ts @@ -50,6 +50,23 @@ export interface AlertItem { timestamp: string; } +function hashStringToSeed(text: string): number { + let hash = 2166136261; + for (let i = 0; i < text.length; i++) { + hash ^= text.charCodeAt(i); + hash = Math.imul(hash, 16777619); + } + return hash >>> 0; +} + +function createRng(seedText: string) { + let seed = hashStringToSeed(seedText) || 1; + return () => { + seed = (Math.imul(seed, 1664525) + 1013904223) >>> 0; + return seed / 4294967296; + }; +} + /** * 获取设备统计 */ @@ -193,17 +210,25 @@ export async function getTrendData(days: number = 7): Promise<{ taskTrend: Trend date.setDate(date.getDate() - i); const dateStr = date.toISOString().split('T')[0]; + const rng = createRng(`trend:${dateStr}`); + const created = Math.floor(8 + rng() * 18); + const completed = Math.floor(created * (0.68 + rng() * 0.22)); + const failed = Math.max(0, Math.floor(created * (0.03 + rng() * 0.08))); + taskTrend.push({ date: dateStr, - created: Math.floor(Math.random() * 20) + 5, - completed: Math.floor(Math.random() * 15) + 3, - failed: Math.floor(Math.random() * 3), + created, + completed, + failed, }); + const online = Math.floor(72 + rng() * 24); + const total = 100; + deviceTrend.push({ date: dateStr, - online: Math.floor(Math.random() * 30) + 70, - total: 100, + online, + total, }); } @@ -214,24 +239,83 @@ export async function getTrendData(days: number = 7): Promise<{ taskTrend: Trend * 模拟告警数据 */ export function getMockAlerts(): AlertItem[] { - return [ + const now = dayjs(); + const dayKey = now.format('YYYY-MM-DD'); + const rng = createRng(`alerts:${dayKey}:${now.format('HH')}`); + const pick = (arr: T[]) => arr[Math.floor(rng() * arr.length)]; + + const devices = [ + { sn: 'DRONE-A01', name: '城市巡检无人机A' }, + { sn: 'DRONE-B02', name: '河道巡检无人机B' }, + { sn: 'DOCK-01', name: '城北机库01' }, + { sn: 'CAM-07', name: '高新大道摄像头07' }, + ]; + + const baseAlerts: AlertItem[] = [ { - id: '1', + id: `a-${dayKey}-1`, type: 'device_offline', - deviceSn: 'DRONE001', - deviceName: '巡检无人机A', - message: '设备离线超过5分钟', + deviceSn: 'CAM-07', + deviceName: '高新大道摄像头07', + message: '关键点位离线超过 5 分钟', level: 'warning', - timestamp: new Date().toISOString(), + timestamp: now.subtract(3, 'minute').toISOString(), }, { - id: '2', + id: `a-${dayKey}-2`, type: 'low_battery', - deviceSn: 'DRONE002', - deviceName: '巡检无人机B', - message: '电池电量低于20%', + deviceSn: 'DRONE-B02', + deviceName: '河道巡检无人机B', + message: '电池电量低于 20%,建议返航或更换任务资源', level: 'warning', - timestamp: new Date(Date.now() - 300000).toISOString(), + timestamp: now.subtract(9, 'minute').toISOString(), + }, + { + id: `a-${dayKey}-3`, + type: 'device_fault', + deviceSn: 'DOCK-01', + deviceName: '城北机库01', + message: '舱门状态异常,请核对机库自检结果', + level: 'error', + timestamp: now.subtract(18, 'minute').toISOString(), + }, + { + id: `a-${dayKey}-4`, + type: 'task_failed', + taskId: 10086, + taskName: '主干道早高峰巡检', + message: '任务中断:链路波动导致视频回传丢包', + level: 'error', + timestamp: now.subtract(26, 'minute').toISOString(), + }, + { + id: `a-${dayKey}-5`, + type: 'device_offline', + deviceSn: 'DRONE-A01', + deviceName: '城市巡检无人机A', + message: '回传信号弱,定位数据更新异常', + level: 'critical', + timestamp: now.subtract(37, 'minute').toISOString(), }, ]; + + const extraCount = 1 + Math.floor(rng() * 2); + for (let i = 0; i < extraCount; i++) { + const d = pick(devices); + baseAlerts.push({ + id: `a-${dayKey}-x${i}`, + type: pick(['device_offline', 'low_battery', 'device_fault'] as AlertItem['type'][]), + deviceSn: d.sn, + deviceName: d.name, + message: pick([ + '状态波动:请关注在线率与告警趋势', + '链路质量下降:可能影响实时回传', + '边缘算力占用较高:建议分流任务', + ]), + level: pick(['warning', 'error'] as AlertItem['level'][]), + timestamp: now.subtract(45 + Math.floor(rng() * 25), 'minute').toISOString(), + }); + } + + return baseAlerts.slice(0, 8); }