Browse Source

更新地图刷新

wangqin
王钦 12 months ago
parent
commit
3a20c18ad6
  1. 21
      ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/RoadAndEvents/index.vue

21
ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/RoadAndEvents/index.vue

@ -189,12 +189,17 @@ export default {
} }
getMinMapLayers(); getMinMapLayers();
this.$root.$on('delete-event', this.handleRefresh);
}, },
beforeDestroy() { beforeDestroy() {
this.emitter.off("selectedCompleted", this.selectedCompletedHandle); this.emitter.off("selectedCompleted", this.selectedCompletedHandle);
Object.keys(lngLatMap).forEach(key => delete lngLatMap[key]); Object.keys(lngLatMap).forEach(key => delete lngLatMap[key]);
markerClusterIns.clear(); markerClusterIns.clear();
window.renderData = undefined; window.renderData = undefined;
this.$root.$off('delete-event', this.handleRefresh);
}, },
methods: { methods: {
selectedCompletedHandle(item) { selectedCompletedHandle(item) {
@ -262,19 +267,21 @@ export default {
handleDevice: debounce(async function (item) { handleDevice: debounce(async function (item) {
await this.handleDeviceImmediate(item); await this.handleDeviceImmediate(item);
}, 360), }, 360),
handleRefresh(){ async handleRefresh(){
// const tab = _.filter(this.tabContentData,{status:'_active'})
const { mapIns } = this.getMap(); try{
console.log(mapIns.getLayers(),'-----') this.handleCleared();
mapIns.getLayers().forEach((layer, index) => index > this.minLayers && mapIns.remove(layer)) } catch(e){
}
tab.forEach(async item=>{
await this.handleDeviceImmediate(item);
})
}, },
handleCleared() { handleCleared() {
const { mapIns } = this.getMap(); const { mapIns } = this.getMap();
this.layerData.forEach(({ children }) => { this.layerData.forEach(({ children }) => {
children.forEach(item => item.status = "") children.forEach(item => item.status = "")
}); });
if (!mapIns) return; if (!mapIns) return;
for (const key in cacheRemoveFunc) { for (const key in cacheRemoveFunc) {

Loading…
Cancel
Save