This commit is contained in:
parent
5929fb8433
commit
5f87d337a2
|
@ -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();
|
||||
// 检查并移除当前标记
|
||||
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();
|
||||
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), {
|
||||
icon: icons,
|
||||
});
|
||||
// 将新标记添加到地图中并更新当前标记引用
|
||||
map.addOverlay(marker);
|
||||
currentMarker = marker;
|
||||
};
|
||||
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) => {
|
||||
|
@ -1294,7 +1284,7 @@ const changeRs = (id) => {
|
|||
jdm_arr.value.forEach((item, 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]);
|
||||
});
|
||||
// if (cs_name_arr.value?.length) {
|
||||
|
|
Loading…
Reference in New Issue