From d50cc12c336b28c94d02c6ce05a73a48ed5d8bd5 Mon Sep 17 00:00:00 2001 From: Surpriseplus <845948745@qq.com> Date: 星期三, 14 六月 2023 09:40:12 +0800 Subject: [PATCH] 在线制图,图层列表修改 --- src/views/exportMap/index.vue | 38 ++++++++++++++++++++++++++++---------- 1 files changed, 28 insertions(+), 10 deletions(-) diff --git a/src/views/exportMap/index.vue b/src/views/exportMap/index.vue index bbfa803..b2408bb 100644 --- a/src/views/exportMap/index.vue +++ b/src/views/exportMap/index.vue @@ -371,23 +371,26 @@ }); }, async LayerStart() { + this.treeData = []; const data = await perms_selectLayers() if (data.code != 200) { return this.$message.error("鍥惧眰鍒楄〃鏌ヨ澶辫触") } var res = data.result; - var val = []; - var std = []; - var layerWMS = []; - for (var i in res) { + const val = []; + const std = []; + const layerWMS = []; + for (var i = 0; i < res.length; i++) { var str = res[i]; - if (str.type == 1) { + if (str.type == 1 && str.cnName.indexOf('妯″瀷') == -1 && str.cnName.indexOf('鍊炬枩鎽勫奖') == -1 && str.cnName.indexOf('鏁板瓧姝e皠褰卞儚') == -1 && str.isProject != 1) { val.push(str) - } else if (str.url != null && str.type == 2 && str.serveType == 'WMS') { - if (str.isShow == 1) { + } + if (str.url != null && str.type == 2 && str.serveType == 'WMS') { + + if (str.isShow == 1) { std.push(str.id) layerWMS.push(str) this.tableData.push({ @@ -398,12 +401,26 @@ val.push(str) } } - var res = this.setTreeData(val); - this.treeData = res; + const val_data = val.filter(ts => { + if (ts.type == 1) { + return ts + } + if (ts.url != null && ts.type == 2 && ts.serveType == 'WMS') { + return ts + } + }) + var layer_data = this.setTreeData(val_data); + this.treeData = layer_data; this.$refs.tree.setCheckedKeys(std) this.showMapLayer(layerWMS); - }, + + + + + + + setClearMap() { var layers_ol = mapView.getAllLayers(); for (var i in layers_ol) { @@ -418,6 +435,7 @@ this.setClearMap(); var url = []; for (var i in val) { + console.log(val[i]) if (val[i].url) { url.push(val[i].url) } -- Gitblit v1.9.3