<template>
  <a-card :bordered="false" title="答题记录">
    <template slot="extra">
      <a-button size="small" @click="close">返回</a-button>
    </template>
    <s-table ref="table" size="default" rowKey="id" :columns="columns" :data="loadData">
      <template slot="action" slot-scope="text, record">
        <a href="javascript:;" @click="trainDetail(record)">答题记录</a>
      </template>
    </s-table>
  </a-card>
</template>

<script>
import { STable, SearchCom } from '@/components'
import { getArchivesUserAutoTrainAnswerList } from '@/api/archives/user'

export default {
  components: { STable, SearchCom },
  data() {
    return {
      userId: this.$route.query.userId,
      projectId: this.$route.query.projectId,
      queryParam: { userId: this.$route.query.userId, projectId: this.$route.query.projectId },
      columns: [
        { title: '交卷时间', width: 'auto', align: 'center', dataIndex: 'handDate', key: 'handDate' },
        { title: '考试时长', width: 'auto', align: 'center', dataIndex: 'testTime', key: 'testTime' },
        { title: '考试成绩', width: 'auto', align: 'center', dataIndex: 'testResult', key: 'testResult' },
        { title: '操作', width: 'auto', key: 'operation', align: 'center', scopedSlots: { customRender: 'action' } }
      ],
      loadData: parameter => { return getArchivesUserAutoTrainAnswerList(Object.assign(parameter, this.queryParam)).then(res => { return res }) }
    }
  },
  computed: {},
  methods: {
    // 返回 按钮
    close() {
      this.$router.push({
        path: '/archives/user/Project', query: {
          id: this.$route.query.userId,
          archivesUserName: this.$route.query.archivesUserName,
          archivesUserOrgId: this.$route.query.archivesUserOrgId,
          archivesUserPageNum: this.$route.query.archivesUserPageNum,
          archivesUserProjectTable1ProjectName: this.$route.query.archivesUserProjectTable1ProjectName,
          archivesUserProjectTable1FinishState: this.$route.query.archivesUserProjectTable1FinishState,
          archivesUserProjectTable1PageNum: this.$route.query.archivesUserProjectTable1PageNum,
          defaultActiveKey: this.$route.query.defaultActiveKey
        }
      });
    }
  }
}
</script>