<!--  -->
<template>
  <div class>
    <div class="m-core">
      <div class="tableWrap">
        <el-table style="width: 100%"
                  :header-cell-style="{background:'#EDEEF0',color:'#444'}"
                  :data="tableList">
          <el-table-column align="center"
                           prop="id"
                           label="课程编号"></el-table-column>
          <el-table-column align="center"
                           prop="name"
                           label="课程名称"></el-table-column>
          <!-- <el-table-column align="center" prop="subjectName" label="声部"></el-table-column> -->
          <el-table-column align="center"
                           prop="teacherName"
                           label="指导老师"></el-table-column>
          <el-table-column align="center"
                           prop="educationalTeacherName"
                           label="乐团主管"></el-table-column>
          <el-table-column align="center"
                           prop="type"
                           label="课程组类型"
                           width="100">
            <template slot-scope="scope">
              <div>
                <p>{{scope.row.type | comType}}</p>
              </div>
            </template>
          </el-table-column>
          <el-table-column align="center"
                           prop="groupStatus"
                           label="课程组状态">
            <template slot-scope="scope">
              <div>
                <p>{{scope.row.groupStatus | comCourseGroup}}</p>
              </div>
            </template>
          </el-table-column>
          <el-table-column align="center"
                           label="开始时间">
            <template slot-scope="scope">
              <div>
                <div>{{scope.row.coursesStartDate|dateForMinFormat}}</div>
              </div>
            </template>
          </el-table-column>
          <el-table-column align="center"
                           label="结束时间">
            <template slot-scope="scope">
              <div>
                <div>{{scope.row.coursesExpireDate|dateForMinFormat}}</div>
              </div>
            </template>
          </el-table-column>
        </el-table>
        <pagination :total="rules.total"
                    :page.sync="rules.page"
                    :limit.sync="rules.limit"
                    :page-sizes="rules.page_size"
                    @pagination="getList" />
      </div>
    </div>
  </div>
</template>

<script>
import pagination from "@/components/Pagination/index";
import load from "@/utils/loading";
import { practiceGroupManage } from "@/api/buildTeam";
export default {
  components: { pagination },
  data () {
    return {
      searchForm: {
        search: null
      },
      studentId: null,
      tableList: [],

      rules: {
        // 分页规则
        limit: 10, // 限制显示条数
        page: 1, // 当前页
        total: 0, // 总条数
        page_size: [10, 20, 40, 50] // 选择限制显示条数
      }
    };
  },
  //生命周期 - 创建完成（可以访问当前this实例）
  created () { },
  //生命周期 - 挂载完成（可以访问DOM元素）
  mounted () {
    // 获取分部
    this.init();
  },
  activated () {
    this.init();
  },
  methods: {
    init () {
      this.studentId = this.$route.query.userId;
      this.getList();
    },
    getList () {
      practiceGroupManage({
        studentId: this.studentId,
        page: this.rules.page,
        rows: this.rules.limit
      }).then(res => {
        if (res.code == 200) {
          this.tableList = res.data.rows;
          this.rules.total = res.data.total;
        }
      });
    }
  }
};
</script>
<style lang='scss' scoped>
</style>
