odc.xiaohui
2023-06-20 6bbb4faa43448d4c9ba3f25b7f0efcd6aed3b450
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
97
<template>
  <div class="app-container">
    <el-form :model="queryParam" ref="queryForm" :inline="true " style="display: flex">
<!--      <el-form-item label="课目:" >-->
<!--        <el-select v-model="queryParam.subjectId"  clearable>-->
<!--          <el-option v-for="item in subjects" :key="item.id" :value="item.id" :label="item.name"></el-option>-->
<!--        </el-select>-->
<!--      </el-form-item>-->
      <el-form-item label="学生:" >
       <el-input v-model="queryParam.userName"></el-input>
      </el-form-item>
      <el-form-item label="试卷题目:">
        <el-input v-model="queryParam.paperName"></el-input>
    </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="submitForm">查询</el-button>
      </el-form-item>
      <el-form-item style="flex: 1;
    text-align: right;">
       <span>{{avgSource}}分</span>
      </el-form-item>
    </el-form>
 
    <el-table v-loading="listLoading" :data="tableData" border fit highlight-current-row style="width: 100%">
      <el-table-column prop="id" label="Id"  width="100" />
      <el-table-column prop="paperName" label="试卷名称"/>
      <el-table-column prop="userName" label="用户名称"/>
      <el-table-column  label="得分" width="100px" >
        <template slot-scope="{row}">
          {{row.userScore}} / {{row.paperScore}}
        </template>
      </el-table-column>
      <el-table-column  label="题目对错" width="80px" >
        <template slot-scope="{row}">
          {{row.questionCorrect}} / {{row.questionCount}}
        </template>
      </el-table-column>
      <el-table-column prop="doTime" label="耗时" width="100px"/>
      <el-table-column prop="createTime" label="提交时间" width="160px"/>
    </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'
 
export default {
  components: { Pagination },
  data () {
    return {
      avgSource:null,
      queryParam: {
        paperName:'',
        userName:'',
        subjectId: null,
        pageIndex: 1,
        pageSize: 10
      },
      listLoading: false,
      tableData: [],
      total: 0
    }
  },
  created () {
    this.initSubject()
    this.search()
  },
  methods: {
    search () {
      this.listLoading = true
      examPaperAnswerApi.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
      })
    },
    submitForm () {
      this.queryParam.pageIndex = 1
      this.search()
    },
    ...mapActions('exam', { initSubject: 'initSubject' })
  },
  computed: {
    ...mapGetters('enumItem', ['enumFormat']),
    ...mapGetters('exam', ['subjectEnumFormat']),
    ...mapState('exam', { subjects: state => state.subjects })
  }
}
</script>