| | |
| | | }, |
| | | // 获取新树数据 |
| | | getNewTreeData (code) { |
| | | if (!code) return this.sourceData; |
| | | |
| | | let data = JSON.parse(JSON.stringify(this.sourceData)); |
| | | if (!code) return data; |
| | | |
| | | this.setSubTreeData(data, code); |
| | | this.rmPrjTreeData(data, code); |
| | | |
| | | return data; |
| | | }, |
| | |
| | | } |
| | | } |
| | | }, |
| | | // 移除项目树数据 |
| | | rmPrjTreeData (data, code) { |
| | | /*let j = 0; |
| | | while (j < data.length) { |
| | | let d = data[j]; |
| | | if (d.type == 1 && d.isProject && d.enName == code) { |
| | | data.splice(j, 1); |
| | | data.concat(d.children); |
| | | continue; |
| | | } |
| | | |
| | | j++; |
| | | } |
| | | |
| | | for (let i = 0, c = data.length; i < c; i++) { |
| | | if (data[i].children && data[i].children.length) { |
| | | this.rmPrjTreeData(data[i].children, code); |
| | | } |
| | | }*/ |
| | | |
| | | let i = 0; |
| | | while (i < data.length) { |
| | | let d = data[i]; |
| | | if (!d.children) { |
| | | i++; |
| | | continue; |
| | | } |
| | | if (!d.children.length) { |
| | | data.splice(i, 1); |
| | | continue; |
| | | } |
| | | |
| | | let j = 0; |
| | | while (j < d.children.length) { |
| | | let e = d.children[j]; |
| | | if (e.type == 1 && e.isProject && e.enName == code) { |
| | | d.children.splice(j, 1); |
| | | if (e.children && e.children.length) d.children = d.children.concat(e.children); |
| | | continue; |
| | | } |
| | | |
| | | j++; |
| | | } |
| | | |
| | | i++; |
| | | } |
| | | |
| | | for (let i = 0, c = data.length; i < c; i++) { |
| | | if (data[i].children && data[i].children.length) { |
| | | this.rmPrjTreeData(data[i].children, code); |
| | | } |
| | | } |
| | | }, |
| | | // 添加WFS图层 * |
| | | addWFSLayers (res) { |
| | | let url = |