This commit is contained in:
ljx
2025-09-12 22:01:26 +08:00
parent 6bc9ed7054
commit 8316636c68
8 changed files with 426 additions and 381 deletions

View File

@ -53,6 +53,8 @@ const router = useRouter();
const getProjectGisData = async () => {
try {
const response = await projectGis();
console.log(response, 111111111111);
if (response.code === 200) {
// 过滤掉没有经纬度的项目
projectData.value = response.data.filter((item: any) => item.lng !== null && item.lat !== null && item.lng !== '' && item.lat !== '');
@ -108,6 +110,7 @@ const initEcharts = () => {
// 从接口数据生成散点数据
const scatterData = projectData.value.map((item) => ({
name: item.projectName,
id: item.id,
value: [parseFloat(item.lng), parseFloat(item.lat)], // 转换为数值类型
shortName: item.shortName,
projectSite: item.projectSite,
@ -200,15 +203,18 @@ const initEcharts = () => {
myChart.setOption(option);
// 添加点击事件监听 - 这是关键修改部分
myChart.on('click', function (params: any) {
console.log(params, 111111);
// 检查点击的是散点图系列
if (params.componentType === 'series' && params.seriesType === 'scatter') {
// 跳转到项目详情页
navigateToProjectDetail();
navigateToProjectDetail(params.data);
}
});
};
const navigateToProjectDetail = () => {
window.open('http://xny.yj-3d.com:7788/ProjectScreen', '_blank');
const navigateToProjectDetail = (data) => {
window.open('http://localhost:7788/ProjectScreen?projectId=' + data.id + '&projectName=' + data.name, '_blank');
//xny.yj-3d.com
};
const risk_level_type1 = ref([]);
const safety_inspection_type1 = ref([]);