<template>
  <!-- 今日图书借还 -->
  <div class="screen-item total-lending">
    <div class="common-title">今日图书借还</div>
    <div class="small-module module-content">
      <div class="chart-wrapper" style="height: calc(100%);">
        <LineChartService :chart-data="chartData" />
      </div>
    </div>
  </div>
</template>

<script>
import LineChartService from '@/components/echart/lineChartService'
import { FetchHalfYearBRNum } from '@/api/library'
export default {
  name: 'TodayBorrowed',
  components: {
    LineChartService
  },
  data() {
    return {
      chartData: {
        returnData: [],
        borrowedData: []
      }
    }
  },
  created() {
  },
  mounted() {
    this.getHalfYearBRNum()
  },
  methods: {
    getHalfYearBRNum() {
      FetchHalfYearBRNum().then(res => {
        if (res.errCode === 0) {
          this.chartData.borrowedData = res.data.borrow
          this.chartData.returnData = res.data.return
        } else {
          this.$message.error('接口错误')
        }
      })
    }
  }
}
</script>

<style lang="scss">
@import "~@/assets/styles/index.scss";
</style>
