<template>
  <div id="ranking-board">
    <div class="ranking-board-title">{{Type === 'total'?'各个学校事务项':'事务项'}}上报数量</div>
    <dv-scroll-ranking-board :config="config" />
  </div>
</template>

<script>
export default {
  name: 'RankingBoard',
  props: ['LeftData', 'Type'],
  data () {
    return {
      config: {
        data: [ ],
        rowNum: 10
      }
    }
  },
  created () {
    if (this.Type === 'dinner') {
      this.config.data = this.LeftData.map((item) => {
        return {
          name: item.name,
          value: item.details.length
        }
      })
    }
    if (this.Type === 'total') {
      this.config.data = this.LeftData.map((item) => {
        return {
          name: item.dinnerName,
          value: item.quantityDone
        }
      })
    }
  }
}
</script>

<style lang="less">
#ranking-board {
  width: 20%;
  box-shadow: 0 0 3px blue;
  display: flex;
  flex-direction: column;
  background-color: rgba(6, 30, 93, 0.5);
  border-top: 2px solid rgba(1, 153, 209, .5);
  box-sizing: border-box;
  padding: 0px 30px;

  .ranking-board-title {
    font-weight: bold;
    height: 50px;
    display: flex;
    align-items: center;
    font-size: 20px;
  }

  .dv-scroll-ranking-board {
    flex: 1;
  }
}
</style>
