diff --git a/src/views/sponeScreen/HaiMianScreen/index.vue b/src/views/sponeScreen/HaiMianScreen/index.vue index a9e1962..f624eaa 100644 --- a/src/views/sponeScreen/HaiMianScreen/index.vue +++ b/src/views/sponeScreen/HaiMianScreen/index.vue @@ -89,8 +89,8 @@
- - + +

{{ weatherInfo.text }} {{ weatherInfo.temp }}℃

{{ dateNow }}

@@ -145,6 +145,14 @@ import newfiberMapBoxVectorLayer from '@/views/sponeScreen/gisMF/mapboxVectorLayer.js'; import { onBeforeUnmount } from 'vue'; import { artificialSiteSearch } from '@/api/floodSys/floodStation.js'; +import { realtimeRainfallStatistics } from '@/api/floodSys/oneMap.js'; +import rainStation_icon from '@/assets/cesiumMap/legendIcon/rainStation_icon.png'; +import sewageBenZhan_icon from '@/assets/cesiumMap/legendIcon/sewageBenZhan_icon.png'; +import rainBengZhan_icon from '@/assets/cesiumMap/legendIcon/rainBengZhan_icon.png'; +import combineBengZhan_icon from '@/assets/cesiumMap/legendIcon/combineBengZhan_icon.png'; +import waterCourse_icon from '@/assets/cesiumMap/legendIcon/combineBengZhan_icon.png'; +import sewageFactory_icon from '@/assets/cesiumMap/legendIcon/sewageFactory_icon.png'; +import pipeMonitor_icon from '@/assets/cesiumMap/legendIcon/pipeMonitor_icon.png'; const { proxy } = getCurrentInstance(); const router = useRouter(); @@ -168,6 +176,7 @@ const showLandXDM = ref(false); //下垫面控制 const showProjectDX = ref(false); const areaObj = ref({ value: '0' }); +const pointSourceData = ref({}); // 下垫面统计 const landArr = ref([ { title: '水田', color: '#f8d072' }, @@ -214,7 +223,6 @@ let res = await artificialSiteSearch(); if (res && res.code == 200) { stationList.value = res.data; - console.log(res.data); } }; // 获取天气信息 @@ -266,13 +274,79 @@ newfiberMapBoxVectorLayer.removeByIds(['bengzhan_Area']); //清除泵站范围 } }; +//获取所有站点列表 +const getAllPointDataList = async () => { + let res = await realtimeRainfallStatistics({ monitorTargetType: 'rainfall', orderBy: 'tt desc' }); + let features = []; + if (res && res.code == 200) { + let rainData = res.data; + rainData.forEach(element => { + let lonlat = element.lonLat.split(',').map(Number); + element.name = element.stName; + let rainFeature = turf.point(lonlat, element); + features.push(rainFeature); + }); + } + pointSourceData.value = newfiberMapbox.map.getSource('point')._data; + pointSourceData.value.features = pointSourceData.value.features.concat(features); +}; //全局搜索站点 -const selectPointByName = value => { - console.log('value---', value); +const selectPointByName = () => { + newfiberMapBoxVectorLayer.removeByIds(['selectedPoint']); + if (newfiberMapbox.map.hasImage('selectedPoint')) { + newfiberMapbox.map.removeImage('selectedPoint'); + } + let icon; + let selectedPointGeojson = { + type: 'FeatureCollection', + features: pointSourceData.value.features.filter(feature => feature.properties.name == stationCode.value), + }; + if (selectedPointGeojson.features[0].properties.type && selectedPointGeojson.features[0].properties.type == 'YSBZ') { + icon = rainBengZhan_icon; //雨水泵站 + } else if (selectedPointGeojson.features[0].properties.type && selectedPointGeojson.features[0].properties.type == 'WSBZ') { + icon = sewageBenZhan_icon; //污水泵站 + } else if (selectedPointGeojson.features[0].properties.type && selectedPointGeojson.features[0].properties.type == 'combineBengZhan') { + icon = combineBengZhan_icon; //合流泵站 + } else if (selectedPointGeojson.features[0].properties.type && selectedPointGeojson.features[0].properties.type == 'sewageFactory') { + icon = sewageFactory_icon; //污水处理厂 + } else if (selectedPointGeojson.features[0].properties.type && selectedPointGeojson.features[0].properties.type == 'waterCourse') { + icon = waterCourse_icon; //河道 + } else if (selectedPointGeojson.features[0].properties.type && selectedPointGeojson.features[0].properties.type == 'pipeMonitor') { + icon = pipeMonitor_icon; //管网监测 + } else if (selectedPointGeojson.features[0].properties.siteType && selectedPointGeojson.features[0].properties.siteType == 'rain') { + icon = rainStation_icon; + } + newfiberMapBoxVectorLayer.addGeojsonSymbol('selectedPoint', selectedPointGeojson, icon); + newfiberMapbox.map.easeTo({ + center: selectedPointGeojson.features[0].geometry.coordinates, + zoom: 15, + }); }; onMounted(() => { getWeather(); getAllStationInfo(); + let initeMapTimer = setInterval(() => { + if (!newfiberMapbox) return; + if (!newfiberMapbox.map.getLayer('point')) return; + getAllPointDataList(); + newfiberMapbox.map.on('click', 'selectedPoint', e => { + console.log(e); + const feature = ( + newfiberMapbox.map.queryRenderedFeatures([ + [e.point.x - 10 / 2, e.point.y - 10 / 2], + [e.point.x + 10 / 2, e.point.y + 10 / 2], + ]) || [] + ).filter(i => i.layer.id)[0]; + console.log('feature---', feature); + bus.emit('popupcontent', { + popupShow: true, + point: [e.lngLat.lng, e.lngLat.lat], + popupInfo: feature.properties, + }); + }); + clearInterval(initeMapTimer); + }, 100); + // 获取项目片区点击 bus.on('checkProjectArea', params => { areaObj.value = params;