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

This commit is contained in:
2026-06-26 09:39:23 +08:00
parent 0403491b16
commit 20de7f99ca
+52 -22
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,34 +140,59 @@
}; };
}); });
// 监听脉冲点变化并更新表格数据 // 监听脉冲点变化和下拉选项变化,过滤并更新表格数据
watch( watch(
() => aroundAnalysisState.pulsePoints.value, [
(newPulsePoints: PointResource[]) => { () => aroundAnalysisState.pulsePoints.value,
() => 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 => ({
name: point.value, id:
disasterName: point.value, typeof point.id === 'number'
position: point.lon !== undefined && point.lat !== undefined ? point.id
? `${point.lon.toFixed(4)}, ${point.lat.toFixed(4)}` : parseInt(String(point.id), 10),
: '未知位置', name: point.value,
scaleGrade: String(point.scale_grade || '未知'), disasterName: point.value,
riskGrade: String(point.risk_grade || '一般'), position:
lon: point.lon, point.lon !== undefined && point.lat !== undefined
lat: point.lat, ? `${point.lon.toFixed(4)}, ${point.lat.toFixed(4)}`
fieldCode: String(point.id), : '未知位置',
province: '陕西省', scaleGrade: String(point.scale_grade || '未知'),
city: '西安市', riskGrade: String(point.risk_grade || '一般'),
county: '', lon: point.lon,
village: '', lat: point.lat,
isDelete: 0, fieldCode: String(point.id),
})); province: '陕西省',
city: '西安市',
county: '',
village: '',
isDelete: 0,
})
);
console.log('convertedData:', convertedData); console.log('convertedData:', convertedData);
setTableDatas(convertedData); setTableDatas(convertedData);