import React, { useMemo, useState, useEffect } 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 { DatePicker } from 'antd'; import moment from 'moment'; import './index.less' const { RangePicker } = DatePicker; 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) => { const { lgtd, lttd } = record; if (lgtd && lttd) { // dispatch.runtime.setFeaturePop({ type: InfoPopNames.RealHDPop, properties: record, coordinates: [lgtd, lttd] }); dispatch.runtime.setCameraTarget({ center: [lgtd, lttd + config.poiPositionOffsetY.hd], zoom: config.poiPositionZoom.hd, pitch: config.poiPitch, }); } } const data = [ { stnm: '福田镇中心区', leakage: '1258.6', supply: '3526.8', rate: 35.6 }, { stnm: '木子店镇区', leakage: '986.3', supply: '2832.7', rate: 34.8 }, { stnm: '龙池桥镇区', leakage: '1485.5', supply: '4482.5', rate: 33.1 }, { stnm: '宋埠镇区', leakage: '1284.8', supply: '4029.5', rate: 31.9 }, { stnm: '黄土岗镇区', leakage: '186.2', supply: '698.2', rate: 26.7 }, { stnm: '铁门岗镇区', leakage: '984.2', supply: '3994.4', rate: 24.6 }, { stnm: '乘马岗镇区', leakage: '300.6', supply: '1250.5', rate: 24.0 }, { stnm: '白果镇区', leakage: '1129.0', supply: '6422.6', rate: 17.6 }, { stnm: '张家畈镇区', leakage: '444.8', supply: '2661.8', rate: 16.7 }, { name: '顺河镇区', leakage: '749.3', supply: '4490.1', rate: 16.7 } ]; const scData = [ { "stcd": "61612610", "type": "sk", "hasRz": true, "stnm": "三河口水厂", "adcd": "421181109000", "wscd": null, rate:32.95, "importancy": 0, "lgtd": 115.166667, "lttd": 31.333333, "elev": 0, "damel": 156.8, "dsflz": 154.99, "fsltdz": 149, "ddz": 124, "zcxsw": 149, "drpTm": "2025-06-03T02:00:00.000Z", "today": 0, "h1": 0, "h3": 0, "h6": 0, "h12": 0, "h24": 0, "h48": 12.5, "drpState": 1, "rz": 141.45, "w": 77.8, "a_fsltdz": -7.550000000000011, "rzTm": "2025-06-03T01:00:00.000Z", "rzWarning": 0, "rzState": 1, "aRz": -7.55 }, { "stcd": "7CS000231", "type": "sk", "hasRz": true, "stnm": "刘集水厂", rate:31.04, "adcd": "421181100000", "wscd": null, "importancy": 0, "lgtd": 115.048056, "lttd": 31.335556, "elev": 0, "damel": 79.6, "dsflz": 78.65, "fsltdz": 72.05, "ddz": 69.55, "zcxsw": 72.05, "drpTm": "2023-11-20T01:00:00.000Z", "today": 0, "h1": 0, "h3": 0, "h6": 0, "h12": 0, "h24": 0, "h48": 0, "drpState": 2, "rz": 76.49, "w": 0.049, "a_fsltdz": 4.439999999999998, "rzTm": "2025-04-11T06:00:00.000Z", "rzWarning": 1, "rzState": 2, "pic": [ { "stcd": "7CS000231", "tm": "2023-11-20T01:04:18.000Z", "url": "http://223.75.53.106:8891/skjgimages/2023/1120/7CS000231/20231120090418.jpg" }, { "stcd": "7CS000231", "tm": "2023-11-20T01:07:54.000Z", "url": "http://223.75.53.106:8891/skjgimages/2023/1120/7CS000232/20231120090754.jpg" } ], "aRz": 4.44 }, { "stcd": "716460001", "type": "sk", "hasRz": true, "stnm": "杉林河水厂", rate:31.95, "adcd": "421181107000", "wscd": null, percent:42.14, "importancy": 0, "lgtd": 115.433056, "lttd": 31.304444, "elev": 0, "damel": 236.2, "dsflz": 233.92, "fsltdz": 231, "ddz": 204, "zcxsw": 231, "drpTm": "2025-04-11T05:00:00.000Z", "today": 0, "h1": 0, "h3": 0, "h6": 0, "h12": 0, "h24": 0, "h48": 0, "drpState": 2, "rz": 224.31, "w": 0, "a_fsltdz": -6.689999999999998, "rzTm": "2025-04-11T05:00:00.000Z", "rzWarning": 0, "rzState": 2, "aRz": -6.69 }, ] const [type, setType] = useState('sc') const toggleStType = (type) => { setType(type) } const [params, setParams] = useState({ tm: [] }) const toggleAutoRefresh = () => { dispatch.realview.setHdAutoRefresh(!hdAutoRefresh); } 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) }, []) const [list, setList] = useState([]) useEffect(() => { const newArr = type == 'sc' ? scData :type == 'xz' ? data:[]; setList(newArr) }, [type]) return ( toggleStType('sc')}>水厂 toggleStType('xz')}>乡镇 toggleStType('dma')}>DMA分区 } extra={ <> {/* */} {/* showSetting(true)}> */} } >
trigger.parentElement} />
序号 名称 {/* 漏水量(㎡) 供水量(m³) */} 漏损率(%) {list.map((row,i) => ( flyTo(row)}>
{i+1}
{row.stnm} {/* {row.leakage} {row.supply} */} {row.rate} {/* {rzRender(row.rz, row.grz)} {rzRender(row.rz, row.wrz)} */}
))}
{ setting && showSetting(false)} /> }
) } export default HDReal;