From a012d96b2188cacc46f7ba63e60bf5ec142602a4 Mon Sep 17 00:00:00 2001
From: odc.xiaohui <xiaohui@Q1>
Date: 星期二, 04 七月 2023 17:53:04 +0800
Subject: [PATCH] 修改青羊后台答卷统计
---
src/views/answer/sheetStatistics.vue | 128 +++++++++++++++++++++++++
src/views/user/student/list.vue | 62 +++++++++++-
src/api/dashboard.js | 4
src/router.js | 6 +
src/views/exam/paper/edit.vue | 42 ++++++-
5 files changed, 228 insertions(+), 14 deletions(-)
diff --git a/src/api/dashboard.js b/src/api/dashboard.js
index 18a97f1..b91178d 100644
--- a/src/api/dashboard.js
+++ b/src/api/dashboard.js
@@ -1,5 +1,7 @@
import { post } from '@/utils/request'
export default {
- index: () => post('/api/admin/dashboard/index')
+ index: () => post('/api/admin/dashboard/index'),
+ getData: query => post('/api/admin/examPaperAnswer/paperStatistics',query),
+ page: query => post('/api/admin/examPaperAnswer/page', query)
}
diff --git a/src/router.js b/src/router.js
index 415ffc9..470f931 100644
--- a/src/router.js
+++ b/src/router.js
@@ -215,6 +215,12 @@
component: () => import('@/views/answer/list'),
name: 'AnswerPageList',
meta: { title: '绛斿嵎鍒楄〃', noCache: true }
+ },
+ {
+ path: 'sheetStatistics',
+ component: () => import('@/views/answer/sheetStatistics.vue'),
+ name: 'AnswerPageList',
+ meta: { title: '绛斿嵎缁熻', noCache: true }
}
]
},
diff --git a/src/views/answer/sheetStatistics.vue b/src/views/answer/sheetStatistics.vue
new file mode 100644
index 0000000..84f64ed
--- /dev/null
+++ b/src/views/answer/sheetStatistics.vue
@@ -0,0 +1,128 @@
+
+<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>
+<!-- <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>
+ <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 dashboardApi from '@/api/dashboard'
+const animationDuration = 6000
+export default {
+ data(){
+ return{
+ max:'',
+ min:'',
+ avg:'',
+ paperName:{
+ paperName:''
+ },
+ loading:false,
+ examPaperCount: 0,
+ questionCount: 0,
+ doExamPaperCount: 0,
+ doQuestionCount: 0,
+ echartsUserAction: null,
+ queryParam: {
+ paperName:'',
+ userName:'',
+ subjectId: null,
+ pageIndex: 1,
+ pageSize: 10
+ },
+ listLoading:false
+ }
+ },
+ mounted(){
+ let _this = this
+ dashboardApi.getData(this.paperName).then(re => {
+ let response = re.response
+ console.log(response)
+ _this.avg = response.avg
+ _this.max = response.max
+ _this.min = response.min
+ _this.examPaperCount = response.examPaperCount
+ _this.questionCount = response.questionCount
+ _this.doExamPaperCount = response.doExamPaperCount
+ _this.doQuestionCount = response.doQuestionCount
+ _this.echartsUserAction.setOption(this.option('鐢ㄦ埛娲昏穬搴�', '{b}鍒唟c}浜�', response.mothDayText, response))
+ // _this.echartsQuestion.setOption(this.option('棰樼洰鏈堟暟閲�', '{b}鏃c}棰�', response.mothDayText, response.mothDayDoExamQuestionValue))
+ this.loading = false
+ })
+ this.echartsUserAction = echarts.init(document.getElementById('echarts-moth-user'), 'macarons')
+ },
+ methods:{
+ option (title, formatter, label, vaule) {
+ return {
+ title: {
+ text: '绛斿嵎缁熻',
+ x: 'center'
+ },
+ tooltip: {
+ trigger: 'item',
+ formatter: formatter
+ },
+ xAxis: {
+ type: 'category',
+ data: ['0-60','60-80','80-100']
+ },
+ grid: {
+ left: 10,
+ right: 10,
+ bottom: 20,
+ top: 30,
+ containLabel: true
+ },
+ yAxis: {
+ type: 'value'
+ },
+ series: [{
+ data: [vaule.lowGrade,vaule.intermediate,vaule.advanced],
+ type: 'bar',
+ barMaxWidth:'10%'
+ }]
+ }
+ },
+ search () {
+ // this.listLoading = true
+ let _this = this
+ dashboardApi.getData(this.paperName).then(re => {
+ console.log(re)
+ let response = re.response
+ _this.avg = response.avg
+ _this.max = response.max
+ _this.min = response.min
+ _this.echartsUserAction.setOption(this.option('鐢ㄦ埛娲昏穬搴�', '{b}鍒唟c}浜�', response.mothDayText, response))
+ })
+ this.echartsUserAction = echarts.init(document.getElementById('echarts-moth-user'), 'macarons')
+ },
+ submitForm () {
+ this.queryParam.pageIndex = 1
+ this.search()
+ },
+ }
+}
+</script>
+
+<style scoped lang="scss">
+
+</style>
diff --git a/src/views/exam/paper/edit.vue b/src/views/exam/paper/edit.vue
index b203177..317fb5e 100644
--- a/src/views/exam/paper/edit.vue
+++ b/src/views/exam/paper/edit.vue
@@ -37,13 +37,26 @@
</el-col>
</el-row>
</el-form-item>
- <el-form-item :key="key" :label="titlejs(key)" required v-for="(value,key,index) in form.subjectSource" v-if="form.paperType ==7">
+ <el-form-item :key="item.subjectId" :label="item.label" required v-for="(item,key,index) in form.questionTypeVMS" v-if="form.paperType ==7">
<el-row >
<el-col :span="3" >
- <span>棰樼洰鏁伴噺锛�</span>
+ <span>澶氶�夐锛�</span>
+
</el-col>
- <el-col :span="9">
- <el-input v-model="form.subjectSource[key]" style="width: 80%"/>
+ <el-col :span="3">
+ <el-input v-model="form.questionTypeVMS[key].multipleChoice" style="width: 80%"/>
+ </el-col>
+ <el-col :span="3" >
+ <span>鍗曢�夐锛�</span>
+ </el-col>
+ <el-col :span="3">
+ <el-input v-model="form.questionTypeVMS[key].singleChoice" style="width: 80%"/>
+ </el-col>
+ <el-col :span="3" >
+ <span>鍒ゆ柇棰橈細</span>
+ </el-col>
+ <el-col :span="3">
+ <el-input v-model="form.questionTypeVMS[key].trueFalse" style="width: 80%"/>
</el-col>
</el-row>
</el-form-item>
@@ -135,7 +148,8 @@
name: '',
suggestTime: null,
titleItems: [],
- subjectSource:{}
+ subjectSource:{},
+ questionTypeVMS:[]
},
subjectFilter: null,
formLoading: false,
@@ -207,19 +221,29 @@
this.$refs.subjectIdRef.selected.forEach(item=>{
arr.push({
label:item.label,
- id:item.value
+ subjectId:item.value,
+ singleChoice:'',
+ multipleChoice:'',
+ trueFalse:''
})
})
console.log(arr)
+ this.form.questionTypeVMS = arr
}
if (this.form.paperType ==7){
//瑾槑鏄毃姗�
this.subjectIdList = arr
let obj1={}
+ let arr1 = []
arr.forEach((item,index)=>{
- obj1[item.id]=''
-
+ // obj1[item.id]=''
+ arr1.push({
+ subjectId:item.id,
+ singleChoice:'',
+ multipleChoice:'',
+ trueFalse:''
+ })
// let obj={
// item
// }
@@ -233,7 +257,9 @@
// }
})
this.form.subjectSource = obj1
+
console.log(this.form.subjectSource)
+ console.log(this.form.questionTypeVMS)
// this.form.paperType = 7
this.form.titleItems = []
}else {
diff --git a/src/views/user/student/list.vue b/src/views/user/student/list.vue
index 85005d9..63db439 100644
--- a/src/views/user/student/list.vue
+++ b/src/views/user/student/list.vue
@@ -4,11 +4,25 @@
<el-form-item label="鐢ㄦ埛鍚嶏細">
<el-input v-model="queryParam.userName"></el-input>
</el-form-item>
- <el-form-item>
- <el-button type="primary" @click="submitForm">鏌ヨ</el-button>
- <router-link :to="{path:'/user/student/edit'}" class="link-left">
- <el-button type="primary">娣诲姞</el-button>
- </router-link>
+ <el-form-item >
+ <div style="display: flex">
+ <el-button type="primary" @click="submitForm">鏌ヨ</el-button>
+ <router-link :to="{path:'/user/student/edit'}" class="link-left">
+ <el-button type="primary">娣诲姞</el-button>
+ </router-link>
+ <el-upload
+ class="upload-demo"
+ :action="upLoadUrl"
+ :with-credentials="true"
+ :on-success="handlePreview"
+ multiple
+ :show-file-list="false"
+ :file-list="fileList"
+ :before-upload="beforeAvatarUpload">
+ <el-button type="primary">瀵煎叆</el-button>
+ <!-- <div slot="tip" class="el-upload__tip">鍙兘涓婁紶Excel鏂囦欢</div>-->
+ </el-upload>
+ </div>
</el-form-item>
</el-form>
@@ -56,6 +70,8 @@
components: { Pagination },
data () {
return {
+ upLoadUrl:'/api/admin/user/import',
+ fileList:[],
queryParam: {
userName: '',
role: 1,
@@ -71,6 +87,37 @@
this.search()
},
methods: {
+ handlePreview(e){
+ console.log(e)
+ if (e.code==1){
+ this.search()
+ this.$message.success(e.message)
+ }else {
+ this.$message.error(e.message)
+ }
+ },
+ beforeAvatarUpload(file) {
+ let legalName = ['xlsx', 'xls']
+ // 鎷垮埌鍚庣紑鍚�
+ let name = file.name.substring(file.name.lastIndexOf('.') + 1, file.name.length)
+ if (legalName.includes(name)) {
+ // console.log(legalName.includes(name));
+ } else {
+ this.$message.warning('鏂囦欢鏍煎紡涓嶅锛屼粎闄恱ls鍜寈lsx')
+ return false
+ }
+ // console.log(file)
+ // const isJPG = file.type === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
+ // // const isLt2M = file.size / 1024 / 1024 < 2;
+ //
+ // if (!isJPG) {
+ // this.$message.error('涓婁紶鏂囦欢鍙兘鏄疎xcel!');
+ // }
+ // // if (!isLt2M) {
+ // // this.$message.error('涓婁紶澶村儚鍥剧墖澶у皬涓嶈兘瓒呰繃 2MB!');
+ // // }
+ // return isJPG ;
+ },
search () {
this.listLoading = true
userApi.getUserPageList(this.queryParam).then(data => {
@@ -137,3 +184,8 @@
}
}
</script>
+<style lang="scss" scoped>
+.upload-demo{
+ margin-left: 5px;
+}
+</style>
--
Gitblit v1.8.0