2026-04-11 10:09:40 +08:00
|
|
|
<!-- 隐患点组件 -->
|
|
|
|
|
<template>
|
|
|
|
|
<div>
|
|
|
|
|
<!-- 加载基础隐患点 -->
|
2026-04-13 10:30:03 +08:00
|
|
|
<LoadingPoints
|
|
|
|
|
v-if="
|
2026-04-14 08:59:05 +08:00
|
|
|
useStatusStore().getAppLoadingCompleted() && baseHiddenPoints.length > 0
|
2026-04-13 10:30:03 +08:00
|
|
|
"
|
|
|
|
|
:base-points="baseHiddenPoints"
|
|
|
|
|
:get-disaster-icon="getDisasterIcon"
|
|
|
|
|
:prefix="config.prefix.hiddenDangerPointId"
|
2026-04-14 08:59:05 +08:00
|
|
|
:show-points="useStatusStore().getHiddenDangerPointShow()"
|
2026-04-14 17:05:27 +08:00
|
|
|
:is-default="true"
|
2026-04-13 10:30:03 +08:00
|
|
|
/>
|
2026-04-11 10:09:40 +08:00
|
|
|
|
|
|
|
|
<!-- 显示信息框 -->
|
2026-04-13 10:30:03 +08:00
|
|
|
<InformationBox
|
|
|
|
|
:data="hiddenDangerPointDetail as Record<string, any>"
|
|
|
|
|
:field="field"
|
|
|
|
|
v-if="
|
|
|
|
|
useLoadingInformationStore().getLoadingHiddenPointInformationStatus()
|
|
|
|
|
"
|
|
|
|
|
:title="informationBoxTitle"
|
|
|
|
|
:offset-x="offsetX"
|
|
|
|
|
:offset-y="offsetY"
|
|
|
|
|
:key="useLoadingInformationStore().getHiddenPointId()"
|
|
|
|
|
/>
|
2026-04-11 10:09:40 +08:00
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
2026-04-14 08:08:01 +08:00
|
|
|
import { DisasterType } from '@/types/common/DisasterType.ts';
|
2026-04-13 10:30:03 +08:00
|
|
|
import { ref, watch } from 'vue';
|
|
|
|
|
import { $api } from '@/api/api.ts';
|
|
|
|
|
import type { Point } from '@/types/base/Point';
|
|
|
|
|
import LoadingPoints from '@/component/rain-earthquake/LoadingPoints.vue';
|
|
|
|
|
import config from '@/config/config.json';
|
|
|
|
|
import InformationBox from '@/component/common/InformationBox.vue';
|
2026-04-14 08:59:05 +08:00
|
|
|
import { useStatusStore } from '@/stores/useStatusStore';
|
2026-04-13 10:30:03 +08:00
|
|
|
import { useLoadingInformationStore } from '@/stores/useLoadingInformation';
|
|
|
|
|
import { CesiumUtilsSingleton } from '@/utils/cesium/CesiumUtils';
|
2026-04-13 21:23:24 +08:00
|
|
|
import { useHiddenPoint } from '@/hooks/rain-earthquake/useHiddenPoint';
|
2026-04-13 10:30:03 +08:00
|
|
|
|
2026-04-13 21:23:24 +08:00
|
|
|
// 接收父组件传递的参数
|
2026-04-13 10:30:03 +08:00
|
|
|
const props = defineProps<{
|
|
|
|
|
disasterType: DisasterType;
|
|
|
|
|
}>();
|
|
|
|
|
|
2026-04-13 21:23:24 +08:00
|
|
|
// 基本隐患点数据
|
2026-04-13 10:30:03 +08:00
|
|
|
const baseHiddenPoints = ref<Point[]>([]);
|
2026-04-13 21:23:24 +08:00
|
|
|
// 信息框相关字段
|
2026-04-13 10:30:03 +08:00
|
|
|
const informationBoxTitle = ref('');
|
|
|
|
|
const offsetX = ref(0);
|
|
|
|
|
const offsetY = ref(0);
|
|
|
|
|
const hiddenDangerPointDetail = ref<Point>();
|
|
|
|
|
|
2026-04-13 21:23:24 +08:00
|
|
|
// 获取钩子函数
|
|
|
|
|
const { field, getDisasterIcon } = useHiddenPoint();
|
2026-04-13 10:30:03 +08:00
|
|
|
|
|
|
|
|
$api.hiddenDangerSpots.getBasePoins(props.disasterType).then((res) => {
|
|
|
|
|
baseHiddenPoints.value = res.data;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// 监听id变化
|
|
|
|
|
watch(
|
|
|
|
|
() => useLoadingInformationStore().getHiddenPointId(),
|
|
|
|
|
async (newId: number) => {
|
|
|
|
|
if (newId === -1) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取隐患点数据
|
|
|
|
|
const clickObject = useLoadingInformationStore().getClickObject();
|
|
|
|
|
|
|
|
|
|
if (!clickObject || !clickObject.primitive) {
|
|
|
|
|
console.warn('点击对象或图元不存在');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const res = await $api.hiddenDangerSpots.getPointDetailById(
|
|
|
|
|
useLoadingInformationStore().getHiddenPointId()
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
// 更新数据
|
|
|
|
|
hiddenDangerPointDetail.value = res.data;
|
|
|
|
|
informationBoxTitle.value = res.data.disasterType + '隐患点';
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
// 将坐标转换为偏移量
|
|
|
|
|
const screenPos = CesiumUtilsSingleton.convertScreenPosition(
|
|
|
|
|
clickObject.primitive.position
|
|
|
|
|
);
|
|
|
|
|
offsetX.value = screenPos.x;
|
|
|
|
|
offsetY.value = screenPos.y;
|
|
|
|
|
|
|
|
|
|
// 显示新的信息框
|
|
|
|
|
useLoadingInformationStore().setLoadingHiddenPointInformationStatus(
|
|
|
|
|
true
|
|
|
|
|
);
|
|
|
|
|
} catch (error) {
|
|
|
|
|
throw new Error(`坐标转换失败:${error}`);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
);
|
2026-04-11 10:09:40 +08:00
|
|
|
</script>
|
|
|
|
|
<style scoped></style>
|