From 20de7f99ca6448b65aa6227d45bf1aa889d9752c Mon Sep 17 00:00:00 2001 From: zxyroyy <1442470094@qq.com> Date: Fri, 26 Jun 2026 09:39:23 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AC=AC=E4=BA=8C=E6=AD=A5=EF=BC=9A=E5=B0=86?= =?UTF-8?q?=E9=9A=90=E6=82=A3=E9=A2=84=E8=AD=A6=E7=82=B9=E5=88=86=E7=B1=BB?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E6=95=B0=E6=8D=AE=EF=BC=88=E6=97=A0=E9=A3=8E?= =?UTF-8?q?=E9=99=A9=E7=82=B9=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/home/rainstorm/RainstormView.vue | 74 +++++++++++++++------- 1 file changed, 52 insertions(+), 22 deletions(-) diff --git a/src/views/home/rainstorm/RainstormView.vue b/src/views/home/rainstorm/RainstormView.vue index 670ed91..75d291c 100644 --- a/src/views/home/rainstorm/RainstormView.vue +++ b/src/views/home/rainstorm/RainstormView.vue @@ -80,7 +80,11 @@ type SearchConditions, } from '@/hooks/useDisasterChainTable'; import { useStatusStore } from '@/stores/useStatusStore'; - import { DisasterType, PointType } from '@/types/common/DisasterType.ts'; + import { + DisasterType, + PointType, + HiddenDangerPointTypeMap, + } from '@/types/common/DisasterType.ts'; import { onBeforeMount, watch, provide } from 'vue'; import { useRoute } from 'vue-router'; @@ -100,6 +104,7 @@ tableColumns, tableDatas, paginationConfig, + conditions, changeConditions, setConditions, changeCurrentPage, @@ -135,34 +140,59 @@ }; }); - // 监听脉冲点变化并更新表格数据 + // 监听脉冲点变化和下拉选项变化,过滤并更新表格数据 watch( - () => aroundAnalysisState.pulsePoints.value, - (newPulsePoints: PointResource[]) => { + [ + () => aroundAnalysisState.pulsePoints.value, + () => conditions.value.hiddenPoint, + ], + ([newPulsePoints, hiddenPointType]: [PointResource[], PointType]) => { console.log('=== 脉冲点变化 ==='); console.log('newPulsePoints:', newPulsePoints); console.log('newPulsePoints.length:', newPulsePoints?.length); + console.log('hiddenPointType:', hiddenPointType); if (newPulsePoints && newPulsePoints.length > 0) { + // 根据选中的隐患点类型过滤 + const englishType = HiddenDangerPointTypeMap[hiddenPointType]; + const filteredPoints = newPulsePoints.filter(point => { + if (point.category === 'hidden-danger') { + return point.originalType === englishType; + } + if ( + hiddenPointType === PointType.RISK_AREA && + point.category === 'risk-point' + ) { + return true; + } + return false; + }); + // 将 PointResource 转换为 XianHiddenDangerSpots 格式 - const convertedData: XianHiddenDangerSpots[] = newPulsePoints.map(point => ({ - id: typeof point.id === 'number' ? point.id : parseInt(String(point.id), 10), - name: point.value, - disasterName: point.value, - position: point.lon !== undefined && point.lat !== undefined - ? `${point.lon.toFixed(4)}, ${point.lat.toFixed(4)}` - : '未知位置', - scaleGrade: String(point.scale_grade || '未知'), - riskGrade: String(point.risk_grade || '一般'), - lon: point.lon, - lat: point.lat, - fieldCode: String(point.id), - province: '陕西省', - city: '西安市', - county: '', - village: '', - isDelete: 0, - })); + const convertedData: XianHiddenDangerSpots[] = filteredPoints.map( + point => ({ + id: + typeof point.id === 'number' + ? point.id + : parseInt(String(point.id), 10), + name: point.value, + disasterName: point.value, + position: + point.lon !== undefined && point.lat !== undefined + ? `${point.lon.toFixed(4)}, ${point.lat.toFixed(4)}` + : '未知位置', + scaleGrade: String(point.scale_grade || '未知'), + riskGrade: String(point.risk_grade || '一般'), + lon: point.lon, + lat: point.lat, + fieldCode: String(point.id), + province: '陕西省', + city: '西安市', + county: '', + village: '', + isDelete: 0, + }) + ); console.log('convertedData:', convertedData); setTableDatas(convertedData);