This commit is contained in:
duanxiaohai 2024-07-25 10:35:33 +08:00
parent 5929fb8433
commit 5f87d337a2
1 changed files with 26 additions and 36 deletions

View File

@ -386,37 +386,24 @@ const xkzCenter = reactive([
var map = null; var map = null;
// //
let currentMarker = null; // let currentMarker = null; //
const BMAP = (name) => { const markera = (e) => {
// console.log(name, 666); // console.log(`${e.latlng.lng},${e.latlng.lat} `, "name");
// //
map.addEventListener("click", function (e) { if (currentMarker !== null) {
console.log(`${e.latlng.lng},${e.latlng.lat} `, name, 777); map.removeOverlay(currentMarker);
xkzCenter.forEach((item, index) => { }
if (item.name == name) { //
item.center = [e.latlng.lng, e.latlng.lat]; let icons = new BMapGL.Icon(AED, new BMapGL.Size(24, 62));
} var marker = new BMapGL.Marker(new BMapGL.Point(e.latlng.lng, e.latlng.lat), {
// console.log(item.center); icon: icons,
});
// console.log(xkzCenter,888);
// addCs();
//
if (currentMarker !== null) {
map.removeOverlay(currentMarker);
}
//
let icons = new BMapGL.Icon(AED, new BMapGL.Size(24, 62));
var marker = new BMapGL.Marker(
new BMapGL.Point(e.latlng.lng, e.latlng.lat),
{
icon: icons,
}
);
//
map.addOverlay(marker);
currentMarker = marker;
// addCs();
}); });
//
map.addOverlay(marker);
currentMarker = marker;
};
const BMAP = () => {
//
map.addEventListener("click", markera);
}; };
const initMap = () => { const initMap = () => {
@ -430,7 +417,6 @@ const initMap = () => {
// //
addPolygonCounty(); addPolygonCounty();
// //
// BMAP();
addJd(); addJd();
}; };
const loadTown = () => { const loadTown = () => {
@ -494,6 +480,7 @@ const addPolygonCounty = () => {
cfjiedao.value = item.name; cfjiedao.value = item.name;
let jdCenter = []; let jdCenter = [];
if (item.name == "溪口镇") { if (item.name == "溪口镇") {
BMAP();
if (!title_choose.value.includes("溪口镇")) { if (!title_choose.value.includes("溪口镇")) {
title_choose.value = title_choose.value + `>${item.name}`; title_choose.value = title_choose.value + `>${item.name}`;
} }
@ -510,9 +497,13 @@ const addPolygonCounty = () => {
} else { } else {
addCs2(); addCs2();
} }
console.log('dbfjdsbfjds',choose.value.person); console.log("dbfjdsbfjds", choose.value.person);
goMapCenter(jdCenter, 13); goMapCenter(jdCenter, 13);
} else { } else {
map.removeEventListener("click", markera);
if (currentMarker !== null) {
map.removeOverlay(currentMarker);
}
// xuanzhongCs.value = []; // xuanzhongCs.value = [];
// sfdd.value = false; // sfdd.value = false;
// title_choose.value = ""; // title_choose.value = "";
@ -688,7 +679,6 @@ const addCsChoose = () => {
chooseCsList.value.map((item, index) => { chooseCsList.value.map((item, index) => {
console.log("item11", item.name); console.log("item11", item.name);
sqname.value = item.name; sqname.value = item.name;
BMAP(item.name);
let fillColor = "blue"; let fillColor = "blue";
// //
let points = []; let points = [];
@ -873,7 +863,7 @@ const createCustomOverlayJd2 = (polygon, indexx) => {
number.style.fontSize = "9px"; number.style.fontSize = "9px";
number.style.fontWeight = "600"; number.style.fontWeight = "600";
number.style.color = "#FEFF6C"; number.style.color = "#FEFF6C";
number.style.textShadow='0px 2px 4px rgba(0,0,0,0.5)'; number.style.textShadow = "0px 2px 4px rgba(0,0,0,0.5)";
div.appendChild(number); div.appendChild(number);
number.appendChild(document.createTextNode(this.properties.number)); number.appendChild(document.createTextNode(this.properties.number));
content.appendChild(div); content.appendChild(div);
@ -1257,7 +1247,7 @@ const choose = ref({
}); });
const changeRs = (id) => { const changeRs = (id) => {
if (choose.value.person == id) { if (choose.value.person == id) {
console.log('重复'); console.log("重复");
// chooseArr.value = chooseArr.value.filter((item) => item !== "person"); // chooseArr.value = chooseArr.value.filter((item) => item !== "person");
choose.value.person = ""; choose.value.person = "";
jdm_number_arr.value.forEach((item, index) => { jdm_number_arr.value.forEach((item, index) => {
@ -1294,7 +1284,7 @@ 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]);
}); });
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_name_arr.value?.length) { // if (cs_name_arr.value?.length) {