fix(): 水库数据修改

lsf-dev
李神峰 2025-06-12 14:10:02 +08:00
parent 4118661eeb
commit 31a4d43314
7 changed files with 1266 additions and 1237 deletions

View File

@ -174,19 +174,26 @@ function RealSkTip({ record, dispatch,view }) {
const changePic = () => {
setpicidx([picidx[0] === 1 ? 2 : 1, picidx[1] === 1 ? 2 : 1])
}
const openSw = () => {
window.open("http://local.gunshiiot.com:18083/zhtmp/#/mgr/home")
}
return (
<>
<div className="boxhead"></div>
<div className="featuretip-title">
<div className="name">{record.stnm}
{
{record.stnm == '浮桥河水库' ?
record?.setView&&view===200?
<span style={{cursor:'pointer',color:'#50b1f9'}} onClick={()=>{
<span style={{cursor:'pointer',color:'#50b1f9',marginLeft:20}} onClick={()=>{
dispatch.map.setView(203)
sessionStorage.setItem('lastCenter',JSON.stringify(record))
}}> 进入水库模块</span>
:null
: null :
record.stnm == '小玉潭水库' ?
<span style={{ cursor: 'pointer', color: '#50b1f9',marginLeft:20 }} onClick={openSw}>
进入三维模块
</span>:null
}
</div>
<div className="extra cursor-pointer" onClick={viewInfo}>详细</div>

View File

@ -143,7 +143,7 @@ export default function MapCtrl({ initParams, onLoad }) {
dispatch?.runtime.setInfoDlg({ layerId: 'SyjcLayer', properties: record })
}else if (record.cd_nm == 'WE1') {
dispatch?.runtime.setInfoDlg({ layerId: 'SljcLayer', properties: record })
}else if (record.cd_nm == '0EA5DE') {
}else if (record.cd == '0AB3ED') {
dispatch?.runtime.setInfoDlg({ layerId: 'ByjcLayer', properties: record })
}else if (record.stnm == '浮桥河水库') {
dispatch?.runtime.setInfoDlg({ layerId: 'RealSkLayer', properties: record })

View File

@ -1,4 +1,4 @@
import React, { useMemo, useState,useEffect } from 'react';
import React, { useMemo, useState, useEffect } from 'react';
import useRequest from '../../../../utils/useRequest';
import { useDispatch, useSelector } from 'react-redux';
import PanelBox from '../../components/PanelBox';
@ -19,7 +19,7 @@ import { parseGeoJSON } from "../../../../utils/tools";
function DrpReal({ style }) {
const [tab,setTab] = useState('1')
const [tab, setTab] = useState('1')
const dispatch = useDispatch();
const [dimension, setDimension] = useState('浮桥河水库');
const onChange = (event) => {
@ -28,14 +28,14 @@ function DrpReal({ style }) {
}
const data1 = [
{
{
"res_cd": "42118140035",
"lgtd": 114.88089,
"lttd": 31.171467,
"cd": "01",
"cd_nm": "GN1",
'stnm':'GN1',
dm:"0+60",
'stnm': 'GN1',
dm: "0+60",
"res_reg_cd": "42118140006-A4",
"ch": "0+000",
"province_cd": "420000000000",
@ -69,8 +69,8 @@ function DrpReal({ style }) {
"lttd": 31.55095,
"cd": "02",
"cd_nm": "GN2",
'stnm':'GN2',
dm:"0+60",
'stnm': 'GN2',
dm: "0+60",
"res_reg_cd": "42118140006-A4",
"ch": "0+000",
"province_cd": "420000000000",
@ -104,7 +104,7 @@ function DrpReal({ style }) {
"lttd": 31.55095,
"cd": "04",
"cd_nm": "GN3",
dm:"0+60",
dm: "0+60",
"res_reg_cd": "42118140006-A4",
"ch": "0+000",
"province_cd": "420000000000",
@ -138,7 +138,7 @@ function DrpReal({ style }) {
"lttd": 30.88904,
"cd": "01",
"cd_nm": "GN1",
dm:"0+120",
dm: "0+120",
"res_reg_cd": "42118140019-A4",
"ch": "0+000",
"province_cd": "420000000000",
@ -172,7 +172,7 @@ function DrpReal({ style }) {
"lttd": 30.88904,
"cd": "02",
"cd_nm": "GN2",
dm:"0+120",
dm: "0+120",
"res_reg_cd": "42118140019-A4",
"ch": "0+000",
"province_cd": "420000000000",
@ -206,7 +206,7 @@ function DrpReal({ style }) {
"lttd": 30.95398,
"cd": "03",
"cd_nm": "GN3",
dm:"0+120",
dm: "0+120",
"res_reg_cd": "42118140031-A4",
"ch": "0+000",
"province_cd": "420000000000",
@ -240,7 +240,7 @@ function DrpReal({ style }) {
"lttd": 30.88904,
"cd": "03",
"cd_nm": "GN1",
dm:"0+180",
dm: "0+180",
"res_reg_cd": "42118140019-A4",
"ch": "0+000",
"province_cd": "420000000000",
@ -274,7 +274,7 @@ function DrpReal({ style }) {
"lttd": 31.1526,
"cd": "02",
"cd_nm": "GN2",
dm:"0+180",
dm: "0+180",
"res_reg_cd": "42118140014-A4",
"ch": "0+000",
"province_cd": "420000000000",
@ -308,7 +308,7 @@ function DrpReal({ style }) {
"lttd": 30.88904,
"cd": "04",
"cd_nm": "GN3",
dm:"0+180",
dm: "0+180",
"res_reg_cd": "42118140019-A4",
"ch": "0+000",
"province_cd": "420000000000",
@ -341,12 +341,12 @@ function DrpReal({ style }) {
{
"cd": "1",
"cd_nm": "UPD1",
stnm:'UPD1',
stnm: 'UPD1',
"ch": "0+060",
dm:"0+70",
dm: "0+70",
"res_reg_cd": "42118140011-A4",
"res_cd": "42118140038",
"lgtd": 114.87929+ 0.0019,
"lgtd": 114.87929 + 0.0019,
"lttd": 31.171467,
"res_nm": "浮桥河水库",
"province_cd": "420000000000",
@ -382,7 +382,7 @@ function DrpReal({ style }) {
"cd": "1",
"cd_nm": "UPD2",
"ch": "0+027",
dm:"0+70",
dm: "0+70",
"res_reg_cd": "42118140006-A4",
"res_cd": "42118140035",
"lgtd": 115.14137,
@ -421,7 +421,7 @@ function DrpReal({ style }) {
"cd": "3",
"cd_nm": "UPD3",
"ch": "0+070",
dm:"0+70",
dm: "0+70",
"res_reg_cd": "42118140011-A4",
"res_cd": "42118140038",
"lgtd": 115.01664,
@ -460,7 +460,7 @@ function DrpReal({ style }) {
"cd": "1",
"cd_nm": "UPD1",
"ch": "0+038",
dm:"0+140",
dm: "0+140",
"res_reg_cd": "42118140014-A4",
"res_cd": "42118140022",
"lgtd": 115.39612,
@ -500,7 +500,7 @@ function DrpReal({ style }) {
"cd": "4",
"cd_nm": "UPD2",
"ch": "0+085",
dm:"0+140",
dm: "0+140",
"res_reg_cd": "42118140020-A4",
"res_cd": "42118140032",
"lgtd": 115.13073,
@ -539,7 +539,7 @@ function DrpReal({ style }) {
"cd": "1",
"cd_nm": "UPD3",
"ch": "0+51.6",
dm:"0+140",
dm: "0+140",
"res_reg_cd": "42118140042-A4",
"res_cd": "42118140004",
@ -582,11 +582,11 @@ function DrpReal({ style }) {
"cd": "1",
"cd_nm": "WE1",
"ch": "1",
'stnm':'WE1',
'stnm': 'WE1',
"res_reg_cd": "42118140042-A4",
"res_cd": "42118140004",
"res_nm": "浮桥河水库",
"lgtd": 114.88429- 0.0029,
"lgtd": 114.88429 - 0.0029,
"lttd": 31.172700,
"province_cd": "420000000000",
"province_nm": "湖北省",
@ -609,10 +609,42 @@ function DrpReal({ style }) {
},
]
const data4 = [
{
"res_cd": "42118140015",
"res_nm": "麻城坳水库",
"cd": '0AB3ED',
"stnm": "0AB3ED",
"province_cd": "420000000000",
"province_nm": "湖北省",
"city_cd": "421100000000",
"city_nm": "黄冈市",
"county_cd": "421181000000",
"county_nm": "麻城市",
"town_cd": "421181107000",
"town_nm": "盐田河镇",
"rv_name": "举水",
"bas_guid": "鄂东五河片区",
"lgtd": 114.88299 - 0.0019,
"lttd": 31.172700 - 0.0001,
"res_reg_cd": "42118140025-A4",
"eng_scal": "小1型",
"eng_g": "IV",
"children": [
{
"res_cd": "42118140015",
"res_nm": "麻城坳水库",
"cd": "0AB3ED",
"cd_nm": "麻城坳水库",
"termite_status": "y",
"tm": "2025-05-21 04:27:18",
"is_main_cd": "y"
}
]
},
{
"res_cd": "42118140035",
"lgtd": 114.88299- 0.0019,
"lttd": 31.172700- 0.0001,
"lgtd": 114.88299 - 0.0019,
"lttd": 31.172700 - 0.0001,
"cd": "01",
"cd_nm": "0EA5DE",
"stnm": "0EA5DE",
@ -747,36 +779,7 @@ function DrpReal({ style }) {
}
]
},
{
"res_cd": "42118140015",
"res_nm": "麻城坳水库",
"province_cd": "420000000000",
"province_nm": "湖北省",
"city_cd": "421100000000",
"city_nm": "黄冈市",
"county_cd": "421181000000",
"county_nm": "麻城市",
"town_cd": "421181107000",
"town_nm": "盐田河镇",
"rv_name": "举水",
"bas_guid": "鄂东五河片区",
"lgtd": 115.22541,
"lttd": 30.98156,
"res_reg_cd": "42118140025-A4",
"eng_scal": "小1型",
"eng_g": "IV",
"children": [
{
"res_cd": "42118140015",
"res_nm": "麻城坳水库",
"cd": "0AB3ED",
"cd_nm": "麻城坳水库",
"termite_status": "y",
"tm": "2025-05-21 04:27:18",
"is_main_cd": "y"
}
]
},
]
const skdata = [
{
@ -911,50 +914,50 @@ function DrpReal({ style }) {
"rzState": 2,
"aRz": -17.4
}
]
]
const [showbx, setShowdbx] = useState(0)
const [showsy, setShowdsy] = useState(0)
const [showsl, setShowdsl] = useState(0)
const [showby, setShowdby] = useState(0)
useEffect(()=>{
useEffect(() => {
const map = window.__mapref;
if (map) {
if(tab==='1'&&data1 && showbx){
setLayer(data1,'变形')
if (tab === '1' && data1 && showbx) {
setLayer(data1, '变形')
}
if (tab === '2' && data2 && showsy) {
setLayer(data2,'渗压')
setLayer(data2, '渗压')
}
if(tab==='3'&&data3 && showsl){
setLayer(data3,'渗流')
if (tab === '3' && data3 && showsl) {
setLayer(data3, '渗流')
}
if(tab==='4'&&data4&& showby){
setLayer(data4,'白蚁')
if (tab === '4' && data4 && showby) {
setLayer(data4, '白蚁')
}
}
else {
const dsq = setInterval(() => {
const map = window.__mapref;
if(map && skdata.length>0){
if (map && skdata.length > 0) {
clearInterval(dsq)
setLayer(skdata,'sk')
setLayer(skdata, 'sk')
}
}, 500);
}
},[data1,data2,data3,data4,tab,showbx,showsy,showsl,showby])
}, [data1, data2, data3, data4, tab, showbx, showsy, showsl, showby])
const setLayer = (data=[],type)=>{
const setLayer = (data = [], type) => {
const map = window.__mapref;
const layer = map.getLayer('关联站点')
if(layer){
if (layer) {
map.removeLayer('关联站点');
map.removeSource('关联站点');
}
if(data.length===0){return}
if(type==='变形'){
if (data.length === 0) { return }
if (type === '变形') {
map.addLayer({
'id': '关联站点',//+new Date().getTime(),
'type': 'symbol',
@ -997,7 +1000,7 @@ function DrpReal({ style }) {
'visibility': 'visible',
});
}
if(type==='渗压'){
if (type === '渗压') {
map.addLayer({
'id': '关联站点',//+new Date().getTime(),
'type': 'symbol',
@ -1040,7 +1043,7 @@ function DrpReal({ style }) {
'visibility': 'visible',
});
}
if(type==='渗流'){
if (type === '渗流') {
map.addLayer({
'id': '关联站点',//+new Date().getTime(),
'type': 'symbol',
@ -1127,7 +1130,7 @@ function DrpReal({ style }) {
'visibility': 'visible',
});
}
if(type==='sk'){
if (type === 'sk') {
map.addLayer({
'id': '关联站点',//+new Date().getTime(),
'type': 'symbol',
@ -1174,13 +1177,13 @@ function DrpReal({ style }) {
map.getSource('关联站点').setData(parseGeoJSON(data))
}
useEffect(() => {
useEffect(() => {
setShowdbx(0)
setShowdsy(0)
setShowdsl(0)
setShowdby(0)
}, [tab])
}, [tab])
return (
<PanelBox
style={style}
@ -1189,16 +1192,16 @@ useEffect(() => {
extra={
<>
<span className="button-group">
<span className={clsx({ active: tab==='1' })} onClick={() => {
<span className={clsx({ active: tab === '1' })} onClick={() => {
setTab('1')
}}>变形</span>
<span className={clsx({ active: tab === '2' })} onClick={() => {
setTab('2')
}}>渗压</span>
<span className={clsx({ active: tab==='3' })} onClick={() => {
<span className={clsx({ active: tab === '3' })} onClick={() => {
setTab('3')
}}>渗流</span>
<span className={clsx({ active: tab==='4' })} onClick={() => {
<span className={clsx({ active: tab === '4' })} onClick={() => {
setTab('4')
}}>白蚁</span>
@ -1221,11 +1224,11 @@ useEffect(() => {
</TableRow>
</TableHead>
<TableBody>
{data1.map((row,index) => (
<DpTableRow key={row.stcd}>
<DpTableCell align="center">
<div className="table-ellipsis cursor-pointer" onClick={() => {
const {lgtd, lttd,res_nm:stnm } = row;
{data1.map((row, index) => (
<DpTableRow
key={row.stcd}
onClick={() => {
const { lgtd, lttd, res_nm: stnm } = row;
if (stnm == '浮桥河水库') {
setShowdbx(1)
if (lgtd && lttd) {
@ -1237,7 +1240,11 @@ useEffect(() => {
});
}
}
}}>{row.dm}</div>
}}
>
<DpTableCell align="center">
<div className="table-ellipsis cursor-pointer"
>{row.dm}</div>
</DpTableCell>
<DpTableCell align="center">{row.cd_nm}</DpTableCell>
<DpTableCell align="center">{row.du_value}</DpTableCell>
@ -1262,11 +1269,11 @@ useEffect(() => {
</TableRow>
</TableHead>
<TableBody>
{data2.map((row,index) => (
<DpTableRow key={row.stcd}>
<DpTableCell align="center">
<div className="table-ellipsis cursor-pointer" onClick={() => {
const { lgtd, lttd,res_nm:stnm } = row;
{data2.map((row, index) => (
<DpTableRow
key={row.stcd}
onClick={() => {
const { lgtd, lttd, res_nm: stnm } = row;
if (stnm == '浮桥河水库') {
setShowdsy(1)
if (lgtd && lttd) {
@ -1278,7 +1285,11 @@ useEffect(() => {
});
}
}
}}>{row.dm}</div>
}}
>
<DpTableCell align="center">
<div className="table-ellipsis cursor-pointer"
>{row.dm}</div>
</DpTableCell>
<DpTableCell align="center">{row.cd_nm}</DpTableCell>
<DpTableCell align="center">{row.value}</DpTableCell>
@ -1287,7 +1298,7 @@ useEffect(() => {
</DpTableRow>
))}
</TableBody>
</Table>:null
</Table> : null
}
{
tab == '3' ? <Table size="small" stickyHeader>
@ -1299,10 +1310,10 @@ useEffect(() => {
</TableRow>
</TableHead>
<TableBody>
{data3.map((row,index) => (
<DpTableRow key={row.stcd}>
<DpTableCell align="center">
<div className="table-ellipsis cursor-pointer" onClick={() => {
{data3.map((row, index) => (
<DpTableRow
key={row.stcd}
onClick={() => {
const { lgtd, lttd } = row;
setShowdsl(1)
if (row.cd == 1) {
@ -1316,7 +1327,11 @@ useEffect(() => {
}
}
}}>{row.cd_nm}</div>
}}
>
<DpTableCell align="center">
<div className="table-ellipsis cursor-pointer"
>{row.cd_nm}</div>
</DpTableCell>
{/* <DpTableCell align="center">{row.cd_nm}</DpTableCell> */}
<DpTableCell align="center">{row.value}</DpTableCell>
@ -1324,7 +1339,7 @@ useEffect(() => {
</DpTableRow>
))}
</TableBody>
</Table>:null
</Table> : null
}
{
tab == '4' ? <Table size="small" stickyHeader>
@ -1337,14 +1352,13 @@ useEffect(() => {
</TableRow>
</TableHead>
<TableBody>
{data4.map((row,index) => (
<DpTableRow key={row.stcd}>
<DpTableCell align="center">
<div className="table-ellipsis cursor-pointer" onClick={() => {
{data4.map((row, index) => (
<DpTableRow
key={row.stcd}
onClick={() => {
const { lgtd, lttd } = row;
setShowdby(1)
if (row.cd == '0EA5DE') {
if (row.cd == '0AB3ED') {
if (lgtd && lttd) {
dispatch.runtime.setCameraTarget({
center: [lgtd, lttd],
@ -1354,15 +1368,19 @@ useEffect(() => {
});
}
}
}}>{row?.children?.[0]?.cd}</div>
}}
>
<DpTableCell align="center">
<div className="table-ellipsis cursor-pointer"
>{row?.children?.[0]?.cd}</div>
</DpTableCell>
{/* <DpTableCell align="center">{row?.children?.[0]?.cd}</DpTableCell> */}
<DpTableCell align="center">{row?.children?.[0]?.termite_status==='y'?<span style={{color:'#ff4d4f',display:'flex',alignItems:'center'}}><div style={{width:'10px',height:'10px',borderRadius:'10px',marginRight:'7px',background:'#ff4d4f'}}></div></span>:<span style={{color:'#3af6cd',display:'flex',alignItems:'center'}}><div style={{width:'10px',height:'10px',borderRadius:'10px',marginRight:'7px',background:'#3af6cd'}}></div></span>}</DpTableCell>
<DpTableCell align="center">{row?.children?.[0]?.termite_status === 'y' ? <span style={{ color: '#ff4d4f', display: 'flex', alignItems: 'center' }}><div style={{ width: '10px', height: '10px', borderRadius: '10px', marginRight: '7px', background: '#ff4d4f' }}></div></span> : <span style={{ color: '#3af6cd', display: 'flex', alignItems: 'center' }}><div style={{ width: '10px', height: '10px', borderRadius: '10px', marginRight: '7px', background: '#3af6cd' }}></div></span>}</DpTableCell>
<DpTableCell align="center"> <div className="table-ellipsis cursor-pointer">{row?.children?.[0]?.tm}</div></DpTableCell>
</DpTableRow>
))}
</TableBody>
</Table>:null
</Table> : null
}
</TableContainer>

View File

@ -194,12 +194,12 @@ function ARzSk({data}) {
{
data.map((tableRow,index)=>
<TableBody>
<DpTableRow key={tableRow.stcd}>
<DpTableCell align="center" >
<div className="table-ellipsis cursor-pointer" onClick={()=>{
<DpTableRow key={tableRow.stcd} onClick={()=>{
flyTo(tableRow)
setSkLayer([tableRow])
}}>
<DpTableCell align="center" >
<div className="table-ellipsis cursor-pointer" >
{tableRow.stnm}
</div>
</DpTableCell>

View File

@ -47,8 +47,8 @@ const data1 = [
"tm": "2025-06-03T02:00:00.000Z",
"state": 1,
"warning": 0
},
{
},
{
"stcd": "61612910",
"stnm": "桃林河(阎河)",
"adcd": "421181000000000",
@ -69,8 +69,8 @@ const data1 = [
"tm": "2025-06-03T02:10:00.000Z",
"state": 1,
"warning": 0
},
{
},
{
"stcd": "61613700",
"stnm": "四角门(宋铁二桥)",
"adcd": "421181000000000",
@ -91,8 +91,8 @@ const data1 = [
"tm": "2025-06-03T02:00:00.000Z",
"state": 1,
"warning": 0
},
{
},
{
"stcd": "61614460",
"stnm": "项生(宋埠)",
"adcd": "421181000000000",
@ -113,8 +113,8 @@ const data1 = [
"tm": "2025-06-03T02:00:00.000Z",
"state": 1,
"warning": 0
},
{
},
{
"stcd": "61615110",
"stnm": "杨梅河(木子店)",
"adcd": "421181000000000",
@ -135,8 +135,8 @@ const data1 = [
"tm": "2025-06-03T02:00:00.000Z",
"state": 1,
"warning": 0
},
{
},
{
"stcd": "61640390",
"stnm": "两路口(福田河)",
"adcd": "421181000000000",
@ -157,8 +157,8 @@ const data1 = [
"tm": "2025-06-03T02:00:00.000Z",
"state": 1,
"warning": 0
},
{
},
{
"stcd": "61640700",
"stnm": "新屋河(黄土岗)",
"adcd": "421181000000000",
@ -179,8 +179,8 @@ const data1 = [
"tm": "2025-06-03T02:00:00.000Z",
"state": 1,
"warning": 0
},
{
},
{
"stcd": "61640850",
"stnm": "喻家垸(黄土岗)",
"adcd": "421181000000000",
@ -201,8 +201,8 @@ const data1 = [
"tm": "2025-06-03T02:00:00.000Z",
"state": 1,
"warning": 0
},
{
},
{
"stcd": "61640900",
"stnm": "得胜寨(乘马岗)",
"adcd": "421181000000000",
@ -223,8 +223,8 @@ const data1 = [
"tm": "2025-06-03T02:00:00.000Z",
"state": 1,
"warning": 0
},
{
},
{
"stcd": "61640960",
"stnm": "桐枧冲(黄土岗)",
"adcd": "421181000000000",
@ -245,8 +245,8 @@ const data1 = [
"tm": "2025-06-03T02:00:00.000Z",
"state": 1,
"warning": 0
},
{
},
{
"stcd": "61640970",
"stnm": "闵家畈(黄土岗)",
"adcd": "421181000000000",
@ -267,8 +267,8 @@ const data1 = [
"tm": "2025-06-03T02:00:00.000Z",
"state": 1,
"warning": 0
},
{
},
{
"stcd": "61640980",
"stnm": "飞龙山(乘马岗)",
"adcd": "421181000000000",
@ -289,8 +289,8 @@ const data1 = [
"tm": "2025-06-03T02:00:00.000Z",
"state": 1,
"warning": 0
},
{
},
{
"stcd": "61641500",
"stnm": "黄金桥(开发区)",
"adcd": "421181000000000",
@ -311,8 +311,8 @@ const data1 = [
"tm": "2025-06-03T02:00:00.000Z",
"state": 1,
"warning": 0
},
{
},
{
"stcd": "61641610",
"stnm": "张广河(三河口)",
"adcd": "421181000000000",
@ -333,8 +333,8 @@ const data1 = [
"tm": "2025-06-03T02:00:00.000Z",
"state": 1,
"warning": 0
},
{
},
{
"stcd": "61641700",
"stnm": "前畈(三河口)",
"adcd": "421181000000000",
@ -355,7 +355,7 @@ const data1 = [
"tm": "2025-06-03T02:00:00.000Z",
"state": 1,
"warning": 0
},
},
]
const data2 = [
{
@ -585,22 +585,23 @@ const data3 = [
time: '2025-05-26 10:00',
stcd: 42000002,
stnm: '汉通闸流量站',
water:30,
water: 30,
flow: 0.222,
"lttd": 30.973775 + 0.2002,
"lgtd": 112.17597 +2.9619,
"lgtd": 112.17597 + 2.9619,
},
{ water:12,
{
water: 12,
type: '工业',
stcd: 42000001,
time: '2025-05-26 10:00',
stnm: '福耀玻璃',
flow: 0.355,
"lttd": 30.93926+0.2002,
"lgtd": 112.191703+ 2.9619,
"lttd": 30.93926 + 0.2002,
"lgtd": 112.191703 + 2.9619,
}, {
water:21,
water: 21,
type: '工业',
time: '2025-05-26 10:00',
stnm: '格林美',
@ -866,120 +867,120 @@ const data5 = [
]
function DrpReal({ style }) {
const [tab,setTab] = useState('1')
const [drpData,setDrpData] = useState([])
const [hdData,setHdData] = useState([])
const [tab, setTab] = useState('1')
const [drpData, setDrpData] = useState([])
const [hdData, setHdData] = useState([])
const dispatch = useDispatch();
const skObj = useSelector(s => s.runtime.skObj);
useEffect(()=>{
useEffect(() => {
getDrp(skObj)
getHd(skObj)
return ()=>{
return () => {
const map = window.__mapref;
const layer = map.getLayer('关联站点')
if(layer){
if (layer) {
map.removeLayer('关联站点');
map.removeSource('关联站点');
}
}
},[skObj])
}, [skObj])
const [showDrp, setShowdDrp] = useState(0)
const [showHd, setShowdHd] = useState(0)
useEffect(()=>{
useEffect(() => {
const map = window.__mapref;
if(map){
if(tab==='1'&&drpData && showDrp){
setLayer(drpData,'drp')
if (map) {
if (tab === '1' && drpData && showDrp) {
setLayer(drpData, 'drp')
}
if(tab==='2'&&hdData && showHd){
setLayer(hdData,'hd')
if (tab === '2' && hdData && showHd) {
setLayer(hdData, 'hd')
}
if(tab==='3'&&data3){
setLayer(data3,'ll')
if (tab === '3' && data3) {
setLayer(data3, 'll')
}
if(tab==='4'&&data4){
setLayer(data4,'tx')
if (tab === '4' && data4) {
setLayer(data4, 'tx')
}
if(tab==='5'&&data5){
setLayer(data5,'sk')
if (tab === '5' && data5) {
setLayer(data5, 'sk')
}
}else{
} else {
const dsq = setInterval(() => {
const map = window.__mapref;
if(map && drpData.length>0){
if (map && drpData.length > 0) {
clearInterval(dsq)
setLayer(drpData,'drp')
setLayer(drpData, 'drp')
}
}, 500);
}
},[drpData,hdData,skObj,tab,showDrp,showHd])
}, [drpData, hdData, skObj, tab, showDrp, showHd])
const getDrp = async(skObj)=>{
const getDrp = async (skObj) => {
const { lgtd, lttd } = skObj
const step = 0.05
let data = await DrpRealPromise.get();
if (Array.isArray(data)) {
data = data.filter(o => {
if(o.type !== 'sk'){
if(
lgtd-step<o.lgtd && o.lgtd<lgtd+step &&
lttd-step<o.lttd && o.lttd<lttd+step
){return true}
else{
if (o.type !== 'sk') {
if (
lgtd - step < o.lgtd && o.lgtd < lgtd + step &&
lttd - step < o.lttd && o.lttd < lttd + step
) { return true }
else {
return false
}
}else{
} else {
return false
}
});
}
const newData = [data[1],data[0]]
const newData = [data[1], data[0]]
setDrpData(newData)
}
const getHd = async(skObj)=>{
const getHd = async (skObj) => {
const { lgtd, lttd } = skObj
const step = 0.1
let data = await HDRealPromise.get();
if (Array.isArray(data)) {
data = data.filter(o => {
if(o.type !== 'sk'){
if(
lgtd-step<o.lgtd && o.lgtd<lgtd+step &&
lttd-step<o.lttd && o.lttd<lttd+step
){return true}
else{
if (o.type !== 'sk') {
if (
lgtd - step < o.lgtd && o.lgtd < lgtd + step &&
lttd - step < o.lttd && o.lttd < lttd + step
) { return true }
else {
return false
}
}else{
} else {
return false
}
});
}
const newData = [data[1],data[0]]
const newData = [data[1], data[0]]
setHdData(newData)
}
const setLayer = (data=[],type)=>{
const setLayer = (data = [], type) => {
const map = window.__mapref;
const layer = map.getLayer('关联站点')
if(layer){
if (layer) {
map.removeLayer('关联站点');
map.removeSource('关联站点');
}
if(data.length===0){return}
if(type==='drp'){
if (data.length === 0) { return }
if (type === 'drp') {
map.addLayer({
'id': '关联站点',//+new Date().getTime(),
'type': 'circle',
@ -1038,7 +1039,7 @@ function DrpReal({ style }) {
'visibility': 'visible',
});
}
if(type==='hd'){
if (type === 'hd') {
map.addLayer({
'id': '关联站点',//+new Date().getTime(),
'type': 'symbol',
@ -1079,7 +1080,7 @@ function DrpReal({ style }) {
'visibility': 'visible',
});
}
if(type==='ll'){
if (type === 'll') {
map.addLayer({
'id': '关联站点',//+new Date().getTime(),
'type': 'symbol',
@ -1122,7 +1123,7 @@ function DrpReal({ style }) {
'visibility': 'visible',
});
}
if(type==='tx'){
if (type === 'tx') {
map.addLayer({
'id': '关联站点',//+new Date().getTime(),
'type': 'symbol',
@ -1166,7 +1167,7 @@ function DrpReal({ style }) {
'visibility': 'visible',
});
}
if(type==='sk'){
if (type === 'sk') {
map.addLayer({
'id': '关联站点',//+new Date().getTime(),
'type': 'symbol',
@ -1231,11 +1232,11 @@ function DrpReal({ style }) {
color="green"
tabs={
<span className="button-group">
<span className={clsx({ active: tab==='1' })} onClick={() => {
<span className={clsx({ active: tab === '1' })} onClick={() => {
setTab('1')
}}>雨量站</span>
<span className={clsx({ active: tab==='2' })} onClick={() => {
<span className={clsx({ active: tab === '2' })} onClick={() => {
setTab('2')
}}>水位站</span>
{/* <span className={clsx({ active: tab==='3' })} onClick={() => {
@ -1253,7 +1254,7 @@ function DrpReal({ style }) {
<TableContainer style={{ height: '100%' }}>
{
tab==='1'?
tab === '1' ?
<Table size="small" stickyHeader>
<TableHead>
<TableRow>
@ -1264,11 +1265,10 @@ function DrpReal({ style }) {
</TableRow>
</TableHead>
<TableBody>
{drpData.map((row,index) => (
<DpTableRow key={row.stcd}>
{/* <DpTableCell align="center">{index+1}</DpTableCell> */}
<DpTableCell component="th" scope="row">
<div className="table-ellipsis cursor-pointer" onClick={() => {
{drpData.map((row, index) => (
<DpTableRow
key={row.stcd}
onClick={() => {
const { lgtd, lttd } = row;
if (row.stnm == '浮桥河') {
setShowdDrp(1)
@ -1282,17 +1282,21 @@ function DrpReal({ style }) {
});
}
}
}}>{row.stnm}</div>
}}
>
{/* <DpTableCell align="center">{index+1}</DpTableCell> */}
<DpTableCell component="th" scope="row">
<div className="table-ellipsis cursor-pointer">{row.stnm}</div>
</DpTableCell>
<DpTableCell align="center">{(row.h1).toFixed(2)}</DpTableCell>
<DpTableCell align="center">{row.tm.slice(0,10)}</DpTableCell>
<DpTableCell align="center">{row.tm.slice(0, 10)}</DpTableCell>
</DpTableRow>
))}
</TableBody>
</Table>:null
</Table> : null
}
{
tab==='2'?
tab === '2' ?
<Table size="small" stickyHeader>
<TableHead>
<TableRow>
@ -1303,7 +1307,7 @@ function DrpReal({ style }) {
</TableRow>
</TableHead>
<TableBody>
{hdData.map((row,index) => (
{hdData.map((row, index) => (
<DpTableRow key={row.stcd}>
<DpTableCell component="th" scope="row">
<div className="table-ellipsis cursor-pointer" onClick={() => {
@ -1323,15 +1327,15 @@ function DrpReal({ style }) {
}}>{row.stnm}</div>
</DpTableCell>
<DpTableCell align="center">{row.rz}</DpTableCell>
<DpTableCell align="center">{row.rz+5.5}</DpTableCell>
<DpTableCell align="center">{row.rz+4}</DpTableCell>
<DpTableCell align="center">{row.rz + 5.5}</DpTableCell>
<DpTableCell align="center">{row.rz + 4}</DpTableCell>
</DpTableRow>
))}
</TableBody>
</Table>:null
</Table> : null
}
{
tab==='3'?
tab === '3' ?
<Table size="small" stickyHeader>
<TableHead>
<TableRow>
@ -1343,7 +1347,7 @@ function DrpReal({ style }) {
</TableRow>
</TableHead>
<TableBody>
{data3.map((row,index) => (
{data3.map((row, index) => (
<DpTableRow key={row.stcd}>
{/* <DpTableCell align="center">{index+1}</DpTableCell> */}
<DpTableCell component="th" scope="row">
@ -1366,10 +1370,10 @@ function DrpReal({ style }) {
</DpTableRow>
))}
</TableBody>
</Table>:null
</Table> : null
}
{
tab==='4'?
tab === '4' ?
<Table size="small" stickyHeader>
<TableHead>
<TableRow>
@ -1379,11 +1383,11 @@ function DrpReal({ style }) {
</TableRow>
</TableHead>
<TableBody>
{data4.map((row,index) => (
{data4.map((row, index) => (
<DpTableRow key={row.stcd}>
<DpTableCell align="center">{index+1}</DpTableCell>
<DpTableCell align="center">{index + 1}</DpTableCell>
<DpTableCell component="th" scope="row">
<div className="table-ellipsis cursor-pointer" style={{marginLeft:'20px'}} onClick={() => {
<div className="table-ellipsis cursor-pointer" style={{ marginLeft: '20px' }} onClick={() => {
const { lgtd, lttd } = row;
if (lgtd && lttd) {
dispatch.runtime.setFeaturePop({ type: 'PicStPop', properties: row, coordinates: [row.lgtd, row.lttd] });
@ -1396,14 +1400,14 @@ function DrpReal({ style }) {
}
}}>{row.stnm}</div>
</DpTableCell>
<DpTableCell align="center">{<span style={{color:'#3af6cd',display:'flex',alignItems:'center',marginLeft:'30px'}}><div style={{width:'10px',height:'10px',borderRadius:'10px',marginRight:'7px',background:'#3af6cd'}}></div>线</span>}</DpTableCell>
<DpTableCell align="center">{<span style={{ color: '#3af6cd', display: 'flex', alignItems: 'center', marginLeft: '30px' }}><div style={{ width: '10px', height: '10px', borderRadius: '10px', marginRight: '7px', background: '#3af6cd' }}></div>线</span>}</DpTableCell>
</DpTableRow>
))}
</TableBody>
</Table>:null
</Table> : null
}
{
tab==='5'?
tab === '5' ?
<Table size="small" stickyHeader>
<TableHead>
<TableRow>
@ -1414,11 +1418,11 @@ function DrpReal({ style }) {
</TableRow>
</TableHead>
<TableBody>
{data5.map((row,index) => (
{data5.map((row, index) => (
<DpTableRow key={row.stcd}>
<DpTableCell align="center">{index+1}</DpTableCell>
<DpTableCell align="center">{index + 1}</DpTableCell>
<DpTableCell component="th" scope="row">
<div className="table-ellipsis cursor-pointer" style={{marginLeft:'20px'}} onClick={() => {
<div className="table-ellipsis cursor-pointer" style={{ marginLeft: '20px' }} onClick={() => {
const { lgtd, lttd } = row;
if (lgtd && lttd) {
dispatch.runtime.setFeaturePop({ type: 'RealSkPop', properties: row, coordinates: [row.lgtd, row.lttd] });
@ -1432,14 +1436,14 @@ function DrpReal({ style }) {
}}>{row.res_nm}</div>
</DpTableCell>
<DpTableCell align="center">{row.town_nm}</DpTableCell>
<DpTableCell align="center">{row.online==='1'?
<span style={{color:'#3af6cd',display:'flex',alignItems:'center',justifyContent:'center'}}><div style={{width:'10px',height:'10px',borderRadius:'10px',marginRight:'7px',background:'#3af6cd'}}></div>线</span>
:<span style={{color:'#eeeeee',display:'flex',alignItems:'center',justifyContent:'center'}}><div style={{width:'10px',height:'10px',borderRadius:'10px',marginRight:'7px',background:'#eeeeee'}}></div>线</span>
<DpTableCell align="center">{row.online === '1' ?
<span style={{ color: '#3af6cd', display: 'flex', alignItems: 'center', justifyContent: 'center' }}><div style={{ width: '10px', height: '10px', borderRadius: '10px', marginRight: '7px', background: '#3af6cd' }}></div>线</span>
: <span style={{ color: '#eeeeee', display: 'flex', alignItems: 'center', justifyContent: 'center' }}><div style={{ width: '10px', height: '10px', borderRadius: '10px', marginRight: '7px', background: '#eeeeee' }}></div>线</span>
}</DpTableCell>
</DpTableRow>
))}
</TableBody>
</Table>:null
</Table> : null
}
</TableContainer>
</PanelBox>

View File

@ -8,7 +8,7 @@ function Page({ type,name,num1,num2,skType,setSkType }) {
<img src={`${process.env.PUBLIC_URL}/assets/icon/大型水库.svg`} width={15} height={15} alt=""/>
<div style={{flex:1,paddingLeft:'0.8rem',marginBottom:'-0.1rem'}}>{name}</div>
<div style={{marginBottom:'-0.1rem'}}>{num1}</div>
<div style={{margin:'0 1rem -0.1rem 1rem'}}>{num2}亿m³</div>
<div style={{ margin: '0 1rem -0.1rem 1rem' }}>{num2}{(type !=1 && type != 2) ?"万m³":"亿m³"}</div>
<img src={`${process.env.PUBLIC_URL}/assets/icon/${skType===type?'收起':'展开'}.png`} style={{cursor:'pointer'}} width={20} alt="" />
</div>
)

View File

@ -39,10 +39,10 @@ function DrpReal({ style }) {
}, [skData, skType, sort, sort1])
const skTypeObj = [
{ type: '1', name: '大型水库', num1: 3, num2: 7.9316 },//8.735
{ type: '2', name: '中型水库', num1: 7, num2: 1.627 },
{ type: '3', name: '小(1)型水库', num1: 44, num2: 1.627 },
{ type: '4', name: '小(2)型水库', num1: 207, num2: 8.735 },
{ type: '1', name: '大型水库', num1: 3, num2: 7.93,num3:8.73 },//8.735
{ type: '2', name: '中型水库', num1: 7, num2: 0.51,num3:1.62 },
{ type: '3', name: '小(1)型水库', num1: 44, num2: 31.54,num3:52.61 },
{ type: '4', name: '小(2)型水库', num1: 207, num2: 10.11,num3:16.91 },
]
useEffect(() => {
@ -136,7 +136,7 @@ function DrpReal({ style }) {
{
skTypeObj.map((item) =>
(<>
<CollapsePage type={item.type} name={item.name} num1={item.num1} num2={item.num2} skType={skType} setSkType={setSkType} />
<CollapsePage type={item.type} name={item.name} num1={item.num1} num2={`${item.num2}/${item.num3}`} skType={skType} setSkType={setSkType} />
<Collapse in={skType === item.type} timeout="auto" unmountOnExit>
<TableContainer style={{ maxHeight: 'calc( 100vh - 28.2rem )' }}>
<Table size="small" stickyHeader>