<template>
  <div>
    <titlesection title="PDA"></titlesection>
    <totalsection :totalNum="totalVal"></totalsection>
    <bar-chart :chart-data="barChartData" class="flexfm"/>
  </div>
</template>

<script>
import titlesection from '../components/titlesection'
import totalsection from '../components/total'
import barChart from '../components/barChart'
import { deviceAddress } from '../api/api'

export default {
  name: 'pdasection',
  components: {
    titlesection,
    totalsection,
    barChart
  },
  data() {
    return {
      totalVal: '',
      barChartData: {
        // yData: [100,200,300],
        // xData: ['正常', '异常', '故障']
      }
    }
  },
  created() {
    this.getList()
  },
  methods: {
    getList() {
      deviceAddress({
        orgIds: this.GLOBAL.paramsvariables
      }).then((response)=>{
        const data = response.data.data
        this.totalVal = data[0].num.toString()
        let Xdata = data[0].xData.split(',')
        let Ydata = data[0].yData.split(',')
        this.barChartData = {
          yData: Ydata,
          xData: Xdata
        }
      })
    },
  }
}
</script>

<style scoped>

</style>
