From 1ca5ed016fded25c0efef7b11f366088bfd15688 Mon Sep 17 00:00:00 2001 From: wzy-warehouse <18135009705@163.com> Date: Fri, 12 Jun 2026 10:42:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=9C=B0=E9=9C=87=E7=81=BE?= =?UTF-8?q?=E5=AE=B3=E9=93=BE=E5=BD=B1=E5=93=8D=E7=82=B9=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../earthquake/useEarthquakeDisasterChain.ts | 75 +------------------ src/views/home/earthquake/EarthquakeView.vue | 64 ++++++++-------- 2 files changed, 33 insertions(+), 106 deletions(-) diff --git a/src/hooks/earthquake/useEarthquakeDisasterChain.ts b/src/hooks/earthquake/useEarthquakeDisasterChain.ts index 4b0b834..933ed0b 100644 --- a/src/hooks/earthquake/useEarthquakeDisasterChain.ts +++ b/src/hooks/earthquake/useEarthquakeDisasterChain.ts @@ -1,7 +1,3 @@ -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 { ControlPanelCategory } from '@/types/common/ControlPanelCategory'; import { useStatusStore } from '@/stores/useStatusStore'; import { useLayerControl } from '../rain-earthquake/useLayerControl.ts'; @@ -25,7 +21,7 @@ import { useLoadingResourceStore } from '@/stores/useLoadingResourceStore.ts'; import { LoadingResource } from '@/types/common/LoadingResourceType.ts'; /** - * 暴雨灾害链 + * 地震灾害链 * @returns */ export const useEarthquakeDisasterChain = () => { @@ -34,68 +30,6 @@ export const useEarthquakeDisasterChain = () => { const resourceStore = useLoadingResourceStore(); const rightHandle = useRightHandle(); - // ================灾害链影响点列表================================ - /** - * 搜索条件 - */ - const conditions = ref({ - tableData: '', - hiddenPoint: PointType.LANDSLIDE, - }); - - /** - * 下拉选项 - */ - const selectOptions = [ - { value: PointType.LANDSLIDE, label: '滑坡' }, - { value: PointType.DEBRIS_FLOW, label: '泥石流' }, - { value: PointType.RISK_AREA, label: '风险区' }, - ]; - - /** - * 表格数据 - */ - const tableDatas = ref([]); - - /** - * 表头配置 - */ - const tableColumns = [ - { title: '名称', key: 'disasterName' }, - { title: '位置', key: 'position' }, - { title: '规模等级', key: 'scaleGrade' }, - { title: '险情等级', key: 'riskGrade' }, - ]; - - /** - * 分页配置 - */ - const paginationConfig = ref({ - currentPage: 1, - pageSize: 10, - total: 10, - totalPage: 1, - }); - - /** - * 修改搜索条件 - * @param value - 新的搜索条件 - */ - const changeConditions = (value: { - tableData: string; - hiddenPoint: PointType; - }): void => { - conditions.value = value; - }; - - /** - * 修改页码 - * @param value - 新的页码 - */ - const changeCurrentPage = (value: number) => { - paginationConfig.value.currentPage = value; - }; - // ================左侧按钮================================ /** * 左侧按钮信息 @@ -356,15 +290,8 @@ export const useEarthquakeDisasterChain = () => { }; return { - conditions, - selectOptions, - tableDatas, - tableColumns, - paginationConfig, leftButtonInfo, rightButtonInfo, controlPanel: getControlPanel(), - changeConditions, - changeCurrentPage, }; }; diff --git a/src/views/home/earthquake/EarthquakeView.vue b/src/views/home/earthquake/EarthquakeView.vue index fc78ba1..47890f9 100644 --- a/src/views/home/earthquake/EarthquakeView.vue +++ b/src/views/home/earthquake/EarthquakeView.vue @@ -9,23 +9,23 @@ @@ -63,36 +63,36 @@ import LeftButtonComponent from '@/component/rain-earthquake/LeftButtonComponent.vue'; import RightButtonComponent from '@/component/rain-earthquake/RightButtonComponent.vue'; import { useEarthquakeDisasterChain } from '@/hooks/earthquake/useEarthquakeDisasterChain'; + import { useDisasterChainTableStore } from '@/stores/useDisasterChainTableStore'; import { useStatusStore } from '@/stores/useStatusStore'; - import { DisasterType } from '@/types/common/DisasterType.ts'; - import { watch } from 'vue'; + import { DisasterType, PointType } from '@/types/common/DisasterType.ts'; + import { onBeforeMount } from 'vue'; import { useRoute } from 'vue-router'; const route = useRoute(); - const { - conditions, - selectOptions, - tableDatas, - tableColumns, - paginationConfig, - leftButtonInfo, - rightButtonInfo, - controlPanel, - changeConditions, - changeCurrentPage, - } = useEarthquakeDisasterChain(); + const { leftButtonInfo, rightButtonInfo, controlPanel } = + useEarthquakeDisasterChain(); const statusStore = useStatusStore(); - // 监听条件变化 - watch( - conditions, - () => { - console.log('条件改变'); - }, - { deep: true } - ); + const disasterChainTableStore = useDisasterChainTableStore(); + + onBeforeMount(() => { + // 设置相关数据 + disasterChainTableStore.selectOptions = [ + { value: PointType.LANDSLIDE, label: '滑坡' }, + { value: PointType.DEBRIS_FLOW, label: '泥石流' }, + { value: PointType.RISK_AREA, label: '风险区' }, + ]; + + disasterChainTableStore.tableColumns = [ + { title: '名称', key: 'disasterName' }, + { title: '位置', key: 'position' }, + { title: '规模等级', key: 'scaleGrade' }, + { title: '险情等级', key: 'riskGrade' }, + ]; + });