From 2a4198032976f1b69f91197d3e83b8407e41c0d4 Mon Sep 17 00:00:00 2001 From: duanxiaohai <1812246227@qq.com> Date: Wed, 7 Aug 2024 15:12:34 +0800 Subject: [PATCH] gx --- src/view/sy_mapcopy.vue | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/view/sy_mapcopy.vue b/src/view/sy_mapcopy.vue index efcb5c3..5d0a8b2 100644 --- a/src/view/sy_mapcopy.vue +++ b/src/view/sy_mapcopy.vue @@ -1948,10 +1948,10 @@ const getFwq = () => { name: item.xzjd, child: [], }); - item.csqs.forEach((item2) => { + item.jcs.forEach((item2) => { jbfwqTotal.value[index].child.push({ - name: item2.csq, - jc: item2.jc, + name: item2.jc, + // jc: item2.jc, }); }); }); @@ -1984,9 +1984,13 @@ const changeFwq = async (id, name, names) => { map.clearOverlays(); //清空地图上所有的覆盖物 addggfwq(); //创建公共服务圈 setTimeout(() => { - goMapCenter([data.fwqCoordinates1, data.fwqCoordinates2], data.zoomLevel); //中心点缩放 + goMapCenter( + [data.fwqCoordinates1, data.fwqCoordinates2], + data.zoomLevel + ); //中心点缩放 }, 500); } else { + console.log('无数据11'); ElMessage.warning("无数据"); } } @@ -1995,7 +1999,7 @@ const changeFwq = async (id, name, names) => { const getServiceCircle = async (communityName, townName) => { try { const response = await http.get( - `/api/ggfwyth/ysyzt/zyysxx?csq=${communityName}&xzjd=${townName}` + `/api/ggfwyth/ysyzt/zyysxx?jc=${communityName}&xzjd=${townName}` ); if (response.code === 200) { updateFwqList(response.data, townName, communityName); @@ -2052,7 +2056,6 @@ const calculateAverage = (coordinates) => { }; // 根据最大距离计算合适的缩放级别 const calculateZoomLevel = (maxDistance) => { - // 示例实现,您可以根据需要调整计算逻辑 if (maxDistance < 151) return 18; if (maxDistance < 400) return 17; if (maxDistance < 600) return 17.5; @@ -2076,9 +2079,9 @@ const addggfwq = () => { }); const centerPoint = calculateCenterPoint(data.fwqCoordinates); - data.fwqCoordinates1 = centerPoint[0]; data.fwqCoordinates2 = centerPoint[1]; + // data.fwqCoordinates1 = calculateAverage(data.fwqCoordinates1); // data.fwqCoordinates2 = calculateAverage(data.fwqCoordinates2); // console.log(centerPoint); // 输出中心点的经纬度 @@ -2109,7 +2112,7 @@ const addggfwq = () => { // console.log("最大距离:", maxDistance,data.zoomLevel); drawACircle(maxDistance); } else { - ElMessage.warning("无数据"); + ElMessage.warning("无数据"); } }; //计算两点之间直线距离 @@ -2237,6 +2240,7 @@ const createCustomOverlay = (polygon, indexx) => { map.addOverlay(fwq_list_arr.value[indexx]); }; const updateFwqList = (data, townName, communityName) => { + // console.log(data, townName, communityName,'服务器数据'); let updatedFwqList = []; jbfwqTotal.value.forEach((town) => { if (town.name === townName) { @@ -2244,7 +2248,7 @@ const updateFwqList = (data, townName, communityName) => { if (community.name === communityName) { updatedFwqList = data .filter( - (item) => item.xzjd === townName && item.csq === communityName + (item) => item.xzjd === townName && item.jc === communityName ) .map((item) => ({ x: 53,