告警详情和 总览界面 修改 布局调整
This commit is contained in:
@@ -1,208 +1,208 @@
|
||||
import React, { useState } from 'react';
|
||||
import {
|
||||
Row,
|
||||
Col,
|
||||
Card,
|
||||
Button,
|
||||
Tag,
|
||||
Typography,
|
||||
Space,
|
||||
Tooltip,
|
||||
List,
|
||||
Avatar,
|
||||
Select,
|
||||
Divider,
|
||||
import {
|
||||
Row,
|
||||
Col,
|
||||
Card,
|
||||
Button,
|
||||
Tag,
|
||||
Typography,
|
||||
Space,
|
||||
Tooltip,
|
||||
List,
|
||||
Avatar,
|
||||
Select,
|
||||
Divider,
|
||||
} from 'antd';
|
||||
import {
|
||||
CaretUpOutlined,
|
||||
CaretDownOutlined,
|
||||
CaretLeftOutlined,
|
||||
CaretRightOutlined,
|
||||
FullscreenOutlined,
|
||||
ReloadOutlined,
|
||||
MonitorOutlined,
|
||||
VideoCameraOutlined,
|
||||
ThunderboltOutlined,
|
||||
CustomerServiceOutlined,
|
||||
AlertOutlined,
|
||||
EyeOutlined
|
||||
import {
|
||||
CaretUpOutlined,
|
||||
CaretDownOutlined,
|
||||
CaretLeftOutlined,
|
||||
CaretRightOutlined,
|
||||
FullscreenOutlined,
|
||||
ReloadOutlined,
|
||||
MonitorOutlined,
|
||||
VideoCameraOutlined,
|
||||
ThunderboltOutlined,
|
||||
CustomerServiceOutlined,
|
||||
AlertOutlined,
|
||||
EyeOutlined
|
||||
} from '@ant-design/icons';
|
||||
import { DEVICES } from '../constants';
|
||||
|
||||
const { Text, Title } = Typography;
|
||||
|
||||
function cn(...classes: string[]) {
|
||||
return classes.filter(Boolean).join(' ');
|
||||
return classes.filter(Boolean).join(' ');
|
||||
}
|
||||
|
||||
export default function VideoControl() {
|
||||
const [selectedDevice, setSelectedDevice] = useState(DEVICES[0]);
|
||||
const onlineDevices = DEVICES.filter(d => d.status === 'online' || d.status === 'alert');
|
||||
const [selectedDevice, setSelectedDevice] = useState(DEVICES[0]);
|
||||
const onlineDevices = DEVICES.filter(d => d.status === 'online' || d.status === 'alert');
|
||||
|
||||
const getVideoConfig = (type: string) => {
|
||||
switch (type) {
|
||||
case '安防型':
|
||||
return {
|
||||
count: 4,
|
||||
labels: ['Front/主前', 'Back/后视', 'Left/左侧', 'Right/右侧'],
|
||||
gridClass: 'grid-cols-2 grid-rows-2'
|
||||
};
|
||||
case '运输型':
|
||||
return {
|
||||
count: 5,
|
||||
labels: ['Front/前驱', 'Back/后置', 'Left/左翼', 'Right/右翼', 'Cargo/货舱'],
|
||||
gridClass: 'grid-cols-4 grid-rows-2'
|
||||
};
|
||||
case '巡检型':
|
||||
default:
|
||||
return {
|
||||
count: 3,
|
||||
labels: ['Main/主探', 'Pan/全景', 'Detail/细节'],
|
||||
gridClass: 'grid-cols-2 grid-rows-2'
|
||||
};
|
||||
}
|
||||
};
|
||||
const getVideoConfig = (type: string) => {
|
||||
switch (type) {
|
||||
case '安防型':
|
||||
return {
|
||||
count: 4,
|
||||
labels: ['Front/主前', 'Back/后视', 'Left/左侧', 'Right/右侧'],
|
||||
gridClass: 'grid-cols-2 grid-rows-2'
|
||||
};
|
||||
case '运输型':
|
||||
return {
|
||||
count: 5,
|
||||
labels: ['Front/前驱', 'Back/后置', 'Left/左翼', 'Right/右翼', 'Cargo/货舱'],
|
||||
gridClass: 'grid-cols-4 grid-rows-2'
|
||||
};
|
||||
case '巡检型':
|
||||
default:
|
||||
return {
|
||||
count: 3,
|
||||
labels: ['Main/主探', 'Pan/全景', 'Detail/细节'],
|
||||
gridClass: 'grid-cols-2 grid-rows-2'
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
const config = getVideoConfig(selectedDevice.type);
|
||||
const config = getVideoConfig(selectedDevice.type);
|
||||
|
||||
return (
|
||||
<Row gutter={16} className="h-full overflow-hidden" style={{ minHeight: 0 }}>
|
||||
{/* Video Content */}
|
||||
<Col flex="auto" className="h-full flex flex-col gap-4 overflow-hidden">
|
||||
{/* Top Control Bar */}
|
||||
<div className="flex items-center justify-between bg-white p-3 rounded shadow-sm border border-gray-100">
|
||||
<Space size="large">
|
||||
<div className="flex flex-col">
|
||||
<Text type="secondary" style={{ fontSize: 10, textTransform: 'uppercase', letterSpacing: 1 }}>当前执勤设备</Text>
|
||||
<Select
|
||||
value={selectedDevice.id}
|
||||
onChange={(id) => setSelectedDevice(onlineDevices.find(d => d.id === id)!)}
|
||||
style={{ width: 220, fontWeight: 'bold' }}
|
||||
bordered={false}
|
||||
options={onlineDevices.map(d => ({ label: d.name, value: d.id }))}
|
||||
suffixIcon={<VideoCameraOutlined style={{ color: '#1890ff' }} />}
|
||||
/>
|
||||
</div>
|
||||
<Divider type="vertical" style={{ height: 32 }} />
|
||||
<div className="flex flex-col">
|
||||
<Text type="secondary" style={{ fontSize: 10, textTransform: 'uppercase', letterSpacing: 1 }}>视频流路数</Text>
|
||||
<Tag color="processing" style={{ marginTop: 2, fontWeight: 'bold', fontFamily: 'monospace' }}>
|
||||
{config.count} CHANNELS ACTIVE
|
||||
</Tag>
|
||||
</div>
|
||||
</Space>
|
||||
<Space>
|
||||
<Button size="small" icon={<ReloadOutlined />}>刷新信号</Button>
|
||||
<Button size="small" type="primary" ghost>全屏墙</Button>
|
||||
</Space>
|
||||
</div>
|
||||
return (
|
||||
<Row gutter={16} className="h-full overflow-hidden" style={{ minHeight: 0 }}>
|
||||
{/* Video Content */}
|
||||
<Col flex="auto" className="h-full flex flex-col gap-4 overflow-hidden">
|
||||
{/* Top Control Bar */}
|
||||
<div className="flex items-center justify-between bg-white p-3 rounded shadow-sm border border-gray-100">
|
||||
<Space size="large">
|
||||
<div className="flex flex-col">
|
||||
<Text type="secondary" style={{ fontSize: 10, textTransform: 'uppercase', letterSpacing: 1 }}>当前执勤设备</Text>
|
||||
<Select
|
||||
value={selectedDevice.id}
|
||||
onChange={(id) => setSelectedDevice(onlineDevices.find(d => d.id === id)!)}
|
||||
style={{ width: 220, fontWeight: 'bold' }}
|
||||
variant={false}
|
||||
options={onlineDevices.map(d => ({ label: d.name, value: d.id }))}
|
||||
suffixIcon={<VideoCameraOutlined style={{ color: '#1890ff' }} />}
|
||||
/>
|
||||
</div>
|
||||
<Divider type="vertical" style={{ height: 32 }} />
|
||||
<div className="flex flex-col">
|
||||
<Text type="secondary" style={{ fontSize: 10, textTransform: 'uppercase', letterSpacing: 1 }}>视频流路数</Text>
|
||||
<Tag color="processing" style={{ marginTop: 2, fontWeight: 'bold', fontFamily: 'monospace' }}>
|
||||
{config.count} CHANNELS ACTIVE
|
||||
</Tag>
|
||||
</div>
|
||||
</Space>
|
||||
<Space>
|
||||
<Button size="small" icon={<ReloadOutlined />}>刷新信号</Button>
|
||||
<Button size="small" type="primary" ghost>全屏墙</Button>
|
||||
</Space>
|
||||
</div>
|
||||
|
||||
{/* Multi-Video Grid */}
|
||||
<div className={cn(
|
||||
"bg-black rounded border border-gray-800 p-1 gap-1 flex-1 overflow-hidden grid",
|
||||
config.gridClass
|
||||
)}>
|
||||
{Array.from({ length: config.count }).map((_, idx) => (
|
||||
<div
|
||||
key={idx}
|
||||
className={cn(
|
||||
"relative bg-gray-900 overflow-hidden flex items-center justify-center group border border-white/5",
|
||||
config.count === 3 && idx === 0 && "col-span-2",
|
||||
config.count === 5 && idx === 0 && "col-span-2 row-span-2"
|
||||
)}
|
||||
>
|
||||
<img
|
||||
src={`https://picsum.photos/seed/${selectedDevice.id}_cam${idx}/640/360`}
|
||||
alt={`Camera ${idx}`}
|
||||
className="w-full h-full object-cover opacity-60 group-hover:opacity-100 transition-opacity"
|
||||
/>
|
||||
<div className="absolute top-2 left-2 bg-black/60 text-white px-2 py-0.5 text-[10px] rounded-sm backdrop-blur-sm flex items-center gap-2 border border-white/10 uppercase font-mono">
|
||||
<div className="w-1.5 h-1.5 rounded-full bg-red-500 animate-pulse shadow-[0_0_8px_rgba(239,68,68,0.8)]" />
|
||||
CAM-0{idx + 1} | {config.labels[idx]}
|
||||
</div>
|
||||
|
||||
<div className="absolute inset-0 bg-blue-500/10 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center pointer-events-none">
|
||||
<Button shape="circle" icon={<FullscreenOutlined />} className="pointer-events-auto shadow-2xl" />
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
{/* Multi-Video Grid */}
|
||||
<div className={cn(
|
||||
"bg-black rounded border border-gray-800 p-1 gap-1 flex-1 overflow-hidden grid",
|
||||
config.gridClass
|
||||
)}>
|
||||
{Array.from({ length: config.count }).map((_, idx) => (
|
||||
<div
|
||||
key={idx}
|
||||
className={cn(
|
||||
"relative bg-gray-900 overflow-hidden flex items-center justify-center group border border-white/5",
|
||||
config.count === 3 && idx === 0 && "col-span-2",
|
||||
config.count === 5 && idx === 0 && "col-span-2 row-span-2"
|
||||
)}
|
||||
>
|
||||
<img
|
||||
src={`https://picsum.photos/seed/${selectedDevice.id}_cam${idx}/640/360`}
|
||||
alt={`Camera ${idx}`}
|
||||
className="w-full h-full object-cover opacity-60 group-hover:opacity-100 transition-opacity"
|
||||
/>
|
||||
<div className="absolute top-2 left-2 bg-black/60 text-white px-2 py-0.5 text-[10px] rounded-sm backdrop-blur-sm flex items-center gap-2 border border-white/10 uppercase font-mono">
|
||||
<div className="w-1.5 h-1.5 rounded-full bg-red-500 animate-pulse shadow-[0_0_8px_rgba(239,68,68,0.8)]" />
|
||||
CAM-0{idx + 1} | {config.labels[idx]}
|
||||
</div>
|
||||
|
||||
{/* Console Controls */}
|
||||
<Card size="small" styles={{ body: { padding: 12 } }}>
|
||||
<Row gutter={16} align="middle">
|
||||
<Col flex="0 0 160px" style={{ borderRight: '1px solid #f0f0f0', paddingRight: 24 }}>
|
||||
<Text strong type="secondary" style={{ fontSize: 10, textTransform: 'uppercase', display: 'block', textAlign: 'center', marginBottom: 8 }}>PTZ 舵机控制</Text>
|
||||
<div className="flex flex-col items-center gap-1">
|
||||
<Button type="text" size="small" icon={<CaretUpOutlined />} />
|
||||
<Space>
|
||||
<Button type="text" size="small" icon={<CaretLeftOutlined />} />
|
||||
<div className="w-4 h-4 rounded-full bg-blue-500 shadow-[0_0_8px_rgba(24,144,255,0.8)]" />
|
||||
<Button type="text" size="small" icon={<CaretRightOutlined />} />
|
||||
</Space>
|
||||
<Button type="text" size="small" icon={<CaretDownOutlined />} />
|
||||
</div>
|
||||
</Col>
|
||||
|
||||
<Col flex="auto">
|
||||
<div className="flex items-center justify-between mb-4">
|
||||
<Text strong type="secondary" style={{ fontSize: 10, textTransform: 'uppercase' }}>系统集成作业指令 ({selectedDevice.type})</Text>
|
||||
<Tag color="success" bordered={false} style={{ fontSize: 10, fontWeight: 'bold' }}>SIGNAL: 100% EXCELLENT</Tag>
|
||||
</div>
|
||||
<Space className="w-full" size="middle">
|
||||
<Button icon={<CustomerServiceOutlined />} style={{ borderRadius: 2 }} block>双轴双向对讲</Button>
|
||||
<Button danger icon={<AlertOutlined />} style={{ borderRadius: 2 }} block>触发远程驱逐</Button>
|
||||
<Button type="primary" icon={<EyeOutlined />} style={{ borderRadius: 2 }} block>AI 视觉追踪锁定</Button>
|
||||
</Space>
|
||||
</Col>
|
||||
</Row>
|
||||
</Card>
|
||||
</Col>
|
||||
<div className="absolute inset-0 bg-blue-500/10 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center pointer-events-none">
|
||||
<Button shape="circle" icon={<FullscreenOutlined />} className="pointer-events-auto shadow-2xl" />
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
{/* Sidebar Channels */}
|
||||
<Col flex="0 0 260px" className="h-full">
|
||||
<Card
|
||||
title={<Space><MonitorOutlined /><Text strong style={{ fontSize: 13 }}>活跃视频流 ({onlineDevices.length})</Text></Space>}
|
||||
extra={<Button type="text" size="small" icon={<ReloadOutlined />} />}
|
||||
styles={{ body: { padding: 0 } }}
|
||||
className="h-full flex flex-col overflow-hidden"
|
||||
>
|
||||
<div className="flex-1 overflow-y-auto">
|
||||
<List
|
||||
dataSource={onlineDevices}
|
||||
renderItem={(device) => (
|
||||
<List.Item
|
||||
onClick={() => setSelectedDevice(device)}
|
||||
className={cn(
|
||||
"px-4 py-3 cursor-pointer transition-colors border-b last:border-0",
|
||||
selectedDevice.id === device.id ? "bg-blue-50 border-l-4 border-l-blue-500" : "hover:bg-gray-50 border-l-4 border-l-transparent"
|
||||
)}
|
||||
>
|
||||
<List.Item.Meta
|
||||
avatar={
|
||||
<div className={cn("w-12 h-12 rounded overflow-hidden border", selectedDevice.id === device.id ? "border-blue-300" : "border-gray-200")}>
|
||||
<img src={`https://picsum.photos/seed/${device.id}/80/80`} className="w-full h-full object-cover" />
|
||||
</div>
|
||||
}
|
||||
title={
|
||||
<Text strong style={{ fontSize: 13, color: selectedDevice.id === device.id ? '#1890ff' : 'inherit' }}>
|
||||
{device.name}
|
||||
</Text>
|
||||
}
|
||||
description={
|
||||
<Space size={4} style={{ fontSize: 10 }}>
|
||||
<Text type="secondary" style={{ fontFamily: 'monospace' }}>{device.id}</Text>
|
||||
<div className={cn("w-2 h-2 rounded-full", device.status === 'alert' ? "bg-red-500" : "bg-green-500")} />
|
||||
<Text type="secondary" italic>{device.type}</Text>
|
||||
</Space>
|
||||
}
|
||||
/>
|
||||
</List.Item>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
</Card>
|
||||
</Col>
|
||||
</Row>
|
||||
);
|
||||
{/* Console Controls */}
|
||||
<Card size="small" styles={{ body: { padding: 12 } }}>
|
||||
<Row gutter={16} align="middle">
|
||||
<Col flex="0 0 160px" style={{ borderRight: '1px solid #f0f0f0', paddingRight: 24 }}>
|
||||
<Text strong type="secondary" style={{ fontSize: 10, textTransform: 'uppercase', display: 'block', textAlign: 'center', marginBottom: 8 }}>PTZ 舵机控制</Text>
|
||||
<div className="flex flex-col items-center gap-1">
|
||||
<Button type="text" size="small" icon={<CaretUpOutlined />} />
|
||||
<Space>
|
||||
<Button type="text" size="small" icon={<CaretLeftOutlined />} />
|
||||
<div className="w-4 h-4 rounded-full bg-blue-500 shadow-[0_0_8px_rgba(24,144,255,0.8)]" />
|
||||
<Button type="text" size="small" icon={<CaretRightOutlined />} />
|
||||
</Space>
|
||||
<Button type="text" size="small" icon={<CaretDownOutlined />} />
|
||||
</div>
|
||||
</Col>
|
||||
|
||||
<Col flex="auto">
|
||||
<div className="flex items-center justify-between mb-4">
|
||||
<Text strong type="secondary" style={{ fontSize: 10, textTransform: 'uppercase' }}>系统集成作业指令 ({selectedDevice.type})</Text>
|
||||
<Tag color="success" variant={false} style={{ fontSize: 10, fontWeight: 'bold' }}>SIGNAL: 100% EXCELLENT</Tag>
|
||||
</div>
|
||||
<Space className="w-full" size="middle">
|
||||
<Button icon={<CustomerServiceOutlined />} style={{ borderRadius: 2 }} block>双轴双向对讲</Button>
|
||||
<Button danger icon={<AlertOutlined />} style={{ borderRadius: 2 }} block>触发远程驱逐</Button>
|
||||
<Button type="primary" icon={<EyeOutlined />} style={{ borderRadius: 2 }} block>AI 视觉追踪锁定</Button>
|
||||
</Space>
|
||||
</Col>
|
||||
</Row>
|
||||
</Card>
|
||||
</Col>
|
||||
|
||||
{/* Sidebar Channels */}
|
||||
<Col flex="0 0 260px" className="h-full">
|
||||
<Card
|
||||
title={<Space><MonitorOutlined /><Text strong style={{ fontSize: 13 }}>活跃视频流 ({onlineDevices.length})</Text></Space>}
|
||||
extra={<Button type="text" size="small" icon={<ReloadOutlined />} />}
|
||||
styles={{ body: { padding: 0 } }}
|
||||
className="h-full flex flex-col overflow-hidden"
|
||||
>
|
||||
<div className="flex-1 overflow-y-auto">
|
||||
<List
|
||||
dataSource={onlineDevices}
|
||||
renderItem={(device) => (
|
||||
<List.Item
|
||||
onClick={() => setSelectedDevice(device)}
|
||||
className={cn(
|
||||
"px-4 py-3 cursor-pointer transition-colors border-b last:border-0",
|
||||
selectedDevice.id === device.id ? "bg-blue-50 border-l-4 border-l-blue-500" : "hover:bg-gray-50 border-l-4 border-l-transparent"
|
||||
)}
|
||||
>
|
||||
<List.Item.Meta
|
||||
avatar={
|
||||
<div className={cn("w-12 h-12 rounded overflow-hidden border", selectedDevice.id === device.id ? "border-blue-300" : "border-gray-200")}>
|
||||
<img src={`https://picsum.photos/seed/${device.id}/80/80`} className="w-full h-full object-cover" />
|
||||
</div>
|
||||
}
|
||||
title={
|
||||
<Text strong style={{ fontSize: 13, color: selectedDevice.id === device.id ? '#1890ff' : 'inherit' }}>
|
||||
{device.name}
|
||||
</Text>
|
||||
}
|
||||
description={
|
||||
<Space size={4} style={{ fontSize: 10 }}>
|
||||
<Text type="secondary" style={{ fontFamily: 'monospace' }}>{device.id}</Text>
|
||||
<div className={cn("w-2 h-2 rounded-full", device.status === 'alert' ? "bg-red-500" : "bg-green-500")} />
|
||||
<Text type="secondary" italic>{device.type}</Text>
|
||||
</Space>
|
||||
}
|
||||
/>
|
||||
</List.Item>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
</Card>
|
||||
</Col>
|
||||
</Row>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user