diff --git a/src/view/home.vue b/src/view/home.vue index f091900..b10f99e 100644 --- a/src/view/home.vue +++ b/src/view/home.vue @@ -7,15 +7,7 @@
- - - + diff --git a/src/view/sy_mapcopy.vue b/src/view/sy_mapcopy.vue index 5d0a8b2..a1535ac 100644 --- a/src/view/sy_mapcopy.vue +++ b/src/view/sy_mapcopy.vue @@ -119,15 +119,15 @@ v-for="(item, index) in jbfwqTotal" :key="index" > -
{{ item.name }}
+
{{ item.xzjd }}
- {{ itemm.name }} + {{ itemm.jc }}
@@ -141,8 +141,11 @@
@@ -960,6 +963,24 @@ const yaosuTotal = ref([ wz: true, }, ]); +//选中的资源要素 +const yaosuList = ref([]); +//选中资源要素坐标 +const yaosuIcon = ref({ + 体育场所: { + sj: [], + }, + 幼儿园: { sj: [] }, + 小学: { sj: [] }, + 初中: { sj: [] }, + 高中: { sj: [] }, + 医院: { sj: [] }, + 南孔书院: { sj: [] }, + 养老机构: { sj: [] }, + 汽车充电桩: { sj: [] }, + 卫生服务中心: { sj: [] }, + AED: { sj: [] }, +}); // 鼠标点击添加点位 let currentMarker = null; // 用于保存当前标记的引用 // 详情弹框 @@ -1790,9 +1811,58 @@ const changeRs2 = (id) => { addJd2(); } }; -const changeys = (id) => { - choose.value.yaosu = id; +//----------资源要素------------ +//判断数组中是否包含某个字符 +const removeCharFromArray = (arr, charToRemove) => { + // 如果数组包含该字符,则过滤掉它 + if (arr.includes(charToRemove)) { + return arr.filter((ch) => ch !== charToRemove); + } else { + arr.push(charToRemove); + return arr; + } }; +const changeys = (name) => { + if (yaosuList.value.includes(name)) { + yaosuList.value = yaosuList.value.filter((ch) => ch !== name); + } else { + yaosuList.value.push(name); + yaosuIcon.value.forEach((item,index)=>{ + createZyys() + }) + } + // yaosuList.value = removeCharFromArray(yaosuList.value, name); +}; +// 添加资源要素的图标 +const createZyys = (polygon, indexx) => { + // data.fwqCoordinates = polygon.point; + function createLabelDOM() { + var content = document.createElement("div"); + content.style.display = "flex"; + content.style.flexDirection = "column"; + content.style.alignItems = "center"; + content.style.height = "40px"; + content.style.width = "40px"; + content.style.zIndex = BMapGL.Overlay.getZIndex(this.point.lat); + let img2 = document.createElement("img"); + img2.style.width = "20px"; + img2.style.height = "20px"; + img2.src = this.properties.imgSrc2; + content.appendChild(img2); + return content; + } + fwq_list_arr.value[indexx] = new BMapGL.CustomOverlay(createLabelDOM, { + point: new BMapGL.Point(...polygon.point), + opacity: 0.5, + offsetY: -10, + properties: { + imgSrc2: polygon.img2, + type: "customOverlay", + }, + }); + map.addOverlay(fwq_list_arr.value[indexx]); +}; +//----------资源要素------------ //点击街道,回到街道 const to_jd = (item_name) => { clear(); @@ -2316,10 +2386,6 @@ const addPolygonCounty = () => { // townName.value = item.name; if (item.name == cfJd.value) { } else { - // cs_qk_arr.value.forEach((item, index) => { - // map.removeOverlay(cs_qk_arr.value[index]); - // }); - // cs_qk_arr.value.length=0; clear(); xkzDk.length = 0; cfJd.value = item.name; @@ -2450,8 +2516,8 @@ const createCustomOverlayJd2 = (polygon, indexx) => { content.style.flexDirection = "column"; content.style.alignItems = "center"; content.style.zIndex = BMapGL.Overlay.getZIndex(this.point.lat); - content.style.height = "30px"; - content.style.width = "30px"; + content.style.height = "20px"; + content.style.width = "20px"; var div = document.createElement("div"); div.style.color = "#333"; div.style.whiteSpace = "nowrap"; @@ -2514,7 +2580,7 @@ const createCustomOverlayJd2 = (polygon, indexx) => { jdm_number_arr.value[indexx] = new BMapGL.CustomOverlay(createLabelDOM, { point: new BMapGL.Point(...polygon.center), opacity: 0.5, - offsetY: 0, + offsetY: -10, properties: { title: polygon.name, number: polygon[`${num}`], @@ -2828,7 +2894,7 @@ const createCs = (polygon, indexx) => { cs_name_arr.value[indexx] = new BMapGL.CustomOverlay(createLabelDOM, { point: new BMapGL.Point(...polygon.center), opacity: 0.5, - offsetY: 0, + offsetY: -10, properties: { title: polygon.name, imgSrc2: dwd, @@ -2904,7 +2970,7 @@ const createCs2 = (polygon, indexx) => { cs_number_name_arr.value[indexx] = new BMapGL.CustomOverlay(createLabelDOM, { point: new BMapGL.Point(...polygon.center), opacity: 0.5, - offsetY: 0, + offsetY: -10, properties: { title: polygon.name, number: polygon[`${num}`], @@ -2973,7 +3039,7 @@ const DGcreateCs = (polygon, indexx) => { cs_dd_arr.value[indexx] = new BMapGL.CustomOverlay(createLabelDOM, { point: new BMapGL.Point(...polygon.center), opacity: 0.5, - offsetY: 0, + offsetY: -10, properties: { title: polygon.name, imgSrc2: dwd, @@ -3054,7 +3120,7 @@ const DGcreateCs2 = (polygon, indexx) => { cs_dd_arr.value[indexx] = new BMapGL.CustomOverlay(createLabelDOM, { point: new BMapGL.Point(...polygon.center), opacity: 0.5, - offsetY: 0, + offsetY: -10, properties: { title: polygon.name, number: polygon[`${num}`],