<template>
  <div>
    <titlesection title="今日车流量"></titlesection>
    <div style="padding: 10px 10px;width: 100%;height: calc(100% - 30px)">
      <lineChart :chart-data="lineChartData" class=" inout-wrap" >
      </lineChart>
    </div>
  </div>
</template>

<script>
import titlesection from '../components/titlesection'
import lineChart from '../components/lineChart'
import { dayAddress } from '../api/api'

export default {
  name: 'vehiclesection',
  components: {
    titlesection,
    lineChart
  },
  data() {
    return {
      lineChartData: {},
      dzNum: '23454',
      ydpNum: '4454'
    }
  },
  created() {
    this.getList()
  },
  methods: {
    getList() {
      dayAddress({
        orgIds: this.GLOBAL.paramsvariables
      }).then((response)=>{
        const data = response.data.data
        let xData = [], indata = [], outdata = []
        for (let i=0;i<data.length;i++){
          xData.push(data[i].queryDate)
          indata.push(data[i].inNum)
          outdata.push(data[i].outNum)
        }
        this.lineChartData = {
          xData: xData,
          yData: {
            indata:indata,
            outdata:outdata,
          },
          legendData: ['出场','进场']
        }
      })
    },
  }
}
</script>

<style lang="scss"  scoped>
  .inout-wrap{
    padding: 10px 10px;
    box-sizing: border-box;
    background: url(../assets/img/border.svg) no-repeat;
    background-size: 100% 100%;
    width: 100%;
    height: 100%;
  }
</style>
