From b0827f4c098e9507ce1d5dc490111421ebdea29a Mon Sep 17 00:00:00 2001
From: 张含笑 <zhx18749296735@163.com>
Date: Fri, 14 Nov 2025 19:16:57 +0800
Subject: [PATCH] feat:11
---
src/views/layerManagement/index.vue | 91 ++++++++++++++++++++++++++++++++++-----------
1 files changed, 68 insertions(+), 23 deletions(-)
diff --git a/src/views/layerManagement/index.vue b/src/views/layerManagement/index.vue
index 9ff0fda..1d40241 100644
--- a/src/views/layerManagement/index.vue
+++ b/src/views/layerManagement/index.vue
@@ -97,7 +97,8 @@
editFolderData: null,
editingIsProhibited: false, //禁止编辑
isDetailShow: false,
- isSingleLocating:false
+ isSingleLocating:false ,
+ currentLocationFolderId:null,
});
const handleClick = tab => {
@@ -169,6 +170,8 @@
};
// 点击显示区域
const handleCoverDataUpdate = data => {
+console.log('daa',data);
+
selectDataList.value = data;
if (selectDataList.value.length > 0) {
@@ -243,6 +246,7 @@
});
});
+ console.log('layerParams.value.isSingleLocating',layerParams.value.isSingleLocating);
if (!layerParams.value.isSingleLocating) {
focusOnAllFeatures();
@@ -251,16 +255,46 @@
};
const focusOnAllFeatures = () => {
if (tbJwdList.length === 0 || !viewer) return;
+
+ // 判断是否有指定定位的文件夹
+ if (layerParams.value.currentLocationFolderId) {
+ console.log('11111111');
+
+ // 筛选当前文件夹下的所有子节点坐标
+ const targetFolderPositions = selectDataList.value
+ .filter(item => item.folder_id === layerParams.value.currentLocationFolderId)
+ .flatMap(item => {
+ const positions = parseGeoDataToPositions(item.geo_data, item.altitude);
+ return positions.length >= 3 ? positions : [];
+ });
+
+ if (targetFolderPositions.length > 0) {
+ const positionsData = targetFolderPositions.map(pos => [
+ pos.lng,
+ pos.lat,
+ pos.height || 0
+ ]);
+ flyVisual({
+ positionsData,
+ viewer,
+ multiple: activeName.value === '国土空间规划' ? 13 : 10,
+ pitch: -90
+ });
+ return; // 仅聚焦当前文件夹,结束方法
+ }
+ }
+ console.log('333333');
+ // 无指定文件夹时,聚焦所有选中数据(保持原有逻辑)
const positionsData = tbJwdList.map(pos => [
pos.lng,
pos.lat,
- pos.height || 0
+ pos.height || 0
]);
flyVisual({
positionsData,
viewer,
- multiple:activeName.value == '国土空间规划' ? 13 :4, // 缩放倍数
- pitch: -90
+ multiple: activeName.value === '国土空间规划' ? 13 : 4,
+ pitch: -90
});
};
// 区域点击显示详细信息
@@ -409,14 +443,6 @@
}
};
provide('layerParams', layerParams);
-// onMounted(() => {
-// initMap();
-// cesiumContextMenu();
-// getdataFolderApi();
-// EventBus.on('deleteMapEntityById', deleteMapEntityById);
-// EventBus.on('deleteMapEntitiesByFolderId', deleteMapEntitiesByFolderId);
-
-// });
onMounted(() => {
initMap();
cesiumContextMenu();
@@ -430,23 +456,42 @@
});
//定位到指定节点
-const focusOnNode = (nodeData) => {
+// const focusOnNode = (nodeData) => {
+// if (!viewer || !nodeData?.geo_data) return;
+// // 解析节点坐标
+// const positions = parseGeoDataToPositions(nodeData.geo_data, nodeData.altitude);
+// if (positions.length < 3) {
+
+// return;
+// }
+// flyVisual({
+// positionsData: positions.map(pos => [pos.lng, pos.lat, pos.height || 0]),
+// viewer,
+// multiple:activeName.value == '国土空间规划' ? 13 :7, // 缩放倍数
+// pitch: -90
+// });
+
+// };
+// 父组件中修改 focusOnNode 方法
+const focusOnNode = (nodeData) => {
if (!viewer || !nodeData?.geo_data) return;
// 解析节点坐标
const positions = parseGeoDataToPositions(nodeData.geo_data, nodeData.altitude);
-if (positions.length < 3) {
-
- return;
- }
- flyVisual({
- positionsData: positions.map(pos => [pos.lng, pos.lat, pos.height || 0]),
- viewer,
- multiple:activeName.value == '国土空间规划' ? 13 :7, // 缩放倍数
- pitch: -90
- });
+ if (positions.length < 3) return;
+ // level 2 节点走全量聚焦,level 3 节点走单个聚焦
+ if (nodeData.level === 2) {
+ focusOnAllFeatures();
+ } else {
+ flyVisual({
+ positionsData: positions.map(pos => [pos.lng, pos.lat, pos.height || 0]),
+ viewer,
+ multiple: activeName.value === '国土空间规划' ? 13 : 7, // 缩放倍数
+ pitch: -90
+ });
+ }
};
onBeforeUnmount(() => {
destroyMap();
--
Gitblit v1.9.3