| | |
| | | this.featureGroup = this.L.featureGroup({}).addTo(this.map) |
| | | |
| | | this.layers = new List() |
| | | this.filters = new List() |
| | | for (var i = 0; i < layersConfig.length; i++) { |
| | | const config = layersConfig[i] |
| | | const typeName = config.typeName |
| | | if (typeName) { |
| | | this.layers.add(config.index, typeName) |
| | | if (config.filter) { |
| | | this.filters.addEnd(config.filter) |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | if (typeName) { |
| | | if (!this.layers.contains(typeName)) { |
| | | this.layers.add(config.index, typeName) |
| | | this.wmsLayer.setParams({ layers: this.layers.join(',') }) |
| | | if (config.filter) { |
| | | this.filters.addEnd(config.filter) |
| | | } |
| | | this.wmsLayer.setParams({ cql_filter: this.filters.join(' and ') }) |
| | | } |
| | | } |
| | | } |
| | | |
| | | remove (config) { |
| | | console.log(config) |
| | | const typeName = config.typeName |
| | | this.layers.remove(typeName) |
| | | this.wmsLayer.setParams({ layers: this.layers.join(',') }) |
| | | if (config.filter) { |
| | | this.filters.remove(config.filter) |
| | | } |
| | | this.wmsLayer.setParams({ cql_filter: this.filters.join(' and ') }) |
| | | } |
| | | |
| | | load (layers) { |
| | | this.wmsLayer = this.L.tileLayer.wms(PIPELINE_WMS, { |
| | | format: 'image/png', // 返回的数据格式 |
| | | transparent: true, |
| | | layers: this.layers.join(',') |
| | | layers: 'sewer:pipesegment', // this.layers.join(','), |
| | | cql_filter: this.filters.join(' and ') |
| | | }).addTo(this.map) |
| | | } |
| | | |
| | |
| | | this.filters = [] |
| | | this.typeNames = [] |
| | | this.url = WFS_URL |
| | | this.page = 1 |
| | | this.pageSize = 10 |
| | | this.params = { |
| | | REQUEST: 'getfeature', |
| | | OUTPUTFORMAT: 'application/json', |
| | | maxFeatures: 20000, |
| | | version: '1.0.0' |
| | | maxFeatures: 10, |
| | | version: '1.0.0', |
| | | startIndex: 0 |
| | | } |
| | | |
| | | this.setTypeName = (typeName) => { |
| | | this.typeNames = typeName |
| | | } |
| | | |
| | | this.clearFilter = () => { |
| | | this.filters = [] |
| | | } |
| | | |
| | | this.addTypeName = (typeName) => { |
| | |
| | | } |
| | | return url + this.getUrlParams() |
| | | } |
| | | |
| | | this.setPage = (page) => { |
| | | const startIndex = page * this.pageSize |
| | | this.params.startIndex = startIndex |
| | | this.page = page |
| | | } |
| | | } |
| | | |
| | | export default WfsHelper |
| | |
| | | list: [], |
| | | items: [LayerPipeLines, LayerFsss, LayerHbss, LayerPk, LayerArea], |
| | | subItems: LayerPipeLines.layers, |
| | | pageSize: 10, |
| | | total: 0, |
| | | form: { |
| | | pipelineType: '管线', |
| | |
| | | facilitiesParameter: null, |
| | | fuShuSheShiShow: true, |
| | | fuShuSheShiPanelShow: true, |
| | | activeNum: -1 |
| | | activeNum: -1, |
| | | wfsHelper: null |
| | | } |
| | | }, |
| | | props: ['title'], |
| | |
| | | }, |
| | | handleClick (tab, event) { |
| | | console.log(tab, event) |
| | | }, |
| | | handlePage (page) { |
| | | this.wfsHelper.setPage(page) |
| | | this.handleSearch() |
| | | }, |
| | | // 设施类型筛选 |
| | | handlePipelineType (val) { |
| | |
| | | async handleSearch () { |
| | | // console.log(this.form.dataType.sname, this.form.keyword) |
| | | this.list = [] |
| | | var wfsHelper = new WfsHelper() |
| | | this.wfsHelper.clearFilter() |
| | | // todo 现在管网还没区分开类型,后面改 |
| | | wfsHelper.addTypeName(this.form.dataType.typeName) |
| | | this.wfsHelper.setTypeName([this.form.dataType.typeName]) |
| | | if (this.form.keyword) { |
| | | wfsHelper.addLike('name', this.form.keyword) |
| | | this.wfsHelper.addLike('name', this.form.keyword) |
| | | } |
| | | // const _this = this |
| | | const res = await AjaxUtils.GetDataAsynByUrl(wfsHelper.getUrl(), {}) |
| | | const res = await AjaxUtils.GetDataAsynByUrl(this.wfsHelper.getUrl(), {}) |
| | | if (res instanceof Object && Object.prototype.hasOwnProperty.call(res, 'features')) { |
| | | this.total = res.totalFeatures |
| | | this.list = res.features |
| | | } |
| | | }, |
| | |
| | | } |
| | | window.layerFactory.flyByFeature(val, this.form.dataType.code) |
| | | } |
| | | }, |
| | | mounted () { |
| | | this.wfsHelper = new WfsHelper() |
| | | } |
| | | } |
| | | </script> |
| | |
| | | sname: '管网', |
| | | checked: false, |
| | | type: SERVICE_TYPE.WMS, |
| | | typeName: 'sewer:pipeline', |
| | | typeName: 'sewer:pipeline,sewer:pipenetwork,sewer:pipesegment', |
| | | icon: 'sewers/雨水线.png', |
| | | color: '#0070ff', |
| | | minZoom: 13, |
| | |
| | | sname: '事故水', |
| | | checked: false, |
| | | type: SERVICE_TYPE.WMS, |
| | | typeName: 'sewer:pipeline', |
| | | typeName: 'sewer:pipeline,sewer:pipenetwork,sewer:pipesegment', |
| | | minZoom: 13, |
| | | filter: 'mediumtype = \'事故水\'', |
| | | index: 1 |
| | |
| | | sname: '含油污水', |
| | | checked: false, |
| | | type: SERVICE_TYPE.WMS, |
| | | typeName: 'sewer:pipeline', |
| | | typeName: 'sewer:pipeline,sewer:pipenetwork,sewer:pipesegment', |
| | | minZoom: 13, |
| | | color: '#ffaa00', |
| | | filter: 'mediumtype = \'含油\'', |
| | | filter: 'mediumtype = \'含油污水\'', |
| | | styles: { |
| | | COLOR: '#ffaa00', |
| | | FILL_COLOR: '#ffaa00' |
| | |
| | | sname: '含盐污水', |
| | | checked: false, |
| | | type: SERVICE_TYPE.WMS, |
| | | typeName: 'sewer:pipeline', |
| | | typeName: 'sewer:pipeline,sewer:pipenetwork,sewer:pipesegment', |
| | | minZoom: 13, |
| | | filter: 'mediumtype = \'含盐\'', |
| | | filter: 'mediumtype = \'含盐污水\'', |
| | | index: 1 |
| | | }, |
| | | { |
| | |
| | | sname: '含碱污水', |
| | | checked: false, |
| | | type: SERVICE_TYPE.WMS, |
| | | typeName: 'sewer:pipeline', |
| | | filter: 'mediumtype = \'含碱\'', |
| | | typeName: 'sewer:pipeline,sewer:pipenetwork,sewer:pipesegment', |
| | | filter: 'mediumtype = \'含碱污水\'', |
| | | minZoom: 10, |
| | | index: 1 |
| | | }, |
| | |
| | | sname: '含硫污水', |
| | | checked: false, |
| | | type: SERVICE_TYPE.WMS, |
| | | typeName: 'sewer:pipeline', |
| | | filter: 'mediumtype = \'含硫\'', |
| | | typeName: 'sewer:pipeline,sewer:pipenetwork,sewer:pipesegment', |
| | | filter: 'mediumtype = \'含硫污水\'', |
| | | minZoom: 10, |
| | | index: 1 |
| | | }, |
| | |
| | | sname: '生活污水', |
| | | checked: false, |
| | | type: SERVICE_TYPE.WMS, |
| | | typeName: 'sewer:pipeline', |
| | | typeName: 'sewer:pipeline,sewer:pipenetwork,sewer:pipesegment', |
| | | filter: 'mediumtype = \'生活污水\'', |
| | | minZoom: 13, |
| | | index: 1 |
| | |
| | | sname: '净化水', |
| | | checked: false, |
| | | type: SERVICE_TYPE.WMS, |
| | | typeName: 'sewer:pipeline', |
| | | typeName: 'sewer:pipeline,sewer:pipenetwork,sewer:pipesegment', |
| | | filter: 'mediumtype = \'净化水\'', |
| | | minZoom: 13, |
| | | index: 1 |
| | |
| | | name: '循环水', |
| | | sname: '循环水', |
| | | type: SERVICE_TYPE.WMS, |
| | | typeName: 'sewer:pipeline', |
| | | typeName: 'sewer:pipeline,sewer:pipenetwork,sewer:pipesegment', |
| | | filter: 'mediumtype = \'循环水\'', |
| | | checked: false, |
| | | minZoom: 13, |
| | |
| | | sname: '生产污水', |
| | | checked: false, |
| | | type: SERVICE_TYPE.WMS, |
| | | typeName: 'sewer:pipeline', |
| | | typeName: 'sewer:pipeline,sewer:pipenetwork,sewer:pipesegment', |
| | | filter: 'mediumtype = \'生产污水\'', |
| | | minZoom: 13, |
| | | color: '#a8a800', |
| | |
| | | } |
| | | |
| | | add (index, element) { |
| | | if (element.indexOf(',') > 0) { |
| | | const arr = element.split(',') |
| | | for (const k in arr) { |
| | | if (!this.contains(element)) { |
| | | this._addElement(index, arr[k]) |
| | | } |
| | | } |
| | | } else if (!this.contains(element)) { |
| | | this._addElement(index, element) |
| | | } |
| | | } |
| | | |
| | | _addIndex (index, element) { |
| | | const newArr = [] |
| | | for (var i = this.dataSouce.length - 1; i > index - 1; i--) { |
| | | newArr[i + 1] = this.dataSouce[i] |
| | | } |
| | | newArr[index] = element |
| | | this.dataSouce = newArr |
| | | } |
| | | |
| | | _addElement (index, element) { |
| | | if (!index) { |
| | | this.addEnd(element) |
| | | } else if (index >= this.dataSouce.length) { |
| | |
| | | } else if (index === 1) { |
| | | this.addFront(element) |
| | | } else { |
| | | this._add(index, element) |
| | | this._addIndex(index, element) |
| | | } |
| | | } |
| | | |
| | |
| | | * @param {*} element 要添加的元素 |
| | | */ |
| | | addEnd (element) { |
| | | this.dataSouce[this.dataSouce.length] = element |
| | | if (!this.contains(element)) { |
| | | this.dataSouce[this.dataSouce.length] = element |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param {*} after |
| | | */ |
| | | addFront (element) { |
| | | this._add(0, element) |
| | | } |
| | | |
| | | _add (index, element) { |
| | | const newArr = [] |
| | | for (var i = this.dataSouce.length - 1; i > index - 1; i--) { |
| | | newArr[i + 1] = this.dataSouce[i] |
| | | if (!this.contains(element)) { |
| | | this._addIndex(0, element) |
| | | } |
| | | newArr[index] = element |
| | | this.dataSouce = newArr |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | removeBlank () { |
| | | const arr = this.dataSouce |
| | | console.log(arr) |
| | | for (const k in arr) { |
| | | if (!arr[k]) { |
| | | this.dataSouce.splice(k, 1) |