<template>
  <div>
    <titlesection title="周出场统计"></titlesection>
    <div style="padding: 10px 10px;width: 100%;height: calc(100% - 30px)">
      <arealineChart :chart-data="lineChartData" class=" inout-wrap" >
      </arealineChart>
    </div>

  </div>
</template>

<script>
import titlesection from '../components/titlesection'
import arealineChart from '../components/arealineChart'
import { weekAddress } from '../api/api'
export default {
  name: 'outsection',
  components: {
    titlesection,
    arealineChart
  },
  data() {
    return {
      lineChartData: {},
    }
  },
  created() {
    this.getList()
  },
  methods: {
    getList() {
      weekAddress({
        orgIds: this.GLOBAL.paramsvariables
      }).then((response)=>{
        const data = response.data.data
        let xData = [], indata = [], outdata = [], lastInNum;
        for (let i=0;i<data.length;i++){
          xData.push(data[i].queryDate)
          indata.push(data[i].inNum)
          outdata.push(data[i].outNum)
          lastInNum = data[data.length-1].inNum
        }
        this.$store.dispatch('transferOrderTotal',lastInNum)
        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>
