<template>
  <div>
    <div class="con-title">办事大厅</div>
    <Tap :tapParam='tapParam' @tapIndex='tapIndexs'></Tap>
    <div class="con-box">
      <el-button type="primary" v-show="tapIndex==0">申请新的活动</el-button>
      <el-button type="primary" v-show="tapIndex==1">申请新乐分享</el-button>
      <el-button type="primary" v-show="tapIndex==2">申请重修</el-button>
      <!-- <el-button style="float:right;" type="text" @click='gobackReportList'>返回报告列表</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 Tap from '../../components/module/tap.vue'
import mPage from '../../components/module/mPage.vue'
import cAction from '@actions'
export default {
  components: {
    Tap,
    mPage
  },
  data () {
    return {
      tapIndex: 0,
      // tap切换
      tapParam: [{
        name: '分类',
        isShow: false,
        selectIndex: 0,
        key: 'cc',
        arrItem: [
          { val: '1', name: '学术活动' },
          { val: '2', name: '乐分享' },
          { val: '3', name: '重修' }
        ]
      }],
      // 学术活动
      tableConfig: { border: '', size: '', selection: { has: false, sels: [], width: '50px', fix: 'left', align: '' } }, // 增加选择框，has设置为true
      tableHead: [],
      tableData: [],
      params: { keywords: '', curPage: 1, pageSize: 100, total: '' },
      objFn: {
        paramsFn: (_this) => { return {} },
        nameAPI: 'getReportActiveList',
        actionClass: 'reportAction',
        // nameExcel: 'getStatSummaryExcel',
        nameExcel: 'getExportExcel3_4_14',
        callback: (_this, data) => {
          _this.params.total = 100
          data.forEach((elem, i) => {
            elem.approve_status = elem.approve_status === 1 ? '通过' : (elem.approve_status === 0 ? '未通过' : '未审核') // 0 未通过；1 通过；2 未审核
            elem.index = i + 1 + (_this.params.curPage - 1) * _this.params.pageSize
            elem.reportscount = Number(elem.reportscount || '0')
            _this.tableData.push(elem)
          })
        }
      }
      // 音分享
    }
  },
  mounted () {
    this.getInfo(0)
    this.getTapData()
  },
  methods: {
    tapIndexs (index) {
      this.tapIndex = index
      this.getInfo(index)
    },
    getInfo (index) {
      let n = parseInt(index)
      switch (n) {
        case 0:
          this.tableHead = [
            { prop: 'index', label: '序号', minWidth: '80', fix: false },
            { prop: 'symposium_name', label: '活动名称', minWidth: '150', fix: false },
            { prop: 'symposium_time', label: '活动时间', minWidth: '120', fix: false },
            { prop: 'symposium_lecturer', label: '主讲人', minWidth: '120', fix: false },
            { prop: 'approve_status', label: '审核状态', minWidth: '80', fix: false },
            { prop: 'approve_time', label: '审核时间', minWidth: '120', fix: false },
            // { prop: '', label: '', minWidth: '', fix: false, goObj: { routerName: '', params: {} } }, // 点击跳转页面并传参数
            { prop: 'operate-x', label: '操作', width: '200px', fix: false, commandArr: [ { command: 'activelist-show', name: '查看报告' }, { command: 'activereport-add', name: '上传报告' }, { command: 'activelist-edit', name: '编辑' }, { command: 'activelist-delete', name: '删除' } ] }
          ]
          break
        case 1:
          this.tableHead = [
            { prop: 'index', label: '序号', minWidth: '80', fix: true },
            { prop: 'symposium_name', label: '分享主题', minWidth: '150', fix: false },
            { prop: 'symposium_time', label: '班级', minWidth: '80', fix: false },
            { prop: 'symposium_lecturer', label: '申请人', minWidth: '80', fix: false },
            { prop: 'approve_status', label: '电话', minWidth: '120', fix: false },
            { prop: 'approve_time', label: '审核状态', minWidth: '80', fix: false },
            { prop: 'approve_time', label: '审核时间', minWidth: '200', fix: false },
            { prop: 'operate-x', label: '备注', width: '120', fix: false }
          ]
          break
        case 2:
          this.tableHead = [
            { prop: 'index', label: '序号', minWidth: '80', fix: false },
            { prop: 'symposium_name', label: '班级', minWidth: '150', fix: false },
            { prop: 'symposium_time', label: '课程', minWidth: '80', fix: false },
            { prop: 'symposium_lecturer', label: '审核状态', minWidth: '80', fix: false },
            { prop: 'approve_time', label: '审核时间', minWidth: '120', fix: false },
            { prop: 'operate-x', label: '备注', width: '120', fix: false }
          ]
          break
      }
    },
    getTapData () {
      cAction.reportAction.getDataList().then(data => {
        console.log('------------', data)
      }).catch(e => {
        this.$message.error(e.message)
      })
    }
  }
}
</script>

<style lang="scss" scoped>

</style>