龚焕茏
2024-05-14 fa11faa07eb31e9dda4ae48d6ba4b2fc32190b3b
feat:答卷统计新需求
2个文件已修改
50 ■■■■■ 已修改文件
src/api/dashboard.js 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/answer/sheetStatistics.vue 44 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/dashboard.js
@@ -1,7 +1,9 @@
import { post } from '@/utils/request'
import { get, post } from '@/utils/request'
export default {
  index: () => post('/api/admin/dashboard/index'),
  getData: query => post('/api/admin/examPaperAnswer/paperStatistics',query),
  getData: query => get('/api/admin/examPaperAnswer/statistic', query),
  getData: query => get('/api/admin/examPaperAnswer/statistic', query),
  examPaperList: query => get('/api/admin/exam/paper/list', query),
  page: query => post('/api/admin/examPaperAnswer/page', query)
}
src/views/answer/sheetStatistics.vue
@@ -1,41 +1,36 @@
<template>
<div style="padding: 10px">
  <el-form :model="queryParam" ref="queryForm" :inline="true " style="display: flex">
    <el-form-item label="试卷名称:" >
      <el-input v-model="paperName.paperName"></el-input>
    <el-form-item label="试卷:" >
      <el-select v-model="queryParam.examPaperId" filterable placeholder="试卷">
        <el-option v-for="item in examPaperList" :key="item.id" :value="item.id" :label="item.name"/>
      </el-select>
    </el-form-item>
<!--    <el-form-item label="试卷题目:">-->
<!--      <el-input v-model="queryParam.paperName"></el-input>-->
<!--    </el-form-item>-->
    <el-form-item label="部门:" v-if="true">
      <el-select v-model="queryParam.departmentId" placeholder="部门" clearable>
        <el-option v-for="item in levelEnum" :key="item.key" :value="item.key" :label="item.value"/>
      </el-select>
    </el-form-item>
    <el-form-item>
      <el-button type="primary" @click="submitForm">查询</el-button>
    </el-form-item>
  </el-form>
  <div style="display: flex;justify-content: center;color: #0a76a4">
    <div >最低分:{{min}}</div>
    <div style="margin-left: 5px">最高分:{{max}}</div>
    <div style="margin-left: 5px">平均分:{{avg}}</div>
  </div>
  <el-row class="echarts-line">
    <div id="echarts-moth-user" style="width: 100%;height:400px;" v-loading="loading"/>
  </el-row>
</div>
</template>
<script>
import examPaperAnswerApi from '@/api/examPaperAnwser'
import { mapGetters, mapState, mapActions } from 'vuex'
import dashboardApi from '@/api/dashboard'
const animationDuration = 6000
export default {
  data(){
    return{
      examPaperList: [],
      max:'',
      min:'',
      avg:'',
      paperName:{
        paperName:''
      },
      loading:false,
      examPaperCount: 0,
      questionCount: 0,
@@ -43,8 +38,8 @@
      doQuestionCount: 0,
      echartsUserAction: null,
      queryParam: {
        paperName:'',
        userName:'',
        examPaperId: '85',
        departmentId: '',
        subjectId: null,
        pageIndex: 1,
        pageSize: 10
@@ -53,8 +48,11 @@
    }
  },
  mounted(){
    dashboardApi.examPaperList().then(res => {
      this.examPaperList = res.response
    })
    let _this = this
    dashboardApi.getData(this.paperName).then(re => {
    dashboardApi.getData(this.queryParam).then(re => {
      let response = re.response
      console.log(response)
      _this.avg = response.avg
@@ -105,7 +103,7 @@
    search () {
      // this.listLoading = true
      let _this = this
      dashboardApi.getData(this.paperName).then(re => {
      dashboardApi.getData(this.queryParam).then(re => {
        console.log(re)
        let response = re.response
        _this.avg = response.avg
@@ -118,7 +116,13 @@
    submitForm () {
      this.queryParam.pageIndex = 1
      this.search()
    }
    },
  computed: {
    ...mapGetters('enumItem', ['enumFormat']),
    ...mapState('enumItem', {
      levelEnum: state => state.user.levelEnum
    })
  }
}
</script>