<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.personal_name', label: '姓名' },
        { prop: 'form.class_name', label: '班级' },
        { prop: 'form.birth_date', label: '出生日期' },
        { prop: 'status_name', label: '审批状态' },
        { prop: 'approve_time1', label: '审批时间' },
        { prop: 'remark1', label: '审批备注' },
        {
          label: '操作',
          attrs: { width: '100' },
          buttons: [
            {
              label: '查看',
              isShow(row) {
                return row.status !== -1
              },
              onClick: row => {
                this.$router.push({ name: 'schoolCertView', params: { id: row.id }, query: { id: row.affair_id } })
              }
            },
            {
              label: '下载',
              isShow(row) {
                return row.status === 1
              },
              onClick: row => {
                console.log(row)
              }
            },
            {
              label: '编辑',
              isShow(row) {
                return row.status === -1
              },
              onClick: row => {
                this.$router.push({ name: 'schoolCertEdit', params: { id: row.id }, query: { id: row.affair_id } })
              }
            },
            {
              label: '删除',
              isShow(row) {
                return row.status !== 2
              },
              onClick: row => {
                this.handleRemove(row)
              }
            }
          ]
        }
      ]
    }
  },
  methods: {
    // 新增
    handleAdd() {
      this.$router.push({ name: 'schoolCertAdd', query: { id: this.affairId } })
    }
  }
}
</script>
