diff --git a/src/view/sy_mapcopy.vue b/src/view/sy_mapcopy.vue index 77c747f..7b0faa7 100644 --- a/src/view/sy_mapcopy.vue +++ b/src/view/sy_mapcopy.vue @@ -119,13 +119,13 @@ v-for="(item, index) in jbfwqTotal" :key="index" > -
{{ item.xzjd }}
+
{{ item.name}}
{{ itemm.jc }}
@@ -2013,20 +2013,19 @@ const person_detail = (age) => { const getFwq = () => { http.get(`/api/ggfwyth/ysyzt/listXzjdAndCsq`).then((res) => { if (res.code == 200) { - jbfwqTotal.value=res.data; - // res.data.forEach((item, index) => { - - // jbfwqTotal.value.push({ - // name: item.xzjd, - // child: [], - // }); - // item.csqs.forEach((item2) => { - // jbfwqTotal.value[index].child.push({ - // name: item2.csq, - // jc: item2.jc, - // }); - // }); - // }); + res.data.forEach((item, index) => { + jbfwqTotal.value.push({ + name: item.xzjd, + child: [], + }); + item.jcs.forEach((item2) => { + // console.log(item2.jc,6666); + jbfwqTotal.value[index].child.push({ + name: item2.jc, + jc: item2.jc, + }); + }); + }); } }); }; @@ -2056,9 +2055,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("无数据"); } } @@ -2124,7 +2127,6 @@ const calculateAverage = (coordinates) => { }; // 根据最大距离计算合适的缩放级别 const calculateZoomLevel = (maxDistance) => { - // 示例实现,您可以根据需要调整计算逻辑 if (maxDistance < 151) return 18; if (maxDistance < 400) return 17; if (maxDistance < 600) return 17.5; @@ -2148,9 +2150,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); // 输出中心点的经纬度 @@ -2181,7 +2183,7 @@ const addggfwq = () => { // console.log("最大距离:", maxDistance,data.zoomLevel); drawACircle(maxDistance); } else { - ElMessage.warning("无数据"); + ElMessage.warning("无数据"); } }; //计算两点之间直线距离 @@ -2309,6 +2311,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) { @@ -2316,7 +2319,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,