2026-04-28 10:05:49 +08:00
|
|
|
<!-- 泥石流隐患点组件 -->
|
2026-04-11 10:09:40 +08:00
|
|
|
<template>
|
|
|
|
|
<div>
|
2026-04-28 10:05:49 +08:00
|
|
|
<!-- 加载泥石流隐患点 -->
|
2026-04-13 10:30:03 +08:00
|
|
|
<LoadingPoints
|
2026-05-07 12:53:25 +08:00
|
|
|
v-if="useStatus.appLoadingCompleted && debrisFlowPoints.length > 0"
|
2026-04-28 10:05:49 +08:00
|
|
|
:base-points="debrisFlowPoints"
|
2026-04-13 10:30:03 +08:00
|
|
|
:get-disaster-icon="getDisasterIcon"
|
2026-04-28 10:05:49 +08:00
|
|
|
:prefix="config.prefix.debrisFlowHiddenPointId"
|
2026-04-28 17:08:43 +08:00
|
|
|
:is-default="true"
|
2026-04-28 10:05:49 +08:00
|
|
|
:loading-resource-field="LoadingResource.DEBRIS_FLOW_HIDDEN_POINT"
|
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
|
2026-04-28 10:05:49 +08:00
|
|
|
:data="debrisFlowPointDetail as Record<string, any>"
|
2026-04-13 10:30:03 +08:00
|
|
|
:field="field"
|
2026-05-07 12:53:25 +08:00
|
|
|
v-if="useLoadingInformation.debrisFlowHiddenPoint.loading"
|
2026-04-13 10:30:03 +08:00
|
|
|
:title="informationBoxTitle"
|
|
|
|
|
:offset-x="offsetX"
|
|
|
|
|
:offset-y="offsetY"
|
2026-05-07 12:53:25 +08:00
|
|
|
:key="useLoadingInformation.debrisFlowHiddenPoint.id"
|
2026-04-13 10:30:03 +08:00
|
|
|
/>
|
2026-04-11 10:09:40 +08:00
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
2026-04-13 10:30:03 +08:00
|
|
|
import { ref, watch } from 'vue';
|
|
|
|
|
import { $api } from '@/api/api.ts';
|
2026-04-21 19:50:57 +08:00
|
|
|
import type { Point } from '@/types/base/Point.ts';
|
|
|
|
|
import LoadingPoints from '@/component/common/LoadingPoints.vue';
|
2026-04-13 10:30:03 +08:00
|
|
|
import config from '@/config/config.json';
|
|
|
|
|
import InformationBox from '@/component/common/InformationBox.vue';
|
2026-04-28 10:05:49 +08:00
|
|
|
import { useStatusStore } from '@/stores/useStatusStore.ts';
|
2026-04-21 19:50:57 +08:00
|
|
|
import { useLoadingInformationStore } from '@/stores/useLoadingInformation.ts';
|
|
|
|
|
import { CesiumUtilsSingleton } from '@/utils/cesium/CesiumUtils.ts';
|
|
|
|
|
import { LoadingResource } from '@/types/common/LoadingResourceType.ts';
|
2026-04-28 10:05:49 +08:00
|
|
|
import { useHiddenPoint } from '@/hooks/rain-earthquake/useHiddenPoint.ts';
|
2026-04-21 19:50:57 +08:00
|
|
|
import { useLoadingResourceStore } from '@/stores/useLoadingResourceStore.ts';
|
2026-04-28 17:08:43 +08:00
|
|
|
import {
|
|
|
|
|
PointType,
|
|
|
|
|
HiddenDangerPointTypeMap,
|
|
|
|
|
} from '@/types/common/DisasterType.ts';
|
2026-04-13 10:30:03 +08:00
|
|
|
|
2026-04-28 10:05:49 +08:00
|
|
|
const debrisFlowPoints = ref<Point[]>([]);
|
2026-04-13 10:30:03 +08:00
|
|
|
|
2026-05-07 12:53:25 +08:00
|
|
|
const useStatus = useStatusStore();
|
|
|
|
|
const useLoadingInformation = useLoadingInformationStore();
|
|
|
|
|
const useLoadingResource = useLoadingResourceStore();
|
|
|
|
|
|
|
|
|
|
const { field, getDisasterIcon } = useHiddenPoint();
|
|
|
|
|
|
2026-04-28 10:05:49 +08:00
|
|
|
// 信息框相关配置
|
2026-04-13 10:30:03 +08:00
|
|
|
const offsetX = ref(0);
|
|
|
|
|
const offsetY = ref(0);
|
2026-04-28 10:05:49 +08:00
|
|
|
const debrisFlowPointDetail = ref<Point>();
|
|
|
|
|
const informationBoxTitle = ref('');
|
2026-04-13 10:30:03 +08:00
|
|
|
|
2026-04-28 10:05:49 +08:00
|
|
|
// 加载泥石流隐患点数据
|
2026-04-28 17:08:43 +08:00
|
|
|
$api.hiddenDangerSpots
|
|
|
|
|
.getBasePoints(HiddenDangerPointTypeMap[PointType.DEBRIS_FLOW])
|
|
|
|
|
.then((res) => {
|
|
|
|
|
debrisFlowPoints.value = res.data;
|
|
|
|
|
});
|
2026-04-13 10:30:03 +08:00
|
|
|
|
|
|
|
|
// 监听id变化
|
|
|
|
|
watch(
|
2026-05-07 12:53:25 +08:00
|
|
|
() => useLoadingInformation.debrisFlowHiddenPoint.id,
|
2026-04-13 10:30:03 +08:00
|
|
|
async (newId: number) => {
|
|
|
|
|
if (newId === -1) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
2026-04-28 10:05:49 +08:00
|
|
|
// 获取泥石流隐患点数据
|
2026-05-07 12:53:25 +08:00
|
|
|
const clickObject = useLoadingInformation.clickObject;
|
2026-04-13 10:30:03 +08:00
|
|
|
|
|
|
|
|
if (!clickObject || !clickObject.primitive) {
|
|
|
|
|
console.warn('点击对象或图元不存在');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const res = await $api.hiddenDangerSpots.getPointDetailById(
|
2026-05-07 12:53:25 +08:00
|
|
|
useLoadingInformation.debrisFlowHiddenPoint.id
|
2026-04-13 10:30:03 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
// 更新数据
|
2026-04-28 10:05:49 +08:00
|
|
|
debrisFlowPointDetail.value = res.data;
|
|
|
|
|
informationBoxTitle.value = res.data.disasterName || '泥石流隐患点信息';
|
2026-04-13 10:30:03 +08:00
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
// 将坐标转换为偏移量
|
|
|
|
|
const screenPos = CesiumUtilsSingleton.convertScreenPosition(
|
|
|
|
|
clickObject.primitive.position
|
|
|
|
|
);
|
|
|
|
|
offsetX.value = screenPos.x;
|
|
|
|
|
offsetY.value = screenPos.y;
|
|
|
|
|
|
|
|
|
|
// 显示新的信息框
|
2026-05-07 12:53:25 +08:00
|
|
|
useLoadingInformation.debrisFlowHiddenPoint.loading = true;
|
2026-04-13 10:30:03 +08:00
|
|
|
} catch (error) {
|
|
|
|
|
throw new Error(`坐标转换失败:${error}`);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
);
|
2026-04-18 17:34:46 +08:00
|
|
|
|
|
|
|
|
// 监听显示隐藏
|
|
|
|
|
watch(
|
2026-05-07 12:53:25 +08:00
|
|
|
() => useStatus.poiLayers.showDebrisFlowHiddenPoint.show,
|
2026-04-18 17:34:46 +08:00
|
|
|
(newValue: boolean) => {
|
|
|
|
|
if (newValue) {
|
2026-04-28 10:05:49 +08:00
|
|
|
// 显示泥石流隐患点
|
2026-04-18 17:34:46 +08:00
|
|
|
CesiumUtilsSingleton.batchShowPrimitives(
|
2026-05-07 12:53:25 +08:00
|
|
|
useLoadingResource.getLoadingResource(
|
2026-04-28 17:08:43 +08:00
|
|
|
LoadingResource.DEBRIS_FLOW_HIDDEN_POINT
|
|
|
|
|
).ids
|
2026-04-18 17:34:46 +08:00
|
|
|
);
|
|
|
|
|
} else {
|
2026-04-28 10:05:49 +08:00
|
|
|
// 隐藏泥石流隐患点
|
2026-04-18 17:34:46 +08:00
|
|
|
CesiumUtilsSingleton.batchHidePrimitives(
|
2026-05-07 12:53:25 +08:00
|
|
|
useLoadingResource.getLoadingResource(
|
2026-04-28 17:08:43 +08:00
|
|
|
LoadingResource.DEBRIS_FLOW_HIDDEN_POINT
|
|
|
|
|
).ids
|
2026-04-18 17:34:46 +08:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
);
|
2026-04-11 10:09:40 +08:00
|
|
|
</script>
|
2026-04-28 10:05:49 +08:00
|
|
|
|
2026-04-11 10:09:40 +08:00
|
|
|
<style scoped></style>
|