diff --git a/src/component/rain-earthquake/LoadingGeoserverLayer.vue b/src/component/common/LoadingGeoserverLayer.vue similarity index 99% rename from src/component/rain-earthquake/LoadingGeoserverLayer.vue rename to src/component/common/LoadingGeoserverLayer.vue index df513f1..c112a56 100644 --- a/src/component/rain-earthquake/LoadingGeoserverLayer.vue +++ b/src/component/common/LoadingGeoserverLayer.vue @@ -4,7 +4,7 @@ diff --git a/src/component/rain-earthquake/FunctionComponent.vue b/src/component/rain-earthquake/FunctionComponent.vue new file mode 100644 index 0000000..b05a93c --- /dev/null +++ b/src/component/rain-earthquake/FunctionComponent.vue @@ -0,0 +1,16 @@ + + + + + + + + diff --git a/src/component/rain-earthquake/LeftButtonComponent.vue b/src/component/rain-earthquake/LeftButtonComponent.vue index 2f23ea4..a431c61 100644 --- a/src/component/rain-earthquake/LeftButtonComponent.vue +++ b/src/component/rain-earthquake/LeftButtonComponent.vue @@ -10,7 +10,7 @@ {{ buttonItem.name }} @@ -22,11 +22,8 @@ diff --git a/src/component/rain-earthquake/RightButtonComponent.vue b/src/component/rain-earthquake/RightButtonComponent.vue index f2605a5..798a1a0 100644 --- a/src/component/rain-earthquake/RightButtonComponent.vue +++ b/src/component/rain-earthquake/RightButtonComponent.vue @@ -1,11 +1,14 @@ - + {{ buttonItem.name }} @@ -17,10 +20,8 @@ diff --git a/src/component/rain-earthquake/HiddenPointComponent.vue b/src/component/rain-earthquake/basic/HiddenPointComponent.vue similarity index 93% rename from src/component/rain-earthquake/HiddenPointComponent.vue rename to src/component/rain-earthquake/basic/HiddenPointComponent.vue index 982de8b..504eb67 100644 --- a/src/component/rain-earthquake/HiddenPointComponent.vue +++ b/src/component/rain-earthquake/basic/HiddenPointComponent.vue @@ -28,16 +28,16 @@ import { DisasterType } from '@/types/common/DisasterType.ts'; 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 type { Point } from '@/types/base/Point.ts'; + import LoadingPoints from '@/component/common/LoadingPoints.vue'; import config from '@/config/config.json'; import InformationBox from '@/component/common/InformationBox.vue'; - import { useLoadingInformationStore } from '@/stores/useLoadingInformation'; - import { CesiumUtilsSingleton } from '@/utils/cesium/CesiumUtils'; - import { useHiddenPoint } from '@/hooks/rain-earthquake/useHiddenPoint'; - import { useStatusStore } from '@/stores/useStatusStore'; - import { LoadingResource } from '@/types/common/LoadingResourceType'; - import { useLoadingResourceStore } from '@/stores/useLoadingResourceStore'; + import { useLoadingInformationStore } from '@/stores/useLoadingInformation.ts'; + import { CesiumUtilsSingleton } from '@/utils/cesium/CesiumUtils.ts'; + import { useHiddenPoint } from '@/hooks/rain-earthquake/useHiddenPoint.ts'; + import { useStatusStore } from '@/stores/useStatusStore.ts'; + import { LoadingResource } from '@/types/common/LoadingResourceType.ts'; + import { useLoadingResourceStore } from '@/stores/useLoadingResourceStore.ts'; // 接收父组件传递的参数 const props = defineProps<{ diff --git a/src/component/rain-earthquake/RiskPointComponent.vue b/src/component/rain-earthquake/basic/RiskPointComponent.vue similarity index 92% rename from src/component/rain-earthquake/RiskPointComponent.vue rename to src/component/rain-earthquake/basic/RiskPointComponent.vue index b6d043f..88f192b 100644 --- a/src/component/rain-earthquake/RiskPointComponent.vue +++ b/src/component/rain-earthquake/basic/RiskPointComponent.vue @@ -27,16 +27,16 @@ + + diff --git a/src/component/rain-earthquake/function-child/around-analysis/AroundAnalysisDetailComponent.vue b/src/component/rain-earthquake/function-child/around-analysis/AroundAnalysisDetailComponent.vue new file mode 100644 index 0000000..3e93f3b --- /dev/null +++ b/src/component/rain-earthquake/function-child/around-analysis/AroundAnalysisDetailComponent.vue @@ -0,0 +1,7 @@ + + + + + + + diff --git a/src/component/rain-earthquake/function-child/around-analysis/ButtonComponent.vue b/src/component/rain-earthquake/function-child/around-analysis/ButtonComponent.vue new file mode 100644 index 0000000..3e93f3b --- /dev/null +++ b/src/component/rain-earthquake/function-child/around-analysis/ButtonComponent.vue @@ -0,0 +1,7 @@ + + + + + + + diff --git a/src/component/rain-earthquake/function-child/around-analysis/SearchComponent.vue b/src/component/rain-earthquake/function-child/around-analysis/SearchComponent.vue new file mode 100644 index 0000000..19c28a1 --- /dev/null +++ b/src/component/rain-earthquake/function-child/around-analysis/SearchComponent.vue @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/src/hooks/earthquake/useEarthquakeDisasterChain.ts b/src/hooks/earthquake/useEarthquakeDisasterChain.ts index 7f97727..ad4bfe5 100644 --- a/src/hooks/earthquake/useEarthquakeDisasterChain.ts +++ b/src/hooks/earthquake/useEarthquakeDisasterChain.ts @@ -3,9 +3,9 @@ import type { XianHiddenDangerSpots } from '@/types/base/XianHiddenDangerSpots'; import type { PaginationType } from '@/types/common/PaginationType'; import { PointType } from '@/types/common/DisasterType'; import { useStatusStore } from '@/stores/useStatusStore'; -import { useLayerControl } from '../useLayerControl'; +import { useLayerControl } from '../rain-earthquake/useLayerControl.ts'; import { debrisFlowIcon, landslideIcon, riskAreaIcon } from '@/assets'; -import { useRightHandle } from '../useRightHandle'; +import { useRightHandle } from '../rain-earthquake/useRightHandle.ts'; /** * 暴雨灾害链 diff --git a/src/hooks/useLayerControl.ts b/src/hooks/rain-earthquake/useLayerControl.ts similarity index 96% rename from src/hooks/useLayerControl.ts rename to src/hooks/rain-earthquake/useLayerControl.ts index 81c039e..86c78d1 100644 --- a/src/hooks/useLayerControl.ts +++ b/src/hooks/rain-earthquake/useLayerControl.ts @@ -1,4 +1,4 @@ -import { useStatusStore } from '@/stores/useStatusStore'; +import { useStatusStore } from '@/stores/useStatusStore.ts'; /** * 控制面板显示隐藏逻辑 diff --git a/src/hooks/rain-earthquake/useLeftHandle.ts b/src/hooks/rain-earthquake/useLeftHandle.ts new file mode 100644 index 0000000..8fae864 --- /dev/null +++ b/src/hooks/rain-earthquake/useLeftHandle.ts @@ -0,0 +1,25 @@ +import { useStatusStore } from '@/stores/useStatusStore'; + +export const useLeftHandle = () => { + /** + * 周边分析 + */ + const clickAroundAnalysis = (status: unknown) => { + // 如果选中,隐藏右侧按钮,取消选中则显示右侧按钮 + if (status as boolean) { + useStatusStore().uiComponents.rightButton.show = false; + + // 加载周边分析 + useStatusStore().functionStatus.aroundAnalysis.loading = true; + useStatusStore().functionStatus.aroundAnalysis.show = true; + } else { + useStatusStore().uiComponents.rightButton.show = true; + + // 隐藏周边分析 + useStatusStore().functionStatus.aroundAnalysis.show = false; + } + }; + return { + clickAroundAnalysis, + }; +}; diff --git a/src/hooks/useRightHandle.ts b/src/hooks/rain-earthquake/useRightHandle.ts similarity index 72% rename from src/hooks/useRightHandle.ts rename to src/hooks/rain-earthquake/useRightHandle.ts index 861b2fa..38c9d74 100644 --- a/src/hooks/useRightHandle.ts +++ b/src/hooks/rain-earthquake/useRightHandle.ts @@ -1,6 +1,7 @@ -import { useStatusStore } from '@/stores/useStatusStore'; -import { CesiumUtilsSingleton } from '@/utils/cesium/CesiumUtils'; +import { useStatusStore } from '@/stores/useStatusStore.ts'; +import { CesiumUtilsSingleton } from '@/utils/cesium/CesiumUtils.ts'; import config from '@/config/config.json'; +import { useButtonSelectedIdStore } from '@/stores/useButtonSelectedIdStore'; export const useRightHandle = () => { /** @@ -9,6 +10,7 @@ export const useRightHandle = () => { const resetScene = () => { CesiumUtilsSingleton.clearAllResources('custom'); useStatusStore().resetScene(); + useButtonSelectedIdStore().resetId(); }; /** diff --git a/src/hooks/rainstorm/useRainDisasterChain.ts b/src/hooks/rainstorm/useRainDisasterChain.ts index 5ec6688..8704802 100644 --- a/src/hooks/rainstorm/useRainDisasterChain.ts +++ b/src/hooks/rainstorm/useRainDisasterChain.ts @@ -10,8 +10,9 @@ import { riskAreaIcon, waterLoggingIcon, } from '@/assets'; -import { useLayerControl } from '../useLayerControl'; -import { useRightHandle } from '../useRightHandle'; +import { useLayerControl } from '../rain-earthquake/useLayerControl.ts'; +import { useRightHandle } from '../rain-earthquake/useRightHandle.ts'; +import { useLeftHandle } from '../rain-earthquake/useLeftHandle.ts'; /** * 暴雨灾害链 @@ -100,9 +101,7 @@ export const useRainDisasterChain = () => { const leftButtonInfo = [ { name: '周边分析', - callback: () => { - console.log('周边分析'); - }, + callback: useLeftHandle().clickAroundAnalysis, }, { name: '关联分析', diff --git a/src/stores/useButtonSelectedIdStore.ts b/src/stores/useButtonSelectedIdStore.ts new file mode 100644 index 0000000..e53bceb --- /dev/null +++ b/src/stores/useButtonSelectedIdStore.ts @@ -0,0 +1,27 @@ +import { defineStore } from 'pinia'; +import { type Ref, ref } from 'vue'; + +/** + * 选中按钮id记录 + */ +export const useButtonSelectedIdStore = defineStore('buttonSelectedId', () => { + /** + * 左侧按钮选中id + */ + const leftButtonSelectedId: Ref = ref(-1); + + /** + * 右侧按钮选中id + */ + const rightButtonSelectedId: Ref = ref(-1); + + /** + * 重置id + */ + const resetId = () => { + leftButtonSelectedId.value = -1; + rightButtonSelectedId.value = -1; + }; + + return { leftButtonSelectedId, rightButtonSelectedId, resetId }; +}); diff --git a/src/stores/useStatusStore.ts b/src/stores/useStatusStore.ts index 7bd435c..badc1b6 100644 --- a/src/stores/useStatusStore.ts +++ b/src/stores/useStatusStore.ts @@ -153,6 +153,14 @@ export const useStatusStore = defineStore('status', () => { }, }); + // ============================ 地图功能显示状态 ================================ + const functionStatus = reactive({ + aroundAnalysis: { + show: false, + loading: false, + }, + }); + /** * 恢复默认值 */ @@ -262,6 +270,12 @@ export const useStatusStore = defineStore('status', () => { show: false, loading: false, }; + + // 功能显示状态重置 + functionStatus.aroundAnalysis = { + show: false, + loading: false, + }; }; return { @@ -270,6 +284,7 @@ export const useStatusStore = defineStore('status', () => { mapLayers, poiLayers, infrastructureLayers, + functionStatus, reset, resetScene, }; diff --git a/src/views/home/rainstorm/RainstormView.vue b/src/views/home/rainstorm/RainstormView.vue index e6d4be1..71807d9 100644 --- a/src/views/home/rainstorm/RainstormView.vue +++ b/src/views/home/rainstorm/RainstormView.vue @@ -53,6 +53,9 @@ + + + @@ -61,6 +64,7 @@ import ControlShowComponent from '@/component/rain-earthquake/ControlShowComponent.vue'; import ControlShowDetailComponent from '@/component/rain-earthquake/ControlShowDetailComponent.vue'; import DisasterChainPointComponent from '@/component/rain-earthquake/DisasterChainPointComponent.vue'; + import FunctionComponent from '@/component/rain-earthquake/FunctionComponent.vue'; import LeftButtonComponent from '@/component/rain-earthquake/LeftButtonComponent.vue'; import LegendComponent from '@/component/rain-earthquake/LegendComponent.vue'; import RightButtonComponent from '@/component/rain-earthquake/RightButtonComponent.vue';