guonan
2025-06-10 2280e8be717608bb36c3cf921f129db24349396d
src/components/menu/Location.vue
@@ -71,30 +71,12 @@
import { initeWaterPrimitiveView } from "@/utils/water"; //相机flyTo函数,后续options列表中有对应经纬度后弃用
import { useRoute, onBeforeRouteUpdate } from "vue-router";
import { Loading } from "@element-plus/icons-vue";
// import { fetchAndLoadDangerPoints } from "@/api/hpApi.js";
const districtList = ref([]);
// const displayData = ref([]);
// const loadCallback = async (newData) => {
//   districtList.value = [...newData];
//   console.log(districtList.value, "aaaaaaaaaaaaaaaaaaaaaaaaa");
//   await initializeDevicePoints();
// };
// onMounted(() => {
//   fetchAndLoadDangerPoints(loadCallback);
// });
const simStore = useSimStore();
// onBeforeRouteUpdate((to, from, next) => {
//   if (to.path !== "/yhgl") {
//     clearAllPoints();
//   }
//   next();
// });
const route = useRoute();
onBeforeUnmount(() => {
@@ -194,22 +176,22 @@
};
let isInitialized = false;
watch(
  () => simStore.DangerShowSwitch,
  async (newValue, oldValue) => {
    console.log("当前状态:", newValue);
// watch(
//   () => simStore.DangerShowSwitch,
//   async (newValue, oldValue) => {
//     console.log("当前状态:", newValue);
    if (newValue) {
      if (!isInitialized) {
        await initializeDevicePoints();
        isInitialized = true;
      }
    } else {
      clearAllPoints();
      isInitialized = false;
    }
  }
);
//     if (newValue) {
//       if (!isInitialized) {
//         await initializeDevicePoints();
//         isInitialized = true;
//       }
//     } else {
//       clearAllPoints();
//       isInitialized = false;
//     }
//   }
// );
// 监听 simStore.DangerPoint 变化
watch(
  () => simStore.DangerPoint,