<template>
  <div>
    <titlesection title="周出场统计"></titlesection>
    <lineChart :chart-data="lineChartData" class="flexfm inout-wrap" >
    </lineChart>
  </div>
</template>

<script>
import titlesection from '../components/titlesection'
import lineChart from '../components/lineChart'
import { weekAddress } from '../api/api'
export default {
  name: 'outsection',
  components: {
    titlesection,
    lineChart
  },
  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>
</style>
