guonan
2025-05-20 a0967df707a547428df9fc80256877c26e061c4a
src/components/tools/LayerTree.vue
@@ -184,30 +184,6 @@
    }
    return;
  }
  if (label === "综合监测设备信息") {
    simStore.DeviceShowSwitch = checked;
    if (checked) {
    if (!treeMap.get("综合监测设备信息")) {
    } else {
      toggleLayerVisible("综合监测设备信息", true);
    }
  } else {
    toggleLayerVisible("综合监测设备信息", false);
  }
  return;
}
if (label === "孙胡沟隐患点") {
    simStore.DangerShowSwitch = checked;
    if (checked) {
    if (!treeMap.get("孙胡沟隐患点")) {
    } else {
      toggleLayerVisible("孙胡沟隐患点", true);
    }
  } else {
    toggleLayerVisible("孙胡沟隐患点", false);
  }
  return;
}
  // 其他图层的处理逻辑
  const list = treeMap.get(label);
@@ -243,7 +219,7 @@
  } else if (entityList && typeof entityList.show !== "undefined") {
    entityList.show = checked;
  } else {
    // console.error(`无法设置图层 ${name} 的可见性`);
    console.error(`无法设置图层 ${name} 的可见性`);
  }
}
@@ -257,7 +233,7 @@
    item.deviceName?.includes("孙胡沟")
  );
};
// 默认加载部分已替换至Device.vue中,逻辑修改为根据当前选择地形切换设备点显示
async function initDevicePoint() {
  let list = [];
  await getDevicetList();
@@ -276,31 +252,31 @@
}
// 隐患点列表
// watchEffect(() => {
//   const dangerPoints = simStore.DangerPoint.filter((item) =>
//     item.position?.includes("孙胡沟")
//   );
watchEffect(() => {
  const dangerPoints = simStore.DangerPoint.filter((item) =>
    item.position?.includes("孙胡沟")
  );
//   if (dangerPoints && dangerPoints.length > 0) {
//     const list = [];
  if (dangerPoints && dangerPoints.length > 0) {
    const list = [];
//     dangerPoints.forEach((item) => {
//       // console.log(item, "item");
//       item.id = item.hdId;
//       item.name = item.hdName;
//       item.latitude = item.lat;
//       item.longitude = item.lon;
//       item.showBillboard = true;
//       item.type = item.disasterType;
//       item.className = "district";
//       const entity = createPoint(item);
//       entity.show = false;
//       list.push(entity);
//     });
    dangerPoints.forEach((item) => {
      // console.log(item, "item");
      item.id = item.hdId;
      item.name = item.hdName;
      item.latitude = item.lat;
      item.longitude = item.lon;
      item.showBillboard = true;
      item.type = item.disasterType;
      item.className = "district";
      const entity = createPoint(item);
      entity.show = false;
      list.push(entity);
    });
//     treeMap.set("孙胡沟隐患点", list);
//   }
// });
    treeMap.set("孙胡沟隐患点", list);
  }
});
let divPointList = [];
/**
@@ -349,7 +325,7 @@
 * 初始化所有数据
 */
function getData() {
  // initDevicePoint();
  initDevicePoint();
  // initDistrictPoint();
  initDuanmianPoint();
  addTetrahedron();