<template>
  <div>
    <el-table
      style="width: 100%"
      :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
      :data="tableList"
    >
      <el-table-column
        align="center"
        prop="userId"
        label="学员编号"
      ></el-table-column>
      <el-table-column
        align="center"
        prop="username"
        label="学员姓名"
      ></el-table-column>
      <el-table-column
        align="center"
        prop="subjectNames"
        label="专业"
      ></el-table-column>
      <el-table-column
        align="center"
        prop="studentId"
        label="是否布置作业"
      >
       <template slot-scope="scope">
        <div>
          {{scope.row.homeworkExist?'是':'否'}}
        </div>
      </template>
      </el-table-column>
    </el-table>
    <pagination
      sync
      :total.sync="rules.total"
      :page.sync="rules.page"
      :limit.sync="rules.limit"
      :page-sizes="rules.page_size"
      @pagination="getList"
    />
  </div>
</template>
<script>
import pagination from "@/components/Pagination/index";
import { getTeacherServeExtraDetail } from "../api";
export default {
  props:['detail'],
    components:{pagination},
  data() {
    return {
       tableList:[],
      rules: {
        // 分页规则
        limit: 10, // 限制显示条数
        page: 1, // 当前页
        total: 0, // 总条数
        page_size: [10, 20, 40, 50], // 选择限制显示条数
      },
    };
  },
  mounted() {
    // 获取分部
    this.init();
  },
  methods: {
    init() {
      this.getList()
    },
    async getList() {
      console.log(this.detail)
      try {
      const dayjs = this.$helpers.dayjs
     const ruselt =  await getTeacherServeExtraDetail({
          page: this.rules.page,
          rows: this.rules.limit,
          monday: dayjs(this.detail.monday).format("YYYY-MM-DD"),
          sunday: dayjs(this.detail.sunday).format("YYYY-MM-DD"),
          teacherId:this.detail.teacherId
        });
        this.tableList = ruselt.data.rows
        this.rules.total = ruselt.data.total
      } catch (e) {
        console.log(e)
      }
    },
    search() {
      this.rules.page = 1;
      this.getList();
    },
    onReSet() {},
  },
};
</script>
<style lang="scss" scoped>
</style>
