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