From b0b8036fda7b2971f1cdf13a99fa923438f8c50f Mon Sep 17 00:00:00 2001 From: Iamasoldier <1272745473@qq.com> Date: Thu, 19 Jun 2025 22:53:22 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E5=9C=B0=E5=9B=BE=E4=BB=AA=E8=A1=A8?= =?UTF-8?q?=E7=9B=98=E5=B1=8F=E5=B9=95=E9=80=82=E9=85=8D=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/mapper/OrderMapper.xml | 4 + .../react-web/src/main/frontend/package.json | 2 + .../pages/device-ops/map-dashboard/index.tsx | 1982 ++++++++++------- 3 files changed, 1148 insertions(+), 840 deletions(-) diff --git a/zlt-business/order-center/src/main/resources/mapper/OrderMapper.xml b/zlt-business/order-center/src/main/resources/mapper/OrderMapper.xml index ef813741..00ad3434 100644 --- a/zlt-business/order-center/src/main/resources/mapper/OrderMapper.xml +++ b/zlt-business/order-center/src/main/resources/mapper/OrderMapper.xml @@ -9,6 +9,10 @@ AND t.order_no LIKE CONCAT('%', #{p.orderNo}, '%') + + + AND t.deviceSn LIKE CONCAT('%', #{p.deviceSn}, '%') + AND t.order_status = #{p.orderStatus} diff --git a/zlt-web/react-web/src/main/frontend/package.json b/zlt-web/react-web/src/main/frontend/package.json index fa3cfafb..ade2c321 100644 --- a/zlt-web/react-web/src/main/frontend/package.json +++ b/zlt-web/react-web/src/main/frontend/package.json @@ -51,6 +51,7 @@ "@ant-design/pro-components": "1.1.1", "@babel/runtime": "^7.27.0", "@types/file-saver": "^2.0.7", + "@types/styled-components": "^5.1.34", "@umijs/route-utils": "^2.0.0", "antd": "^4.20.0", "classnames": "^2.3.0", @@ -69,6 +70,7 @@ "react-json-tree": "^0.17.0", "react-player": "^2.16.0", "spark-md5": "^3.0.2", + "styled-components": "^6.1.18", "treeify-js": "^1.0.8", "umi": "^3.5.0", "uuid": "^9.0.0", diff --git a/zlt-web/react-web/src/main/frontend/src/pages/device-ops/map-dashboard/index.tsx b/zlt-web/react-web/src/main/frontend/src/pages/device-ops/map-dashboard/index.tsx index 478b2a3d..346ee24d 100644 --- a/zlt-web/react-web/src/main/frontend/src/pages/device-ops/map-dashboard/index.tsx +++ b/zlt-web/react-web/src/main/frontend/src/pages/device-ops/map-dashboard/index.tsx @@ -12,13 +12,14 @@ import { ClockCircleOutlined, WarningOutlined, InfoCircleOutlined, EyeOutlined, PlayCircleOutlined, PauseCircleOutlined, HomeOutlined, CameraOutlined, ControlOutlined, BellOutlined, BarChartOutlined, - PauseOutlined + PauseOutlined, SearchOutlined } from '@ant-design/icons'; import moment from 'moment'; import { Amap } from '@amap/amap-react'; import ReactPlayer from 'react-player'; import { device, getStreamUrls } from '@/services/device/api'; import { request } from 'umi'; +import { tourism } from '@/services/orders/api'; import { Device, DeviceStatus, DEVICE_STATUS_CONFIG, generateMockDevices, calculateDeviceStats, DeviceStats @@ -215,6 +216,20 @@ interface FireAlarmPayload { messageType: string; } +// 景区数据接口 +interface TourismData { + id: number; + tourismName: string; + tourismDesc: string; + tourismNo: string; + tourismAddress: string; + tourismPhone: string; + createTime?: string; + status: number; + tenantId?: string; + updateTime?: string; +} + // 地图设备标记 interface MapDeviceMarker { device: RealDevice; @@ -233,6 +248,10 @@ const DeviceMapDashboard: React.FC = () => { const [mapZoom, setMapZoom] = useState(11); const [loading, setLoading] = useState(false); + // 景区数据状态 + const [tourismList, setTourismList] = useState([]); + const [tourismLoading, setTourismLoading] = useState(false); + // 面板控制 const [leftPanelVisible, setLeftPanelVisible] = useState(true); const [rightPanelVisible, setRightPanelVisible] = useState(false); @@ -301,6 +320,39 @@ const DeviceMapDashboard: React.FC = () => { satellite: '卫星图' }; + // 响应式设计状态 + const [isMobile, setIsMobile] = useState(false); + const [isTablet, setIsTablet] = useState(false); + + // 检测屏幕尺寸 + useEffect(() => { + const checkScreenSize = () => { + const width = window.innerWidth; + setIsMobile(width < 768); + setIsTablet(width >= 768 && width < 1024); + }; + + checkScreenSize(); + window.addEventListener('resize', checkScreenSize); + + return () => window.removeEventListener('resize', checkScreenSize); + }, []); + + // 根据屏幕尺寸调整面板宽度 + const getLeftPanelWidth = () => { + if (!leftPanelVisible) return '0px'; + if (leftPanelCollapsed) return '48px'; + if (isMobile) return '100%'; + return '320px'; + }; + + const getRightPanelWidth = () => { + if (!rightPanelVisible) return '0px'; + if (rightPanelCollapsed) return '48px'; + if (isMobile) return '100%'; + return '360px'; + }; + // 获取WebSocket Token const getToken = async (expires: number = DEFAULT_EXPIRES) => { const now = Date.now(); @@ -424,6 +476,29 @@ const DeviceMapDashboard: React.FC = () => { } }; + // 获取景区列表 + const fetchTourismList = async () => { + setTourismLoading(true); + try { + const response = await tourism({ + current: 1, + pageSize: 1000, + }); + + if (response.data && response.data.length > 0) { + setTourismList(response.data); + console.log('获取景区列表成功:', response.data); + } else { + console.log('景区列表为空'); + } + } catch (error) { + console.error('获取景区列表失败:', error); + message.error('获取景区列表失败'); + } finally { + setTourismLoading(false); + } + }; + // 将真实设备状态转换为地图状态 const getDeviceStatus = (device: RealDevice): DeviceStatus => { // 基于实时数据上报判断设备在线状态 @@ -492,8 +567,23 @@ const DeviceMapDashboard: React.FC = () => { // 类型筛选 if (typeFilter !== 'all' && device.deviceType.toString() !== typeFilter) return false; - // 分组筛选(暂时使用设备类型作为分组) - if (groupFilter !== 'all' && device.deviceType.toString() !== groupFilter) return false; + // 景区分组筛选 + if (groupFilter !== 'all') { + if (tourismList.length > 0) { + // 使用真实景区数据筛选 + const selectedTourism = tourismList.find(t => t.id.toString() === groupFilter); + if (selectedTourism) { + // 这里可以根据设备的景区ID进行筛选,暂时使用设备类型作为筛选条件 + if (device.deviceType.toString() !== groupFilter && + !device.deviceSn.includes(groupFilter)) { + return false; + } + } + } else { + // 备用筛选(使用设备类型) + if (device.deviceType.toString() !== groupFilter) return false; + } + } // 关键词搜索 if (searchKeyword && !device.deviceName.toLowerCase().includes(searchKeyword.toLowerCase()) && @@ -529,12 +619,26 @@ const DeviceMapDashboard: React.FC = () => { byType: {} }; - // 按分组统计(使用设备类型) - devices.forEach(device => { - const group = `设备类型${device.deviceType}`; - stats.byGroup[group] = (stats.byGroup[group] || 0) + 1; - stats.byType[device.deviceType.toString()] = (stats.byType[device.deviceType.toString()] || 0) + 1; - }); + // 按分组统计(使用景区数据) + if (tourismList.length > 0) { + // 使用真实景区数据 + tourismList.forEach(tourism => { + const tourismId = tourism.id.toString(); + // 这里可以根据设备的景区ID进行分组,暂时使用设备类型作为分组 + const deviceCount = devices.filter(device => + device.deviceType.toString() === tourismId || + device.deviceSn.includes(tourismId) + ).length; + stats.byGroup[tourism.tourismName] = deviceCount; + }); + } else { + // 备用分组统计(使用设备类型) + devices.forEach(device => { + const group = `设备类型${device.deviceType}`; + stats.byGroup[group] = (stats.byGroup[group] || 0) + 1; + stats.byType[device.deviceType.toString()] = (stats.byType[device.deviceType.toString()] || 0) + 1; + }); + } return stats; }; @@ -708,6 +812,7 @@ const DeviceMapDashboard: React.FC = () => { // 初始化数据 useEffect(() => { fetchDeviceList(); + fetchTourismList(); initWebSocket(); // 添加全局鼠标移动监听器 @@ -863,19 +968,40 @@ const DeviceMapDashboard: React.FC = () => { }, [filteredDevices]); // 获取分组选项 - const groupOptions = Array.from(new Set(devices.map(d => d.deviceType.toString()).filter(Boolean))); + const groupOptions = useMemo(() => { + if (tourismList.length > 0) { + // 使用真实景区数据 + return tourismList.map(tourism => ({ + value: tourism.id.toString(), + label: tourism.tourismName + })); + } else { + // 备用选项 - 转换为相同格式 + return Array.from(new Set(devices.map(d => d.deviceType.toString()).filter(Boolean))) + .map(type => ({ + value: type, + label: `设备类型${type}` + })); + } + }, [tourismList, devices]); // 创建标记图标 const createMarkerIcon = (color: string, status: DeviceStatus) => { const canvas = document.createElement('canvas'); - canvas.width = 32; - canvas.height = 32; + canvas.width = 40; + canvas.height = 40; const ctx = canvas.getContext('2d'); if (ctx) { - // 绘制圆形背景 + // 绘制外圈阴影 ctx.beginPath(); - ctx.arc(16, 16, 14, 0, 2 * Math.PI); + ctx.arc(20, 20, 18, 0, 2 * Math.PI); + ctx.fillStyle = 'rgba(0,0,0,0.2)'; + ctx.fill(); + + // 绘制主圆形背景 + ctx.beginPath(); + ctx.arc(20, 20, 16, 0, 2 * Math.PI); ctx.fillStyle = color; ctx.fill(); @@ -884,12 +1010,30 @@ const DeviceMapDashboard: React.FC = () => { ctx.lineWidth = 2; ctx.stroke(); + // 绘制内圈高光 + ctx.beginPath(); + ctx.arc(20, 20, 12, 0, 2 * Math.PI); + ctx.strokeStyle = 'rgba(255,255,255,0.3)'; + ctx.lineWidth = 1; + ctx.stroke(); + // 绘制图标 ctx.fillStyle = '#fff'; - ctx.font = '16px Arial'; + ctx.font = 'bold 16px Arial'; ctx.textAlign = 'center'; ctx.textBaseline = 'middle'; - ctx.fillText(DEVICE_STATUS_CONFIG[status].icon, 16, 16); + ctx.fillText(DEVICE_STATUS_CONFIG[status].icon, 20, 20); + + // 添加状态指示点 + if (status === DeviceStatus.ERROR || status === DeviceStatus.MAINTENANCE) { + ctx.beginPath(); + ctx.arc(30, 10, 4, 0, 2 * Math.PI); + ctx.fillStyle = '#ff4d4f'; + ctx.fill(); + ctx.strokeStyle = '#fff'; + ctx.lineWidth = 1; + ctx.stroke(); + } } return canvas.toDataURL(); @@ -1574,26 +1718,36 @@ const DeviceMapDashboard: React.FC = () => { // 智能定位悬停卡片 const getSmartCardPosition = (mouseX: number, mouseY: number) => { const cardWidth = 280; - const cardHeight = 200; + const cardHeight = 220; const padding = 20; + const viewportWidth = window.innerWidth; + const viewportHeight = window.innerHeight; - let left = mouseX + 10; - let top = mouseY - 10; + let left = mouseX + 15; + let top = mouseY - 15; // 检查右边界 - if (left + cardWidth > window.innerWidth - padding) { - left = mouseX - cardWidth - 10; + if (left + cardWidth > viewportWidth - padding) { + left = mouseX - cardWidth - 15; } // 检查下边界 - if (top + cardHeight > window.innerHeight - padding) { - top = mouseY - cardHeight - 10; + if (top + cardHeight > viewportHeight - padding) { + top = mouseY - cardHeight - 15; } // 确保不超出左边界和上边界 left = Math.max(padding, left); top = Math.max(padding, top); + // 如果仍然超出边界,调整到安全位置 + if (left + cardWidth > viewportWidth - padding) { + left = viewportWidth - cardWidth - padding; + } + if (top + cardHeight > viewportHeight - padding) { + top = viewportHeight - cardHeight - padding; + } + return { x: left, y: top }; }; @@ -1601,13 +1755,14 @@ const DeviceMapDashboard: React.FC = () => { try { const newMarker = new window.AMap.CircleMarker({ center: position, - radius: 8, + radius: 12, fillColor: color, - fillOpacity: 0.8, + fillOpacity: 0.9, strokeColor: '#fff', - strokeWeight: 2, + strokeWeight: 3, strokeOpacity: 1, - title: `${device.deviceName} (${DEVICE_STATUS_CONFIG[status].text})` + title: `${device.deviceName} (${DEVICE_STATUS_CONFIG[status].text})`, + zIndex: status === DeviceStatus.ERROR ? 100 : 10 }); // 添加点击事件 @@ -1617,27 +1772,47 @@ const DeviceMapDashboard: React.FC = () => { }); newMarker.on('mouseover', (event: any) => { - console.log('地图标记mouseover事件:', event); - console.log('全局鼠标位置:', globalMousePosition); - // 使用全局鼠标位置 const mouseX = globalMousePosition.x; const mouseY = globalMousePosition.y; - console.log('使用的鼠标位置:', { mouseX, mouseY }); - // 使用智能定位 const smartPosition = getSmartCardPosition(mouseX, mouseY); - console.log('智能定位结果:', smartPosition); setHoveredDevice(device); setShowDeviceCard(true); setDeviceCardPosition(smartPosition); + + // 高亮标记 + try { + if (typeof newMarker.setOptions === 'function') { + newMarker.setOptions({ + radius: 16, + fillOpacity: 1, + strokeWeight: 4 + }); + } + } catch (error) { + console.warn('高亮标记失败:', error); + } }); newMarker.on('mouseout', () => { setHoveredDevice(null); setShowDeviceCard(false); + + // 恢复标记样式 + try { + if (typeof newMarker.setOptions === 'function') { + newMarker.setOptions({ + radius: 12, + fillOpacity: 0.9, + strokeWeight: 3 + }); + } + } catch (error) { + console.warn('恢复标记样式失败:', error); + } }); } @@ -1661,235 +1836,453 @@ const DeviceMapDashboard: React.FC = () => { }; return ( -
+
{/* 顶部控制栏 */}
- + - - 设备运维地图 + + 设备运维地图 - + {isMobile && ( + + )} - - - - - setSearchKeyword(e.target.value)} - style={{ width: 200 }} - prefix={} - /> + {!isMobile && ( + <> + + + + + + + setSearchKeyword(e.target.value)} + style={{ width: 180 }} + prefix={} + size="small" + /> + + )} - + + {!isMobile && ( + + )} + - - - - - - - - - + + + }} + disabled={!mapRef.current} + size="small" + > + 刷新地图 + + + )} - - 设备: {devices.length} | 在线: {deviceStats.online} | 离线: {deviceStats.offline} - - - {wsConnected && ( - - 已订阅: 属性上报 | 事件 | 上线/离线 - - )} - - {devices.some(d => d.lastUpdateTime) && ( - - 最后更新: {new Date(Math.max(...devices.filter(d => d.lastUpdateTime).map(d => new Date(d.lastUpdateTime!).getTime()))).toLocaleTimeString()} - + {!isMobile && ( + <> + + 设备: {devices.length} | 在线: {deviceStats.online} | 离线: {deviceStats.offline} + + + {tourismList.length > 0 && ( + + 景区: {tourismList.length} | 活跃: {tourismList.filter(t => t.status === 1).length} + + )} + )}
- {/* 地图区域 */} + {/* 主内容区域 */}
-
- {/* 高德地图容器 */} + {/* 左侧统计面板 */} + {leftPanelVisible && ( +
+ setLeftPanelCollapsed(true)} + > + - + + )} + style={{ + height: '100%', + overflow: 'hidden', + display: 'flex', + flexDirection: 'column' + }} + bodyStyle={{ + flex: '1 1 auto', + overflow: 'auto', + padding: '12px' + }} + > + {leftPanelCollapsed ? ( +
+ +
+ ) : ( + <> + {/* 筛选区域 */} +
+
+ 筛选条件 +
+ + + setSearchKeyword(e.target.value)} + prefix={} + /> + +
+ + + + {/* 统计数据 */} + + + + } + valueStyle={{ color: '#1890ff' }} + /> + + + + + } + valueStyle={{ color: '#52c41a' }} + suffix={`/ ${deviceStats.total}`} + /> + + + + + } + valueStyle={{ color: '#52c41a' }} + /> + + + + + } + valueStyle={{ color: '#ff4d4f' }} + /> + + + + + {/* 按分组统计 */} +
+
+ 景区分布 +
+ {tourismLoading ? ( +
+ 加载景区数据中... +
+ ) : tourismList.length > 0 ? ( + tourismList.map(tourism => ( +
+ {tourism.tourismName} + {deviceStats.byGroup[tourism.tourismName] || 0} +
+ )) + ) : ( + Object.entries(deviceStats.byGroup).map(([group, count]) => ( +
+ {group} + {count} +
+ )) + )} +
+ + {/* 设备列表 */} +
+
+ 设备列表 ({memoizedDeviceList.length}) +
+
+ {memoizedDeviceList.map(device => ( +
locateDeviceOnMap(device)} + onMouseEnter={(e) => handleDeviceHover(device, e)} + onMouseLeave={handleDeviceLeave} + > +
+
+
+ {device.deviceName} +
+
+ {device.deviceSn} +
+
+ + {device.statusConfig.text} + +
+
+ ))} +
+
+ + )} +
+
+ )} + + {/* 地图区域 */} +
+ {/* 地图容器 */}
@@ -1902,57 +2295,84 @@ const DeviceMapDashboard: React.FC = () => { top: deviceCardPosition.y, zIndex: 1001, background: '#fff', - border: '1px solid #d9d9d9', - borderRadius: '8px', - padding: '12px', - boxShadow: '0 4px 12px rgba(0,0,0,0.15)', - minWidth: '220px', - maxWidth: '280px', - pointerEvents: 'none', // 防止卡片阻挡鼠标事件 - transition: 'opacity 0.2s ease-in-out' + borderRadius: '12px', + padding: '16px', + boxShadow: '0 8px 24px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.08)', + minWidth: '240px', + maxWidth: '300px', + pointerEvents: 'none', + transition: 'all 0.3s cubic-bezier(0.4, 0, 0.2, 1)', + backdropFilter: 'blur(8px)', + border: '1px solid rgba(255,255,255,0.2)' }} > {/* 调试信息 */} -
+
位置: ({deviceCardPosition.x}, {deviceCardPosition.y}) | 鼠标: ({globalMousePosition.x}, {globalMousePosition.y})
-
- {hoveredDevice.deviceName} +
+ {hoveredDevice.deviceName} {DEVICE_STATUS_CONFIG[getDeviceStatus(hoveredDevice)].text}
-
+
编号: {hoveredDevice.deviceSn}
类型: {hoveredDevice.deviceType}
-
电量: {hoveredDevice.metrics.batteryCapacity}%
-
网络: {hoveredDevice.metrics.networkQuality}%
+
电量: {hoveredDevice.metrics.batteryCapacity}%
+
网络: {hoveredDevice.metrics.networkQuality}%
温度: {hoveredDevice.metrics.temperature}°C
湿度: {hoveredDevice.metrics.humidity}%
{hoveredDevice.metrics.droneInDock !== undefined && (
机库: {hoveredDevice.metrics.droneInDock === 1 ? '在库' : '离库'}
)} - {hoveredDevice.metrics.emergencyStopState === 1 && ( -
⚠️ 紧急停止已触发
- )} - {hoveredDevice.metrics.alarmState === 1 && ( -
🚨 有报警
- )} - {hoveredDevice.metrics.windSpeed > 10 && ( -
💨 风速过大
- )} - {hoveredDevice.metrics.rainfall > 0 && ( -
🌧️ 有降雨
- )} {hoveredDevice.location && ( -
位置: {hoveredDevice.location.latitude.toFixed(4)}, {hoveredDevice.location.longitude.toFixed(4)}
+
+ 位置: {hoveredDevice.location.latitude.toFixed(4)}, {hoveredDevice.location.longitude.toFixed(4)} +
)} {hoveredDevice.lastUpdateTime && ( -
更新: {new Date(hoveredDevice.lastUpdateTime).toLocaleTimeString()}
+
+ 更新: {new Date(hoveredDevice.lastUpdateTime).toLocaleTimeString()} +
+ )} +
+ + {/* 状态警告 */} +
+ {hoveredDevice.metrics.emergencyStopState === 1 && ( +
⚠️ 紧急停止已触发
+ )} + {hoveredDevice.metrics.alarmState === 1 && ( +
🚨 有报警
+ )} + {hoveredDevice.metrics.windSpeed > 10 && ( +
💨 风速过大
+ )} + {hoveredDevice.metrics.rainfall > 0 && ( +
🌧️ 有降雨
)}
@@ -1992,626 +2412,508 @@ const DeviceMapDashboard: React.FC = () => {
)}
-
- {/* 左侧统计面板 */} - {leftPanelVisible && ( -
- setLeftPanelCollapsed(true)} - > - - - - )} - style={{ height: '100%', overflow: 'auto' }} - > - {leftPanelCollapsed ? ( -
- -
- ) : ( - <> - {/* 统计卡片 */} - - - - } - valueStyle={{ color: '#1890ff' }} - /> - - - - - } - valueStyle={{ color: '#52c41a' }} - suffix={`/ ${deviceStats.total}`} - /> - - - - - } - valueStyle={{ color: '#52c41a' }} - /> - - - - - } - valueStyle={{ color: '#ff4d4f' }} - /> - - - - - {/* 按分组统计 */} -
-
- 景区分布 -
- {Object.entries(deviceStats.byGroup).map(([group, count]) => ( -
- {group} - {count} -
- ))} + {/* 右侧详情面板 */} + {rightPanelVisible && selectedDevice && ( +
+ + + + + )} + style={{ + height: '100%', + display: 'flex', + flexDirection: 'column', + overflow: 'hidden' + }} + bodyStyle={{ + padding: '12px', + flex: 1, + overflow: 'auto' + }} + > + {rightPanelCollapsed ? ( +
+
+ ) : ( + <> + {/* 设备基本信息 */} + + {selectedDevice.deviceName} + {selectedDevice.deviceSn} + {selectedDevice.deviceType} + + + {DEVICE_STATUS_CONFIG[getDeviceStatus(selectedDevice)].text} + + + {selectedDevice.loginTime} + {selectedDevice.lastUpdateTime && ( + {selectedDevice.lastUpdateTime} + )} + {selectedDevice.metrics.lastMaintenance && ( + {selectedDevice.metrics.lastMaintenance} + )} + {selectedDevice.metrics.nextMaintenance && ( + {selectedDevice.metrics.nextMaintenance} + )} + - {/* 设备列表 */} -
-
- 设备列表 ({memoizedDeviceList.length}) -
-
- {memoizedDeviceList.map(device => ( -
locateDeviceOnMap(device)} - onMouseEnter={(e) => { - e.currentTarget.style.backgroundColor = '#f5f5f5'; - }} - onMouseLeave={(e) => { - e.currentTarget.style.backgroundColor = selectedDevice?.deviceSn === device.deviceSn ? '#e6f7ff' : '#fff'; - }} + {/* 景区信息 */} + {tourismList.length > 0 && ( + <> + +
+ 所属景区 + {(() => { + // 尝试根据设备信息找到对应的景区 + const relatedTourism = tourismList.find(tourism => + selectedDevice.deviceSn.includes(tourism.id.toString()) || + selectedDevice.deviceType.toString() === tourism.id.toString() + ); + + if (relatedTourism) { + return ( +
+
景区名称:{relatedTourism.tourismName}
+
景区地址:{relatedTourism.tourismAddress}
+ {relatedTourism.tourismDesc && ( +
景区描述:{relatedTourism.tourismDesc}
+ )} + {relatedTourism.tourismPhone && ( +
联系电话:{relatedTourism.tourismPhone}
+ )} +
+ ); + } else { + return ( +
+ 暂无关联景区信息 +
+ ); + } + })()} +
+ + )} + + + + {/* 操作按钮 */} +
+ 设备操作 + +
- ))} + 视频监控 + + + +
-
- - )} - -
- )} - {/* 右侧详情面板 */} - {rightPanelVisible && selectedDevice && ( -
- - - - - )} - style={{ height: '100%', overflow: 'auto' }} - > - {rightPanelCollapsed ? ( -
- -
- ) : ( - <> - {/* 设备基本信息 */} - - {selectedDevice.deviceName} - {selectedDevice.deviceSn} - {selectedDevice.deviceType} - - - {DEVICE_STATUS_CONFIG[getDeviceStatus(selectedDevice)].text} - - - {selectedDevice.loginTime} - {selectedDevice.lastUpdateTime && ( - {selectedDevice.lastUpdateTime} - )} - {selectedDevice.metrics.lastMaintenance && ( - {selectedDevice.metrics.lastMaintenance} - )} - {selectedDevice.metrics.nextMaintenance && ( - {selectedDevice.metrics.nextMaintenance} - )} - - - - - {/* 操作按钮 */} -
- 设备操作 - - - - - -
- - {/* 无人机控制面板 */} - {selectedDevice.deviceType === 1 && ( - <> - -
- 无人机控制 - - {/* 相机控制 */} -
-
相机控制
- - - - - -
- - {/* 相机模式切换 */} -
-
相机模式
- - - - - - -
- - {/* 飞行控制 */} -
-
飞行控制
- - - - - -
- - {/* 摇杆控制 */} -
-
摇杆控制
-
- 范围:0-2048,1024为中立位 + {/* 无人机控制面板 */} + {selectedDevice.deviceType === 1 && ( + <> + +
+ 无人机控制 + + {/* 相机控制 */} +
+
相机控制
+ + + + +
+ + {/* 相机模式切换 */} +
+
相机模式
+ + + + + + +
+ + {/* 飞行控制 */} +
+
飞行控制
+ + + + + +
+ + {/* 摇杆控制 */} +
+
摇杆控制
+
+ 范围:0-2048,1024为中立位 +
+ + +
Roll (左右)
+ handleStickControl(selectedDevice.deviceSn, 'roll', value)} + style={{ width: '100%' }} + /> + + +
Pitch (上下)
+ handleStickControl(selectedDevice.deviceSn, 'pitch', value)} + style={{ width: '100%' }} + /> + + +
Throttle (油门)
+ handleStickControl(selectedDevice.deviceSn, 'throttle', value)} + style={{ width: '100%' }} + /> + + +
Yaw (偏航)
+ handleStickControl(selectedDevice.deviceSn, 'yaw', value)} + style={{ width: '100%' }} + /> + +
+
+
+ + )} + + {/* 实时数据 */} +
+ 实时数据 + + +
+
电量
+
+ {selectedDevice.metrics.batteryCapacity}% +
+
+ + +
+
网络质量
+
+ {selectedDevice.metrics.networkQuality}% +
+
+ + +
+
温度
+
+ {selectedDevice.metrics.temperature}°C +
+
+ + +
+
湿度
+
+ {selectedDevice.metrics.humidity}% +
+
+ + +
+
风速
+
10 ? '#ff4d4f' : '#52c41a' }}> + {selectedDevice.metrics.windSpeed}m/s +
+
+ + +
+
降雨量
+
0 ? '#ff4d4f' : '#52c41a' }}> + {selectedDevice.metrics.rainfall}mm +
+
+ +
+
+ + {/* 设备状态信息 */} +
+ 设备状态 + + +
+
紧急停止
+
+ {selectedDevice.metrics.emergencyStopState === 1 ? '已触发' : '正常'} +
+
+ + +
+
报警状态
+
+ {selectedDevice.metrics.alarmState === 1 ? '有报警' : '正常'} +
+
+ + +
+
机盖状态
+
+ {selectedDevice.metrics.coverState === 1 ? '开启' : '关闭'} +
+
+ + +
+
静音模式
+
+ {selectedDevice.metrics.silentMode === 1 ? '开启' : '关闭'} +
+
+ + +
+
补光灯
+
+ {selectedDevice.metrics.supplementLightState === 1 ? '开启' : '关闭'} +
+
+ + +
+
空调状态
+
+ {selectedDevice.metrics.airConditionerState === 1 ? '开启' : '关闭'} +
+
+ +
+
+ + {/* 无人机特有信息 */} + {selectedDevice.deviceType === 1 && ( + <> + +
+ 飞行信息 -
Roll (左右)
- handleStickControl(selectedDevice.deviceSn, 'roll', value)} - style={{ width: '100%' }} - /> +
+
飞行模式
+
+ {selectedDevice.metrics.modeCode > 0 ? '执行中' : '待机'} +
+
-
Pitch (上下)
- handleStickControl(selectedDevice.deviceSn, 'pitch', value)} - style={{ width: '100%' }} - /> +
+
机库状态
+
+ {selectedDevice.metrics.droneInDock === 1 ? '在库' : '离库'} +
+
-
Throttle (油门)
- handleStickControl(selectedDevice.deviceSn, 'throttle', value)} - style={{ width: '100%' }} - /> +
+
位置质量
+
= 4 ? '#52c41a' : '#ff4d4f' }}> + {selectedDevice.metrics.positionQuality}/5 +
+
-
Yaw (偏航)
- handleStickControl(selectedDevice.deviceSn, 'yaw', value)} - style={{ width: '100%' }} - /> +
+
告警状态
+
0 ? '#ff4d4f' : '#52c41a' }}> + {(selectedDevice.metrics.errorCount + selectedDevice.metrics.warningCount) > 0 ? '异常' : '正常'} +
+
-
- - )} - - {/* 实时数据 */} -
- 实时数据 - - -
-
电量
-
- {selectedDevice.metrics.batteryCapacity}% -
-
- - -
-
网络质量
-
- {selectedDevice.metrics.networkQuality}% -
-
- - -
-
温度
-
- {selectedDevice.metrics.temperature}°C -
-
- - -
-
湿度
-
- {selectedDevice.metrics.humidity}% -
-
- - -
-
风速
-
10 ? '#ff4d4f' : '#52c41a' }}> - {selectedDevice.metrics.windSpeed}m/s -
-
- - -
-
降雨量
-
0 ? '#ff4d4f' : '#52c41a' }}> - {selectedDevice.metrics.rainfall}mm -
-
- -
-
- - {/* 设备状态信息 */} -
- 设备状态 - - -
-
紧急停止
-
- {selectedDevice.metrics.emergencyStopState === 1 ? '已触发' : '正常'} -
-
- - -
-
报警状态
-
- {selectedDevice.metrics.alarmState === 1 ? '有报警' : '正常'} -
-
- - -
-
机盖状态
-
- {selectedDevice.metrics.coverState === 1 ? '开启' : '关闭'} -
-
- - -
-
静音模式
-
- {selectedDevice.metrics.silentMode === 1 ? '开启' : '关闭'} -
-
- - -
-
补光灯
-
- {selectedDevice.metrics.supplementLightState === 1 ? '开启' : '关闭'} -
-
- - -
-
空调状态
-
- {selectedDevice.metrics.airConditionerState === 1 ? '开启' : '关闭'} -
-
- -
-
- - {/* 无人机特有信息 */} - {selectedDevice.deviceType === 1 && ( - <> - -
- 飞行信息 - - -
-
飞行模式
-
- {selectedDevice.metrics.modeCode > 0 ? '执行中' : '待机'} -
-
- - -
-
机库状态
-
- {selectedDevice.metrics.droneInDock === 1 ? '在库' : '离库'} -
-
- - -
-
位置质量
-
= 4 ? '#52c41a' : '#ff4d4f' }}> - {selectedDevice.metrics.positionQuality}/5 -
-
- - -
-
告警状态
-
0 ? '#ff4d4f' : '#52c41a' }}> - {(selectedDevice.metrics.errorCount + selectedDevice.metrics.warningCount) > 0 ? '异常' : '正常'} -
-
- -
-
- - )} - - {/* 维护信息 */} - {(selectedDevice.metrics.lastMaintenance || selectedDevice.metrics.nextMaintenance) && ( - <> - -
- 维护信息 - {selectedDevice.metrics.lastMaintenance && ( -
- 最后维护: - {selectedDevice.metrics.lastMaintenance} -
- )} - {selectedDevice.metrics.nextMaintenance && ( -
- 下次维护: - {selectedDevice.metrics.nextMaintenance} -
- )} -
- - )} - - - - {/* 位置信息 */} -
- 位置信息 - {selectedDevice.location ? ( -
-
纬度: {selectedDevice.location.latitude.toFixed(6)}
-
经度: {selectedDevice.location.longitude.toFixed(6)}
- {selectedDevice.location.height && ( -
高度: {selectedDevice.location.height}m
- )} -
- ) : ( -
- 暂无位置信息 -
+ )} -
- - )} - -
- )} + + {/* 维护信息 */} + {(selectedDevice.metrics.lastMaintenance || selectedDevice.metrics.nextMaintenance) && ( + <> + +
+ 维护信息 + {selectedDevice.metrics.lastMaintenance && ( +
+ 最后维护: + {selectedDevice.metrics.lastMaintenance} +
+ )} + {selectedDevice.metrics.nextMaintenance && ( +
+ 下次维护: + {selectedDevice.metrics.nextMaintenance} +
+ )} +
+ + )} + + + + {/* 位置信息 */} +
+ 位置信息 + {selectedDevice.location ? ( +
+
纬度: {selectedDevice.location.latitude.toFixed(6)}
+
经度: {selectedDevice.location.longitude.toFixed(6)}
+ {selectedDevice.location.height && ( +
高度: {selectedDevice.location.height}m
+ )} +
+ ) : ( +
+ 暂无位置信息 +
+ )} +
+ + )} + +
+ )} +
{/* 视频播放弹窗 */}