第二步:将隐患预警点分类显示数据(无风险点)

This commit is contained in:
2026-06-26 09:39:23 +08:00
parent 0403491b16
commit 20de7f99ca
+37 -7
View File
@@ -80,7 +80,11 @@
type SearchConditions, type SearchConditions,
} from '@/hooks/useDisasterChainTable'; } from '@/hooks/useDisasterChainTable';
import { useStatusStore } from '@/stores/useStatusStore'; 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 { onBeforeMount, watch, provide } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
@@ -100,6 +104,7 @@
tableColumns, tableColumns,
tableDatas, tableDatas,
paginationConfig, paginationConfig,
conditions,
changeConditions, changeConditions,
setConditions, setConditions,
changeCurrentPage, changeCurrentPage,
@@ -135,21 +140,45 @@
}; };
}); });
// 监听脉冲点变化并更新表格数据 // 监听脉冲点变化和下拉选项变化,过滤并更新表格数据
watch( watch(
[
() => aroundAnalysisState.pulsePoints.value, () => aroundAnalysisState.pulsePoints.value,
(newPulsePoints: PointResource[]) => { () => conditions.value.hiddenPoint,
],
([newPulsePoints, hiddenPointType]: [PointResource[], PointType]) => {
console.log('=== 脉冲点变化 ==='); console.log('=== 脉冲点变化 ===');
console.log('newPulsePoints:', newPulsePoints); console.log('newPulsePoints:', newPulsePoints);
console.log('newPulsePoints.length:', newPulsePoints?.length); console.log('newPulsePoints.length:', newPulsePoints?.length);
console.log('hiddenPointType:', hiddenPointType);
if (newPulsePoints && newPulsePoints.length > 0) { 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 格式 // 将 PointResource 转换为 XianHiddenDangerSpots 格式
const convertedData: XianHiddenDangerSpots[] = newPulsePoints.map(point => ({ const convertedData: XianHiddenDangerSpots[] = filteredPoints.map(
id: typeof point.id === 'number' ? point.id : parseInt(String(point.id), 10), point => ({
id:
typeof point.id === 'number'
? point.id
: parseInt(String(point.id), 10),
name: point.value, name: point.value,
disasterName: point.value, disasterName: point.value,
position: point.lon !== undefined && point.lat !== undefined position:
point.lon !== undefined && point.lat !== undefined
? `${point.lon.toFixed(4)}, ${point.lat.toFixed(4)}` ? `${point.lon.toFixed(4)}, ${point.lat.toFixed(4)}`
: '未知位置', : '未知位置',
scaleGrade: String(point.scale_grade || '未知'), scaleGrade: String(point.scale_grade || '未知'),
@@ -162,7 +191,8 @@
county: '', county: '',
village: '', village: '',
isDelete: 0, isDelete: 0,
})); })
);
console.log('convertedData:', convertedData); console.log('convertedData:', convertedData);
setTableDatas(convertedData); setTableDatas(convertedData);