diff --git a/src/utils/vector-layer-utils.js b/src/utils/vector-layer-utils.js index b149f65..9c801b5 100644 --- a/src/utils/vector-layer-utils.js +++ b/src/utils/vector-layer-utils.js @@ -145,10 +145,15 @@ export async function loadVectorFeature(layerId, feature, color, visibility, map export function setHighlight(layerId, sourceId, mapId = "homeMap") { let hoveredLineId = null; let clickedLineId = null; - Vue.config.maps[mapId].on('click', layerId, (e) => { + Vue.config.maps[mapId].on('click', layerId, async (e) => { if (!e.features || e.features.length <= 0) return; + if (mapId == "workUnitMap_uuv") { + showUnitReport(mapId, e.features[0].properties.unit_name, e.features[0].geometry.coordinates); + return; + } + // // 查询点击点周围的所有要素(使用边界框) // const bbox = [ // [e.point.x - 10, e.point.y - 10], // 左上 @@ -203,6 +208,9 @@ export function setHighlight(layerId, sourceId, mapId = "homeMap") { // When the user moves their mouse over the state-fill layer, we'll update the feature state for the feature under the mouse. Vue.config.maps[mapId].on('mousemove', layerId, (e) => { + if (mapId == "workUnitMap_uuv") + return; + if (e.features.length <= 0) return; sourceLayer = e.features[0].sourceLayer; @@ -231,6 +239,40 @@ export function setHighlight(layerId, sourceId, mapId = "homeMap") { }); } +export async function showUnitReport(mapId, unit, coordinates) { + const result = await (await fetch(`${Vue.config.baseUrl}/ds/report/unit/total.htm?unit=${unit}`)).json(); + const unitReports = result.array || []; + if (!unitReports.length) { + alert("未查询到相关单位的统计信息"); + return; + } + const description = ` +
| 参航信息 | +|
| 单位名称: ${unitReports[0].unit_name} | +|
| 首潜人数: ${unitReports[0].f_drving_total || ""} | +首次参航人数: ${unitReports[0].f_voyage_total || ""} | +
| 参航次数: ${unitReports[0].voyage_total || ""} | +参航天数: ${unitReports[0].voyage_days || ""} | +
| 参航人数: ${unitReports[0].member_total || ""} | +下潜次数: ${unitReports[0].drving_total || ""} | +