<template>
  <div class="c-container">
    <!-- 搜索标题 -->
    <div class="tableWrap">
      <el-table :data='tableList'
                :header-cell-style="{background:'#EDEEF0',color:'#444'}">
        <el-table-column align='center'
                         prop="classGroupName"
                         label="班级名称">
        </el-table-column>
        <el-table-column align='center'
                         label="班级类型">
          <template slot-scope="scope">
            <div>
              {{ scope.row.classGroupType | classType}}
            </div>
          </template>
        </el-table-column>
        <el-table-column align='center'
                         prop="masterTeacher"
                         label="主教老师">
        </el-table-column>
        <el-table-column align='center'
                         prop='subTeacher'
                         label="助教老师">
        </el-table-column>
        <el-table-column align='center'
                         prop="currentClassTimes"
                         label="是否有课">
          <template slot-scope="scope">
            {{ scope.row.totalClassTimes ? '是' : '否'}}
          </template>
        </el-table-column>
        <el-table-column align='center'
                         prop="studyNum"
                         label="在读人数">
        </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>
</template>
<script>
import pagination from '@/components/Pagination/index'
import { getClassList, coursePostpone } from '@/api/buildTeam'
import { permission } from '@/utils/directivePage'
export default {
  name: 'tclassList',
  props: ['teamid'],
  data () {
    return {
      searchLsit: [],
      searchForm: {
        name: '',
        status: ''
      },
      tableList: [],
      rules: {
        // 分页规则
        limit: 10, // 限制显示条数
        page: 1, // 当前页
        total: 0, // 总条数
        page_size: [10, 20, 40, 50] // 选择限制显示条数
      }
    }
  },
  components: {
    pagination
  },
  activated () {
    this.getList();
  },
  mounted () {
    this.getList();
  },
  methods: {

    permission (str) {
      return permission(str)
    },
    getList () {
      // search: this.teamid
      getClassList({ search: this.teamid, 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
        }
      })
    },
    resetClass () {
      // 跳转到班级详情页
      this.$router.push({ path: '/business/resetClass', query: { id: this.teamid } })
    },
  }
}
</script>
<style lang="scss" scope>
</style>