| | |
| | | img_layer.show = checked; |
| | | } |
| | | } |
| | | //存储选中图层 |
| | | let checkedLayers = JSON.parse(sessionStorage.getItem("checkedLayers")); |
| | | if (checked && data.url){ |
| | | checkedLayers.push(data); |
| | | } |
| | | else { |
| | | for (let i = 0; i < checkedLayers.length; i++) { |
| | | let item = checkedLayers[i]; |
| | | if (item.enName == data.enName){ |
| | | checkedLayers.splice(i,1); |
| | | } |
| | | } |
| | | } |
| | | sessionStorage.setItem("checkedLayers",JSON.stringify(checkedLayers)); |
| | | setTimeout(() => { |
| | | this.$bus.$emit("treeChanged", true); |
| | | }, 500) |
| | | } else if (data.serveType == "WFS") { |
| | | if (window.Viewer.dataSources._dataSources.length == 0) { |
| | | this.setAddLayers(data); |
| | |
| | | var std = data.result; |
| | | var that = this; |
| | | var checkKey = []; |
| | | let checkedLayers = []; |
| | | var val = std.filter((str) => { |
| | | if (str.type == 1) { |
| | | return str; |
| | |
| | | if (str.isShow == 1) { |
| | | checkKey.push(str.id); |
| | | that.setAddLayers(str); |
| | | if (str.serveType == "WMS" && str.url){ |
| | | checkedLayers.push(str); |
| | | } |
| | | } |
| | | return str; |
| | | } |
| | | }); |
| | | |
| | | //存储选中图层 |
| | | sessionStorage.setItem("checkedLayers",JSON.stringify(checkedLayers)); |
| | | var res = this.setTreeData(val); |
| | | |
| | | for (var i in res) { |