派生自 wuyushui/SewerAndRainNetwork

陈泽平
2021-05-21 1f619887452d6c0faaf4c509b9e1725a02db990c
src/components/panel/topicSearch/SewersSelect/AnalysisChoose/Connectivity.vue
@@ -56,10 +56,12 @@
<script>
import mapApi from '../../../../../api/mapApi'
import eventBus from '../../../../../eventBus'
import { createFlowLine } from './PublicWay'
export default {
  name: 'Connectivity',
  props: ['tableData'],
  data () {
    return {
      // 连通性  // 1  连通性起始管段   0 连通性结束管段 用来判断是点击了起始  还是结束管段
@@ -81,15 +83,25 @@
      flowPipeLine: null
    }
  },
  mounted () {
    this.$nextTick(() => {
      eventBus.$on('tabData-change', (obj) => {
        if (obj) {
          this.handleClick()
        }
      })
    })
  },
  methods: {
    // 地图上点击
    selectPipeLine () {
      // window.mapManager.clickDialogSwitch = false
      window.map.on('click', this.selectClick)
      // 关闭弹窗
      window.layerFactory.clickSwitch = false
      // window.mapManager.clickDialogSwitch = true
    },
    // 地图上点击回调
    selectClick (e) {
      // console.log(e)
      window.map.off('click', this.selectClick)
      const point = [e.latlng.lng, e.latlng.lat]
      this.getPipeLine(point)
@@ -103,7 +115,7 @@
      }
      // 根据参数请求接口数据
      const res = await mapApi.findPipelineByClickPoint(param)
      // console.log(res)
      console.log(res)
      if (this.linkType === 1) {
        this.tableDataLinkStart = res.data
      } else {
@@ -112,7 +124,6 @@
    },
    // 连通性 ===> 地图点击起始管段e
    linkClickStart (e) {
      // console.log('地图点击起始管段')
      this.linkType = 1
      this.selectPipeLine()
    },
@@ -203,7 +214,11 @@
        const geom = JSON.parse(itm.geomText)
        const points = []
        geom.coordinates.forEach((it, id) => {
          points.push(it.reverse())
          const item = it.reverse()
          if (it.length > 2) {
            item.shift()
          }
          points.push(item)
        })
        linkPipe.push(points)
      })