派生自 wuyushui/SewerAndRainNetwork

seatonwan9
2021-05-21 4d265afb3419bd5cedc6f31ab78d570f6917b520
src/components/panel/topicSearch/SewersSelect/AnalysisChoose/PublicWay.js
@@ -1,427 +1,16 @@
// export default {
//   handleClick (tab, event) {
//     console.log(tab, event)
//     this.clearLinkPipe()
//     this.clearLX()
//     this.linkClear()
//     this.jdmClear()
//     this.bgFm = []
//     this.bgPipeLine = []
//     this.tableData = []
//     this.tableDataLiuxiang = []
//     this.tableDataLinkStart = []
//     this.tableDataLinkEnd = []
//     this.tableDataLinkResult = []
//   },
//   linkClickStart () {
//     console.log('地图点击起始管段')
//     this.linkType = 1
//     this.selectPipeLine()
//   },
//   linkClickEnd () {
//     console.log('地图点击结束管段')
//     this.linkType = 0
//     this.selectPipeLine()
//   },
//   linkSelectStart (e) {
//     console.log('选择起始管段')
//     console.log(e)
//     this.$refs.singleTable.setCurrentRow(e)
//     this.currentSelectStart = e
//     if (this.currentSelectStartLine != null) {
//       this.currentSelectStartLine.remove()
//       this.currentSelectStartLine = null
//     }
//     const geom = JSON.parse(e.geomText)
//     this.currentSelectStartLine = L.geoJSON(geom, {
//       style: function (feature) {
//         return { color: 'rgba(0,255,0,.6)' }
//       }
//     }).addTo(this.map)
//     this.map.panInsideBounds(this.currentSelectStartLine.getBounds())
//   },
//   linkSelectEnd (e) {
//     console.log('选择结束管段')
//     console.log(e)
//     this.currentSelectEnd = e
//
//     if (this.currentSelectEndLine != null) {
//       this.currentSelectEndLine.remove()
//       this.currentSelectEndLine = null
//     }
//
//     const geom = JSON.parse(e.geomText)
//     this.currentSelectEndLine = L.geoJSON(geom, {
//       style: function (feature) {
//         return { color: 'rgba(200,0,200,.6)' }
//       }
//     }).addTo(this.map)
//     this.map.panInsideBounds(this.currentSelectEndLine.getBounds())
//   },
//   linkResultSelect (e) {
//     console.log('连通性分析结果列表点击')
//     console.log(e)
//
//     const geom = JSON.parse(e.geomText)
//     if (this.currentSelectResultLine != null) {
//       this.currentSelectResultLine.remove()
//       this.currentSelectResultLine = null
//     }
//     this.currentSelectResultLine = L.geoJSON(geom, {
//       style: function (feature) {
//         return {
//           color: 'rgba(255,0,0,.6)',
//           weight: 6
//         }
//       }
//     }).addTo(this.map)
//     this.map.panInsideBounds(this.currentSelectResultLine.getBounds())
//   },
//   // 连通性查询
//   async linkQuery () {
//     this.tableDataLinkResult = []
//     if (this.linkPipeline.length > 1) {
//       this.linkPipeline.forEach((itm) => {
//         itm.remove()
//       })
//       this.linkPipeline = []
//     }
//     if (this.currentSelectStart === null || this.currentSelectEnd === null) {
//       this.$message('请选择起始管段和结束管段')
//       return
//     }
//     const param = {
//       startLineID: this.currentSelectStart.id,
//       endLineID: this.currentSelectEnd.id
//     }
//
//     const res = await api.findConnectedPipelines(param)
//
//     if (res.data.length === 0) {
//       this.$message('没有找到连通的管段')
//       this.currentLinkIsTrue = '不连通'
//       return
//     }
//     this.tableDataLinkResult = res.data
//     this.currentLinkIsTrue = '连通'
//     const linkPipe = []
//     res.data.forEach((itm, idx) => {
//       const geom = JSON.parse(itm.geomText)
//       const points = []
//       geom.coordinates.forEach((it, id) => {
//         points.push(it.reverse())
//       })
//
//       linkPipe.push(points)
//     })
//
//     linkPipe.forEach((itm, idx) => {
//       const param1 = {
//         points: itm,
//         option: {
//           dashArray: '15 15',
//           dashSpeed: -30,
//           color: '#ffff00'
//         }
//       }
//       const line = main.createFlowLine(param1)
//       this.linkPipeline.push(line)
//     })
//   },
//
//   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
//     }
//     if (this.bgMarker != null) {
//       this.bgMarker.remove()
//       this.bgMarker = null
//     }
//   },
//   lxResultSelect () {
//     console.log('连通性分析结果列表点击')
//     console.log(e)
//
//     const geom = JSON.parse(e.geomText)
//     if (this.currentSelectResultLine != null) {
//       this.currentSelectResultLine.remove()
//       this.currentSelectResultLine = null
//     }
//     this.currentSelectResultLine = L.geoJSON(geom, {
//       style: function (feature) {
//         return { color: 'rgba(0,250,255,.6)' }
//       }
//     }).addTo(this.map)
//     this.map.panInsideBounds(this.currentSelectResultLine.getBounds())
//   },
//   async lxQuery (e) {
//     this.clearLinkPipe()
//     const param = {
//       lineNodeID: e.startpoint
//     }
//     const res = await api.findFlowDirection(param)
//
//     this.lxTableDataResult = res.data
//     const linkPipe = []
//     res.data.forEach((itm, idx) => {
//       const geom = JSON.parse(itm.geomText)
//       const points = []
//       geom.coordinates.forEach((it, id) => {
//         points.push(it.reverse())
//       })
//
//       linkPipe.push(points)
//     })
//
//     linkPipe.forEach((itm, idx) => {
//       const param1 = {
//         points: itm,
//         option: {
//           dashArray: '15 15',
//           dashSpeed: -30,
//           color: '#ffff00'
//         }
//       }
//       const line = main.createFlowLine(param1)
//       this.linkPipeline.push(line)
//     })
//   },
//
//   bgClick () {
//     this.selectPipeLine()
//   },
//   async bgSelect (e) {
//     console.log('选择爆管管段')
//     console.log(e)
//     this.bgFm = []
//     if (this.bgMarker != null) {
//       this.bgMarker.remove()
//       this.bgMarker = null
//     }
//
//     if (this.currentSelectEndLine != null) {
//       this.currentSelectEndLine.remove()
//       this.currentSelectEndLine = null
//     }
//     this.clearLinkPipe()
//     const geom = JSON.parse(e.geomText)
//     this.currentSelectEndLine = L.geoJSON(geom, {
//       style: function (feature) {
//         return { color: 'rgba(200,0,200,.6)' }
//       }
//     }).addTo(this.map)
//     this.map.panInsideBounds(this.currentSelectEndLine.getBounds())
//
//     const param = {
//       lineID: e.id
//     }
//     const res = await api.findLeakages(param)
//     console.log(res)
//
//     const len = res.data.length
//     if (len === 0) {
//       this.$message('未找到需要关闭的阀门')
//
//       return
//     }
//     res.data.reverse()
//     this.bgFm = res.data
//
//     this.bgPoint = res.data[0].startControlPoint
//
//     const point = JSON.parse(this.bgPoint.geomText)
//
//     const p = [point.coordinates[1], point.coordinates[0]]
//
//     this.bgMarker = main.createFlowMarker(p)
//     this.bgMarker.bindTooltip(this.bgPoint.pointnumbe)
//     this.bgMarker.addTo(this.map)
//     this.map.flyTo(p)
//
//     const linkPipe = []
//     res.data.forEach((itm, idx) => {
//       const geom = JSON.parse(itm.geomText)
//       const points = []
//       geom.coordinates.forEach((it, id) => {
//         points.push(it.reverse())
//       })
//
//       linkPipe.push(points)
//     })
//
//     linkPipe.forEach((itm, idx) => {
//       const param1 = {
//         points: itm,
//         option: {
//           dashArray: '15 15',
//           dashSpeed: -30,
//           color: '#ffff00'
//         }
//       }
//       const line = main.createFlowLine(param1)
//       this.linkPipeline.push(line)
//     })
//   },
//   bgFmClick (e) {
//     console.log('点击影响的阀门')
//     console.log(e)
//     const point = [e.data[0][0], e.data[0][1]]
//     const marker = main.createFlowMarker(point)
//     marker.addTo(this.map)
//     this.map.flyTo(point, 16)
//   },
//   // 流向地图上点击
//   selectPipeLine () {
//     this.map.on('click', this.selectClick)
//   },
//   // 地图上点击回调
//   selectClick (e) {
//     this.map.off('click', this.selectClick)
//     const point = [e.latlng.lng, e.latlng.lat]
//     console.log(point)
//     this.getPipeLine(point)
//   },
//
//   // 流向数据请求
//   async getPipeLine (point) {
//     const param = {
//       x: point[0],
//       y: point[1],
//       radius: 3
//     }
//
//     const res = await api.getPipeline(param)
//     // 3 流向
//
//     if (this.activeName === 'first') {
//       if (this.linkType) {
//         this.tableDataLinkStart = res.data
//       } else {
//         this.tableDataLinkEnd = res.data
//       }
//     } else if (this.activeName === 'second') {
//       this.bgPipeLine = res.data
//     } else if (this.activeName === 'third') {
//       this.tableDataLiuxiang = res.data
//     } else if (this.activeName === 'fourth') {
//
//     }
//
//     console.log(res)
//   },
//   // 流向-管线选择
//   selectRowLiuXiang (e) {
//     // 选择要显示的流向线
//     console.log('选择要显示的流向线')
//     console.log(e)
//   },
//   lxHandleClick (e) {
//     console.log('正流向显示')
//     console.log(e)
//
//     this.clearLX()
//     const param = {
//       points: e.data,
//       option: {
//         dashArray: '15 15',
//         dashSpeed: -30
//       }
//     }
//     this.flowPipeLine = main.createFlowLine(param)
//   },
//   clearLinkPipe () {
//     if (this.linkPipeline.length > 0) {
//       this.linkPipeline.forEach((itm, idx) => {
//         itm.remove()
//       })
//     }
//     this.linkPipeline = []
//   },
//   clearLX () {
//     if (this.flowPipeLine != null) {
//       this.flowPipeLine.remove()
//       this.flowPipeLine = null
//     }
//   },
//   lxHandleClick2 (e) {
//     console.log('逆流向显示')
//     console.log(e)
//     if (this.flowPipeLine != null) {
//       this.flowPipeLine.remove()
//       this.flowPipeLine = null
//     }
//     const param = {
//       points: e.data,
//       option: {
//         dashArray: '15 15',
//         dashSpeed: 30
//       }
//     }
//     this.flowPipeLine = main.createFlowLine(param)
//   },
//   // 横断面数据请求
//   async getHdmPoint (line) {
//     console.log('横断面的绘制线')
//     console.table(line)
//     this.hdmParam = {
//       x1: line[0].lng,
//       y1: line[0].lat,
//       x2: line[1].lng,
//       y2: line[1].lat
//     }
//   },
//   // 横断面选择后 图表展示
//   async selectRow (e) {
//     console.log(e)
//     // 3. 使用刚指定的配置项和数据,显示图表
//
//     const option = {
//       xAxis: {
//         type: 'category',
//         data: ['井1', '井2', '井3', '井4', '井5', '井6', '井7']
//       },
//       yAxis: {
//         type: 'value'
//       },
//       series: [{
//         data: [820, 932, 901, 934, 1290, 1330, 1320],
//         type: 'line'
//       }]
//     }
//
//     this.myChartShow = true
//     this.myChart.setOption(option)
//   },
//   drawLine () {
//     console.log('drawLine')
//     if (this.measure === null) {
//       this.measure = new DrawLine(this.map)
//     }
//     this.measure.destory()
//     this.measure.init()
//   },
//   async jdmQuery () {
//     if (this.hdmParam == null) {
//       this.$message('请先在地图上绘制截断线')
//       return
//     }
//     const res = await api.getCrossSection(this.hdmParam)
//     console.log(res)
//     // debugger
//   },
//   jdmClear () {
//     this.hdmParam = null
//     if (this.measure != null) {
//       this.measure.destory()
//     }
//   }
// }
export function selectPipeLine () {
  window.map.on('click', this.selectClick)
}
export function createFlowLine (param) {
  const flowLine = window.L.polyline(param.points, param.option)
  flowLine.addTo(window.map)
  return flowLine
}
export function linkClear (linkClear) {
  if (this.linkClear != null) {
    this.linkClear.remove()
    this.linkClear = null
  }
}