"use client" import type React from "react" import {useState} from "react" import {Badge, Button, Descriptions, Layout, List, Menu, Modal, Space, Switch, Tag} from "antd" import { AlertOutlined, BellOutlined, CheckCircleOutlined, ClockCircleOutlined, DashboardOutlined, DatabaseOutlined, ExclamationCircleOutlined, MenuFoldOutlined, MenuUnfoldOutlined, MonitorOutlined, MoonOutlined, SunOutlined, } from "@ant-design/icons" import globalMessage from "@/app/_modules/globalMessage"; const { Header, Sider, Content } = Layout interface AdminLayoutProps { children: React.ReactNode activeKey?: string onMenuSelect?: (key: string) => void } export default function AdminLayout({ children, activeKey = "dashboard", onMenuSelect }: AdminLayoutProps) { const [collapsed, setCollapsed] = useState(false) const [isDarkMode, setIsDarkMode] = useState(false) const [notificationModalVisible, setNotificationModalVisible] = useState(false) const [emergencyModalVisible, setEmergencyModalVisible] = useState(false) const menuItems = [ { key: "dashboard", icon: , label: "系统概览" }, { key: "facilities", icon: , label: "基础数据管理" }, { key: "devices", icon: , label: "监测设备管理" }, { key: "monitoring", icon: , label: "运行监测" }, { key: "alarms", icon: , label: "监测报警" }, ] const notifications = [ { id: 1, title: "设备维护提醒", content: "岳麓区泵站#001需要进行定期维护", time: "2024-01-15 14:30", type: "info", read: false }, { id: 2, title: "数据同步完成", content: "今日监测数据已成功同步至中央数据库", time: "2024-01-15 12:00", type: "success", read: true }, { id: 3, title: "系统更新通知", content: "监测系统将于今晚22:00进行版本更新", time: "2024-01-15 10:15", type: "warning", read: false }, { id: 4, title: "月度报告生成", content: "12月份供水监测月度报告已生成完成", time: "2024-01-14 16:45", type: "info", read: true }, { id: 5, title: "新设备接入", content: "五一大道新增3台流量监测设备已成功接入系统", time: "2024-01-14 09:20", type: "success", read: false }, ] const emergencyAlarms = [ { id: 1, location: "湘江水源地取水口", type: "水质异常", level: "高", description: "检测到浊度超标,当前值:15.2 NTU,标准值:≤10 NTU", time: "2024-01-15 15:45", status: "处理中" }, { id: 2, location: "长沙第一水厂", type: "压力异常", level: "中", description: "出厂压力偏低,当前值:0.25 MPa,标准值:≥0.3 MPa", time: "2024-01-15 14:20", status: "待处理" }, { id: 3, location: "岳麓区主管网", type: "流量异常", level: "高", description: "检测到异常流量波动,疑似管道破裂", time: "2024-01-15 13:10", status: "已处理" }, ] const getNotificationIcon = (type: string) => { switch (type) { case "success": return case "warning": return default: return } } const getAlarmLevelColor = (level: string) => { switch (level) { case "高": return "red" case "中": return "orange" case "低": return "yellow" default: return "default" } } const getStatusColor = (status: string) => { switch (status) { case "已处理": return "green" case "处理中": return "blue" case "待处理": return "red" default: return "default" } } return ( {/* 固定侧边栏 */}
{collapsed ? "供水" : "供水管网监测系统"}
onMenuSelect?.(key)} style={{ background: "transparent", border: "none" }} className="mt-4" /> {/* 右侧内容区 */}
{children}
{/* 系统通知 Modal */} 系统通知 } open={notificationModalVisible} onCancel={() => setNotificationModalVisible(false)} footer={[ , , ]} width={600} > ( {item.title} {!item.read && 未读} } description={

{item.content}

{item.time}
} />
)} />
{/* 紧急报警 Modal */} 紧急报警处理 } open={emergencyModalVisible} onCancel={() => setEmergencyModalVisible(false)} footer={[ , , ]} width={800} > (
{item.level}级报警 {item.status}
{item.time}
{item.location} {item.type} {item.description}
)} />
) }