派生自 wuyushui/SewerAndRainNetwork

徐旺旺
2021-04-14 90bd1d10df12f458eb2e64e8de2b225f45d02153
管网、环保设施、附属设施搜索定位
1个文件已添加
6个文件已修改
114 ■■■■ 已修改文件
src/components/LayerController/logic/PipeLineAnimal.js 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/LayerController/service/BusiLayerService.js 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/LayerController/service/LayerFactory.js 52 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/helpers/WfsHelper.js 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/panel/topicSearch/SewersSearch.vue 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/conf/Constants.js 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/conf/layers/LayerFsss.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/LayerController/logic/PipeLineAnimal.js
New file
@@ -0,0 +1,28 @@
/**
 *  管线动画控制逻辑
 */
const layerPipeLines = require('../../../conf/layers/LayerPipeLines').LayerPipeLines
module.exports = function () {
  this.init = (layer, L) => {
    console.log('sssssss')
    const layers = layerPipeLines.layers
    for (var i = 0; i < layers.length; i++) {
      const config = layers[i]
      const code = config.code
      const layer = window.layerFactory.layers[code]
      layer.setStyle({
        FILL: true,
        WEIGHT: 3,
        FILL_COLOR: '#73b2ff',
        COLOR: '#73b2ff',
        FILL_OPACITY: 0.2,
        OPACITY: 1,
        DASH_ARRAY: '4,4',
        DASH_SPPED: -5,
        ICON_SIZE: [10, 10]
      })
      console.log(layer)
    }
  }
}
src/components/LayerController/service/BusiLayerService.js
@@ -13,9 +13,10 @@
  init (layer) {
    // 引入 关联的js,在constant.js中根据config配置的id得到处理js
    const id = this.config.code
    console.log(id)
    const file = logicMapper[id]
    if (!file) {
      console.log('找不到逻辑处理js!!!')
      console.log('找不到逻辑处理js!!!' + id)
    } else {
      var BusiLayer = require('../logic/' + file)
      var busiLayer = new BusiLayer()
src/components/LayerController/service/LayerFactory.js
@@ -21,7 +21,7 @@
        var checked = config.checked
        checked && this.load(config)
        checked && this.toggleZoomByConfnig(config)
        checked && this.toggleZoomByConfig(config)
      }
    }
  }
@@ -43,14 +43,14 @@
        var childLayer = config.childLayer
        layers && this.toggleZoomByLayer(layers)
        childLayer && this.toggleZoomByLayer(childLayer)
        this.toggleZoomByConfnig(config)
        this.toggleZoomByConfig(config)
      }
    } else {
      this.toggleZoomByConfnig(layerConfig)
      this.toggleZoomByConfig(layerConfig)
    }
  }
  toggleZoomByConfnig (config) {
  toggleZoomByConfig (config) {
    const zoom = this.map.getZoom()
    var checked = config.checked
    if (checked && config.minZoom) {
@@ -112,25 +112,57 @@
  }
  flyByLayerId (layerId, bound) {
    for (var k in this.layers) {
  flyByLayerId (code, id) {
    const layer = this.layers[code]
    if (layer.eachLayer) {
      layer.eachLayer(function (layer) {
        const layers = layer.getLayers()
        for (var i = 0; i < layers.length; i++) {
          const lay = layers[i]
          const feature = lay.feature
          lay.closePopup()
          if (feature.id === id) {
            lay.openPopup()
            break
          }
        }
      })
    }
    /* for (var k in this.layers) {
      var layerGroup = this.layers[k]
      layerGroup.eachLayer(function (layer) {
        console.log(layer)
        console.log(layer.getAttribution())
      })
      var layers = layerGroup.getLayers()
      if (layers) {
        for (var m = 0; m < layers.length; m++) {
          var layer = layers[m]
          console.log(layer.toGeoJSON())
          /* var feature = layer.feature
          console.log(layer)
          console.log(layer.getLayerId(val.id))
          /!* var feature = layer.feature
          if (feature.id === layerId) {
            this.map.flyToBounds(bound)
            return layer
          } */
          } *!/
        }
      }
    }
    } */
    return null
  }
  findLayerById (layer, id) {
    const layers = layer.getLayers
    if (layers) {
      this.findLayerById(layer.getLayers(), id)
    } else {
      layer.eachLayer(function (layer) {
        console.log(layer)
      })
    }
  }
  /**
   * todo 这里无效,貌似是因为geojson加载到地图也是个layergroup
   *
src/components/helpers/WfsHelper.js
@@ -1,11 +1,11 @@
/**
 * 加载WMS,拼接FILTER,LAYERS参数等
 */
import MapConfig from '../../conf/MapConfig'
import { PIPELINE_WFS } from '../../conf/Constants'
function WfsHelper () {
  this.filters = []
  this.typeNames = []
  this.url = MapConfig.PIPELINE_WFS
  this.url = PIPELINE_WFS
  this.params = {
    REQUEST: 'getfeature',
    OUTPUTFORMAT: 'JSON',
@@ -23,8 +23,10 @@
  }
  this.addLike = (property, literal) => {
    var filter = '<PropertyIsLike><PropertyName>' + property + '</PropertyName><Literal>*' + literal + '*</Literal></PropertyIsLike>'
    this.filters.push(filter)
    if (property && literal) {
      var filter = '<PropertyIsLike><PropertyName>' + property + '</PropertyName><Literal>*' + literal + '*</Literal></PropertyIsLike>'
      this.filters.push(filter)
    }
  }
  /**
src/components/panel/topicSearch/SewersSearch.vue
@@ -17,13 +17,13 @@
              </el-select>
            </el-form-item>
            <el-form-item :label="form.pipelineType+':'" size="mini">
              <el-select style="width: 100%" v-model="form.dataType" :popper-class="'select-down'">
              <el-select style="width: 100%" v-model="form.dataType" value-key="code" :popper-class="'select-down'">
                <!--  @change="handleDataType"-->
                <el-option
                    v-for="item in subItems"
                    :key="item.code"
                    :label="item.name"
                    :value="item.name">
                    :value="item">
                </el-option>
              </el-select>
            </el-form-item>
@@ -37,13 +37,12 @@
        <el-scrollbar style="height:380.44px;">
          <div class="environmental-risk-list" v-for="(item,index) in list" :key="index">
            <div @click="handleLocation(item)">
              <h3 class="B-TMD-table-list-title-y"
                  :class="['B-TMD-table-list-title-y-nam', { 'warning': item.vehicleStatus==='910003' }, { 'offline': item.vehicleStatus==='910001' }]">
              <h3 class="B-TMD-table-list-title-y">
                {{ item.properties.pipename }}</h3>
              <p v-for="itm in labelList" :key="itm.label">
              <!--<p v-for="itm in labelList" :key="itm.label">
                <span>{{ itm.label }}:</span>
                <span :title="item.properties[itm.key] ">{{ item.properties[itm.key] }}</span>
              </p>
              </p>-->
            </div>
          </div>
        </el-scrollbar>
@@ -126,7 +125,7 @@
    async handleSearch () {
      var wfsHelper = new WfsHelper()
      // todo 现在管网还没区分开类型,后面改
      wfsHelper.addTypeName('管网')
      wfsHelper.addTypeName(this.form.dataType.name)
      wfsHelper.addLike('name', this.form.keyword)
      // const _this = this
      const res = await AjaxUtils.GetDataAsynByUrl(wfsHelper.getUrl(), {})
@@ -136,10 +135,9 @@
      }
    },
    handleLocation (val) {
      console.log(val)
      const bound = this.L.geoJSON([val], {}).getBounds()
      // var layer = window.layerFactory.flyByLayerId(val.id, bound)
      window.map.flyToBounds(bound)
      window.layerFactory.flyByLayerId(this.form.dataType.code, val.id)
      // layer && layer.openPopup()
    }
  }
src/conf/Constants.js
@@ -10,7 +10,8 @@
  wasteGasPfk: 'WasteGas.js',
  wasteWaterPfk: 'WasteWater.js',
  wasteSolidCcd: 'SolidWaste.js',
  sewersAreaGs: 'Company.js'
  sewersAreaGs: 'Company.js',
  pipesegment: 'PipeLineAnimal.js'
}
export const STYLES = {
src/conf/layers/LayerFsss.js
@@ -54,7 +54,7 @@
      code: 'pipesegment',
      name: '流向',
      sname: 'ywslx',
      wfs: WFS_URL + '?TYPENAME=流向',
      url: 'pipesegment',
      checked: false
    },
    {