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 { showData,bzData} from './constatData'
function rzRender(rz, base) {
return (
= base ? 'red' : '#fff' }}>
{typeof base === 'number' ? base.toFixed(2) : ''}
);
}
function HDReal({ style }) {
const dispatch = useDispatch();
const tableRzFilter = useSelector(s => s.realview.tableRzFilter);
const hdAutoRefresh = useSelector(s => s.realview.hdAutoRefresh);
// const t = useRefresh(hdAutoRefresh ? 60 * 1000 : 0);
// let { data } = useRequest(HDRealPromise.get, t);
const [setting, showSetting] = useState(false);
const flyTo = (record,type) => {
const { lgtd, lttd } = record;
if (lgtd && lttd) {
dispatch.runtime.setFeaturePop({ type, properties: record, coordinates: [lgtd, lttd] });
dispatch.runtime.setCameraTarget({
center: [lgtd, lttd + config.poiPositionOffsetY.hd],
zoom: config.poiPositionZoom.hd,
pitch: config.poiPitch,
});
}
}
const [type, setType] = useState('sz')
const toggleStType = (type) => {
setType(type)
}
const toggleAutoRefresh = () => {
dispatch.realview.setHdAutoRefresh(!hdAutoRefresh);
}
return (
toggleStType('sz')}>水闸
toggleStType('bz')}>泵站
}
extra={
<>
{/* showSetting(true)}> */}
>
}
>
{
type == 'sz' ?
水闸名称
类型
所在灌区
{/* 警戒水位 */}
{showData.map((row) => (
flyTo(row,'sz')}>
{row.wagaName}
{row.wagaType_dictText}
{row.irrCode_dictText}
))}
:
泵站名称
工程类别
所在灌区
{bzData.map((row) => (
flyTo(row,'bz')}>
{row.pustName}
{row.pustType}
{row.irrCode_dictText}
))}
}
{/* {
setting && showSetting(false)} />
} */}
)
}
export default HDReal;