修改组件中store的调用方式
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<div>
|
||||
<!-- 加载风险点 -->
|
||||
<LoadingPoints
|
||||
v-if="useStatus.appLoadingCompleted && riskPoints.length > 0"
|
||||
v-if="statusStore.appLoadingCompleted && riskPoints.length > 0"
|
||||
:base-points="riskPoints"
|
||||
:get-disaster-icon="getDisasterIcon"
|
||||
:prefix="config.prefix.riskPointId"
|
||||
@@ -15,11 +15,11 @@
|
||||
<InformationBox
|
||||
:data="riskPointDetail as Record<string, any>"
|
||||
:field="field"
|
||||
v-if="useLoadingInformation.riskPoint.loading"
|
||||
v-if="loadingInformationStore.riskPoint.loading"
|
||||
:title="informationBoxTitle"
|
||||
:offset-x="offsetX"
|
||||
:offset-y="offsetY"
|
||||
:key="useLoadingInformation.riskPoint.id"
|
||||
:key="loadingInformationStore.riskPoint.id"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
@@ -40,9 +40,9 @@
|
||||
|
||||
const riskPoints = ref<Point[]>([]);
|
||||
|
||||
const useStatus = useStatusStore();
|
||||
const useLoadingInformation = useLoadingInformationStore();
|
||||
const useLoadingResource = useLoadingResourceStore();
|
||||
const statusStore = useStatusStore();
|
||||
const loadingInformationStore = useLoadingInformationStore();
|
||||
const loadingResourceStore = useLoadingResourceStore();
|
||||
|
||||
// 信息框相关配置
|
||||
const offsetX = ref(0);
|
||||
@@ -58,13 +58,13 @@
|
||||
|
||||
// 监听id变化
|
||||
watch(
|
||||
() => useLoadingInformation.riskPoint.id,
|
||||
() => loadingInformationStore.riskPoint.id,
|
||||
async (newId: number) => {
|
||||
if (newId === -1) {
|
||||
return;
|
||||
}
|
||||
// 获取风险点数据
|
||||
const clickObject = useLoadingInformation.clickObject;
|
||||
const clickObject = loadingInformationStore.clickObject;
|
||||
|
||||
if (!clickObject || !clickObject.primitive) {
|
||||
console.warn('点击对象或图元不存在');
|
||||
@@ -72,7 +72,7 @@
|
||||
}
|
||||
|
||||
const res = await $api.riskSpots.getPointDetailById(
|
||||
useLoadingInformation.riskPoint.id
|
||||
loadingInformationStore.riskPoint.id
|
||||
);
|
||||
|
||||
// 更新数据
|
||||
@@ -87,7 +87,7 @@
|
||||
offsetY.value = screenPos.y;
|
||||
|
||||
// 显示新的信息框
|
||||
useLoadingInformation.riskPoint.loading = true;
|
||||
loadingInformationStore.riskPoint.loading = true;
|
||||
} catch (error) {
|
||||
throw new Error(`坐标转换失败:${error}`);
|
||||
}
|
||||
@@ -96,17 +96,17 @@
|
||||
|
||||
// 监听显示隐藏风险点
|
||||
watch(
|
||||
() => useStatus.mapLayers.riskPointShow.show,
|
||||
() => statusStore.mapLayers.riskPointShow.show,
|
||||
(newValue: boolean) => {
|
||||
if (newValue) {
|
||||
CesiumUtilsSingleton.batchShowPrimitives(
|
||||
useLoadingResource.getLoadingResource(
|
||||
loadingResourceStore.getLoadingResource(
|
||||
LoadingResource.RISK_POINT
|
||||
).ids
|
||||
);
|
||||
} else {
|
||||
CesiumUtilsSingleton.batchHidePrimitives(
|
||||
useLoadingResource.getLoadingResource(
|
||||
loadingResourceStore.getLoadingResource(
|
||||
LoadingResource.RISK_POINT
|
||||
).ids
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user