派生自 wuyushui/SewerAndRainNetwork

陈泽平
2021-05-21 c60e56e2b6ceb633c6b10f5dc52e3da88129ad70
src/components/panel/topicSearch/SewersSelect/AnalysisChoose/CrossSectional.vue
@@ -78,6 +78,17 @@
    })
  },
  methods: {
    // 横断面清除
    jdmClear () {
      this.hdmParam = null
      this.tableData = []
      this.option = []
      this.myChartShow = false
      this.myChart.clear()
      if (this.measure != null) {
        this.measure.destory()
      }
    },
    // 横断面 线段绘制
    drawLine () {
      if (this.measure === null) {
@@ -105,8 +116,8 @@
      }
      // 已绘制线图 进行绘制横断面数据分析
      const res = await mapApi.getCrossSection(this.hdmParam)
      // 调用数据处理方法
      this.dealWithData(res)
      // // 调用数据处理方法
      // this.dealWithData(res)
      // table数据处理
      const dataPoint = res.data.point
      // 存储间距list
@@ -117,29 +128,33 @@
          x: parseFloat(dataPoint[i].crossPoint3D.x).toFixed(8),
          y: parseFloat(dataPoint[i].crossPoint3D.y).toFixed(8),
          z: parseFloat(dataPoint[i].crossPoint3D.z).toFixed(2),
          spacing: spacingList[i - 1]
          spacing: spacingList[i - 1],
          startpointz: dataPoint[i].pipelines.extraData.startpointz,
          diameter: dataPoint[i].pipelines.extraData.diameter
        }
        this.tableData.push(obj)
      }
      // 调用数据处理方法
      this.dealWithData(this.tableData)
    },
    // 对获取到的数据进行处理
    dealWithData (e) {
      console.log(e)
      const dataPoint = e.data.point
      const spacingList = e.data.pointInterval.reverse()
      const dataList = []
      for (let i = 0; i < dataPoint.length; i++) {
        const obj = {
          mediumtype: dataPoint[i].pipelines.extraData.mediumtype,
          startpointz: dataPoint[i].pipelines.extraData.startpointz,
          diameter: dataPoint[i].pipelines.extraData.diameter,
          spacing: spacingList[i - 1],
          x: parseFloat(dataPoint[i].crossPoint3D.x).toFixed(8),
          y: parseFloat(dataPoint[i].crossPoint3D.y).toFixed(8),
          z: parseFloat(dataPoint[i].crossPoint3D.z).toFixed(2)
        }
        dataList.push(obj)
      }
    dealWithData (dataList) {
      console.log(dataList)
      // const dataPoint = e.data.point
      // const spacingList = e.data.pointInterval.reverse()
      // const dataList = []
      // for (let i = 0; i < dataPoint.length; i++) {
      //   const obj = {
      //     mediumtype: dataPoint[i].pipelines.extraData.mediumtype,
      //     startpointz: dataPoint[i].pipelines.extraData.startpointz,
      //     diameter: dataPoint[i].pipelines.extraData.diameter,
      //     spacing: spacingList[i - 1],
      //     x: parseFloat(dataPoint[i].crossPoint3D.x).toFixed(8),
      //     y: parseFloat(dataPoint[i].crossPoint3D.y).toFixed(8),
      //     z: parseFloat(dataPoint[i].crossPoint3D.z).toFixed(2)
      //   }
      //   dataList.push(obj)
      // }
      // 横向坐标数据
      const xAxisData = []
      const dataObj = []
@@ -175,16 +190,29 @@
            },
            show: true
          },
          axisLine: {
            lineStyle: {
              color: '#fff',
              width: 2
            }
          },
          // data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
          data: xAxisData,
          axisLabel: {
            interval: 0,
            textStyle: {
              color: '#fff'
            }
            },
            margin: 20
          }
        },
        yAxis: {
          axisLine: {
            lineStyle: {
              color: '#fff',
              width: 2
            }
          },
          axisPointer: {
            snap: true
          },
@@ -209,17 +237,6 @@
      this.myChartShow = true
      this.myChart.clear()
      this.myChart.setOption(option)
    },
    // 横断面清除
    jdmClear () {
      this.hdmParam = null
      this.tableData = []
      this.option = []
      this.myChartShow = false
      this.myChart.clear()
      if (this.measure != null) {
        this.measure.destory()
      }
    }
  }
}