diff --git a/src/component/rain-earthquake/LeftButtonComponent.vue b/src/component/rain-earthquake/LeftButtonComponent.vue index cfc74a0..869a637 100644 --- a/src/component/rain-earthquake/LeftButtonComponent.vue +++ b/src/component/rain-earthquake/LeftButtonComponent.vue @@ -29,8 +29,12 @@ const selectedButtonId: Ref = ref(-1); // 接收父组件传递的参数 - defineProps<{ - buttonList: { name: string; callback: (...args: unknown[]) => unknown }[]; + const props = defineProps<{ + buttonList: { + name: string; + callback: (...args: unknown[]) => unknown; + executeOnce?: boolean; + }[]; }>(); // 点击按钮触发 @@ -49,6 +53,10 @@ } selectedButtonId.value = index; callback(); + + if (props.buttonList[index].executeOnce) { + selectedButtonId.value = -1; + } }; diff --git a/src/component/rain-earthquake/RightButtonComponent.vue b/src/component/rain-earthquake/RightButtonComponent.vue new file mode 100644 index 0000000..f2605a5 --- /dev/null +++ b/src/component/rain-earthquake/RightButtonComponent.vue @@ -0,0 +1,100 @@ + + + + + diff --git a/src/hooks/rainstorm/useRainDisasterChain.ts b/src/hooks/rainstorm/useRainDisasterChain.ts index 1990c57..fd894eb 100644 --- a/src/hooks/rainstorm/useRainDisasterChain.ts +++ b/src/hooks/rainstorm/useRainDisasterChain.ts @@ -2,6 +2,8 @@ import { ref } from 'vue'; import type { XianHiddenDangerSpots } from '@/types/base/XianHiddenDangerSpots'; import type { PaginationType } from '@/types/common/PaginationType'; import { PointType } from '@/types/common/DisasterType'; +import { CesiumUtilsSingleton } from '@/utils/cesium/CesiumUtils'; +import config from '@/config/config.json'; /** * 暴雨灾害链影响点列表钩子函数 @@ -136,6 +138,52 @@ export const useRainDisasterChain = () => { }, ]; + /** + * 右侧按钮信息 + */ + const rightButtonInfo = [ + { + name: '暴雨下载', + callback: () => { + console.log('暴雨下载'); + }, + }, + { + name: '图件下载', + callback: () => { + console.log('图件下载'); + }, + }, + { + name: '雷达云图', + callback: () => { + console.log('雷达云图'); + }, + }, + { + name: '信息表格', + callback: () => { + console.log('信息表格'); + }, + }, + { + name: '场景重置', + callback: () => { + CesiumUtilsSingleton.clearAllResources('custom'); + }, + executeOnce: true, + }, + { + name: '视角重置', + callback: () => { + CesiumUtilsSingleton.flyToTarget( + config.defaultPosition as [number, number, number] + ); + }, + executeOnce: true, + }, + ]; + // 把所有需要用到的数据/方法 return 出去 return { conditions, @@ -144,6 +192,7 @@ export const useRainDisasterChain = () => { tableColumns, paginationConfig, leftButtonInfo, + rightButtonInfo, changeConditions, changeCurrentPage, }; diff --git a/src/views/home/rainstorm/RainstormView.vue b/src/views/home/rainstorm/RainstormView.vue index 76be231..0fcb219 100644 --- a/src/views/home/rainstorm/RainstormView.vue +++ b/src/views/home/rainstorm/RainstormView.vue @@ -21,6 +21,9 @@ + + + @@ -29,6 +32,7 @@ import DisasterChainPointComponent from '@/component/rain-earthquake/DisasterChainPointComponent.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'; import { useRainDisasterChain } from '@/hooks/rainstorm/useRainDisasterChain'; import { useRainLegend } from '@/hooks/rainstorm/useRainLegend'; import { DisasterType } from '@/types/common/DisasterType.ts'; @@ -44,6 +48,7 @@ tableColumns, paginationConfig, leftButtonInfo, + rightButtonInfo, changeConditions, changeCurrentPage, } = useRainDisasterChain();