派生自 wuyushui/SewerAndRainNetwork

陈泽平
2021-05-29 8eebe7cdf3865d37e8d21b5078c9721207a38b6d
src/components/base-page/enterprise-emergency/events-reported/ReportLocationSection.vue
@@ -118,7 +118,7 @@
                            show-overflow-tooltip
                            width="150"
                            prop="properties.pipecode"
                            label="编号">
                            label="管线编号">
                    </el-table-column>
                    <el-table-column
                            show-overflow-tooltip
@@ -130,7 +130,7 @@
                            width="150"
                            show-overflow-tooltip
                            prop="properties.type"
                            label="类型">
                            label="设施类型">
                    </el-table-column>
                    <el-table-column width="90" fixed="right" label="操作">
                        <template slot-scope="scope">
@@ -176,6 +176,30 @@
    this.wfsHelper = new WfsHelper()
  },
  methods: {
    // 管线搜索
    async pipelineSearch () {
      this.SectionAndAffFacTableJudge = true
      this.tableList = []
      this.tableListSection = []
      this.tableDataAffFac = []
      this.wfsHelper.clearFilter()
      this.wfsHelper.setTypeName(['sewer:pipeline'])
      if (this.form.pipeName) {
        this.wfsHelper.addLike('subchaname', this.form.pipeName)
      }
      // this.wfsHelper.addEquals('pipename', '\'' + this.form.pipeName + '\'')
      const res = await AjaxUtils.GetDataAsynByUrl(this.wfsHelper.getUrl(), {})
      // console.log(res)
      if (res instanceof Object && Object.prototype.hasOwnProperty.call(res, 'features')) {
        this.total = res.totalFeatures
        // console.log(res.features)
        this.tableList = res.features
      }
      this.wfsHelper = new WfsHelper()
      this.form.pipeName = ''
      this.form.sectionName = ''
      this.form.affiliatedFacilities = ''
    },
    // 点击管线列表 展示管段内容 和附属设施内容
    async sectionShowClick (val) {
      console.log(val)
@@ -205,6 +229,10 @@
        const resAffFac = await AjaxUtils.GetDataAsynByUrl(this.wfsHelper.getUrl(), {})
        console.log(resAffFac)
        if (resAffFac instanceof Object && Object.prototype.hasOwnProperty.call(resAffFac, 'features')) {
          // for (let i = 0; i < resAffFac.features.length; i++) {
          //   // console.log(resAffFac.features[i])
          //   this.tableDataAffFac.push(resAffFac.features[i].properties)
          // }
          this.tableDataAffFac = resAffFac.features
        }
        this.wfsHelper = new WfsHelper()
@@ -230,54 +258,68 @@
    pipeClickLocation () {
      // 设施不进行 管线表格数据的点击交互
      this.SectionAndAffFacTableJudge = false
      window.mapManager.clickDialogSwitch = false
      // this.tableList = []
      // 点击获取数据
      window.map.on('click', (e) => {
        // window.mapManager.loadWfsDatas(e.latlng).then((res) => {
        //   console.log(res)
        //   for (let i = 0; i < res.features.length; i++) {
        //     this.tableList.push(res.features[i])
        //     this.tableListSection.push(res.features[i])
        //     this.tableDataAffFac.push(res.features[i])
        //   }
        // })
        // return new Promise((resolve, reject) => {
        const size = window.map.getSize()
        var point = window.map.latLngToContainerPoint(e.latlng, window.map.getZoom())
        const wmsParams = Object.assign({
          LAYERS: 'pipeline_group',
          QUERY_LAYERS: 'pipeline_group',
          WIDTH: size.x,
          HEIGHT: size.y,
          X: Math.round(point.x),
          Y: Math.round(point.y),
          BBOX: window.map.getBounds().toBBoxString()
        }, {
          VERSION: '1.1.1',
          SERVICE: 'WMS',
          REQUEST: 'GetFeatureInfo',
          // bbox: bbox,
          FORMAT: 'image/png',
          INFO_FORMAT: 'application/json',
          TRANSPARENT: true,
          FEATURE_COUNT: 50,
          SRS: 'EPSG:4326',
          EXCEPTIONS: 'application/vnd.ogc.se_inimage'
        })
        AjaxUtils.get4JsonDataByUrl(WMS_URL, wmsParams, (res) => {
          // console.log(res)
          for (let i = 0; i < res.data.features.length; i++) {
            // console.log(res.data.features[i])
            this.tableList.push(res.data.features[i])
        // window.mapManager.clickDialogSwitch = false
        window.mapManager.loadWfsDatas(e.latlng).then((res) => {
          for (let i = 0; i < res.features.length; i++) {
            console.log(res.features[i])
            const ids = res.features[i].id.split('.')
            // console.log(ids[0])
            if (ids[0] === 'pipeline') {
              this.tableList.push(res.features[i])
            } else if (ids[0] === 'pipesegment') {
              this.tableListSection.push(res.features[i])
            } else {
              this.tableDataAffFac.push(res.features[i])
              // const obj = {
              //   properties: {
              //     pipecode: res.features[i].properties.code,
              //     name: res.features[i].properties.companyname,
              //     type: res.features[i].properties.mediumtype
              //   }
              // }
              // console.log(obj)
              // this.tableDataAffFac.push(obj)
              // console.log(this.tableDataAffFac)
            }
          }
        })
        // 管段
        this.sectionData(e)
        // 附属设施
        this.affFacData(e)
        // })
        window.map.off('click')
        // const size = window.map.getSize()
        // var point = window.map.latLngToContainerPoint(e.latlng, window.map.getZoom())
        // const wmsParams = Object.assign({
        //   LAYERS: 'pipeline_group',
        //   QUERY_LAYERS: 'pipeline_group',
        //   WIDTH: size.x,
        //   HEIGHT: size.y,
        //   X: Math.round(point.x),
        //   Y: Math.round(point.y),
        //   BBOX: window.map.getBounds().toBBoxString()
        // }, {
        //   VERSION: '1.1.1',
        //   SERVICE: 'WMS',
        //   REQUEST: 'GetFeatureInfo',
        //   // bbox: bbox,
        //   FORMAT: 'image/png',
        //   INFO_FORMAT: 'application/json',
        //   TRANSPARENT: true,
        //   FEATURE_COUNT: 50,
        //   SRS: 'EPSG:4326',
        //   EXCEPTIONS: 'application/vnd.ogc.se_inimage'
        // })
        // AjaxUtils.get4JsonDataByUrl(WMS_URL, wmsParams, (res) => {
        //   // console.log(res)
        //   for (let i = 0; i < res.data.features.length; i++) {
        //     // console.log(res.data.features[i])
        //     this.tableList.push(res.data.features[i])
        //   }
        // })
        // // 管段
        // this.sectionData(e)
        // // 附属设施
        // this.affFacData(e)
      })
      // 数据 重新获取 进行置空
      this.tableList = []
@@ -318,15 +360,15 @@
        }
      })
    },
    // 附属设施
    // 点击定位 擦寻附属设施
    affFacData (e) {
      const size = window.map.getSize()
      var point = window.map.latLngToContainerPoint(e.latlng, window.map.getZoom())
      const wmsParams = Object.assign({
        LAYERS: 'sewer:view_pipeline',
        QUERY_LAYERS: 'sewer:view_pipeline',
        // LAYERS: 'sewer:pipeline_fs',
        // QUERY_LAYERS: 'sewer:pipeline_fs',
        // LAYERS: 'pipeline_fs',
        // QUERY_LAYERS: 'pipeline_fs',
        WIDTH: size.x,
        HEIGHT: size.y,
        X: Math.round(point.x),
@@ -350,30 +392,6 @@
          this.tableDataAffFac.push(res.data.features[i])
        }
      })
    },
    // 管线搜索
    async pipelineSearch () {
      this.SectionAndAffFacTableJudge = true
      this.tableList = []
      this.tableListSection = []
      this.tableDataAffFac = []
      this.wfsHelper.clearFilter()
      this.wfsHelper.setTypeName(['sewer:pipeline'])
      if (this.form.pipeName) {
        this.wfsHelper.addLike('subchaname', this.form.pipeName)
      }
      // this.wfsHelper.addEquals('pipename', '\'' + this.form.pipeName + '\'')
      const res = await AjaxUtils.GetDataAsynByUrl(this.wfsHelper.getUrl(), {})
      // console.log(res)
      if (res instanceof Object && Object.prototype.hasOwnProperty.call(res, 'features')) {
        this.total = res.totalFeatures
        // console.log(res.features)
        this.tableList = res.features
      }
      this.wfsHelper = new WfsHelper()
      this.form.pipeName = ''
      this.form.sectionName = ''
      this.form.affiliatedFacilities = ''
    },
    // 点击确认
    confirm () {