diff --git a/.env.development b/.env.development index d1c8a3e7c..e6abb72d8 100644 --- a/.env.development +++ b/.env.development @@ -8,7 +8,7 @@ VUE_APP_API_SERVER = http://192.168.1.140/api # VUE_APP_API_SERVER = https://epmet-dev.elinkservice.cn:41080/api # VUE_APP_API_SERVER = https://epmet-dev.elinkservice.cn/api -# VUE_APP_NODE_ENV=dev_sdtdt -VUE_APP_NODE_ENV=dev +VUE_APP_NODE_ENV=dev_sdtdt +# VUE_APP_NODE_ENV=dev #项目根路径 VUE_APP_PUBLIC_PATH=epmet-oper \ No newline at end of file diff --git a/src/views/modules/visual/command/cpts/map-ol.vue b/src/views/modules/visual/command/cpts/map-ol.vue index 0959d17f8..df446bf40 100644 --- a/src/views/modules/visual/command/cpts/map-ol.vue +++ b/src/views/modules/visual/command/cpts/map-ol.vue @@ -456,9 +456,11 @@ export default { target: "map", }); - myMap.on("singleclick", function (e) { - // console.log(e.coordinate) - // console.log(transform(e.coordinate, 'EPSG:3857', 'EPSG:4326')); + myMap.on("singleclick", (event) => { + myMap.forEachFeatureAtPixel(event.pixel, function (feature) { + // 为移动到的 feature 发送自定义的 mousemove 消息 + feature.dispatchEvent({ type: "click", event }); + }); }); await nextTick(); @@ -535,6 +537,21 @@ export default { }), ]; + item.on("click", function (event) { + console.log("我被点击拉", item, event); + // 修改feature的样式为半径100像素的园,用蓝色填充 + this.setStyle( + new ol.style.Style({ + image: new ol.style.Circle({ + radius: 100, + fill: new ol.style.Fill({ + color: "blue", + }), + }), + }) + ); + }); + setInterval(() => { let currStyle = item.getStyle(); if (!Array.isArray(currStyle)) {