<template>
  <div>
    <div class="con-title">{{ $t('pages.learn.reportList.title') }}</div>
    <div class="con-box">
      <el-button type="primary" @click="goActiveList">{{ $t('pages.learn.reportList.已申请的活动') }}</el-button>
      <div style="width: 100%; height: 0.2rem;"></div>
      <m-page
        :tableHead="tableHead"
        :tableData="tableData"
        :params="params"
        :objFn="objFn"
        :tableConfig="tableConfig"
      />
    </div>
  </div>
</template>

<script>
import mPage from '@/components/comTable/mPage.vue'
export default {
  components: { mPage },
  data () {
    return {
      tableConfig: { border: '', size: '', selection: { has: false, sels: [], width: '50px', fix: 'left', align: '' } }, // 增加选择框，has设置为true
      tableHead: [
        { prop: 'index', label: '序号', minWidth: '80', fix: false },
        { prop: 'sno', label: '学号', minWidth: '120', fix: false },
        { prop: 'sname', label: '姓名', minWidth: '110', fix: false },
        { prop: 'report_name', label: '学术报告主题', minWidth: '170', fix: false },
        { prop: 'review_status', label: '审核状态', minWidth: '100', fix: false },
        { prop: 'review_time', label: '审核时间', minWidth: '150', fix: false },
        { prop: 'review_comment', label: '老师评语', minWidth: '150', fix: false },
        { prop: 'file_url', label: '附件', minWidth: '80', fix: false }
        // { prop: '', label: '', minWidth: '', fix: false, goObj: { routerName: '', params: {} } }, // 点击跳转页面并传参数
        // { prop: 'img_url', label: '图片', width: '60px', fix: false, align: 'left' } // 显示图片缩略小图，浮上去可查看大图
        // { prop: 'operate', label: '操作', width: '60px', fix: false, commandArr: [ { command: 'newslist-edit', name: '编辑' }, { command: 'newslist-del', name: '删除' } ] } // 操作控制列
      ],
      tableData: [],
      params: { keywords: '', curPage: 1, pageSize: 100, total: '' },
      objFn: {
        paramsFn: (_this) => { return {} },
        nameAPI: 'getReportList',
        actionClass: 'Report',
        // nameExcel: 'getStatSummaryExcel',
        nameExcel: 'getExportExcel3_4_14',
        callback: (_this, data) => {
          _this.params.total = 100
          data.forEach((elem, i) => {
            elem.review_status = '已通过'
            elem.sno = elem.student.sno
            elem.sname = elem.student.personal_name
            const _o = JSON.parse(elem.file_url || '[]')
            elem.file_url = (_o[0] && _o[0].url) || ''
            elem.index = i + 1 + (_this.params.curPage - 1) * _this.params.pageSize
            _this.tableData.push(elem)
          })
        }
      }
    }
  },
  mounted () {},
  methods: {
    goActiveList () {
      this.$router.push({ path: '/app/learn/report-active-list' })
    }
  }
}
</script>

<style lang="scss" scoped>
/* 申请 */
.el-date-editor.el-input {
  width: 100%;
}
.el-upload__tip {
  line-height: 1.5;
}
</style>
