This commit is contained in:
parent
5929fb8433
commit
5f87d337a2
|
@ -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) {
|
||||||
|
|
Loading…
Reference in New Issue