<template>
  <div id="attendance">
    <el-select v-model="value" placeholder="请选择" @change="filterDate">
      <el-option v-for="(item, index) in options" :key="index" :label="item" :value="item"> </el-option>
    </el-select>
    <el-table :data="tableData" border style="width: 100%">
      <el-table-column prop="date" label="日期"> </el-table-column>
      <el-table-column prop="time" label="时间"> </el-table-column>
      <el-table-column prop="name" label="姓名"> </el-table-column>
      <el-table-column align="center" label="类型">
        <template slot-scope="scope">
          <span>{{ scope.row.type === '0' ? '上课考勤' : scope.row.type === '1' ? '寝室考勤' : '' }}</span>
        </template>
      </el-table-column>
      <el-table-column align="center" label="状态">
        <template slot-scope="scope">
          <span>{{ scope.row.status === '0' ? '未签到' : scope.row.status === '1' ? '已签到' : scope.row.status === '2' ? '迟到' : '' }}</span>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
import { mapState, createNamespacedHelpers } from 'vuex';
const { mapActions: attendance } = createNamespacedHelpers('attendance');
const { mapActions: classes } = createNamespacedHelpers('classes');
const moment = require('moment');
export default {
  name: 'attendance',
  props: {
    tableData: { type: Array },
    options: { type: Array },
  },
  components: {},
  data: () => ({
    value: '',
  }),
  created() {},
  computed: {},
  methods: {
    filterDate(time) {
      this.$emit('filterDate', time);
    },
  },
};
</script>

<style lang="less" scoped></style>
