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) {
|
|
||||||
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) {
|
if (currentMarker !== null) {
|
||||||
map.removeOverlay(currentMarker);
|
map.removeOverlay(currentMarker);
|
||||||
}
|
}
|
||||||
// 创建新标记
|
// 创建新标记
|
||||||
let icons = new BMapGL.Icon(AED, new BMapGL.Size(24, 62));
|
let icons = new BMapGL.Icon(AED, new BMapGL.Size(24, 62));
|
||||||
var marker = new BMapGL.Marker(
|
var marker = new BMapGL.Marker(new BMapGL.Point(e.latlng.lng, e.latlng.lat), {
|
||||||
new BMapGL.Point(e.latlng.lng, e.latlng.lat),
|
|
||||||
{
|
|
||||||
icon: icons,
|
icon: icons,
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
|
||||||
// 将新标记添加到地图中并更新当前标记引用
|
// 将新标记添加到地图中并更新当前标记引用
|
||||||
map.addOverlay(marker);
|
map.addOverlay(marker);
|
||||||
currentMarker = marker;
|
currentMarker = marker;
|
||||||
// addCs();
|
};
|
||||||
});
|
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) => {
|
||||||
|
|
Loading…
Reference in New Issue