xiangpei
2024-10-30 31f7b390b44db12308943492891e7e0ef96f32e8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<template>
  <div class="app-container">
    <el-form :inline="true" :model="queryParam" class="demo-form-inline" label-width="80px">
      <el-form-item>
        <el-input v-model="queryParam.name" size="small" placeholder="请输入姓名" clearable @input="search()"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button style="width:100px;" type="primary" size="small" @click="search()">查询</el-button>
      </el-form-item>
    </el-form>
 
    <el-table v-loading="listLoading" :data="tableData" border style="width: 100%;">
      <el-table-column align="center" prop="userName" label="姓名" />
      <el-table-column align="center" prop="examCount" label="考试次数" />
      <el-table-column label="操作" align="center">
        <template slot-scope="{row}">
          <el-button size="mini" @click="view(row)">查看</el-button>
        </template>
      </el-table-column>
    </el-table>
    <pagination v-show="total > 0" :total="total" :page.sync="queryParam.pageIndex"
      :limit.sync="queryParam.pageSize" @pagination="search" />
  </div>
</template>
 
<script>
 
import { mapGetters, mapState, mapActions } from 'vuex'
import Pagination from '@/components/Pagination'
import examPaperAnswerApi from '@/api/examPaperAnswer'
 
export default {
  components: { Pagination },
  data () {
    return {
      listLoading: true,
      queryParam: {
        name: '',
        pageIndex: 1,
        pageSize: 10
      },
      formLoading: false,
      total: 0,
      tableData: [],
      visible: false
    };
  },
  created () {
    this.initSubject()
    this.search()
  },
  methods: {
    // 获取列表
    search() {
      this.listLoading = true
      examPaperAnswerApi.pageUser(this.queryParam).then(re => {
        this.tableData = re.data.list
        this.total = re.data.total
        this.queryParam.pageSize = re.data.pageSize
        this.queryParam.pageIndex = re.data.pageNum
        this.listLoading = false
      })
    },
    view(row) {
      this.$router.push({ path: '/answer/answer-info', query: { userId: row.id } });
    },
    ...mapActions('exam', { initSubject: 'initSubject' })
  },
  computed: {
    ...mapGetters('enumItem', ['enumFormat']),
    ...mapGetters('exam', ['subjectEnumFormat']),
    ...mapState('exam', { subjects: state => state.subjects })
  }
}
</script>