派生自 wuyushui/SewerAndRainNetwork

YANGDL
2021-03-02 2a803059365f15f350a9c088d3a4a5c1ac234fde
Merge remote-tracking branch 'origin/master'
1个文件已删除
1个文件已添加
6个文件已修改
211 ■■■■ 已修改文件
src/assets/css/map/map-elem-ui.less 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/LayerController/modules/LcServiceLayer.vue 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/helpers/ServiceLayerHelper.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/helpers/WfsHelper.js 77 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/helpers/WmsHelper.js 78 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/conf/Constants.js 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/conf/MapConfig.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/popup/Popup.vue 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/css/map/map-elem-ui.less
@@ -5,6 +5,14 @@
    border-color: @color;
}
.el-tabs{
  .el-tabs__item{
      padding: 0 10px;
      text-align: center;
      height: 20px;
      line-height: 20px;
  }
}
.select-down {
    border: none !important;
    background-color: @background-color !important;
src/components/LayerController/modules/LcServiceLayer.vue
@@ -4,7 +4,8 @@
            <div v-for="item in serviceLayers" :key="item.code" class="layerbox">
                <div><input type="checkbox" :name="'wmsLayer_'+item.code" :checked="item.checked" :value="item.code"
                            @change="swAllLayers(item)"/>{{ item.name }} <span @click="swFilter(item)"
                                                                               class="btn-filter">过滤</span>
                                                                               class="btn-filter">过滤</span><span @click="loadWfs()"
                                                                                                                 class="btn-filter">测试</span>
                </div>
                <div class="layerbox-item">
                    <div class="basemap-layer-item" v-for="itm in item.layers" :key="itm.code"><input type="checkbox"
@@ -22,9 +23,9 @@
</template>
<script>
import WmsHelper from '../../helpers/WmsHelper'
import AjaxUtils from '@/utils/AjaxUtils'
import WfsHelper from '../../helpers/WfsHelper'
import LcServiceLayerFilter from '@components/LayerController/modules/LcServiceLayerFilter'
import AjaxUtils from '../../../utils/AjaxUtils'
export default {
  name: 'LcServiceLayer',
@@ -53,8 +54,12 @@
      this.updateWms()
    },
    loadWfs () {
      AjaxUtils.GetDataAsynByUrl('http://xearth.cn:6289/server/ogcserver/PipeLineTest/wfs?version=1.0.0&TYPENAME=pipeline&REQUEST=getfeature&OUTPUTFORMAT=json&maxFeatures=20000', {}, (res) => {
        window.L.geoJSON(res).addTo(window.map)
      var wfsHelper = new WfsHelper()
      wfsHelper.addTypeName('管线点')
      wfsHelper.addEquals('pipename', '研究院01路YS000001')
      AjaxUtils.GetDataAsynByUrl(wfsHelper.getUrl(), {}, (res) => {
        console.log(res)
      })
    },
    swWmsLayer (url, itm) {
@@ -74,7 +79,7 @@
    },
    updateWms () {
      var mapConfig = this.mapConfig
      var wmsHelper = new WmsHelper()
      var wmsHelper = new WfsHelper()
      wmsHelper.initMapConfig(mapConfig)
      var wmsLayersMap = wmsHelper.getWmsLayersMap()
      for (var k in wmsLayersMap) {
src/components/helpers/ServiceLayerHelper.js
@@ -118,7 +118,7 @@
          })
      }
    }).bindPopup(function (layer) {
      that.popupComp.setDatas(layer.feature)
      that.popupComp.setDatas(layer)
      that.popupComp.setShow()
      return that.popupComp.$el
    }, {
src/components/helpers/WfsHelper.js
New file
@@ -0,0 +1,77 @@
/**
 * 加载WMS,拼接FILTER,LAYERS参数等
 */
import MapConfig from '../../conf/MapConfig'
function WfsHelper () {
  this.filters = []
  this.typeNames = []
  this.url = MapConfig.BLUEMAP_HOST + '/server/ogcserver/PipeLine/wfs'
  this.params = {
    REQUEST: 'getfeature',
    OUTPUTFORMAT: 'JSON',
    maxFeatures: 20000,
    version: '1.0.0'
  }
  this.addTypeName = (typeName) => {
    this.typeNames.push(typeName)
  }
  this.addEquals = (property, literal) => {
    var filter = '<PropertyIsEqualTo><PropertyName>' + property + '</PropertyName><Literal>' + literal + '</Literal></PropertyIsEqualTo>'
    this.filters.push(filter)
  }
  this.addLike = (property, literal) => {
    var filter = '<PropertyIsLike><PropertyName>' + property + '</PropertyName><Literal>' + literal + '</Literal></PropertyIsLike>'
    this.filters.push(filter)
  }
  /**
   * 得到filter参数值
   * @returns {string|null}
   */
  this.getFilterParams = () => {
    var head = '<Filter xmlns="http://www.opengis.net/ogc">'
    var end = '</Filter>'
    var filter = ''
    if (this.filters.length > 0) {
      for (var i = 0; i < this.filters.length; i++) {
        filter += this.filters[i]
      }
      // 当条件数 > 1时,需要用and标签包裹
      if (this.filters.length > 1) {
        return ('FILTER=' + head + '<And>' + filter + '</And>' + end)
      }
      return ('FILTER=' + head + filter + end)
    }
    return null
  }
  this.getUrlParams = () => {
    var params = ''
    for (var p in this.params) {
      params += (p + '=' + this.params[p] + '&')
    }
    // 拼接typename参数
    params += 'typename=' + this.typeNames.join(',')
    // 拼接filter参数
    var filterParam = this.getFilterParams()
    if (filterParam) {
      params += '&' + filterParam
    }
    return encodeURI(params)
  }
  this.getUrl = () => {
    var url = this.url
    if (url.indexOf('?') > 0) {
      url += '&'
    } else {
      url += '?'
    }
    return url + this.getUrlParams()
  }
}
export default WfsHelper
src/components/helpers/WmsHelper.js
File was deleted
src/conf/Constants.js
@@ -27,5 +27,9 @@
  embeddingmode: '埋设方式',
  pipetrenchtype: '管沟类型',
  datecollected: '探测时间',
  operationalstatus: '运行状态'
  operationalstatus: '运行状态',
  acquisitionpeople: '采集人',
  acquisitiondate: '采集日期',
  fourtype: '四通类型',
  fourm: '四通材料'
}
src/conf/MapConfig.js
@@ -7,8 +7,8 @@
const HOST_URL = curWwwPath.substring(0, pos)
// service主机配置
const APP_GIS_HOST = 'http://xearth.cn:6299'
// const APP_GIS_HOST_PIPELINE = 'http://xearth.cn:6289'
// const APP_GIS_HOST = 'http://xearth.cn:6299'
const APP_GIS_HOST = 'http://xearth.cn:6289'
// 自定义主机配置
const BLUEMAP_HOST = APP_GIS_HOST // 公司发布的地图服务,用于测试的地址
src/views/popup/Popup.vue
@@ -1,6 +1,6 @@
<template>
  <div id="popup" v-if="isShow" class="s-map-popup-panel">
    <el-tabs v-model="tabsValue" type="card" @edit="handleTabsEdit">
    <el-tabs v-model="tabsValue" type="card">
      <el-tab-pane
              :key="item.name"
              v-for="(item) in tabs"
@@ -8,8 +8,8 @@
              :name="item.name"
      >
        <el-row v-for="(v,k) in filter" :key="k">
          <el-col :span="12">{{k}}</el-col>
          <el-col :span="12">{{v}}</el-col>
          <el-col :span="10"><B>{{k}}:</B></el-col>
          <el-col :span="14">{{v}}</el-col>
        </el-row>
      </el-tab-pane>
    </el-tabs>
@@ -25,10 +25,7 @@
  data () {
    return {
      tabsValue: '1',
      tabs: [{
        title: '污雨水',
        name: '1'
      }],
      tabs: [],
      tabIndex: 2,
      isShow: false,
      properties: {},
@@ -75,8 +72,12 @@
        this.editableTabs = tabs.filter(tab => tab.name !== targetName)
      }
    },
    setDatas (feature) {
      this.properties = feature.properties
    setDatas (layer) {
      this.tabs = [{
        title: layer.feature.id,
        name: '1'
      }]
      this.properties = layer.feature.properties
    },
    setShow () {
      // this.style.display='auto'