Newer
Older
CloudBrainNew / src / views / socialLive / components / canteen / components / canteenDetail.vue
<!--
 * @Description:各餐厅就餐人数
 * @Author: 王晓颖
 * @Date: 2020-10-13 14:32:19
 -->
<template>
  <div style="width: 100%;height:100%;margin-left:-10px;padding-bottom:0.15rem;padding-right:0.1rem">
    <scroll-board :config="boardConfig"/>
  </div>
</template>

<script>
import SimplePieChart from '@/components/pieChart/simplePieChart'
import Corner1 from '@/components/corner/Corner1'
import ChartLayout from '@/components/layout/chartLayout'
import {getCanteenStatistics} from '@/api/ecard'
import ScrollBoard from '@/components/board/ScrollBoard'
import { dateToString } from '@/utils/formatDate'
import mockData from '../../../../../../static/socialLive.json'
export default {
  name: 'canteenDetail',
  components: {ScrollBoard, ChartLayout, Corner1, SimplePieChart},
  data () {
    return {
      boardConfig: {
        header: ['食堂', '早餐', '午餐', '晚餐'],
        rowNum: 3,
        hoverColor: true,
        headerBGC: 'rgba(46,145,244,0.4)',
        oddRowBGC: 'rgba(46,145,244,0.4)',
        evenRowBGC: '#030737',
        headerColor: '#00F0FF',
        rowColor: '#FFFFFF',
        headerFontSize: '0.075rem', // 表头字体大小
        rowFontSize: '0.075rem', // 行字体大小
        columnWidth: [150],
        data: []
      }
    }
  },
  created () {
    // this.getData()
    this.boardConfig.data = mockData.right.canteen.table
  },
  methods: {
    getData () {
      const today = dateToString(new Date(), 'y-m-d')
      const params = {params: [today, today]}
      getCanteenStatistics(params).then(response => {
        if (response.code === 200) {
          const data = response.data
          const list = data.map(item => {
            return [item.name, item.breakfast, item.lunch, item.dinner]
          })
          this.boardConfig.data = list
          const boardConfig = this.boardConfig
          this.boardConfig = Object.assign({}, boardConfig)
        }
      })
    }
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>

</style>