diff --git a/public/assets/bg.png b/public/assets/bg.png new file mode 100644 index 0000000..794fa27 Binary files /dev/null and b/public/assets/bg.png differ diff --git a/src/models/map/index.js b/src/models/map/index.js index 68b28dd..b8a2752 100644 --- a/src/models/map/index.js +++ b/src/models/map/index.js @@ -147,6 +147,7 @@ const map = { setView(id) { let layerVisible = {}; + const map = window.__mapref if (id === 0 || id === 1) { layerVisible = { RealDrpLayer: true, @@ -223,11 +224,48 @@ const map = { Object.keys(DCPJ_TYPES).forEach(key => { layerVisible['Dcpj_' + key + 'Layer'] = false; }); + } else if (id === 201) { + layerVisible = { + RealDrpLayer: true, + RealHDLayer: true, + RealSkLayer: false, + BxSkLayer: false, + FzdxLayer: false, + WataLayer: false, + AdcdLayer: true, + RoadLayer: true, + RivlLayer: true, + }; + Object.keys(DCPJ_TYPES).forEach(key => { + layerVisible['Dcpj_' + key + 'Layer'] = false; + }); + } else if (id === 202) { + layerVisible = { + RealDrpLayer: false, + RealHDLayer: true, + RealSkLayer: true, + BxSkLayer: false, + FzdxLayer: false, + WataLayer: false, + AdcdLayer: true, + RoadLayer: true, + RivlLayer: true, + }; + Object.keys(DCPJ_TYPES).forEach(key => { + layerVisible['Dcpj_' + key + 'Layer'] = false; + }); } dispatch.runtime.setLayerSetting({ contour: null, dem: undefined }) dispatch.map.setRaw({ layerVisible, view: id }); dispatch.runtime.setFeaturePop(null); + + + if(id===201){ + map.setLayoutProperty('热力图', 'visibility', 'visible'); + }else{ + map.setLayoutProperty('热力图', 'visibility', 'none'); + } } }) }; diff --git a/src/models/map/layout.js b/src/models/map/layout.js index d8d9980..35b7dee 100644 --- a/src/models/map/layout.js +++ b/src/models/map/layout.js @@ -50,6 +50,25 @@ export default function calcLayout(view, rightStack, hidePanels) { { key: '天气' }, { key: '病险水库综述', style: { flexShink: 0 } }, ]; + } else if (view === 201) { + left = [ + { key: '天气' }, + { key: '实时雨情', style: { height: '20rem', flexGrow: 1 } }, + ]; + leftFullHeight = true; + } else if (view === 202) { + left = [ + { key: '天气' }, + { key: '河道实时水情', style: { height: '20rem', flexGrow: 1 } }, + { key: '水库监测', style: { height: '30rem', flexGrow: 1 } }, + ]; + // leftFullHeight = true; + } else if (view === 203) { + left = [ + { key: '天气' }, + { key: '安全监测', style: { height: '20rem', flexGrow: 1 } }, + ]; + leftFullHeight = true; } if (rightEx) { @@ -112,6 +131,18 @@ export default function calcLayout(view, rightStack, hidePanels) { { key: '警报' }, { key: '病险水库' }, ]; + } else if (view === 201) { + right = [ + { key: '警报' }, + ]; + } else if (view === 202) { + right = [ + { key: '警报' }, + ]; + } else if (view === 203) { + right = [ + { key: '警报' }, + ]; } } } diff --git a/src/views/Home/MapCtrl/mapstyle/base.js b/src/views/Home/MapCtrl/mapstyle/base.js index bfc3a4e..ffa9485 100644 --- a/src/views/Home/MapCtrl/mapstyle/base.js +++ b/src/views/Home/MapCtrl/mapstyle/base.js @@ -10,6 +10,17 @@ export default { 'fill-color': '#38467f', } }, + heatmap: { + 'id': '热力图', + 'type': 'raster', + 'source': 'heatmapImg', + 'layout': { + 'visibility':'none' + }, + 'paint': { + 'raster-opacity': 1, + } + }, water: { 'id': '水系', 'type': 'fill', diff --git a/src/views/Home/MapCtrl/mapstyle/layermgr.js b/src/views/Home/MapCtrl/mapstyle/layermgr.js index ba1a55e..dac6a55 100644 --- a/src/views/Home/MapCtrl/mapstyle/layermgr.js +++ b/src/views/Home/MapCtrl/mapstyle/layermgr.js @@ -92,6 +92,7 @@ class LayerMgr { terrain: this.layerMap.TerrainLayer.getTerrain(), layers: [ base.background, + base.heatmap, this.layerMap.TerrainLayer.getStyle(0), this.layerMap.TerrainLayer.getStyle(1), diff --git a/src/views/Home/MapCtrl/mapstyle/sources.js b/src/views/Home/MapCtrl/mapstyle/sources.js index e0e5df4..44434e7 100644 --- a/src/views/Home/MapCtrl/mapstyle/sources.js +++ b/src/views/Home/MapCtrl/mapstyle/sources.js @@ -40,6 +40,21 @@ const sources = { 'minzoom': 1, 'maxzoom': 18, }, + //热力图 + "heatmapImg": { + 'type': 'image', + 'url': `${hash}/assets/bg.png`, + 'coordinates': [ + // 图片覆盖地图的四至点 + [114.6710271999999929, 31.6068084090000987], // 左上 + + [115.4557823634995805, 31.6068084090000987], // 右上 + + [115.4907823634995805, 30.8713739500000008], // 右下 + + [114.7460271999999929, 30.8613739500000008], // 左下 + ], + }, "县界": { "data": `${hash}/mapbox/geojson/县界.geojson`, "type": "geojson" diff --git a/src/views/Home/PanelIndex.js b/src/views/Home/PanelIndex.js index 85db6b6..cd3d0b9 100644 --- a/src/views/Home/PanelIndex.js +++ b/src/views/Home/PanelIndex.js @@ -24,6 +24,7 @@ import WarnRespOverall from './panels/WarnResp/Overall'; import WarnResp from './panels/WarnResp'; import BxSk from './panels/BxSk'; import BxskOverall from './panels/BxSkOverall'; +import Aqjc from './panels/Aqjc' export default function PanelIndex({ name, style, ...params }) { @@ -77,6 +78,8 @@ export default function PanelIndex({ name, style, ...params }) { return } else if (name === '病险水库综述') { return + } else if (name === '安全监测') { + return } return ( diff --git a/src/views/Home/components/ActionDock/index.js b/src/views/Home/components/ActionDock/index.js index 0488cf4..ae2187e 100644 --- a/src/views/Home/components/ActionDock/index.js +++ b/src/views/Home/components/ActionDock/index.js @@ -15,6 +15,12 @@ const VIEWS = [ { id: 5, title: '天气预报', img: '/assets/menu/降雨中心.png' }, ] }, { id: 200, title: '水库', img: '/assets/menu/实时数据.png',children:[ + { id: 201, title: '雨情监测', img: '/assets/menu/降雨中心.png' }, + { id: 202, title: '水情监测', img: '/assets/menu/水利设施.png' }, + { id: 203, title: '安全监测', img: '/assets/menu/降雨中心.png' }, + { id: 204, title: '视频监测', img: '/assets/menu/辅助决策.png' }, + { id: 205, title: '防汛调度', img: '/assets/menu/辅助决策.png' }, + { id: 206, title: '水库管理', img: '/assets/menu/病险水库.png' }, // 雨情监测 // 水情监测 // 安全监测 diff --git a/src/views/Home/panels/Aqjc/Setting.js b/src/views/Home/panels/Aqjc/Setting.js new file mode 100644 index 0000000..a3055ef --- /dev/null +++ b/src/views/Home/panels/Aqjc/Setting.js @@ -0,0 +1,67 @@ +import React from 'react'; + +import Dialog from '@material-ui/core/Dialog'; +import DialogContent from '@material-ui/core/DialogContent'; +import DpPaperComponent from '../../../../layouts/mui/DpPaperCompanent'; +import { FormGroup, MenuItem, Select, Switch, Typography } from '@material-ui/core'; +import DpDialogTitle from '../../../../layouts/mui/DpDialogTitle'; +import { useDispatch, useSelector } from 'react-redux'; +import { getLayerSetting, getLayerVisible } from '../../../../models/map/selectors'; +import DpBackgroundDrop from '../../../../layouts/mui/DpBackdrop'; + + +function Setting({ onClose }) { + const layerVisible = useSelector(getLayerVisible); + const layerSetting = useSelector(getLayerSetting); + + const dispath = useDispatch(); + + return ( + +
+ + 实时雨量显示设置 + +
+ +
+ 地图实时雨量显示雨量时段 + +
+
+ 显示实时雨量图层 + dispath.map.setLayerVisible({ RealDrpLayer: e.target.checked })} + /> +
+
+
+
+
+
+ ) +} + +export default Setting; diff --git a/src/views/Home/panels/Aqjc/index.js b/src/views/Home/panels/Aqjc/index.js new file mode 100644 index 0000000..fcb0ad5 --- /dev/null +++ b/src/views/Home/panels/Aqjc/index.js @@ -0,0 +1,124 @@ +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 { DrpRealPromise } from '../../../../models/_/real'; +import useRefresh from '../../../../utils/useRefresh'; +import clsx from 'clsx'; +import { renderDrp } from '../../../../utils/renutils'; +import { TableSortLabel } from '@material-ui/core'; +import Setting from './Setting'; +import { InfoPopNames } from '../../InfoPops'; +import config from '../../../../config'; + +function DrpReal({ style }) { + const dispatch = useDispatch(); + const [tab,setTab] = useState('1') + const tableDrpFilter = useSelector(s => s.realview.tableDrpFilter); + const tableDrpSorter = useSelector(s => s.realview.tableDrpSorter); + const drpAutoRefresh = useSelector(s => s.realview.drpAutoRefresh); + const t = useRefresh(drpAutoRefresh ? 20 * 1000 : 0); + const { data } = useRequest(DrpRealPromise.get, t); + const [setting, showSetting] = useState(false); + + const showData = useMemo(() => { + if (!data) { + return []; + } + let ret = []; + data.forEach(o => { + if (!tableDrpFilter[o.type]) { + return; + } + ret.push(o); + }) + if (tableDrpSorter) { + ret = ret.sort((a, b) => b[tableDrpSorter] - a[tableDrpSorter]); + } + return ret; + }, [data, tableDrpFilter, tableDrpSorter]); + + const flyTo = (record) => { + const { lgtd, lttd } = record; + if (lgtd && lttd) { + dispatch.runtime.setFeaturePop({ type: InfoPopNames.RealDrpPop, properties: record, coordinates: [lgtd, lttd] }); + dispatch.runtime.setCameraTarget({ + center: [lgtd, lttd + config.poiPositionOffsetY.drp], + zoom: config.poiPositionZoom.drp, + pitch: config.poiPitch, + bearing: 0 + }); + } + } + + const toggleStType = (type) => { + const visible = !tableDrpFilter[type]; + dispatch.realview.setTableDrpFilter({ [type]: visible }); + } + + const toggleAutoRefresh = () => { + dispatch.realview.setDrpAutoRefresh(!drpAutoRefresh); + } + + const setSort = (type) => { + if (type === tableDrpSorter) { + dispatch.realview.setTableDrpSorter(null); + } else { + dispatch.realview.setTableDrpSorter(type); + } + } + + return ( + + setTab('1')}>变形监测 + setTab('2')}>渗压监测 + setTab('3')}>渗流监测 + setTab('4')}>白蚁监测 + + } + > + + + + + 序号 + 水库名称 + 行政区 + 测点 + 垂直位移 + + + + {showData.map((row,index) => ( + + {index} + {renderDrp(row, 'h1')} + {renderDrp(row, 'h3')} + {renderDrp(row, 'h6')} + {renderDrp(row, 'h24')} + + ))} + +
+
+ { + setting && showSetting(false)} /> + } +
+ ) +} + +export default DrpReal;