🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
路径 D:\ireport365\ireport365.war\WEB-INF\classes\report-resource\design.js 分享页添加得 代码 ![](https://img.kancloud.cn/ae/37/ae37c32de4e588620e85cbeb85f6c042_1185x866.png) 如图位置 ``` // 2020/2/5代码 start var item = component.config.defaudltLayer; var testid = item.columnType + "_" + item.chartType + "_" + item.value; if(component.config.defaudltLayer!=undefined){ if(item.value != 110){ if (testid != layerBeforeId) { if (component.context.layerId == null) { if(map.getLayer(layerBeforeId)!= undefined){ map.setLayoutProperty(layerBeforeId, 'visibility', 'none'); } component.context.layerId } } if(testid == layerBeforeId){ if(map.getLayer(layerBeforeId)!= undefined){ map.setLayoutProperty(layerBeforeId, 'visibility', 'visible'); } } } } // 2020/2/5代码 end ``` 设计页 路径:js\enduser\designer\vs-component-gis.js 如图位置: ![](https://img.kancloud.cn/af/d7/afd7892818f82f63cd5a52145df42a4a_1238x883.png) ``` var defaudltLayerItem = [ { name:'全部', value:110, } ] ``` 如图位置 ![](https://img.kancloud.cn/ee/ef/eeef5a3b9598ba8cff26798fd7f5b25c_1279x876.png) ``` // 默认图层 for(var i = 0;i<component.config.layers.length;i++){ console.log(component.config.layers[i]) defaudltLayerItem.push({ name:component.config.layers[i].name, value:component.config.layers[i].id, columnType:component.config.layers[i].columnType, chartType:component.config.layers[i].chartType }) } defaudltLayerItem.length = parseInt(component.config.layers.length)+1; console.log(defaudltLayerItem) ``` 搜索地图风格 如图: ![](https://img.kancloud.cn/f4/22/f422e944c9fa8fc37a062218e74dd18d_866x634.png) ``` { title:'默认图层', type:"select-s", bind:"defaudltLayer", items:defaudltLayerItem  }, ``` 监听位置 如图 搜索 http://120.27.63.12:6080/conf/styles/sprite-kye/ ![](https://img.kancloud.cn/fa/1f/fa1f044693d8bdecedd03ed8507376f4_1305x619.png) ``` scope.$watch("component.config.defaudltLayer", function(newValue, oldValue) { if (newValue != null && newValue != oldValue) { component.config.defaudltLayer = newValue } }); ```