This commit is contained in:
姚宇浩 2024-08-07 15:33:49 +08:00
commit de8282a502
1 changed files with 25 additions and 22 deletions

View File

@ -119,13 +119,13 @@
v-for="(item, index) in jbfwqTotal"
:key="index"
>
<div class="jbggfwq_content_item_left">{{ item.xzjd }}</div>
<div class="jbggfwq_content_item_left">{{ item.name}}</div>
<div class="jbggfwq_content_item_right">
<div
class="jbggfwq_content_item_right_item"
v-for="itemm in item.jcs"
v-for="itemm in item.child"
:class="{ choose: itemm.jc == choose.fwq }"
@click="changeFwq(itemm.jc, item.xzjd, itemm.jc)"
@click="changeFwq(itemm.jc, item.name, itemm.jc)"
>
{{ itemm.jc }}
</div>
@ -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); //
@ -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,