2025-05-21 15:23:13 +08:00
|
|
|
import React, { useMemo, useState } from 'react';
|
|
|
|
|
import useRequest from '../../../../utils/useRequest';
|
|
|
|
|
import PanelBox from '../../components/PanelBox';
|
|
|
|
|
|
|
|
|
|
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 { HDRealPromise } from '../../../../models/_/real';
|
|
|
|
|
import clsx from 'clsx';
|
|
|
|
|
import { renderHDRz } from '../../../../utils/renutils';
|
|
|
|
|
import Setting from './Setting';
|
|
|
|
|
import { InfoPopNames } from '../../InfoPops';
|
|
|
|
|
import config from '../../../../config';
|
|
|
|
|
import moment from 'moment';
|
|
|
|
|
|
|
|
|
|
function rzRender(rz, base) {
|
|
|
|
|
return (
|
|
|
|
|
<DpTableCell align="right" style={{ color: rz >= base ? 'red' : '#fff' }}>
|
|
|
|
|
{typeof base === 'number' ? base.toFixed(2) : ''}
|
|
|
|
|
</DpTableCell>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function HDReal({ style }) {
|
|
|
|
|
const dispatch = useDispatch();
|
|
|
|
|
const tableRzFilter = useSelector(s => s.realview.tableRzFilter);
|
|
|
|
|
const hdAutoRefresh = useSelector(s => s.realview.hdAutoRefresh);
|
2025-05-26 16:37:17 +08:00
|
|
|
// const t = useRefresh(hdAutoRefresh ? 60 * 1000 : 0);
|
2025-05-21 15:23:13 +08:00
|
|
|
// let { data } = useRequest(HDRealPromise.get, t);
|
|
|
|
|
const [setting, showSetting] = useState(false);
|
|
|
|
|
|
|
|
|
|
// const showData = useMemo(() => {
|
|
|
|
|
// if (!data) {
|
|
|
|
|
// return [];
|
|
|
|
|
// }
|
|
|
|
|
// let ret = [];
|
|
|
|
|
// data.forEach(o => {
|
|
|
|
|
// if (!tableRzFilter[o.type]) {
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
// o.status = Math.floor(Math.random() * (4 - 0 + 1)) + 0
|
|
|
|
|
// o.kd = (Math.random() * 100).toFixed(2);
|
|
|
|
|
// o.ll = (Math.random() * 100).toFixed(1);
|
|
|
|
|
// ret.push(o);
|
|
|
|
|
// });
|
|
|
|
|
// return ret;
|
|
|
|
|
// }, [data, tableRzFilter]);
|
2025-05-26 16:37:17 +08:00
|
|
|
|
|
|
|
|
const showData = Array(1).fill(0).map((o, i) => ({
|
2025-05-26 21:26:20 +08:00
|
|
|
"lgtd": 112.071 +2.9619,
|
|
|
|
|
"lttd": 30.9641 +0.2002,
|
2025-05-26 16:37:17 +08:00
|
|
|
"tm": "2025-03-21 08",
|
|
|
|
|
"doxLevelStr": "Ⅰ类",
|
2025-05-27 16:35:13 +08:00
|
|
|
stnm:'麻城水站'
|
2025-05-21 15:23:13 +08:00
|
|
|
}))
|
|
|
|
|
|
|
|
|
|
const flyTo = (record) => {
|
2025-05-26 21:26:20 +08:00
|
|
|
dispatch.map.setLayerVisible({'ShuizhiLayer':true})
|
2025-05-21 15:23:13 +08:00
|
|
|
const { lgtd, lttd } = record;
|
|
|
|
|
if (lgtd && lttd) {
|
2025-05-26 16:37:17 +08:00
|
|
|
dispatch.runtime.setFeaturePop({ type: '水质站', properties: record, coordinates: [lgtd, lttd] });
|
2025-05-21 15:23:13 +08:00
|
|
|
dispatch.runtime.setCameraTarget({
|
|
|
|
|
center: [lgtd, lttd + config.poiPositionOffsetY.hd],
|
|
|
|
|
zoom: config.poiPositionZoom.hd,
|
|
|
|
|
pitch: config.poiPitch,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const toggleStType = (type) => {
|
|
|
|
|
const visible = !tableRzFilter[type];
|
|
|
|
|
dispatch.realview.setTableRzFilter({ [type]: visible });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const toggleAutoRefresh = () => {
|
|
|
|
|
dispatch.realview.setHdAutoRefresh(!hdAutoRefresh);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<PanelBox
|
|
|
|
|
style={style}
|
|
|
|
|
title="水质监测"
|
|
|
|
|
color="green"
|
|
|
|
|
extra={
|
|
|
|
|
<>
|
|
|
|
|
<i style={{ marginRight: '0.5rem', color: hdAutoRefresh ? '#00deff' : '#aaa' }} className="ionicons loop cursor-pointer" onClick={toggleAutoRefresh}></i>
|
|
|
|
|
{/* <i className="ionicons gear cursor-pointer" onClick={() => showSetting(true)}></i> */}
|
|
|
|
|
</>
|
|
|
|
|
}
|
|
|
|
|
>
|
2025-05-26 16:37:17 +08:00
|
|
|
<TableContainer style={{ height: '100%' }}>
|
|
|
|
|
<Table size="small" stickyHeader>
|
|
|
|
|
<TableHead>
|
|
|
|
|
<TableRow >
|
|
|
|
|
<DpTableCell style={{ width: '40%' }} align="center">站点名称</DpTableCell>
|
|
|
|
|
<DpTableCell style={{ width: '30%' }} align="center">时间</DpTableCell>
|
|
|
|
|
<DpTableCell align="center" style={{ width: '30%' }}>水质类别</DpTableCell>
|
|
|
|
|
</TableRow>
|
|
|
|
|
</TableHead>
|
|
|
|
|
<TableBody>
|
|
|
|
|
{showData.map((row) => (
|
|
|
|
|
<DpTableRow key={row.id} onClick={() => flyTo(row)}>
|
|
|
|
|
<DpTableCell align="center">
|
|
|
|
|
<div
|
|
|
|
|
className="table-ellipsis cursor-pointer"
|
|
|
|
|
>{row.stnm}</div>
|
|
|
|
|
</DpTableCell>
|
|
|
|
|
<DpTableCell align="center">{row.tm}</DpTableCell>
|
|
|
|
|
<DpTableCell align="center">{row.doxLevelStr}</DpTableCell>
|
|
|
|
|
{/* {rzRender(row.rz, row.grz)}
|
|
|
|
|
{rzRender(row.rz, row.wrz)} */}
|
|
|
|
|
</DpTableRow>
|
|
|
|
|
))}
|
|
|
|
|
</TableBody>
|
|
|
|
|
</Table>
|
|
|
|
|
</TableContainer>
|
2025-05-21 15:23:13 +08:00
|
|
|
</PanelBox>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default HDReal;
|