import React, { useState, useEffect } from 'react'; import { OverallPromise } from '../../../../models/_/real'; import useRequest from '../../../../utils/useRequest'; import PanelBox from '../../components/PanelBox'; import OverallContent from './OverallContent'; import { makeStyles } from '@material-ui/core/styles'; import { Box, Typography, Checkbox, FormControlLabel, ButtonGroup, Button, Table, TableBody, TableCell, TableContainer, TableHead, TableRow, IconButton, Collapse, Paper } from '@material-ui/core'; // import AddIcon from '@material-ui/icons/Add'; import RemoveIcon from '@material-ui/icons/Remove'; import WarningIcon from '@material-ui/icons/Warning'; import AddIcon from '@material-ui/icons/Add'; import { DatePicker } from 'antd'; import moment from 'moment'; const { RangePicker } = DatePicker; const useStyles = makeStyles((theme) => ({ root: { color: '#fff' }, table: { '& .MuiTableCell-root': { color: '#fff', borderBottom: '1px solid rgba(255, 255, 255, 0.1)' } }, warningRow: { '&.immediate': { backgroundColor: '#d32f2f' }, '&.prepare': { backgroundColor: '#ed6c02' } }, expandIcon: { marginRight: theme.spacing(1), fontSize: 20, cursor: 'pointer', transition: 'transform 0.3s', '&.expanded': { transform: 'rotate(180deg)' } }, warningCount: { marginLeft: theme.spacing(1) }, expandedContent: { backgroundColor: 'rgba(0, 0, 0, 0.2)', padding: theme.spacing(2) }, statsSection: { marginTop: theme.spacing(4) }, statsTitle: { color: '#1976d2', marginBottom: theme.spacing(3) }, warningStats: { display: 'flex', justifyContent: 'space-around', marginTop: theme.spacing(2) }, statItem: { display: 'flex', flexDirection: 'column', alignItems: 'center' }, warningIcon: { fontSize: 40, marginBottom: theme.spacing(1), '&.immediate': { color: '#d32f2f' }, '&.prepare': { color: '#ed6c02' } } })); export default function Overall({ style }) { const classes = useStyles(); const [timeRange, setTimeRange] = useState('1h'); const [expanded, setExpanded] = useState({}); const warningData = [ { type: 'immediate', label: '立即转移', count: 0, details: [] // 这里可以添加详细信息的数组 }, { type: 'prepare', label: '准备转移', count: 0, details: [] // 这里可以添加详细信息的数组 } ]; const handleExpand = (type) => { setExpanded(prev => ({ ...prev, [type]: !prev[type] })); }; const [params, setParams] = useState({ tm: [] }) const searchTm = (e) => { setParams({ ...params, stm: e[0].format("YYYY-MM-DD HH:mm"), etm: e[1].format("YYYY-MM-DD HH:mm"), tm: e, }) }; useEffect(() => { let options = ""; options = { etm: moment().add(1, 'hour').set({ minute: 0, second: 0 }).format("YYYY-MM-DD HH:mm"), stm: moment().subtract(7, 'days').add(1, 'hour').set({ minute: 0, second: 0 }).format("YYYY-MM-DD HH:mm"), tm: [ moment().subtract(7, 'days').add(1, 'hour').set({ minute: 0, second: 0 }), moment().add(1, 'hour').set({ minute: 0, second: 0 }), ], } setParams(options) }, []) return (
时段选择:
trigger.parentElement} />
乡镇 预警时间 预警状态 {warningData.map((row) => ( {expanded[row.type] ? ( handleExpand(row.type)} /> ) : ( handleExpand(row.type)} /> )} {row.label} {row.count}个乡镇 {/* 这里可以添加展开后显示的详细内容 */} 暂无详细信息 ))}
预警统计: 共 0 条 {warningData.map((stat) => (
{stat.label}
{stat.count}
))}
) }