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" v-for="(item, index) in jbfwqTotal"
:key="index" :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">
<div <div
class="jbggfwq_content_item_right_item" class="jbggfwq_content_item_right_item"
v-for="itemm in item.jcs" v-for="itemm in item.child"
:class="{ choose: itemm.jc == choose.fwq }" :class="{ choose: itemm.jc == choose.fwq }"
@click="changeFwq(itemm.jc, item.xzjd, itemm.jc)" @click="changeFwq(itemm.jc, item.name, itemm.jc)"
> >
{{ itemm.jc }} {{ itemm.jc }}
</div> </div>
@ -2013,20 +2013,19 @@ const person_detail = (age) => {
const getFwq = () => { const getFwq = () => {
http.get(`/api/ggfwyth/ysyzt/listXzjdAndCsq`).then((res) => { http.get(`/api/ggfwyth/ysyzt/listXzjdAndCsq`).then((res) => {
if (res.code == 200) { if (res.code == 200) {
jbfwqTotal.value=res.data; res.data.forEach((item, index) => {
// res.data.forEach((item, index) => { jbfwqTotal.value.push({
name: item.xzjd,
// jbfwqTotal.value.push({ child: [],
// name: item.xzjd, });
// child: [], item.jcs.forEach((item2) => {
// }); // console.log(item2.jc,6666);
// item.csqs.forEach((item2) => { jbfwqTotal.value[index].child.push({
// jbfwqTotal.value[index].child.push({ name: item2.jc,
// name: item2.csq, jc: item2.jc,
// jc: item2.jc, });
// }); });
// }); });
// });
} }
}); });
}; };
@ -2056,9 +2055,13 @@ const changeFwq = async (id, name, names) => {
map.clearOverlays(); // map.clearOverlays(); //
addggfwq(); // addggfwq(); //
setTimeout(() => { setTimeout(() => {
goMapCenter([data.fwqCoordinates1, data.fwqCoordinates2], data.zoomLevel); // goMapCenter(
[data.fwqCoordinates1, data.fwqCoordinates2],
data.zoomLevel
); //
}, 500); }, 500);
} else { } else {
console.log('无数据11');
ElMessage.warning("无数据"); ElMessage.warning("无数据");
} }
} }
@ -2124,7 +2127,6 @@ const calculateAverage = (coordinates) => {
}; };
// //
const calculateZoomLevel = (maxDistance) => { const calculateZoomLevel = (maxDistance) => {
//
if (maxDistance < 151) return 18; if (maxDistance < 151) return 18;
if (maxDistance < 400) return 17; if (maxDistance < 400) return 17;
if (maxDistance < 600) return 17.5; if (maxDistance < 600) return 17.5;
@ -2148,9 +2150,9 @@ const addggfwq = () => {
}); });
const centerPoint = calculateCenterPoint(data.fwqCoordinates); const centerPoint = calculateCenterPoint(data.fwqCoordinates);
data.fwqCoordinates1 = centerPoint[0]; data.fwqCoordinates1 = centerPoint[0];
data.fwqCoordinates2 = centerPoint[1]; data.fwqCoordinates2 = centerPoint[1];
// data.fwqCoordinates1 = calculateAverage(data.fwqCoordinates1); // data.fwqCoordinates1 = calculateAverage(data.fwqCoordinates1);
// data.fwqCoordinates2 = calculateAverage(data.fwqCoordinates2); // data.fwqCoordinates2 = calculateAverage(data.fwqCoordinates2);
// console.log(centerPoint); // // console.log(centerPoint); //
@ -2309,6 +2311,7 @@ const createCustomOverlay = (polygon, indexx) => {
map.addOverlay(fwq_list_arr.value[indexx]); map.addOverlay(fwq_list_arr.value[indexx]);
}; };
const updateFwqList = (data, townName, communityName) => { const updateFwqList = (data, townName, communityName) => {
// console.log(data, townName, communityName,'');
let updatedFwqList = []; let updatedFwqList = [];
jbfwqTotal.value.forEach((town) => { jbfwqTotal.value.forEach((town) => {
if (town.name === townName) { if (town.name === townName) {
@ -2316,7 +2319,7 @@ const updateFwqList = (data, townName, communityName) => {
if (community.name === communityName) { if (community.name === communityName) {
updatedFwqList = data updatedFwqList = data
.filter( .filter(
(item) => item.xzjd === townName && item.csq === communityName (item) => item.xzjd === townName && item.jc === communityName
) )
.map((item) => ({ .map((item) => ({
x: 53, x: 53,