"use client" // 在文件顶部导入 useMemo import {useState} from "react" import { Badge, Button, Card, Col, Form, Input, Layout, Menu, message, Modal, Row, Select, Space, Statistic, Table, Tabs, Tag, } from "antd" import { AlertOutlined, BarChartOutlined, DashboardOutlined, DatabaseOutlined, EditOutlined, EyeOutlined, HomeOutlined, PlusOutlined, SettingOutlined } from "@ant-design/icons" import dynamic from "next/dynamic" import EChart from "@/components/echarts" import GisMapBaidu from "@/components/gisMapBaidu"; import GisMapJinggai from "@/components/GISModule/gisMapJinggai"; import PicEcharts from "@/components/GISModule/PicEcharts"; import BarChart from "@/components/GISModule/eqClassIficationEcharts"; import Dtxxdata from "@/components/GISModule/Dtxxdata"; import Sbledata from "@/components/GISModule/Sbledata"; import DbgdData from "@/components/GISModule/DbgdData"; import SbqyxxData from "@/components/GISModule/SbqyxxData"; //实时监测-实时监测一张图 import RTMMGis from "@/components/realTimeMontorModule/RTMMGis"; const {Header, Sider, Content} = Layout const {TabPane} = Tabs const {Option} = Select // 动态导入地图组件避免SSR问题 const MapView = dynamic(() => import("./components/map-view"), {ssr: false}) export default function ManholeMonitoringSystem() { const [selectedMenu, setSelectedMenu] = useState("home") const [deviceModalVisible, setDeviceModalVisible] = useState(false) const [selectedDevice, setSelectedDevice] = useState(null) const [addDeviceModalVisible, setAddDeviceModalVisible] = useState(false) const [editDeviceModalVisible, setEditDeviceModalVisible] = useState(false) const [editingDevice, setEditingDevice] = useState(null) const [devices, setDevices] = useState([ { id: 1, name: "设备001", type: "智能井盖", status: "normal", location: "朝阳区建国路", lat: 39.9042, lng: 116.4074, battery: 85, signal: 90, }, { id: 2, name: "设备002", type: "智能井盖", status: "warning", location: "海淀区中关村", lat: 39.9826, lng: 116.3186, battery: 45, signal: 75, }, { id: 3, name: "设备003", type: "智能井盖", status: "error", location: "西城区金融街", lat: 39.926, lng: 116.3663, battery: 20, signal: 60, }, { id: 4, name: "设备004", type: "智能井盖", status: "normal", location: "东城区王府井", lat: 39.9097, lng: 116.4109, battery: 92, signal: 95, }, { id: 5, name: "设备005", type: "智能井盖", status: "maintenance", location: "丰台区丽泽", lat: 39.8584, lng: 116.3135, battery: 78, signal: 80, }, ]) const [alerts, setAlerts] = useState([ { id: 1, deviceName: "设备002", type: "位移异常", level: "warning", time: "2024-01-15 14:30:25", location: "海淀区中关村", status: "pending", // pending, processed, ignored }, { id: 2, deviceName: "设备003", type: "电池电压低", level: "error", time: "2024-01-15 14:25:10", location: "西城区金融街", status: "pending", }, { id: 3, deviceName: "设备001", type: "震动异常", level: "info", time: "2024-01-15 14:20:15", location: "朝阳区建国路", status: "processed", }, ]) const [addDeviceForm] = Form.useForm() const [editDeviceForm] = Form.useForm() const handleAddDevice = (values: any) => { const newDevice = { id: devices.length + 1, name: values.name, type: values.type, status: values.status, location: values.location, lat: Number.parseFloat(values.lat), lng: Number.parseFloat(values.lng), battery: Number.parseInt(values.battery), signal: Number.parseInt(values.signal), } setDevices([...devices, newDevice]) setAddDeviceModalVisible(false) addDeviceForm.resetFields() message.success("设备添加成功!") } const handleEditDevice = (values: any) => { const updatedDevices = devices.map((device) => device.id === editingDevice.id ? { ...device, ...values, lat: Number.parseFloat(values.lat), lng: Number.parseFloat(values.lng), battery: Number.parseInt(values.battery), signal: Number.parseInt(values.signal), } : device, ) setDevices(updatedDevices) setEditDeviceModalVisible(false) setEditingDevice(null) editDeviceForm.resetFields() message.success("设备信息更新成功!") } const openEditModal = (device: any) => { setEditingDevice(device) editDeviceForm.setFieldsValue(device) setEditDeviceModalVisible(true) } const handleProcessAlert = (alertId: number) => { const updatedAlerts = alerts.map((alert) => (alert.id === alertId ? {...alert, status: "processed"} : alert)) setAlerts(updatedAlerts) message.success("报警已处理!") } const handleIgnoreAlert = (alertId: number) => { const updatedAlerts = alerts.map((alert) => (alert.id === alertId ? {...alert, status: "ignored"} : alert)) setAlerts(updatedAlerts) message.success("报警已忽略!") } // 设备状态统计 const deviceStats = { total: devices.length, normal: devices.filter((d) => d.status === "normal").length, warning: devices.filter((d) => d.status === "warning").length, error: devices.filter((d) => d.status === "error").length, maintenance: devices.filter((d) => d.status === "maintenance").length, } // 区域分布图表配置 const regionChartOption = { title: {text: "设备区域分布", left: "center"}, tooltip: {trigger: "item"}, series: [ { type: "pie", radius: "50%", data: [ {value: 1, name: "朝阳区"}, {value: 1, name: "海淀区"}, {value: 1, name: "西城区"}, {value: 1, name: "东城区"}, {value: 1, name: "丰台区"}, ], }, ], } // 设备状态分布图表配置 const statusChartOption = { title: {text: "设备状态分布", left: "center"}, tooltip: {trigger: "item"}, series: [ { type: "pie", radius: "50%", data: [ {value: deviceStats.normal, name: "正常", itemStyle: {color: "#52c41a"}}, {value: deviceStats.warning, name: "告警", itemStyle: {color: "#faad14"}}, {value: deviceStats.error, name: "故障", itemStyle: {color: "#f5222d"}}, {value: deviceStats.maintenance, name: "维修中", itemStyle: {color: "#722ed1"}}, ], }, ], } // 实时监测数据图表配置 const monitoringChartOption = { title: {text: "实时监测数据趋势", left: "center"}, tooltip: {trigger: "axis"}, legend: {data: ["倾斜角度", "位移距离", "震动强度"], top: 30}, xAxis: { type: "category", data: ["00:00", "04:00", "08:00", "12:00", "16:00", "20:00"], }, yAxis: {type: "value"}, series: [ { name: "倾斜角度", type: "line", data: [2.1, 2.3, 2.0, 2.5, 2.8, 2.4], itemStyle: {color: "#1890ff"}, }, { name: "位移距离", type: "line", data: [0.5, 0.7, 0.4, 0.9, 1.2, 0.8], itemStyle: {color: "#52c41a"}, }, { name: "震动强度", type: "line", data: [15, 18, 12, 22, 28, 20], itemStyle: {color: "#faad14"}, }, ], } const deviceColumns = [ {title: "设备编号", dataIndex: "name", key: "name"}, {title: "设备类型", dataIndex: "type", key: "type"}, { title: "运维状态", dataIndex: "status", key: "status", render: (status: string) => { const statusMap = { normal: {color: "success", text: "正常"}, warning: {color: "warning", text: "告警"}, error: {color: "error", text: "故障"}, maintenance: {color: "processing", text: "维修中"}, } const config = statusMap[status as keyof typeof statusMap] return }, }, {title: "所在位置", dataIndex: "location", key: "location"}, { title: "电池电量", dataIndex: "battery", key: "battery", render: (battery: number) => `${battery}%`, }, { title: "信号强度", dataIndex: "signal", key: "signal", render: (signal: number) => `${signal}%`, }, { title: "操作", key: "action", render: (_, record: any) => ( ), }, ] const alertColumns = [ {title: "设备名称", dataIndex: "deviceName", key: "deviceName"}, {title: "报警类型", dataIndex: "type", key: "type"}, { title: "报警级别", dataIndex: "level", key: "level", render: (level: string) => { const levelMap = { info: {color: "blue", text: "信息"}, warning: {color: "orange", text: "警告"}, error: {color: "red", text: "严重"}, } const config = levelMap[level as keyof typeof levelMap] return {config.text} }, }, {title: "报警时间", dataIndex: "time", key: "time"}, {title: "设备位置", dataIndex: "location", key: "location"}, { title: "状态", dataIndex: "status", key: "status", render: (status: string) => { const statusMap = { pending: {color: "orange", text: "待处理"}, processed: {color: "green", text: "已处理"}, ignored: {color: "gray", text: "已忽略"}, } const config = statusMap[status as keyof typeof statusMap] return {config.text} }, }, { title: "操作", key: "action", render: (_, record: any) => ( {record.status === "pending" && ( <> )} {record.status !== "pending" && 已处理} ), }, ] const renderContent = () => { switch (selectedMenu) { case "home": return (
待办工单
告警类型统计(15天内)
设备列表
{/* 修改表格容器样式,添加背景色覆盖白色区域 */}
设备区域信息
设备分类
动态信息
{/*
*/} {/* */} {/*
*/}
) case "dashboard": return (
{/* 统计卡片 */} {/* 图表展示 */} {/* 实时监测趋势 */}
) case "devices": return (
} onClick={() => setAddDeviceModalVisible(true)}> 添加设备 } > ) case "map": return (
) case "monitoring": return (
) case "alerts": return (
a.status === "pending").length} valueStyle={{color: "#faad14"}} /> a.status === "processed").length} valueStyle={{color: "#52c41a"}} /> a.status === "ignored").length} valueStyle={{color: "#d9d9d9"}} />
) case "settlement": return (
) default: return
页面开发中...
} } return (

窨井盖安全运行监测子系统

当前时间: {new Date().toLocaleString("zh-CN")}
setSelectedMenu(key)} className="h-full border-r" > }> GIS地图 }> 监控面板 }> 设备管理 {/*}>*/} {/* GIS地图*/} {/**/} }> 实时监测 }> 报警管理 }> 案件办结 {renderContent()} {/* 设备详情弹窗 */} setDeviceModalVisible(false)} footer={null} width={600} > {selectedDevice && (
设备编号: {selectedDevice.name}
设备类型: {selectedDevice.type}
所在位置: {selectedDevice.location}
运维状态:
电池电量: {selectedDevice.battery}%
信号强度: {selectedDevice.signal}%
)} {/* 添加设备弹窗 */} { setAddDeviceModalVisible(false) addDeviceForm.resetFields() }} onOk={() => addDeviceForm.submit()} width={600} >
{/* 编辑设备弹窗 */} { setEditDeviceModalVisible(false) setEditingDevice(null) editDeviceForm.resetFields() }} onOk={() => editDeviceForm.submit()} width={600} >
) }