This commit is contained in:
commit
625c9d66ec
|
@ -13,7 +13,7 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import Header from "../components/header.vue";
|
import Header from "../components/header.vue";
|
||||||
|
|
||||||
import { ref, onMounted, onBeforeMount ,watch} from "vue";
|
import { ref, onMounted, onBeforeMount ,watch, nextTick} from "vue";
|
||||||
import { useRouter, useRoute } from "vue-router";
|
import { useRouter, useRoute } from "vue-router";
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const routers = useRoute();
|
const routers = useRoute();
|
||||||
|
@ -21,9 +21,9 @@ console.log(routers.path);
|
||||||
watch(
|
watch(
|
||||||
() => routers.path,
|
() => routers.path,
|
||||||
(newVal, oldVal) => {
|
(newVal, oldVal) => {
|
||||||
if (routers.path == '/home/index/map') {
|
nextTick(()=>{
|
||||||
reset_font()
|
reset_font()
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
const reset_font = () => {
|
const reset_font = () => {
|
||||||
|
|
|
@ -389,6 +389,7 @@ const addPolygonCounty = () => {
|
||||||
map.clearOverlays();
|
map.clearOverlays();
|
||||||
let fillColor = "#ffffff";
|
let fillColor = "#ffffff";
|
||||||
mapTownDataDK.map((item) => {
|
mapTownDataDK.map((item) => {
|
||||||
|
item.leg = 0;
|
||||||
//地区的坐标范围
|
//地区的坐标范围
|
||||||
let points = [];
|
let points = [];
|
||||||
item.point.map((p) => points.push(new BMapGL.Point(...p)));
|
item.point.map((p) => points.push(new BMapGL.Point(...p)));
|
||||||
|
@ -401,15 +402,18 @@ const addPolygonCounty = () => {
|
||||||
fillColor: fillColor,
|
fillColor: fillColor,
|
||||||
fillOpacity: 0.7,
|
fillOpacity: 0.7,
|
||||||
name: item.name,
|
name: item.name,
|
||||||
|
zIndex: 92,
|
||||||
});
|
});
|
||||||
|
|
||||||
map.addOverlay(polygon);
|
map.addOverlay(polygon);
|
||||||
polygon.addEventListener("click", () => {
|
polygon.addEventListener("click", () => {
|
||||||
console.log(item.name);
|
console.log(item.name);
|
||||||
|
if (title_choose.value.includes("溪口镇")) {
|
||||||
|
} else {
|
||||||
let jdCenter = [];
|
let jdCenter = [];
|
||||||
if (item.name == "溪口镇") {
|
if (item.name == "溪口镇") {
|
||||||
if (!title_choose.value.includes("溪口镇")) {
|
if (!title_choose.value.includes("溪口镇")) {
|
||||||
title_choose.value = title_choose.value + `>${polygon.name}`;
|
title_choose.value = title_choose.value + `>${item.name}`;
|
||||||
}
|
}
|
||||||
loadCs();
|
loadCs();
|
||||||
addPolygonCountyCs();
|
addPolygonCountyCs();
|
||||||
|
@ -421,6 +425,7 @@ const addPolygonCounty = () => {
|
||||||
addCs();
|
addCs();
|
||||||
goMapCenter(jdCenter, 13);
|
goMapCenter(jdCenter, 13);
|
||||||
} else {
|
} else {
|
||||||
|
title_choose.value = "龙游县";
|
||||||
cs_qk_arr.value.forEach((item, index) => {
|
cs_qk_arr.value.forEach((item, index) => {
|
||||||
map.removeOverlay(cs_qk_arr.value[index]);
|
map.removeOverlay(cs_qk_arr.value[index]);
|
||||||
});
|
});
|
||||||
|
@ -428,6 +433,7 @@ const addPolygonCounty = () => {
|
||||||
map.removeOverlay(cs_name_arr.value[index]);
|
map.removeOverlay(cs_name_arr.value[index]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -487,8 +493,35 @@ const addPolygonCountyCs = () => {
|
||||||
fillColor: fillColor,
|
fillColor: fillColor,
|
||||||
fillOpacity: 0.7,
|
fillOpacity: 0.7,
|
||||||
name: item.name,
|
name: item.name,
|
||||||
|
zIndex: 99,
|
||||||
});
|
});
|
||||||
map.addOverlay(cs_qk_arr.value[index]);
|
map.addOverlay(cs_qk_arr.value[index]);
|
||||||
|
cs_qk_arr.value[index].addEventListener("click", () => {
|
||||||
|
console.log(111);
|
||||||
|
// let jdCenter = [];
|
||||||
|
// if (item.name == "溪口镇") {
|
||||||
|
// if (!title_choose.value.includes("溪口镇")) {
|
||||||
|
// title_choose.value = title_choose.value + `>${item.name}`;
|
||||||
|
// }
|
||||||
|
// loadCs();
|
||||||
|
// addPolygonCountyCs();
|
||||||
|
// mapTownCount.map((item) => {
|
||||||
|
// if (item.name == "溪口镇") {
|
||||||
|
// jdCenter = item.center;
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// addCs();
|
||||||
|
// goMapCenter(jdCenter, 13);
|
||||||
|
// } else {
|
||||||
|
// title_choose.value = "龙游县";
|
||||||
|
// cs_qk_arr.value.forEach((item, index) => {
|
||||||
|
// map.removeOverlay(cs_qk_arr.value[index]);
|
||||||
|
// });
|
||||||
|
// cs_name_arr.value.forEach((item, index) => {
|
||||||
|
// map.removeOverlay(cs_name_arr.value[index]);
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -586,7 +619,7 @@ const createCustomOverlayJd2 = (polygon, indexx) => {
|
||||||
title.appendChild(document.createTextNode(this.properties.title));
|
title.appendChild(document.createTextNode(this.properties.title));
|
||||||
content.appendChild(div);
|
content.appendChild(div);
|
||||||
var number = document.createElement("div");
|
var number = document.createElement("div");
|
||||||
number.style.fontSize = "16px";
|
number.style.fontSize = "9px";
|
||||||
number.style.fontWeight = "600";
|
number.style.fontWeight = "600";
|
||||||
number.style.color = "rgba(0, 255, 189, 1)";
|
number.style.color = "rgba(0, 255, 189, 1)";
|
||||||
div.appendChild(number);
|
div.appendChild(number);
|
||||||
|
@ -900,7 +933,7 @@ const changeRs = (id) => {
|
||||||
jdm_number_arr.value.forEach((item, index) => {
|
jdm_number_arr.value.forEach((item, index) => {
|
||||||
map.removeOverlay(jdm_number_arr.value[index]);
|
map.removeOverlay(jdm_number_arr.value[index]);
|
||||||
});
|
});
|
||||||
if (cs_number_name_arr.value) {
|
if (cs_number_name_arr.value?.length) {
|
||||||
cs_number_name_arr.value.forEach((item, index) => {
|
cs_number_name_arr.value.forEach((item, index) => {
|
||||||
map.removeOverlay(cs_number_name_arr.value[index]);
|
map.removeOverlay(cs_number_name_arr.value[index]);
|
||||||
});
|
});
|
||||||
|
@ -920,6 +953,7 @@ const changeRs = (id) => {
|
||||||
// addJd();
|
// addJd();
|
||||||
// }
|
// }
|
||||||
} else {
|
} else {
|
||||||
|
console.log(8888);
|
||||||
// if(chooseArr.value.includes("jd_number")){
|
// if(chooseArr.value.includes("jd_number")){
|
||||||
// chooseArr.value = chooseArr.value.filter((item) => item !== "jd_number");
|
// chooseArr.value = chooseArr.value.filter((item) => item !== "jd_number");
|
||||||
// chooseArr.value.push("jd_noNumber");
|
// chooseArr.value.push("jd_noNumber");
|
||||||
|
@ -930,13 +964,19 @@ const changeRs = (id) => {
|
||||||
jdm_arr.value.forEach((item, index) => {
|
jdm_arr.value.forEach((item, index) => {
|
||||||
map.removeOverlay(jdm_arr.value[index]);
|
map.removeOverlay(jdm_arr.value[index]);
|
||||||
});
|
});
|
||||||
if (cs_name_arr.value) {
|
if (cs_name_arr.value?.length) {
|
||||||
cs_name_arr.value.forEach((item, index) => {
|
cs_name_arr.value.forEach((item, index) => {
|
||||||
map.removeOverlay(cs_name_arr.value[index]);
|
map.removeOverlay(cs_name_arr.value[index]);
|
||||||
});
|
});
|
||||||
cs_name_arr.value.length = 0;
|
cs_name_arr.value.length = 0;
|
||||||
addCs2();
|
addCs2();
|
||||||
}
|
}
|
||||||
|
if (jdm_number_arr.value?.length) {
|
||||||
|
jdm_number_arr.value.forEach((item, index) => {
|
||||||
|
map.removeOverlay(jdm_number_arr.value[index]);
|
||||||
|
});
|
||||||
|
jdm_number_arr.value.length = 0;
|
||||||
|
}
|
||||||
addJd2();
|
addJd2();
|
||||||
// removeAllPolygon("person");
|
// removeAllPolygon("person");
|
||||||
// xuanran();
|
// xuanran();
|
||||||
|
|
Loading…
Reference in New Issue