派生自 wuyushui/SewerAndRainNetwork

陈泽平
2021-05-29 b5e596e670ecb194157436b61e1ffd635e1130f7
src/components/base-page/enterprise-emergency/events-reported/ReportLocationSection.vue
@@ -261,73 +261,73 @@
      // this.tableList = []
      // 点击获取数据
      window.map.on('click', (e) => {
        // window.mapManager.clickDialogSwitch = false
        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)
          // 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)
          //   }
          // }
          const size = window.map.getSize()
          var point = window.map.latLngToContainerPoint(e.latlng, window.map.getZoom())
          const wmsParams = Object.assign({
            LAYERS: 'sewer:pipeline',
            QUERY_LAYERS: 'sewer:pipeline',
            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)
        })
        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 = []
      this.tableListSection = []
      this.tableDataAffFac = []
      this.form.pipeName = ''
      this.form.sectionName = ''
      this.form.affiliatedFacilities = ''
      this.tableList = []
      this.tableListSection = []
      this.tableDataAffFac = []
    },
    // 点击定位 擦寻管段
    sectionData (e) {
@@ -369,6 +369,7 @@
        QUERY_LAYERS: 'sewer:view_pipeline',
        // LAYERS: 'pipeline_fs',
        // QUERY_LAYERS: 'pipeline_fs',
        cql_filter: 'pipecode <> \'\'',
        WIDTH: size.x,
        HEIGHT: size.y,
        X: Math.round(point.x),