<template>
  <div>
    <el-button type="primary" @click="handleAdd">申请重修</el-button>
    <div style="height: 20px"></div>
    <table-list :remote="remote" :columns="columns" ref="tableList"></table-list>
  </div>
</template>

<script>
import listMixins from '../../mixins/list'

export default {
  mixins: [listMixins],
  data() {
    return {
      columns: [
        { prop: 'form.sofia_id', label: 'Sofia ID' },
        { prop: 'form.semester_name', label: '重修时间' },
        { prop: 'form.course_name', label: '重修课程' },
        { prop: 'status_name', label: '审批状态', attrs: { width: '100' } },
        { prop: 'approve_time1', label: '审批时间', attrs: { width: '160' } },
        { prop: 'remark1', label: '审批备注' },
        {
          label: '操作',
          attrs: { width: '160' },
          buttons: [
            {
              label: '查看',
              isShow(row) {
                return row.status !== -1
              },
              onClick: row => {
                this.$router.push({ name: 'retakeView', params: { id: row.id }, query: { id: row.affair_id } })
              }
            },
            {
              label: '支付',
              isShow(row) {
                return row.pay === 0
              },
              onClick: row => {
                this.$router.push({ name: 'retakeEdit', params: { id: row.id }, query: { id: row.affair_id } })
              }
            },
            {
              label: '编辑',
              isShow(row) {
                return row.status === -1
              },
              onClick: row => {
                this.$router.push({ name: 'retakeEdit', params: { id: row.id }, query: { id: row.affair_id } })
              }
            },
            {
              label: '撤销',
              isShow(row) {
                return row.status === -1
              },
              onClick: row => {
                this.handleCancel(row)
              }
            }
          ]
        }
      ]
    }
  },
  methods: {
    // 新增
    handleAdd() {
      this.$router.push({ name: 'retakeAdd', query: { id: this.affairId } })
    }
  }
}
</script>
