From e63244a2db562a0b0eb73cbb7afa8aa5a0a34462 Mon Sep 17 00:00:00 2001 From: lishenfeng Date: Mon, 23 Jun 2025 15:08:39 +0800 Subject: [PATCH] =?UTF-8?q?fix():=E4=BF=AE=E6=94=B9=E6=B0=B4=E5=BA=93?= =?UTF-8?q?=E5=B7=A1=E6=9F=A5=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/Home/MapCtrl/index.js | 4 +- src/views/Home/panels/Xcwtkb/index.js | 54 +++++++++++++++++++++++++ src/views/Home/panels/Xczl/index.js | 57 ++++++++++++++++++++++++++- 3 files changed, 113 insertions(+), 2 deletions(-) diff --git a/src/views/Home/MapCtrl/index.js b/src/views/Home/MapCtrl/index.js index 8e80964..3f1a0c0 100644 --- a/src/views/Home/MapCtrl/index.js +++ b/src/views/Home/MapCtrl/index.js @@ -147,12 +147,14 @@ export default function MapCtrl({ initParams, onLoad }) { dispatch?.runtime.setInfoDlg({ layerId: 'ByjcLayer', properties: record }) }else if (record.stnm == '浮桥河水库') { dispatch?.runtime.setInfoDlg({ layerId: 'RealSkLayer', properties: record }) - } else if (record.type == 'sw') { + }else if (record.type == 'sw') { dispatch?.runtime.setFeaturePop({ type: 'RealHDPop', properties: record,coordinates: [record.lgtd, record.lttd] }) } else if (record.type == 'qx') { dispatch?.runtime.setFeaturePop({ type: 'RealDrpPop', properties: record,coordinates: [record.lgtd, record.lttd] }) } else if (record.flow == 1) { dispatch?.runtime.setInfoDlg({ layerId: 'flowjcLayer', properties: record }) + } else if (record.taskType) { + dispatch?.runtime.setInfoDlg({ layerId: 'XcxqLayer', properties: record }) } // dispatch.runtime.setFeaturePop({ type: 'RealSkPop', properties: record, coordinates: [record.lgtd, record.lttd] }); } diff --git a/src/views/Home/panels/Xcwtkb/index.js b/src/views/Home/panels/Xcwtkb/index.js index 3dc2976..90c972f 100644 --- a/src/views/Home/panels/Xcwtkb/index.js +++ b/src/views/Home/panels/Xcwtkb/index.js @@ -2,6 +2,7 @@ import React, { useMemo, useState } from 'react'; import useRequest from '../../../../utils/useRequest'; import { useDispatch, useSelector } from 'react-redux'; import PanelBox from '../../components/PanelBox'; +import { parseGeoJSON } from "../../../../utils/tools"; import Table from '@material-ui/core/Table'; import TableContainer from '@material-ui/core/TableContainer'; @@ -1755,11 +1756,64 @@ function DrpReal({ style }) { const value = event.target.value; setDimension(value); } + const setLayer = (data = [], type) => { + const map = window.__mapref; + const layer = map.getLayer('关联站点') + if (layer) { + map.removeLayer('关联站点'); + map.removeSource('关联站点'); + } + if (data.length === 0) { return } + map.addLayer({ + 'id': '关联站点',//+new Date().getTime(), + 'type': 'symbol', + 'source': { + 'type': 'geojson', + 'data': { + 'type': 'FeatureCollection', + 'features': [], + }, + }, + 'layout': { + 'icon-allow-overlap': true, + 'text-allow-overlap': true, + 'icon-image': '巡查', + 'icon-size': [ + 'interpolate', ['linear'], ['zoom'], + 10, 0.4, + 14, 0.8, + ], + + 'text-allow-overlap': true, + 'text-size': [ + 'interpolate', ['linear'], ['zoom'], + 10, 10, + 14, 14, + ], + 'text-font': ['Roboto Black'], + 'text-field': [ + 'step', + ['zoom'], + '', + 12, ['get', 'stnm'] + ], + 'text-anchor': 'top', + 'text-offset': [0, 1], + }, + 'paint': { + 'text-color': '#fff' + }, + 'visibility': 'visible', + }); + + map.getSource('关联站点').setData(parseGeoJSON(data)) + } const jumpTo = (record) => { const { lgtd, lttd } = record; const lgtdNum = Number(lgtd); const lttdNum = Number(lttd) if (record.code == 1) { + setLayer([{...record,lgtd:lgtdNum,lttd:lttdNum,stnm:"06-02浮桥河水库日常巡查"}]) if (lgtdNum && lttdNum) { dispatch.runtime.setCameraTarget({ center: [lgtdNum, lttdNum], diff --git a/src/views/Home/panels/Xczl/index.js b/src/views/Home/panels/Xczl/index.js index 358e2dc..0f75820 100644 --- a/src/views/Home/panels/Xczl/index.js +++ b/src/views/Home/panels/Xczl/index.js @@ -2,6 +2,7 @@ import React, { useMemo, useState } from 'react'; import useRequest from '../../../../utils/useRequest'; import { useDispatch, useSelector } from 'react-redux'; import PanelBox from '../../components/PanelBox'; +import { parseGeoJSON } from "../../../../utils/tools"; import Table from '@material-ui/core/Table'; import TableContainer from '@material-ui/core/TableContainer'; @@ -117,13 +118,67 @@ function DrpReal({ style }) { }, 'visibility': 'visible', }); - } + } + + const setLayer = (data = [], type) => { + const map = window.__mapref; + const layer = map.getLayer('关联站点') + if (layer) { + map.removeLayer('关联站点'); + map.removeSource('关联站点'); + } + if (data.length === 0) { return } + map.addLayer({ + 'id': '关联站点',//+new Date().getTime(), + 'type': 'symbol', + 'source': { + 'type': 'geojson', + 'data': { + 'type': 'FeatureCollection', + 'features': [], + }, + }, + 'layout': { + 'icon-allow-overlap': true, + 'text-allow-overlap': true, + 'icon-image': '巡查', + 'icon-size': [ + 'interpolate', ['linear'], ['zoom'], + 10, 0.4, + 14, 0.8, + ], + + 'text-allow-overlap': true, + 'text-size': [ + 'interpolate', ['linear'], ['zoom'], + 10, 10, + 14, 14, + ], + 'text-font': ['Roboto Black'], + 'text-field': [ + 'step', + ['zoom'], + '', + 12, ['get', 'stnm'] + ], + 'text-anchor': 'top', + 'text-offset': [0, 1], + }, + 'paint': { + 'text-color': '#fff' + }, + 'visibility': 'visible', + }); + + map.getSource('关联站点').setData(parseGeoJSON(data)) + } const jumpTo = (record) => { const { lgtd, lttd } = record; const lgtdNum = Number(lgtd); const lttdNum = Number(lttd) if (record.code == 1) { setSkLayer1() + setLayer([{...record,lgtd:lgtdNum,lttd:lttdNum,stnm:"06-02浮桥河水库日常巡查"}]) if (lgtdNum && lttdNum) { dispatch.runtime.setCameraTarget({ center: [lgtdNum, lttdNum],