视频监控初步

This commit is contained in:
mmc
2026-05-06 17:17:36 +08:00
parent de1998a9a8
commit a7026ad690
3 changed files with 343 additions and 2 deletions

View File

@@ -527,8 +527,15 @@ export default function UserRolePage() {
pageSize={rolePagination.pageSize}
total={rolePagination.total}
showSizeChanger
pageSizeOptions={['12', '24', '36', '48', '60']}
showTotal={(t) => `共 ${t} 条`}
onChange={(p, s) => setRolePagination({ pageNum: p, pageSize: s, total: rolePagination.total })}
onChange={(page, pageSize) => {
setRolePagination({
...rolePagination,
pageNum: page,
pageSize: pageSize,
});
}}
/>
</div>
</TabPane>

View File

@@ -0,0 +1,333 @@
import { useState } from 'react';
import {
Card, Row, Col, Button, Space, Input, Select, Table, Tag, Typography, Dropdown, Menu,
Timeline
} from 'antd';
import {
VideoCameraOutlined, BellOutlined, BorderOutlined, DatabaseOutlined,
PauseOutlined, SoundOutlined, CameraOutlined, FullscreenOutlined,
DownOutlined, AlertOutlined, UserOutlined, FireOutlined, ClockCircleOutlined,
ScanOutlined, PlayCircleOutlined, DownloadOutlined
} from '@ant-design/icons';
const { Text } = Typography;
const { Option } = Select;
export default function VideoMonitorPage() {
const [camList] = useState([
{ key: '1', name: 'CAM-01', position: '1#阵列区', status: '在线', recStatus: '录制中', time: '2025-05-20 10:23:45' },
{ key: '2', name: 'CAM-02', position: '逆变器室', status: '在线', recStatus: '录制中', time: '2025-05-20 10:24:10' },
{ key: '3', name: 'CAM-03', position: '电站大门', status: '在线', recStatus: '录制中', time: '2025-05-20 10:23:58' },
{ key: '4', name: 'CAM-04', position: '周界北侧', status: '在线', recStatus: '录制中', time: '2025-05-20 10:24:01' },
{ key: '5', name: 'CAM-05', position: '气象站', status: '在线', recStatus: '录制中', time: '2025-05-20 10:24:05' },
{ key: '6', name: 'CAM-06', position: '设备区', status: '在线', recStatus: '录制中', time: '2025-05-20 10:23:50' },
{ key: '7', name: 'CAM-07', position: '储能区', status: '在线', recStatus: '录制中', time: '2025-05-20 10:23:47' },
{ key: '8', name: 'CAM-08', position: '周界南侧', status: '离线', recStatus: '停止', time: '2025-05-20 09:12:31' },
{ key: '9', name: 'CAM-09', position: '1#阵列区西侧', status: '离线', recStatus: '停止', time: '2025-05-20 08:55:02' },
]);
const camColumns = [
{ title: '摄像头名称', dataIndex: 'name', key: 'name' },
{ title: '位置', dataIndex: 'position', key: 'position' },
{
title: '状态', dataIndex: 'status', key: 'status',
render: (text) => text === '在线'
? <Tag color="green">在线</Tag>
: <Tag color="red">离线</Tag>
},
{ title: '录像状态', dataIndex: 'recStatus', key: 'recStatus' },
{ title: '最后事件时间', dataIndex: 'time', key: 'time' },
{
title: '操作', key: 'action',
render: () => (
<Space size="small">
<Button type="text" icon={<CameraOutlined />} />
</Space>
)
}
];
return (
<div className="p-4 bg-[#f5f7fa] min-h-screen">
{/* 顶部统计卡片 */}
<Row gutter={16} className="mb-4">
<Col span={4}>
<Card>
<div className="flex justify-between items-center">
<div>
<div className="text-2xl font-bold">32 台</div>
<div className="text-gray-600 mt-1">在线摄像头</div>
<div className="text-xs text-gray-500 mt-1">在线率 <span className="text-green-500">↑ 4.1%</span></div>
</div>
<VideoCameraOutlined className="text-3xl text-blue-500" />
</div>
</Card>
</Col>
<Col span={4}>
<Card>
<div className="flex justify-between items-center">
<div>
<div className="text-2xl font-bold">2 台</div>
<div className="text-gray-600 mt-1">离线摄像头</div>
<div className="text-xs text-gray-500 mt-1">离线率 <span className="text-red-500">↑ 5.9%</span></div>
</div>
<VideoCameraOutlined className="text-3xl text-gray-400" />
</div>
</Card>
</Col>
<Col span={4}>
<Card>
<div className="flex justify-between items-center">
<div>
<div className="text-2xl font-bold">6 起</div>
<div className="text-gray-600 mt-1">今日告警事件</div>
<div className="text-xs text-gray-500 mt-1">较昨日 <span className="text-red-500">↑ 50%</span></div>
</div>
<BellOutlined className="text-3xl text-orange-500" />
</div>
</Card>
</Col>
<Col span={4}>
<Card>
<div className="flex justify-between items-center">
<div>
<div className="text-2xl font-bold">2 起</div>
<div className="text-gray-600 mt-1">周界告警</div>
<div className="text-xs text-gray-500 mt-1">较昨日 <span className="text-red-500">↑ 100%</span></div>
</div>
<BorderOutlined className="text-3xl text-red-500" />
</div>
</Card>
</Col>
<Col span={4}>
<Card>
<div className="flex justify-between items-center">
<div>
<div className="text-2xl font-bold">78.6TB</div>
<div className="text-gray-600 mt-1">存储使用率</div>
<div className="text-xs text-gray-500 mt-1">使用率 <span className="text-green-500">65.5%</span></div>
</div>
<DatabaseOutlined className="text-3xl text-blue-500" />
</div>
</Card>
</Col>
</Row>
{/* 视频区域 + AI分析 */}
<Row gutter={16} className="mb-4">
<Col span={18}>
<Card title="视频监控中心" extra={
<Space>
<Button type="link">自定义布局</Button>
<Button type="link">全屏</Button>
</Space>
}>
<div className="flex gap-4">
<div className="flex-1 relative rounded overflow-hidden">
<img
src="https://picsum.photos/id/10/1200/500"
className="w-full h-[400px] object-cover"
alt="video"
/>
<div className="absolute top-0 left-0 w-full p-2 bg-gradient-to-b from-black/60 to-transparent text-white">
<div className="font-bold">主画面:1#阵列区球机</div>
<div className="text-xs opacity-80">2025-05-20 10:24:15</div>
</div>
<div className="absolute bottom-0 w-full p-2 bg-gradient-to-t from-black/60 to-transparent">
<Space>
<Button type="text" icon={<PauseOutlined />} className="text-white" />
<Button type="text" icon={<SoundOutlined />} className="text-white" />
{/* 这里也换成 CameraOutlined */}
<Button type="text" icon={<CameraOutlined />} className="text-white" />
<Button type="text" icon={<FullscreenOutlined />} className="text-white" />
<Dropdown overlay={
<Menu>
<Menu.Item>超清</Menu.Item>
<Menu.Item>高清</Menu.Item>
<Menu.Item>标清</Menu.Item>
</Menu>
}>
<Button type="text" className="text-white">高清 <DownOutlined /></Button>
</Dropdown>
</Space>
</div>
</div>
<div className="w-[220px] grid grid-cols-2 gap-2">
{[11, 12, 13, 14, 15, 16].map((id) => (
<div key={id} className="relative rounded overflow-hidden">
<img src={`https://picsum.photos/id/${id}/200/100`} className="w-full h-[70px] object-cover" />
<div className="absolute bottom-1 right-1 text-xs bg-black/60 text-white px-1 rounded">直播中</div>
</div>
))}
</div>
</div>
</Card>
</Col>
<Col span={6}>
<Card title="AI视频智能分析" extra={<Button type="link">设置</Button>}>
<div className="space-y-4">
<div className="flex items-center gap-3">
<div className="w-8 h-8 rounded-full bg-red-100 flex items-center justify-center text-red-500">
<AlertOutlined />
</div>
<div className="flex-1">
<div className="font-medium">周界入侵检测</div>
<div className="text-xs text-gray-500">识别翻越、攀爬、破坏围栏</div>
</div>
<div className="text-red-500 font-bold">2</div>
</div>
<div className="flex items-center gap-3">
<div className="w-8 h-8 rounded-full bg-blue-100 flex items-center justify-center text-blue-500">
<UserOutlined />
</div>
<div className="flex-1">
<div className="font-medium">人员闯入</div>
<div className="text-xs text-gray-500">识别未经授权人员进入</div>
</div>
<div className="text-red-500 font-bold">1</div>
</div>
<div className="flex items-center gap-3">
<div className="w-8 h-8 rounded-full bg-orange-100 flex items-center justify-center text-orange-500">
<FireOutlined />
</div>
<div className="flex-1">
<div className="font-medium">烟火识别</div>
<div className="text-xs text-gray-500">识别烟雾、明火等异常</div>
</div>
<div className="text-green-500 font-bold">0</div>
</div>
<div className="flex items-center gap-3">
<div className="w-8 h-8 rounded-full bg-yellow-100 flex items-center justify-center text-yellow-600">
<ClockCircleOutlined />
</div>
<div className="flex-1">
<div className="font-medium">设备区域滞留</div>
<div className="text-xs text-gray-500">识别人员超时停留</div>
</div>
<div className="text-red-500 font-bold">1</div>
</div>
<div className="flex items-center gap-3">
<div className="w-8 h-8 rounded-full bg-purple-100 flex items-center justify-center text-purple-500">
<ScanOutlined />
</div>
<div className="flex-1">
<div className="font-medium">运动检测</div>
<div className="text-xs text-gray-500">识别画面异常运动</div>
</div>
<div className="text-red-500 font-bold">2</div>
</div>
</div>
</Card>
</Col>
</Row>
{/* 底部:摄像头列表 + 时间线 + 告警快照 */}
<Row gutter={16}>
<Col span={10}>
<Card
title="摄像头设备列表"
extra={
<Space>
<Input.Search placeholder="搜索摄像头" style={{ width: 200 }} />
<Select defaultValue="all" style={{ width: 120 }}>
<Option value="all">全部状态</Option>
<Option value="online">在线</Option>
<Option value="offline">离线</Option>
</Select>
</Space>
}
>
<Table
columns={camColumns}
dataSource={camList}
pagination={false}
size="small"
scroll={{ y: 320 }}
/>
</Card>
</Col>
<Col span={7}>
<Card
title="事件时间线"
extra={
<Select defaultValue="all" style={{ width: 120 }}>
<Select.Option value="all">全部类型</Select.Option>
<Select.Option value="perimeter">周界入侵</Select.Option>
<Select.Option value="intrusion">人员闯入</Select.Option>
</Select>
}
>
{/* 左右交替时间轴 */}
<Timeline mode="alternate" style={{ marginTop: 10 }}>
<Timeline.Item color="red">
<div className="text-xs text-gray-500">10:23:41</div>
<div className="font-medium text-sm mt-1">周界入侵检测</div>
<div className="text-xs text-gray-500 mt-1">周界北侧区域检测到翻越围栏事件</div>
</Timeline.Item>
<Timeline.Item color="orange">
<div className="text-xs text-gray-500">10:18:09</div>
<div className="font-medium text-sm mt-1">人员闯入</div>
<div className="text-xs text-gray-500 mt-1">设备区检测到人员闯入</div>
</Timeline.Item>
<Timeline.Item color="orange">
<div className="text-xs text-gray-500">10:05:33</div>
<div className="font-medium text-sm mt-1">设备区域滞留</div>
<div className="text-xs text-gray-500 mt-1">逆变器区人员滞留超过5分钟</div>
</Timeline.Item>
<Timeline.Item color="blue">
<div className="text-xs text-gray-500">09:52:17</div>
<div className="font-medium text-sm mt-1">运动检测</div>
<div className="text-xs text-gray-500 mt-1">气象站区域检测到异常运动</div>
</Timeline.Item>
<Timeline.Item color="red">
<div className="text-xs text-gray-500">09:41:28</div>
<div className="font-medium text-sm mt-1">周界入侵检测</div>
<div className="text-xs text-gray-500 mt-1">周界南侧区域检测到攀爬事件</div>
</Timeline.Item>
</Timeline>
<div className="text-center mt-4">
<Button type="link">查看更多</Button>
</div>
</Card>
</Col>
<Col span={7}>
<Card title="最近告警快照" extra={<Button type="link">查看更多</Button>}>
<div className="space-y-3">
{[20, 21, 22, 23].map((id) => (
<div key={id} className="flex gap-2 items-center">
<img src={`https://picsum.photos/id/${id}/120/70`} className="w-[120px] h-[70px] object-cover rounded" />
<div className="flex-1">
<div className="font-medium text-sm">告警事件</div>
<div className="text-xs text-gray-500">2025-05-20 10:23</div>
</div>
<Space>
<Button type="text" icon={<PlayCircleOutlined />} />
<Button type="text" icon={<DownloadOutlined />} />
</Space>
</div>
))}
</div>
</Card>
</Col>
</Row>
</div>
);
}

View File

@@ -1,6 +1,7 @@
import React, { lazy, Suspense } from 'react';
import { createBrowserRouter } from 'react-router-dom';
import type { RouteObject } from 'react-router-dom';
import VideoMonitorPage from '../pages/VideoMonitorPage';
const Layout = lazy(() => import('../components/Layout'));
const ProtectedRoute = lazy(() => import('../components/ProtectedRoute'));
@@ -79,7 +80,7 @@ const routes: RouteObject[] = [
{ path: 'overview', element: <Home /> },
{ path: 'devices', element: <Devices /> },
{ path: 'video', element: <Video /> },
{ path: 'monitor', element: <Video /> },
{ path: 'monitor', element: <VideoMonitorPage /> },
{ path: 'alerts', element: <Alerts /> },
{ path: 'AIanalysis', element: <div>AI诊断分析</div> },
{ path: 'clean', element: <div>清洗优化</div> },