派生自 wuyushui/SewerAndRainNetwork

陈泽平
2021-05-24 9706167cee66aa208e538b9d3a5e9ecd88cd7462
src/components/panel/topicSearch/SewersSelect/AnalysisChoose/Connectivity.vue
@@ -15,9 +15,6 @@
                             label="管段名称"></el-table-column>
            <el-table-column sortable width="100" prop="startpointnumber" label="起点编号"></el-table-column>
            <el-table-column sortable width="100" prop="endpointnumber" label="终点编号"></el-table-column>
<!--            <el-table-column v-for="(item, index) in tableDataLinkStartList" :key="index" :prop="item.prop"-->
<!--                             :label="item.label" :show-overflow-tooltip="true" min-width="100" :sortable="item.sortable">-->
<!--            </el-table-column>-->
            <el-table-column width="40" fixed="right" class-name="fixed-table" label="操作">
                <template slot-scope="scope">
                    <el-button @click="linkSelectStart(scope.row)" type="text" size="small">选择</el-button>
@@ -64,34 +61,12 @@
export default {
  name: 'Connectivity',
  props: ['tableData'],
  data () {
    return {
      // 连通性  // 1  连通性起始管段   0 连通性结束管段 用来判断是点击了起始  还是结束管段
      linkType: 1,
      // 连通性 起始管段 表格数据
      tableDataLinkStart: [],
      tableDataLinkStartList: [// table 表格定义的字段
        {
          label: '管段类型',
          prop: 'datasource'
        },
        {
          label: '管段名称',
          prop: 'pipecode',
          sortable: true
        },
        {
          label: '起点编号',
          prop: 'material',
          sortable: true
        },
        {
          label: '终点编号',
          prop: 'material',
          sortable: true
        }
      ],
      // 连通性 结束管段 表格数据
      tableDataLinkEnd: [],
      // 连通性 分析结果 展示 => 连通 || 不连通
@@ -120,17 +95,15 @@
    // 地图上点击
    selectPipeLine () {
      window.map.on('click', this.selectClick)
      // window.mapManager.clickDialogSwitch = false
      window.mapManager.clickDialogSwitch = false
    },
    // 地图上点击回调
    selectClick (e) {
      // console.log(e)
      // window.mapManager.clickDialogSwitch = true
      window.map.off('click', this.selectClick)
      window.mapManager.clickDialogSwitch = false
      const point = [e.latlng.lng, e.latlng.lat]
      this.getPipeLine(point)
      // this.getPipeLine(point, this.linkType)
      // window.mapManager.clickDialogSwitch = true
    },
    // 点击获取判断数据
    async getPipeLine (point) {
@@ -141,12 +114,42 @@
      }
      // 根据参数请求接口数据
      const res = await mapApi.findPipelineByClickPoint(param)
      console.log(res)
      // console.log(res)
      if (this.linkType === 1) {
        this.tableDataLinkStart = res.data
      } else {
        this.tableDataLinkEnd = res.data
      }
    },
    // 连通性的清除功能
    handleClick () {
      // this.linkClear()
      if (this.currentSelectStartLine != null) {
        this.currentSelectStartLine.remove()
        this.currentSelectStartLine = null
      }
      if (this.currentSelectEndLine != null) {
        this.currentSelectEndLine.remove()
        this.currentSelectEndLine = null
      }
      if (this.currentSelectResultLine != null) {
        this.currentSelectResultLine.remove()
        this.currentSelectResultLine = null
      }
      this.currentLinkIsTrue = ''
      this.tableDataLinkStart = []
      this.tableDataLinkEnd = []
      this.tableDataLinkResult = []
      if (this.flowPipeLine != null) {
        this.flowPipeLine.remove()
        this.flowPipeLine = null
      }
      if (this.linkPipeline.length > 0) {
        this.linkPipeline.forEach((itm, idx) => {
          itm.remove()
        })
      }
      this.linkPipeline = []
    },
    // 连通性 ===> 地图点击起始管段e
    linkClickStart (e) {
@@ -279,36 +282,6 @@
        }
      }).addTo(window.map)
      window.map.panInsideBounds(this.currentSelectResultLine.getBounds())
    },
    // 连通性的清除功能
    handleClick () {
      // this.linkClear()
      if (this.currentSelectStartLine != null) {
        this.currentSelectStartLine.remove()
        this.currentSelectStartLine = null
      }
      if (this.currentSelectEndLine != null) {
        this.currentSelectEndLine.remove()
        this.currentSelectEndLine = null
      }
      if (this.currentSelectResultLine != null) {
        this.currentSelectResultLine.remove()
        this.currentSelectResultLine = null
      }
      this.currentLinkIsTrue = ''
      this.tableDataLinkStart = []
      this.tableDataLinkEnd = []
      this.tableDataLinkResult = []
      if (this.flowPipeLine != null) {
        this.flowPipeLine.remove()
        this.flowPipeLine = null
      }
      if (this.linkPipeline.length > 0) {
        this.linkPipeline.forEach((itm, idx) => {
          itm.remove()
        })
      }
      this.linkPipeline = []
    }
  }
}