修改组件中hooks和store的调用方式
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<div>
|
||||
<!-- 加载桥梁点 -->
|
||||
<LoadingPoints
|
||||
v-if="useStatusStore().appLoadingCompleted && bridgeList.length > 0"
|
||||
v-if="useStatus.appLoadingCompleted && bridgeList.length > 0"
|
||||
:base-points="bridgeList"
|
||||
:get-disaster-icon="getDisasterIcon"
|
||||
:prefix="config.prefix.bridgePointId"
|
||||
@@ -15,11 +15,11 @@
|
||||
<InformationBox
|
||||
:data="storePointDetail as Record<string, any>"
|
||||
:field="field"
|
||||
v-if="useLoadingInformationStore().bridge.loading"
|
||||
v-if="useLoadingInformation.bridge.loading"
|
||||
:title="informationBoxTitle"
|
||||
:offset-x="offsetX"
|
||||
:offset-y="offsetY"
|
||||
:key="useLoadingInformationStore().bridge.id"
|
||||
:key="useLoadingInformation.bridge.id"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
@@ -40,6 +40,10 @@
|
||||
|
||||
const bridgeList = ref<Point[]>([]);
|
||||
|
||||
const useStatus = useStatusStore();
|
||||
const useLoadingInformation = useLoadingInformationStore();
|
||||
const useLoadingResource = useLoadingResourceStore();
|
||||
|
||||
// 信息框相关配置
|
||||
const offsetX = ref(0);
|
||||
const offsetY = ref(0);
|
||||
@@ -55,13 +59,13 @@
|
||||
|
||||
// 监听id变化
|
||||
watch(
|
||||
() => useLoadingInformationStore().bridge.id,
|
||||
() => useLoadingInformation.bridge.id,
|
||||
async (newId: number) => {
|
||||
if (newId === -1) {
|
||||
return;
|
||||
}
|
||||
// 获取桥梁点数据
|
||||
const clickObject = useLoadingInformationStore().clickObject;
|
||||
const clickObject = useLoadingInformation.clickObject;
|
||||
|
||||
if (!clickObject || !clickObject.primitive) {
|
||||
console.warn('点击对象或图元不存在');
|
||||
@@ -69,7 +73,7 @@
|
||||
}
|
||||
|
||||
const res = await $api.bridges.getPointDetailById(
|
||||
useLoadingInformationStore().bridge.id
|
||||
useLoadingInformation.bridge.id
|
||||
);
|
||||
|
||||
// 更新数据
|
||||
@@ -85,7 +89,7 @@
|
||||
offsetY.value = screenPos.y;
|
||||
|
||||
// 显示新的信息框
|
||||
useLoadingInformationStore().bridge.loading = true;
|
||||
useLoadingInformation.bridge.loading = true;
|
||||
} catch (error) {
|
||||
throw new Error(`坐标转换失败:${error}`);
|
||||
}
|
||||
@@ -94,18 +98,18 @@
|
||||
|
||||
// 监听显示隐藏
|
||||
watch(
|
||||
() => useStatusStore().infrastructureLayers.showBridge.show,
|
||||
() => useStatus.infrastructureLayers.showBridge.show,
|
||||
(newValue: boolean) => {
|
||||
if (newValue) {
|
||||
// 显示桥梁点
|
||||
CesiumUtilsSingleton.batchShowPrimitives(
|
||||
useLoadingResourceStore().getLoadingResource(LoadingResource.BRIDGE)
|
||||
useLoadingResource.getLoadingResource(LoadingResource.BRIDGE)
|
||||
.ids
|
||||
);
|
||||
} else {
|
||||
// 隐藏桥梁点
|
||||
CesiumUtilsSingleton.batchHidePrimitives(
|
||||
useLoadingResourceStore().getLoadingResource(LoadingResource.BRIDGE)
|
||||
useLoadingResource.getLoadingResource(LoadingResource.BRIDGE)
|
||||
.ids
|
||||
);
|
||||
}
|
||||
|
||||
@@ -3,9 +3,7 @@
|
||||
<div>
|
||||
<!-- 加载危险源 -->
|
||||
<LoadingPoints
|
||||
v-if="
|
||||
useStatusStore().appLoadingCompleted && dangerousSourcePoints.length > 0
|
||||
"
|
||||
v-if="useStatus.appLoadingCompleted && dangerousSourcePoints.length > 0"
|
||||
:base-points="dangerousSourcePoints"
|
||||
:get-disaster-icon="getDisasterIcon"
|
||||
:prefix="config.prefix.dangerousSourcePointId"
|
||||
@@ -17,11 +15,11 @@
|
||||
<InformationBox
|
||||
:data="dangerousSourcePointDetail as Record<string, any>"
|
||||
:field="field"
|
||||
v-if="useLoadingInformationStore().dangerousSource.loading"
|
||||
v-if="useLoadingInformation.dangerousSource.loading"
|
||||
:title="informationBoxTitle"
|
||||
:offset-x="offsetX"
|
||||
:offset-y="offsetY"
|
||||
:key="useLoadingInformationStore().dangerousSource.id"
|
||||
:key="useLoadingInformation.dangerousSource.id"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
@@ -42,6 +40,10 @@
|
||||
|
||||
const dangerousSourcePoints = ref<Point[]>([]);
|
||||
|
||||
const useStatus = useStatusStore();
|
||||
const useLoadingInformation = useLoadingInformationStore();
|
||||
const useLoadingResource = useLoadingResourceStore();
|
||||
|
||||
// 信息框相关配置
|
||||
const offsetX = ref(0);
|
||||
const offsetY = ref(0);
|
||||
@@ -57,13 +59,13 @@
|
||||
|
||||
// 监听id变化
|
||||
watch(
|
||||
() => useLoadingInformationStore().dangerousSource.id,
|
||||
() => useLoadingInformation.dangerousSource.id,
|
||||
async (newId: number) => {
|
||||
if (newId === -1) {
|
||||
return;
|
||||
}
|
||||
// 获取危险源数据
|
||||
const clickObject = useLoadingInformationStore().clickObject;
|
||||
const clickObject = useLoadingInformation.clickObject;
|
||||
|
||||
if (!clickObject || !clickObject.primitive) {
|
||||
console.warn('点击对象或图元不存在');
|
||||
@@ -71,7 +73,7 @@
|
||||
}
|
||||
|
||||
const res = await $api.dangerousSource.getPointDetailById(
|
||||
useLoadingInformationStore().dangerousSource.id
|
||||
useLoadingInformation.dangerousSource.id
|
||||
);
|
||||
|
||||
// 更新数据
|
||||
@@ -87,7 +89,7 @@
|
||||
offsetY.value = screenPos.y;
|
||||
|
||||
// 显示新的信息框
|
||||
useLoadingInformationStore().dangerousSource.loading = true;
|
||||
useLoadingInformation.dangerousSource.loading = true;
|
||||
} catch (error) {
|
||||
throw new Error(`坐标转换失败:${error}`);
|
||||
}
|
||||
@@ -96,19 +98,19 @@
|
||||
|
||||
// 监听显示隐藏
|
||||
watch(
|
||||
() => useStatusStore().poiLayers.showDangerSource.show,
|
||||
() => useStatus.poiLayers.showDangerSource.show,
|
||||
(newValue: boolean) => {
|
||||
if (newValue) {
|
||||
// 显示危险源
|
||||
CesiumUtilsSingleton.batchShowPrimitives(
|
||||
useLoadingResourceStore().getLoadingResource(
|
||||
useLoadingResource.getLoadingResource(
|
||||
LoadingResource.DANGEROUS_SOURCE
|
||||
).ids
|
||||
);
|
||||
} else {
|
||||
// 隐藏危险源
|
||||
CesiumUtilsSingleton.batchHidePrimitives(
|
||||
useLoadingResourceStore().getLoadingResource(
|
||||
useLoadingResource.getLoadingResource(
|
||||
LoadingResource.DANGEROUS_SOURCE
|
||||
).ids
|
||||
);
|
||||
|
||||
@@ -3,10 +3,7 @@
|
||||
<div>
|
||||
<!-- 加载避难所 -->
|
||||
<LoadingPoints
|
||||
v-if="
|
||||
useStatusStore().appLoadingCompleted &&
|
||||
emergencyShelterPoints.length > 0
|
||||
"
|
||||
v-if="useStatus.appLoadingCompleted && emergencyShelterPoints.length > 0"
|
||||
:base-points="emergencyShelterPoints"
|
||||
:get-disaster-icon="getDisasterIcon"
|
||||
:prefix="config.prefix.emergencyShelterPointId"
|
||||
@@ -18,11 +15,11 @@
|
||||
<InformationBox
|
||||
:data="emergencyShelterPointDetail as Record<string, any>"
|
||||
:field="field"
|
||||
v-if="useLoadingInformationStore().emergencyShelter.loading"
|
||||
v-if="useLoadingInformation.emergencyShelter.loading"
|
||||
:title="informationBoxTitle"
|
||||
:offset-x="offsetX"
|
||||
:offset-y="offsetY"
|
||||
:key="useLoadingInformationStore().emergencyShelter.id"
|
||||
:key="useLoadingInformation.emergencyShelter.id"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
@@ -43,6 +40,10 @@
|
||||
|
||||
const emergencyShelterPoints = ref<Point[]>([]);
|
||||
|
||||
const useStatus = useStatusStore();
|
||||
const useLoadingInformation = useLoadingInformationStore();
|
||||
const useLoadingResource = useLoadingResourceStore();
|
||||
|
||||
// 信息框相关配置
|
||||
const offsetX = ref(0);
|
||||
const offsetY = ref(0);
|
||||
@@ -58,13 +59,13 @@
|
||||
|
||||
// 监听id变化
|
||||
watch(
|
||||
() => useLoadingInformationStore().emergencyShelter.id,
|
||||
() => useLoadingInformation.emergencyShelter.id,
|
||||
async (newId: number) => {
|
||||
if (newId === -1) {
|
||||
return;
|
||||
}
|
||||
// 获取避难所数据
|
||||
const clickObject = useLoadingInformationStore().clickObject;
|
||||
const clickObject = useLoadingInformation.clickObject;
|
||||
|
||||
if (!clickObject || !clickObject.primitive) {
|
||||
console.warn('点击对象或图元不存在');
|
||||
@@ -72,7 +73,7 @@
|
||||
}
|
||||
|
||||
const res = await $api.emergencyShelter.getPointDetailById(
|
||||
useLoadingInformationStore().emergencyShelter.id
|
||||
useLoadingInformation.emergencyShelter.id
|
||||
);
|
||||
|
||||
// 更新数据
|
||||
@@ -88,7 +89,7 @@
|
||||
offsetY.value = screenPos.y;
|
||||
|
||||
// 显示新的信息框
|
||||
useLoadingInformationStore().emergencyShelter.loading = true;
|
||||
useLoadingInformation.emergencyShelter.loading = true;
|
||||
} catch (error) {
|
||||
throw new Error(`坐标转换失败:${error}`);
|
||||
}
|
||||
@@ -97,19 +98,19 @@
|
||||
|
||||
// 监听显示隐藏
|
||||
watch(
|
||||
() => useStatusStore().poiLayers.showRefugeeShelter.show,
|
||||
() => useStatus.poiLayers.showRefugeeShelter.show,
|
||||
(newValue: boolean) => {
|
||||
if (newValue) {
|
||||
// 显示避难所
|
||||
CesiumUtilsSingleton.batchShowPrimitives(
|
||||
useLoadingResourceStore().getLoadingResource(
|
||||
useLoadingResource.getLoadingResource(
|
||||
LoadingResource.EMERGENCY_SHELTER
|
||||
).ids
|
||||
);
|
||||
} else {
|
||||
// 隐藏避难所
|
||||
CesiumUtilsSingleton.batchHidePrimitives(
|
||||
useLoadingResourceStore().getLoadingResource(
|
||||
useLoadingResource.getLoadingResource(
|
||||
LoadingResource.EMERGENCY_SHELTER
|
||||
).ids
|
||||
);
|
||||
|
||||
@@ -3,9 +3,7 @@
|
||||
<div>
|
||||
<!-- 加载消防站 -->
|
||||
<LoadingPoints
|
||||
v-if="
|
||||
useStatusStore().appLoadingCompleted && fireStationPoints.length > 0
|
||||
"
|
||||
v-if="useStatus.appLoadingCompleted && fireStationPoints.length > 0"
|
||||
:base-points="fireStationPoints"
|
||||
:get-disaster-icon="getDisasterIcon"
|
||||
:prefix="config.prefix.fireStationPointId"
|
||||
@@ -17,11 +15,11 @@
|
||||
<InformationBox
|
||||
:data="fireStationPointDetail as Record<string, any>"
|
||||
:field="field"
|
||||
v-if="useLoadingInformationStore().fireStation.loading"
|
||||
v-if="useLoadingInformation.fireStation.loading"
|
||||
:title="informationBoxTitle"
|
||||
:offset-x="offsetX"
|
||||
:offset-y="offsetY"
|
||||
:key="useLoadingInformationStore().fireStation.id"
|
||||
:key="useLoadingInformation.fireStation.id"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
@@ -42,6 +40,10 @@
|
||||
|
||||
const fireStationPoints = ref<Point[]>([]);
|
||||
|
||||
const useStatus = useStatusStore();
|
||||
const useLoadingInformation = useLoadingInformationStore();
|
||||
const useLoadingResource = useLoadingResourceStore();
|
||||
|
||||
// 信息框相关配置
|
||||
const offsetX = ref(0);
|
||||
const offsetY = ref(0);
|
||||
@@ -57,13 +59,13 @@
|
||||
|
||||
// 监听id变化
|
||||
watch(
|
||||
() => useLoadingInformationStore().fireStation.id,
|
||||
() => useLoadingInformation.fireStation.id,
|
||||
async (newId: number) => {
|
||||
if (newId === -1) {
|
||||
return;
|
||||
}
|
||||
// 获取消防站数据
|
||||
const clickObject = useLoadingInformationStore().clickObject;
|
||||
const clickObject = useLoadingInformation.clickObject;
|
||||
|
||||
if (!clickObject || !clickObject.primitive) {
|
||||
console.warn('点击对象或图元不存在');
|
||||
@@ -71,7 +73,7 @@
|
||||
}
|
||||
|
||||
const res = await $api.firefighter.getPointDetailById(
|
||||
useLoadingInformationStore().fireStation.id
|
||||
useLoadingInformation.fireStation.id
|
||||
);
|
||||
|
||||
// 更新数据
|
||||
@@ -87,7 +89,7 @@
|
||||
offsetY.value = screenPos.y;
|
||||
|
||||
// 显示新的信息框
|
||||
useLoadingInformationStore().fireStation.loading = true;
|
||||
useLoadingInformation.fireStation.loading = true;
|
||||
} catch (error) {
|
||||
throw new Error(`坐标转换失败:${error}`);
|
||||
}
|
||||
@@ -96,19 +98,19 @@
|
||||
|
||||
// 监听显示隐藏
|
||||
watch(
|
||||
() => useStatusStore().poiLayers.showFireStation.show,
|
||||
() => useStatus.poiLayers.showFireStation.show,
|
||||
(newValue: boolean) => {
|
||||
if (newValue) {
|
||||
// 显示消防站
|
||||
CesiumUtilsSingleton.batchShowPrimitives(
|
||||
useLoadingResourceStore().getLoadingResource(
|
||||
useLoadingResource.getLoadingResource(
|
||||
LoadingResource.FIRE_STATION
|
||||
).ids
|
||||
);
|
||||
} else {
|
||||
// 隐藏消防站
|
||||
CesiumUtilsSingleton.batchHidePrimitives(
|
||||
useLoadingResourceStore().getLoadingResource(
|
||||
useLoadingResource.getLoadingResource(
|
||||
LoadingResource.FIRE_STATION
|
||||
).ids
|
||||
);
|
||||
|
||||
@@ -13,13 +13,15 @@
|
||||
import { onMounted, watch } from 'vue';
|
||||
import LoadingGeoserverLayer from '../../common/LoadingGeoserverLayer.vue';
|
||||
|
||||
const useStatus = useStatusStore();
|
||||
|
||||
// 保存图层引用
|
||||
let highwayLayer: ImageryLayer | null = null;
|
||||
|
||||
onMounted(() => {
|
||||
// 监听显示隐藏
|
||||
watch(
|
||||
() => useStatusStore().infrastructureLayers.showHighway.show,
|
||||
() => useStatus.infrastructureLayers.showHighway.show,
|
||||
(newValue: boolean) => {
|
||||
highwayLayer!.show = newValue;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<div>
|
||||
<!-- 加载医院 -->
|
||||
<LoadingPoints
|
||||
v-if="useStatusStore().appLoadingCompleted && hospitalPoints.length > 0"
|
||||
v-if="useStatus.appLoadingCompleted && hospitalPoints.length > 0"
|
||||
:base-points="hospitalPoints"
|
||||
:get-disaster-icon="getDisasterIcon"
|
||||
:prefix="config.prefix.hospitalPointId"
|
||||
@@ -15,11 +15,11 @@
|
||||
<InformationBox
|
||||
:data="hospitalPointDetail as Record<string, any>"
|
||||
:field="field"
|
||||
v-if="useLoadingInformationStore().hospital.loading"
|
||||
v-if="useLoadingInformation.hospital.loading"
|
||||
:title="informationBoxTitle"
|
||||
:offset-x="offsetX"
|
||||
:offset-y="offsetY"
|
||||
:key="useLoadingInformationStore().hospital.id"
|
||||
:key="useLoadingInformation.hospital.id"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
@@ -40,6 +40,10 @@
|
||||
|
||||
const hospitalPoints = ref<Point[]>([]);
|
||||
|
||||
const useStatus = useStatusStore();
|
||||
const useLoadingInformation = useLoadingInformationStore();
|
||||
const useLoadingResource = useLoadingResourceStore();
|
||||
|
||||
// 信息框相关配置
|
||||
const offsetX = ref(0);
|
||||
const offsetY = ref(0);
|
||||
@@ -55,13 +59,13 @@
|
||||
|
||||
// 监听id变化
|
||||
watch(
|
||||
() => useLoadingInformationStore().hospital.id,
|
||||
() => useLoadingInformation.hospital.id,
|
||||
async (newId: number) => {
|
||||
if (newId === -1) {
|
||||
return;
|
||||
}
|
||||
// 获取医院数据
|
||||
const clickObject = useLoadingInformationStore().clickObject;
|
||||
const clickObject = useLoadingInformation.clickObject;
|
||||
|
||||
if (!clickObject || !clickObject.primitive) {
|
||||
console.warn('点击对象或图元不存在');
|
||||
@@ -69,7 +73,7 @@
|
||||
}
|
||||
|
||||
const res = await $api.hospitals.getPointDetailById(
|
||||
useLoadingInformationStore().hospital.id
|
||||
useLoadingInformation.hospital.id
|
||||
);
|
||||
|
||||
// 更新数据
|
||||
@@ -85,7 +89,7 @@
|
||||
offsetY.value = screenPos.y;
|
||||
|
||||
// 显示新的信息框
|
||||
useLoadingInformationStore().hospital.loading = true;
|
||||
useLoadingInformation.hospital.loading = true;
|
||||
} catch (error) {
|
||||
throw new Error(`坐标转换失败:${error}`);
|
||||
}
|
||||
@@ -94,18 +98,18 @@
|
||||
|
||||
// 监听显示隐藏
|
||||
watch(
|
||||
() => useStatusStore().poiLayers.showHospital.show,
|
||||
() => useStatus.poiLayers.showHospital.show,
|
||||
(newValue: boolean) => {
|
||||
if (newValue) {
|
||||
// 显示医院
|
||||
CesiumUtilsSingleton.batchShowPrimitives(
|
||||
useLoadingResourceStore().getLoadingResource(LoadingResource.HOSPITAL)
|
||||
useLoadingResource.getLoadingResource(LoadingResource.HOSPITAL)
|
||||
.ids
|
||||
);
|
||||
} else {
|
||||
// 隐藏医院
|
||||
CesiumUtilsSingleton.batchHidePrimitives(
|
||||
useLoadingResourceStore().getLoadingResource(LoadingResource.HOSPITAL)
|
||||
useLoadingResource.getLoadingResource(LoadingResource.HOSPITAL)
|
||||
.ids
|
||||
);
|
||||
}
|
||||
|
||||
@@ -13,13 +13,15 @@
|
||||
import { onMounted, watch } from 'vue';
|
||||
import LoadingGeoserverLayer from '../../common/LoadingGeoserverLayer.vue';
|
||||
|
||||
const useStatus = useStatusStore();
|
||||
|
||||
// 保存图层引用
|
||||
let mainRoadLayer: ImageryLayer | null = null;
|
||||
|
||||
onMounted(() => {
|
||||
// 监听显示隐藏
|
||||
watch(
|
||||
() => useStatusStore().infrastructureLayers.showMainRoad.show,
|
||||
() => useStatus.infrastructureLayers.showMainRoad.show,
|
||||
(newValue: boolean) => {
|
||||
mainRoadLayer!.show = newValue;
|
||||
}
|
||||
|
||||
@@ -13,13 +13,15 @@
|
||||
import { onMounted, watch } from 'vue';
|
||||
import LoadingGeoserverLayer from '../../common/LoadingGeoserverLayer.vue';
|
||||
|
||||
const useStatus = useStatusStore();
|
||||
|
||||
// 保存图层引用
|
||||
let populationLayer: ImageryLayer | null = null;
|
||||
|
||||
onMounted(() => {
|
||||
// 监听显示
|
||||
watch(
|
||||
() => useStatusStore().poiLayers.showPopulationGrid.show,
|
||||
() => useStatus.poiLayers.showPopulationGrid.show,
|
||||
(newValue: boolean) => {
|
||||
populationLayer!.show = newValue;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<div>
|
||||
<!-- 加载水库点位 -->
|
||||
<LoadingPoints
|
||||
v-if="useStatusStore().appLoadingCompleted && reservoirList.length > 0"
|
||||
v-if="useStatus.appLoadingCompleted && reservoirList.length > 0"
|
||||
:base-points="reservoirList"
|
||||
:get-disaster-icon="getDisasterIcon"
|
||||
:prefix="config.prefix.reservoirPointId"
|
||||
@@ -15,11 +15,11 @@
|
||||
<InformationBox
|
||||
:data="reservoirDetail as Record<string, any>"
|
||||
:field="field"
|
||||
v-if="useLoadingInformationStore().reservoir.loading"
|
||||
v-if="useLoadingInformation.reservoir.loading"
|
||||
:title="informationBoxTitle"
|
||||
:offset-x="offsetX"
|
||||
:offset-y="offsetY"
|
||||
:key="useLoadingInformationStore().reservoir.id"
|
||||
:key="useLoadingInformation.reservoir.id"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
@@ -40,6 +40,10 @@
|
||||
|
||||
const reservoirList = ref<Point[]>([]);
|
||||
|
||||
const useStatus = useStatusStore();
|
||||
const useLoadingInformation = useLoadingInformationStore();
|
||||
const useLoadingResource = useLoadingResourceStore();
|
||||
|
||||
// 信息框相关配置
|
||||
const offsetX = ref(0);
|
||||
const offsetY = ref(0);
|
||||
@@ -55,13 +59,13 @@
|
||||
|
||||
// 监听id变化
|
||||
watch(
|
||||
() => useLoadingInformationStore().reservoir.id,
|
||||
() => useLoadingInformation.reservoir.id,
|
||||
async (newId: number) => {
|
||||
if (newId === -1) {
|
||||
return;
|
||||
}
|
||||
// 获取水库数据
|
||||
const clickObject = useLoadingInformationStore().clickObject;
|
||||
const clickObject = useLoadingInformation.clickObject;
|
||||
|
||||
if (!clickObject || !clickObject.primitive) {
|
||||
console.warn('点击对象或图元不存在');
|
||||
@@ -69,7 +73,7 @@
|
||||
}
|
||||
|
||||
const res = await $api.reservoirs.getPointDetailById(
|
||||
useLoadingInformationStore().reservoir.id
|
||||
useLoadingInformation.reservoir.id
|
||||
);
|
||||
|
||||
// 更新数据
|
||||
@@ -85,7 +89,7 @@
|
||||
offsetY.value = screenPos.y;
|
||||
|
||||
// 显示新的信息框
|
||||
useLoadingInformationStore().reservoir.loading = true;
|
||||
useLoadingInformation.reservoir.loading = true;
|
||||
} catch (error) {
|
||||
throw new Error(`坐标转换失败:${error}`);
|
||||
}
|
||||
@@ -94,19 +98,19 @@
|
||||
|
||||
// 监听显示隐藏
|
||||
watch(
|
||||
() => useStatusStore().infrastructureLayers.showReservoir?.show,
|
||||
() => useStatus.infrastructureLayers.showReservoir?.show,
|
||||
(newValue: boolean) => {
|
||||
if (newValue) {
|
||||
// 显示水库
|
||||
CesiumUtilsSingleton.batchShowPrimitives(
|
||||
useLoadingResourceStore().getLoadingResource(
|
||||
useLoadingResource.getLoadingResource(
|
||||
LoadingResource.RESERVOIR
|
||||
).ids
|
||||
);
|
||||
} else {
|
||||
// 隐藏水库
|
||||
CesiumUtilsSingleton.batchHidePrimitives(
|
||||
useLoadingResourceStore().getLoadingResource(
|
||||
useLoadingResource.getLoadingResource(
|
||||
LoadingResource.RESERVOIR
|
||||
).ids
|
||||
);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<div>
|
||||
<!-- 加载学校点位 -->
|
||||
<LoadingPoints
|
||||
v-if="useStatusStore().appLoadingCompleted && schoolList.length > 0"
|
||||
v-if="useStatus.appLoadingCompleted && schoolList.length > 0"
|
||||
:base-points="schoolList"
|
||||
:get-disaster-icon="getDisasterIcon"
|
||||
:prefix="config.prefix.schoolPointId"
|
||||
@@ -15,11 +15,11 @@
|
||||
<InformationBox
|
||||
:data="schoolDetail as Record<string, any>"
|
||||
:field="field"
|
||||
v-if="useLoadingInformationStore().school.loading"
|
||||
v-if="useLoadingInformation.school.loading"
|
||||
:title="informationBoxTitle"
|
||||
:offset-x="offsetX"
|
||||
:offset-y="offsetY"
|
||||
:key="useLoadingInformationStore().school.id"
|
||||
:key="useLoadingInformation.school.id"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
@@ -40,6 +40,10 @@
|
||||
|
||||
const schoolList = ref<Point[]>([]);
|
||||
|
||||
const useStatus = useStatusStore();
|
||||
const useLoadingInformation = useLoadingInformationStore();
|
||||
const useLoadingResource = useLoadingResourceStore();
|
||||
|
||||
// 信息框相关配置
|
||||
const offsetX = ref(0);
|
||||
const offsetY = ref(0);
|
||||
@@ -55,13 +59,13 @@
|
||||
|
||||
// 监听id变化
|
||||
watch(
|
||||
() => useLoadingInformationStore().school.id,
|
||||
() => useLoadingInformation.school.id,
|
||||
async (newId: number) => {
|
||||
if (newId === -1) {
|
||||
return;
|
||||
}
|
||||
// 获取学校数据
|
||||
const clickObject = useLoadingInformationStore().clickObject;
|
||||
const clickObject = useLoadingInformation.clickObject;
|
||||
|
||||
if (!clickObject || !clickObject.primitive) {
|
||||
console.warn('点击对象或图元不存在');
|
||||
@@ -69,7 +73,7 @@
|
||||
}
|
||||
|
||||
const res = await $api.schools.getPointDetailById(
|
||||
useLoadingInformationStore().school.id
|
||||
useLoadingInformation.school.id
|
||||
);
|
||||
|
||||
// 更新数据
|
||||
@@ -85,7 +89,7 @@
|
||||
offsetY.value = screenPos.y;
|
||||
|
||||
// 显示新的信息框
|
||||
useLoadingInformationStore().school.loading = true;
|
||||
useLoadingInformation.school.loading = true;
|
||||
} catch (error) {
|
||||
throw new Error(`坐标转换失败:${error}`);
|
||||
}
|
||||
@@ -94,18 +98,18 @@
|
||||
|
||||
// 监听显示隐藏
|
||||
watch(
|
||||
() => useStatusStore().poiLayers.showSchool?.show,
|
||||
() => useStatus.poiLayers.showSchool?.show,
|
||||
(newValue: boolean) => {
|
||||
if (newValue) {
|
||||
// 显示学校
|
||||
CesiumUtilsSingleton.batchShowPrimitives(
|
||||
useLoadingResourceStore().getLoadingResource(LoadingResource.SCHOOL)
|
||||
useLoadingResource.getLoadingResource(LoadingResource.SCHOOL)
|
||||
.ids
|
||||
);
|
||||
} else {
|
||||
// 隐藏学校
|
||||
CesiumUtilsSingleton.batchHidePrimitives(
|
||||
useLoadingResourceStore().getLoadingResource(LoadingResource.SCHOOL)
|
||||
useLoadingResource.getLoadingResource(LoadingResource.SCHOOL)
|
||||
.ids
|
||||
);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<div>
|
||||
<!-- 加载物资储备点 -->
|
||||
<LoadingPoints
|
||||
v-if="useStatusStore().appLoadingCompleted && storePointsList.length > 0"
|
||||
v-if="useStatus.appLoadingCompleted && storePointsList.length > 0"
|
||||
:base-points="storePointsList"
|
||||
:get-disaster-icon="getDisasterIcon"
|
||||
:prefix="config.prefix.storePointsPointId"
|
||||
@@ -15,11 +15,11 @@
|
||||
<InformationBox
|
||||
:data="storePointDetail as Record<string, any>"
|
||||
:field="field"
|
||||
v-if="useLoadingInformationStore().storePoints.loading"
|
||||
v-if="useLoadingInformation.storePoints.loading"
|
||||
:title="informationBoxTitle"
|
||||
:offset-x="offsetX"
|
||||
:offset-y="offsetY"
|
||||
:key="useLoadingInformationStore().storePoints.id"
|
||||
:key="useLoadingInformation.storePoints.id"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
@@ -40,6 +40,10 @@
|
||||
|
||||
const storePointsList = ref<Point[]>([]);
|
||||
|
||||
const useStatus = useStatusStore();
|
||||
const useLoadingInformation = useLoadingInformationStore();
|
||||
const useLoadingResource = useLoadingResourceStore();
|
||||
|
||||
// 信息框相关配置
|
||||
const offsetX = ref(0);
|
||||
const offsetY = ref(0);
|
||||
@@ -55,13 +59,13 @@
|
||||
|
||||
// 监听id变化
|
||||
watch(
|
||||
() => useLoadingInformationStore().storePoints.id,
|
||||
() => useLoadingInformation.storePoints.id,
|
||||
async (newId: number) => {
|
||||
if (newId === -1) {
|
||||
return;
|
||||
}
|
||||
// 获取物资储备点数据
|
||||
const clickObject = useLoadingInformationStore().clickObject;
|
||||
const clickObject = useLoadingInformation.clickObject;
|
||||
|
||||
if (!clickObject || !clickObject.primitive) {
|
||||
console.warn('点击对象或图元不存在');
|
||||
@@ -69,7 +73,7 @@
|
||||
}
|
||||
|
||||
const res = await $api.storePoints.getPointDetailById(
|
||||
useLoadingInformationStore().storePoints.id
|
||||
useLoadingInformation.storePoints.id
|
||||
);
|
||||
|
||||
// 更新数据
|
||||
@@ -85,7 +89,7 @@
|
||||
offsetY.value = screenPos.y;
|
||||
|
||||
// 显示新的信息框
|
||||
useLoadingInformationStore().storePoints.loading = true;
|
||||
useLoadingInformation.storePoints.loading = true;
|
||||
} catch (error) {
|
||||
throw new Error(`坐标转换失败:${error}`);
|
||||
}
|
||||
@@ -94,19 +98,19 @@
|
||||
|
||||
// 监听显示隐藏
|
||||
watch(
|
||||
() => useStatusStore().poiLayers.showReservePoint.show,
|
||||
() => useStatus.poiLayers.showReservePoint.show,
|
||||
(newValue: boolean) => {
|
||||
if (newValue) {
|
||||
// 显示物资储备点
|
||||
CesiumUtilsSingleton.batchShowPrimitives(
|
||||
useLoadingResourceStore().getLoadingResource(
|
||||
useLoadingResource.getLoadingResource(
|
||||
LoadingResource.STORE_POINTS
|
||||
).ids
|
||||
);
|
||||
} else {
|
||||
// 隐藏物资储备点
|
||||
CesiumUtilsSingleton.batchHidePrimitives(
|
||||
useLoadingResourceStore().getLoadingResource(
|
||||
useLoadingResource.getLoadingResource(
|
||||
LoadingResource.STORE_POINTS
|
||||
).ids
|
||||
);
|
||||
|
||||
@@ -3,9 +3,7 @@
|
||||
<div>
|
||||
<!-- 加载地铁站点点位 -->
|
||||
<LoadingPoints
|
||||
v-if="
|
||||
useStatusStore().appLoadingCompleted && subwayStationList.length > 0
|
||||
"
|
||||
v-if="useStatus.appLoadingCompleted && subwayStationList.length > 0"
|
||||
:base-points="subwayStationList"
|
||||
:get-disaster-icon="getDisasterIcon"
|
||||
:prefix="config.prefix.subwayStationPointId"
|
||||
@@ -17,11 +15,11 @@
|
||||
<InformationBox
|
||||
:data="subwayStationDetail as Record<string, any>"
|
||||
:field="field"
|
||||
v-if="useLoadingInformationStore().subwayStation.loading"
|
||||
v-if="useLoadingInformation.subwayStation.loading"
|
||||
:title="informationBoxTitle"
|
||||
:offset-x="offsetX"
|
||||
:offset-y="offsetY"
|
||||
:key="useLoadingInformationStore().subwayStation.id"
|
||||
:key="useLoadingInformation.subwayStation.id"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
@@ -42,6 +40,10 @@
|
||||
|
||||
const subwayStationList = ref<Point[]>([]);
|
||||
|
||||
const useStatus = useStatusStore();
|
||||
const useLoadingInformation = useLoadingInformationStore();
|
||||
const useLoadingResource = useLoadingResourceStore();
|
||||
|
||||
// 信息框相关配置
|
||||
const offsetX = ref(0);
|
||||
const offsetY = ref(0);
|
||||
@@ -57,13 +59,13 @@
|
||||
|
||||
// 监听id变化
|
||||
watch(
|
||||
() => useLoadingInformationStore().subwayStation.id,
|
||||
() => useLoadingInformation.subwayStation.id,
|
||||
async (newId: number) => {
|
||||
if (newId === -1) {
|
||||
return;
|
||||
}
|
||||
// 获取地铁站点数据
|
||||
const clickObject = useLoadingInformationStore().clickObject;
|
||||
const clickObject = useLoadingInformation.clickObject;
|
||||
|
||||
if (!clickObject || !clickObject.primitive) {
|
||||
console.warn('点击对象或图元不存在');
|
||||
@@ -71,7 +73,7 @@
|
||||
}
|
||||
|
||||
const res = await $api.subwayStations.getPointDetailById(
|
||||
useLoadingInformationStore().subwayStation.id
|
||||
useLoadingInformation.subwayStation.id
|
||||
);
|
||||
|
||||
// 更新数据
|
||||
@@ -87,7 +89,7 @@
|
||||
offsetY.value = screenPos.y;
|
||||
|
||||
// 显示新的信息框
|
||||
useLoadingInformationStore().subwayStation.loading = true;
|
||||
useLoadingInformation.subwayStation.loading = true;
|
||||
} catch (error) {
|
||||
throw new Error(`坐标转换失败:${error}`);
|
||||
}
|
||||
@@ -96,19 +98,19 @@
|
||||
|
||||
// 监听显示隐藏
|
||||
watch(
|
||||
() => useStatusStore().poiLayers.showSubwayStation?.show,
|
||||
() => useStatus.poiLayers.showSubwayStation?.show,
|
||||
(newValue: boolean) => {
|
||||
if (newValue) {
|
||||
// 显示地铁站点
|
||||
CesiumUtilsSingleton.batchShowPrimitives(
|
||||
useLoadingResourceStore().getLoadingResource(
|
||||
useLoadingResource.getLoadingResource(
|
||||
LoadingResource.SUBWAY_STATION
|
||||
).ids
|
||||
);
|
||||
} else {
|
||||
// 隐藏地铁站点
|
||||
CesiumUtilsSingleton.batchHidePrimitives(
|
||||
useLoadingResourceStore().getLoadingResource(
|
||||
useLoadingResource.getLoadingResource(
|
||||
LoadingResource.SUBWAY_STATION
|
||||
).ids
|
||||
);
|
||||
|
||||
@@ -13,13 +13,15 @@
|
||||
import { onMounted, watch } from 'vue';
|
||||
import LoadingGeoserverLayer from '../../common/LoadingGeoserverLayer.vue';
|
||||
|
||||
const useStatus = useStatusStore();
|
||||
|
||||
// 保存图层引用
|
||||
let trafficRoadLayer: ImageryLayer | null = null;
|
||||
|
||||
onMounted(() => {
|
||||
// 监听显示隐藏
|
||||
watch(
|
||||
() => useStatusStore().infrastructureLayers.showTrafficRoad.show,
|
||||
() => useStatus.infrastructureLayers.showTrafficRoad.show,
|
||||
(newValue: boolean) => {
|
||||
trafficRoadLayer!.show = newValue;
|
||||
}
|
||||
|
||||
@@ -13,13 +13,15 @@
|
||||
import { onMounted, watch } from 'vue';
|
||||
import LoadingGeoserverLayer from '../../common/LoadingGeoserverLayer.vue';
|
||||
|
||||
const useStatus = useStatusStore();
|
||||
|
||||
// 保存图层引用
|
||||
let waterPipeLayer: ImageryLayer | null = null;
|
||||
|
||||
onMounted(() => {
|
||||
// 监听显示隐藏
|
||||
watch(
|
||||
() => useStatusStore().infrastructureLayers.showNetworkSystem.show,
|
||||
() => useStatus.infrastructureLayers.showNetworkSystem.show,
|
||||
(newValue: boolean) => {
|
||||
waterPipeLayer!.show = newValue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user