"use client" import {useState} from "react" import dynamic from "next/dynamic" import {Button, Card, Checkbox, Col, Input, Row, Select, Space, Tabs} from "antd" import {FullscreenOutlined, PlayCircleOutlined, SearchOutlined} from "@ant-design/icons" const MapView = dynamic(() => import("./MapView"), { ssr: false, loading: () =>
地图加载中...
, }) const { Option } = Select const { TabPane } = Tabs export default function VideoMonitoring() { const [selectedVideos, setSelectedVideos] = useState([]) const [viewMode, setViewMode] = useState<"1" | "4">("4") // 模拟视频数据 const videoData = [ { id: "V001", name: "人民路积水点监控", type: "积水点", location: "人民路与南京路交叉口", status: "online", associatedDevice: "LV002", }, { id: "V002", name: "第一泵站监控", type: "泵站", location: "城东泵站", status: "online", associatedDevice: "PS001", }, { id: "V003", name: "主干道管网监控", type: "管网", location: "淮海路主干管网", status: "online", associatedDevice: "FL001", }, { id: "V004", name: "南京路积水点监控", type: "积水点", location: "南京路商业区", status: "offline", associatedDevice: "LV003", }, ] const handleVideoSelect = (videoId: string, checked: boolean) => { if (checked) { setSelectedVideos([...selectedVideos, videoId]) } else { setSelectedVideos(selectedVideos.filter((id) => id !== videoId)) } } const renderVideoGrid = () => { const gridCols = viewMode === "1" ? 1 : viewMode === "4" ? 2 : 3 const selectedVideoData = videoData.filter((video) => selectedVideos.includes(video.id)) return (
{selectedVideoData.slice(0, Number.parseInt(viewMode)).map((video) => (
) } return (
} />
{videoData.map((video) => (
handleVideoSelect(video.id, e.target.checked)} />
{video.name}
{video.location}
{video.status === "online" ? "在线" : "离线"}
))}
显示模式: } > {renderVideoGrid()}
} />
{videoData.map((video) => (
视频: {video.name}
关联设备: {video.associatedDevice}
位置: {video.location}
状态: {video.status === "online" ? "在线" : "离线"}
))}
) }