2025-05-19 14:26:18 +08:00
|
|
|
import React, { useMemo, useState } from 'react';
|
|
|
|
|
import useRequest from '../../../../utils/useRequest';
|
|
|
|
|
import PanelBox from '../../components/PanelBox';
|
|
|
|
|
|
|
|
|
|
import HighlightOff from '@material-ui/icons/HighlightOff';
|
|
|
|
|
import { makeStyles } from '@material-ui/core/styles';
|
|
|
|
|
import Modal from '@material-ui/core/Modal';
|
|
|
|
|
import Backdrop from '@material-ui/core/Backdrop';
|
|
|
|
|
import Fade from '@material-ui/core/Fade';
|
|
|
|
|
import Table from '@material-ui/core/Table';
|
|
|
|
|
import TableContainer from '@material-ui/core/TableContainer';
|
|
|
|
|
import TableBody from '@material-ui/core/TableBody';
|
|
|
|
|
import TableHead from '@material-ui/core/TableHead';
|
|
|
|
|
import TableRow from '@material-ui/core/TableRow';
|
|
|
|
|
import DpTableCell from '../../../../layouts/mui/DpTableCell';
|
|
|
|
|
import DpTableRow from '../../../../layouts/mui/DpTableRow';
|
|
|
|
|
import { useDispatch, useSelector } from 'react-redux';
|
|
|
|
|
import useRefresh from '../../../../utils/useRefresh';
|
|
|
|
|
import { SkRealPromise } from '../../../../models/_/real';
|
|
|
|
|
import Setting from './Setting';
|
|
|
|
|
import appconsts from '../../../../models/appconsts';
|
|
|
|
|
import { renderDrp, renderSkArz, renderSkRz } from '../../../../utils/renutils';
|
|
|
|
|
import { InfoPopNames } from '../../InfoPops';
|
|
|
|
|
import config from '../../../../config';
|
|
|
|
|
|
|
|
|
|
import SkPicReal from '../../../Mgr/xqjs/SkPicReal';
|
|
|
|
|
|
|
|
|
|
const useStyles = makeStyles((theme) => ({
|
|
|
|
|
modal: {
|
|
|
|
|
display: 'flex',
|
|
|
|
|
alignItems: 'center',
|
|
|
|
|
justifyContent: 'center',
|
|
|
|
|
width: "80%",
|
|
|
|
|
marginLeft: "10%",
|
|
|
|
|
},
|
|
|
|
|
paper: {
|
|
|
|
|
backgroundColor: theme.palette.background.paper,
|
|
|
|
|
border: '1px solid rgba(41, 182, 246, 0.4)',
|
|
|
|
|
boxShadow: theme.shadows[5],
|
|
|
|
|
padding: theme.spacing(2, 4, 3),
|
|
|
|
|
width: "100%",
|
|
|
|
|
},
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function SkReal({ style }) {
|
|
|
|
|
const dispatch = useDispatch();
|
|
|
|
|
const skAutoRefresh = useSelector(s => s.realview.skAutoRefresh);
|
|
|
|
|
const t = useRefresh(skAutoRefresh ? 60 * 1000 : 0);
|
|
|
|
|
let { data } = useRequest(SkRealPromise.get, t);
|
|
|
|
|
const sortedData = useMemo(() => (data || []).sort((a, b) => (b.aRz - a.aRz), [data]));
|
|
|
|
|
const [setting, showSetting] = useState(false);
|
|
|
|
|
const tableSkDrpField = useSelector(s => s.realview.tableSkDrpField);
|
|
|
|
|
|
|
|
|
|
data = data || [];
|
|
|
|
|
|
|
|
|
|
const flyTo = (record) => {
|
|
|
|
|
const { lgtd, lttd } = record;
|
|
|
|
|
if (lgtd && lttd) {
|
|
|
|
|
dispatch.runtime.setFeaturePop({ type: InfoPopNames.RealSkPop, properties: record, coordinates: [lgtd, lttd] });
|
|
|
|
|
dispatch.runtime.setCameraTarget({
|
|
|
|
|
center: [lgtd, lttd + config.poiPositionOffsetY.sk],
|
|
|
|
|
zoom: config.poiPositionZoom.sk,
|
|
|
|
|
pitch: config.poiPitch,
|
|
|
|
|
bearing: 0,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const toggleAutoRefresh = () => {
|
|
|
|
|
dispatch.realview.setSkAutoRefresh(!skAutoRefresh);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const classes = useStyles();
|
|
|
|
|
const [open, setOpen] = React.useState(false);
|
|
|
|
|
|
|
|
|
|
const handleOpen = () => {
|
|
|
|
|
setOpen(true);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handleClose = () => {
|
|
|
|
|
setOpen(false);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<PanelBox
|
|
|
|
|
style={style}
|
|
|
|
|
title="水库监测"
|
|
|
|
|
color="green"
|
|
|
|
|
extra={
|
|
|
|
|
<>
|
|
|
|
|
<i style={{ marginRight: '0.5rem', color: skAutoRefresh ? '#00deff' : '#aaa' }} className="ionicons loop cursor-pointer" onClick={toggleAutoRefresh}></i>
|
|
|
|
|
<i style={{ marginRight: '0.5rem' }} className="ionicons image cursor-pointer" onClick={handleOpen}></i>
|
|
|
|
|
<i className="ionicons gear cursor-pointer" onClick={() => showSetting(true)}></i>
|
|
|
|
|
</>
|
|
|
|
|
}
|
|
|
|
|
>
|
|
|
|
|
<TableContainer style={{ height: '100%' }}>
|
|
|
|
|
<Table size="small" stickyHeader>
|
|
|
|
|
<TableHead>
|
|
|
|
|
<TableRow>
|
|
|
|
|
<DpTableCell style={{ maxWidth: '30%' }} align="left">名称</DpTableCell>
|
|
|
|
|
<DpTableCell align="right">{appconsts.drpTtype[tableSkDrpField]}降雨</DpTableCell>
|
|
|
|
|
<DpTableCell align="right">水位</DpTableCell>
|
|
|
|
|
<DpTableCell align="right">超汛限</DpTableCell>
|
|
|
|
|
</TableRow>
|
|
|
|
|
</TableHead>
|
|
|
|
|
<TableBody>
|
|
|
|
|
{sortedData.map((row) => (
|
|
|
|
|
<DpTableRow key={row.stcd}>
|
|
|
|
|
<DpTableCell component="th" scope="row">
|
|
|
|
|
<div className="table-ellipsis cursor-pointer" onClick={() => flyTo(row)}>{row.stnm}</div>
|
|
|
|
|
</DpTableCell>
|
2025-06-05 09:48:43 +08:00
|
|
|
<DpTableCell align="right">{row['h24']}</DpTableCell>
|
2025-05-28 15:09:02 +08:00
|
|
|
<DpTableCell align="right">{row?.rz}</DpTableCell>
|
2025-05-19 14:26:18 +08:00
|
|
|
<DpTableCell align="right">{renderSkArz(row)}</DpTableCell>
|
|
|
|
|
</DpTableRow>
|
|
|
|
|
))}
|
|
|
|
|
</TableBody>
|
|
|
|
|
</Table>
|
|
|
|
|
</TableContainer>
|
|
|
|
|
{
|
|
|
|
|
setting && <Setting onClose={() => showSetting(false)} />
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{/*水库图片弹窗*/}
|
|
|
|
|
<Modal
|
|
|
|
|
aria-labelledby="transition-modal-title"
|
|
|
|
|
aria-describedby="transition-modal-description"
|
|
|
|
|
className={classes.modal}
|
|
|
|
|
open={open}
|
|
|
|
|
onClose={handleClose}
|
|
|
|
|
closeAfterTransition
|
|
|
|
|
BackdropComponent={Backdrop}
|
|
|
|
|
BackdropProps={{
|
|
|
|
|
timeout: 500,
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<Fade in={open}>
|
|
|
|
|
<div className={classes.paper}>
|
|
|
|
|
<HighlightOff style={{ color: "#fff", position: "absolute", right: "1rem", fontSize: "2rem", cursor: "pointer" }} onClick={handleClose} />
|
|
|
|
|
<SkPicReal />
|
|
|
|
|
</div>
|
|
|
|
|
</Fade>
|
|
|
|
|
</Modal>
|
|
|
|
|
</PanelBox>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default React.memo(SkReal);
|