From 9e0295ecdc7398f7997c1f0fab9274b42630bc87 Mon Sep 17 00:00:00 2001 From: 龚焕茏 <2842157468@qq.com> Date: 星期三, 15 五月 2024 15:35:20 +0800 Subject: [PATCH] refactor:统计调整 --- src/views/answer/sheetStatistics.vue | 53 ++++++++++++++++++++--------------------------------- 1 files changed, 20 insertions(+), 33 deletions(-) diff --git a/src/views/answer/sheetStatistics.vue b/src/views/answer/sheetStatistics.vue index 4c6e6da..b83fdfb 100644 --- a/src/views/answer/sheetStatistics.vue +++ b/src/views/answer/sheetStatistics.vue @@ -7,7 +7,7 @@ </el-select> </el-form-item> <el-form-item label="閮ㄩ棬锛�" v-if="true"> - <el-select v-model="queryParam.departmentId" placeholder="閮ㄩ棬" clearable> + <el-select v-model="queryParam.departmentId" filterable placeholder="閮ㄩ棬" clearable> <el-option v-for="item in levelEnum" :key="item.key" :value="item.key" :label="item.value" /> </el-select> </el-form-item> @@ -46,7 +46,7 @@ </div> </template> <script> -import { mapGetters, mapState, mapActions } from 'vuex'; +import { mapGetters, mapState } from 'vuex'; import dashboardApi from '@/api/dashboard'; const colorList = ['#3498DB', '#E74C3C', '#F1C40F', '#95A5A6', '#8E44AD', '#F39C12', '#D35400']; @@ -61,12 +61,14 @@ }; const scoreLabel = { 'score0To59': '灏忎簬60鍒�', - 'score60To79': '60-79鍒�', - 'score80To100': '80-100鍒�' + 'score60To69': '60-69鍒�', + 'score70To79': '70-79鍒�', + 'score80To89': '80-89鍒�', + 'score90To100': '90-100鍒�' }; const pieLabel = { - 'totalAbsent': '鍙備笌鑰冭瘯', - 'totalAttended': '鏈弬涓庤�冭瘯' + 'totalAttended': '鍙備笌鑰冭瘯', + 'totalAbsent': '鏈弬涓庤�冭瘯' }; let ageChart = null; let scroeChart = null; @@ -76,39 +78,25 @@ data() { return { examPaperList: [], - max: '', - min: '', - avg: '', chartLoading1: false, chartLoading2: false, chartLoading3: false, - loading: false, - examPaperCount: 0, - questionCount: 0, - doExamPaperCount: 0, - doQuestionCount: 0, - echartsUserAction: null, queryParam: { - examPaperId: '85', - departmentId: '', - subjectId: null, - pageIndex: 1, - pageSize: 10 - }, - listLoading: false + examPaperId: '', + departmentId: '' + } }; - }, - created() { - dashboardApi.examPaperList().then(res => { - this.examPaperList = res.response; - }); }, mounted() { ageChart = echarts.init(this.$refs.ageChart); scroeChart = echarts.init(this.$refs.scoreChart); peopleChart = echarts.init(this.$refs.peopleChart); - this.getChartData(); - this.observe(); + dashboardApi.examPaperList().then(res => { + this.examPaperList = res.response; + this.queryParam.examPaperId = this.examPaperList[0].id + this.getChartData(); + this.observe(); + }); }, methods: { getChartData() { @@ -119,8 +107,8 @@ const { age, score, examPeopleNum } = re.response; const ageOption = this.barOption('骞撮緞娈电粺璁�', age, ageLabel); - const scoreOption = this.barOption('鑰冭瘯鎴愮哗缁熻', score, scoreLabel); - const peopleOption = this.pieOption('鑰冭瘯鎯呭喌', examPeopleNum, pieLabel); + const scoreOption = this.barOption('鍒嗘暟娈电粺璁�', score, scoreLabel); + const peopleOption = this.pieOption('鑰冭瘯浜烘暟', examPeopleNum, pieLabel); ageChart.setOption(ageOption, true); scroeChart.setOption(scoreOption, true); @@ -184,7 +172,7 @@ text: title, x: 'left' }, - color: colorList, + color: ['#E74C3C', '#3498DB', '#F1C40F', '#95A5A6', '#8E44AD', '#F39C12', '#D35400'], tooltip: { trigger: 'item' }, @@ -210,7 +198,6 @@ }, submitForm() { - this.queryParam.pageIndex = 1; this.getChartData(); }, -- Gitblit v1.8.0