xiangpei
2024-11-28 efefbc15efe54bbd4da12bf8aff49432f5b752b8
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<template>
  <div class="app-container">
    <el-form :model="queryParam" ref="queryForm" :inline="true " style="display: flex">
      <el-form-item label="考试时间:" >
        <el-date-picker
          v-model="timeRange"
          value-format="yyyy-MM-dd HH:mm:ss"
          type="daterange"
          @change="updateTime"
          range-separator="至"
          start-placeholder="开始日期"
          end-placeholder="结束日期">
        </el-date-picker>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="search">查询</el-button>
      </el-form-item>
    </el-form>
 
    <el-table v-loading="listLoading" :data="tableData" border fit highlight-current-row style="width: 100%">
      <el-table-column prop="userName" label="考生名称"/>
      <el-table-column prop="counts" label="考试次数" width="160px"/>
      <el-table-column  label="操作" align="center"  width="300px">
        <template slot-scope="{row}">
          <el-button size="mini"
                     @click="$router.push({path:'/answer/achievementStatistics/gradeDetails',query:{id:row.id, userId:row.userId, createUser:row.createUser, start:queryParam.start, end: queryParam.end}})" >
            查看</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/examPaperAnwser'
import AchievementStatistics from "@/api/AchievementStatistics";
 
export default {
  components: { Pagination },
  data () {
    return {
      timeRange: [],
      avgSource: null,
      queryParam: {
        start: null,
        end: null,
        subjectId: null,
        pageIndex: 1,
        pageSize: 10
      },
      listLoading: false,
      tableData: [],
      total: 0
    }
  },
  created () {
    this.initSubject()
    this.search()
  },
  methods: {
    updateTime (value) {
      if (value && value.length > 0) {
        if (this.timeRange && this.timeRange.length > 0) {
          this.queryParam.start = this.timeRange[0]
          this.queryParam.end = this.timeRange[1]
        }
      } else {
        this.queryParam.start = null
        this.queryParam.end = null
      }
    },
    search () {
      this.listLoading = true
      AchievementStatistics.page(this.queryParam).then(data => {
        const re = data.response
        this.avgSource = re.list[0].avgSource
        this.tableData = re.list
        this.total = re.total
        this.queryParam.pageIndex = re.pageNum
        this.listLoading = false
      })
    },
    ...mapActions('exam', { initSubject: 'initSubject' })
  },
  computed: {
    ...mapGetters('enumItem', ['enumFormat']),
    ...mapGetters('exam', ['subjectEnumFormat']),
    ...mapState('exam', { subjects: state => state.subjects })
  }
}
</script>