From 458a16314b4ffee596490ba5c44878570287b21b Mon Sep 17 00:00:00 2001 From: luohairen <3399054449@qq.com> Date: 星期四, 14 十一月 2024 10:34:54 +0800 Subject: [PATCH] 班级成绩图表分析 --- src/views/dashboard/index.vue | 73 ++++++++++++++++++------------------ 1 files changed, 37 insertions(+), 36 deletions(-) diff --git a/src/views/dashboard/index.vue b/src/views/dashboard/index.vue index d14d011..ae8b3e8 100644 --- a/src/views/dashboard/index.vue +++ b/src/views/dashboard/index.vue @@ -34,27 +34,27 @@ </el-col> <el-col :xs="12" :sm="12" :lg="5" class="card-panel-col"> <div class="nameClass"> - <p class="examInfo-text">搴旇�冧汉鏁帮細{{examInfo.toUserCount}}</p> + <p class="examInfo-text">搴旇�冧汉鏁帮細{{examInfo.totalUserCount}}</p> </div> </el-col> <el-col :xs="12" :sm="12" :lg="5" class="card-panel-col"> <div class="nameClass"> - <p class="examInfo-text">缂鸿�冧汉鏁帮細{{examInfo.missUserCount}}</p> + <p class="examInfo-text">缂鸿�冧汉鏁帮細{{examInfo.lackUserCount}}</p> </div> </el-col> <el-col :xs="12" :sm="12" :lg="4" class="card-panel-col"> <div class="nameClass"> - <p class="examInfo-text">鏈�楂樺垎锛歿{examInfo.maxScore}}</p> + <p class="examInfo-text">鏈�楂樺垎锛歿{examInfo.highestScore}}</p> </div> </el-col> <el-col :xs="12" :sm="12" :lg="4" class="card-panel-col"> <div class="nameClass"> - <p class="examInfo-text">鏈�浣庡垎锛歿{examInfo.minScore}}</p> + <p class="examInfo-text">鏈�浣庡垎锛歿{examInfo.lowestScore}}</p> </div> </el-col> </el-row> - <el-row> - + <el-row :xs="12" :sm="12" :lg="20" class="echarts-line" style="height: 490px;"> + <div id="echarts-moth-exam" style="width: 100%;height:400px;" v-loading="loading"/> </el-row> </el-col> </el-row> @@ -93,24 +93,30 @@ // 鑰冭瘯鍚嶇О currentExamName: '', // 搴斿埌浜烘暟 - toUserCount: 0, + totalUserCount: 0, // 缂鸿�冧汉鏁� - missUserCount: 0, + lackUserCount: 0, // 鏈�楂樺垎 - maxScore: 0, + highestScore: 0, // 鏈�浣庡垎 - minScore: 0, + lowestScore: 0, + // 瀛︾敓濮撳悕 + userNames: [], + // 瀛︾敓鑰冭瘯鎴愮哗 + userScores: [], }, examPaperCount: 0, questionCount: 0, doExamPaperCount: 0, doQuestionCount: 0, + echartsExam: null, echartsUserAction: null, echartsQuestion: null, loading: false } }, mounted () { + this.echartsExam = echarts.init(document.getElementById('echarts-moth-exam'), 'macarons') // eslint-disable-next-line no-undef this.echartsUserAction = echarts.init(document.getElementById('echarts-moth-user'), 'macarons') // eslint-disable-next-line no-undef @@ -123,6 +129,7 @@ _this.questionCount = response.questionCount _this.doExamPaperCount = response.doExamPaperCount _this.doQuestionCount = response.doQuestionCount + // _this.echartsExam.setOption(this.option('鐝骇鑰冭瘯鎴愮哗', '{b}鏃c}鍦�', response.mothDayText, response.mothDayExamPaperValue)) _this.echartsUserAction.setOption(this.option('鐢ㄦ埛娲昏穬搴�', '{b}鏃c}搴�', response.mothDayText, response.mothDayUserActionValue)) _this.echartsQuestion.setOption(this.option('棰樼洰鏈堟暟閲�', '{b}鏃c}棰�', response.mothDayText, response.mothDayDoExamQuestionValue)) this.loading = false @@ -135,42 +142,36 @@ getExamList(this.query).then(res => { let response = res.data _this.examList = response.data + _this.handleRowClick(_this.examList[0]) }) }, // 鐐瑰嚮鑰冭瘯鍒楄〃鏇存柊鑰冭瘯鏁版嵁 handleRowClick(row){ // 娓呯┖鏃х殑鑰冭瘯鏁版嵁 this.examInfo = { - // 鑰冭瘯鍚嶇О currentExamName: '', - // 搴斿埌浜烘暟 - toUserCount: 0, - // 缂鸿�冧汉鏁� - missUserCount: 0, - // 鏈�楂樺垎 - maxScore: 0, - // 鏈�浣庡垎 - minScore: 0, + totalUserCount: 0, + lackUserCount: 0, + highestScore: 0, + lowestScore: 0, + userNames: [], + userScores: [], } - // 鑾峰彇褰撳墠鑰冭瘯鍚嶇О + // 鏇存柊褰撳墠鑰冭瘯鍚嶇О this.examInfo.currentExamName = row.examName - // 鑾峰彇搴斿埌瀹炲埌浜烘暟 - examPaperAnswerApi.pageExamPaper({examId: row.id, pageIndex: 1, pageSize: 10}).then(res => { - let response = res.data.list[0] - this.examInfo.toUserCount = response.personTotalNum - this.examInfo.missUserCount = this.examInfo.toUserCount - response.personAnswerNum + // 鑾峰彇搴旇�冪己鑰冧汉鏁板拰鏈�楂樺垎鏈�浣庡垎锛屼互鍙婅鐝骇鎵�鏈夊鐢熷強鍏惰�冭瘯鎴愮哗 + examPaperAnswerApi.getExamPaperInfo(row.id).then(res => { + this.examInfo.totalUserCount = res.data.totalUserCount + this.examInfo.lackUserCount = res.data.lackUserCount + this.examInfo.highestScore = res.data.highestScore + this.examInfo.lowestScore = res.data.lowestScore + this.examInfo.userNames = res.data.userNames + this.examInfo.userScores = res.data.userScores + // 閲嶆柊娓叉煋鍥捐〃 + this.echartsExam.setOption(this.option('鐝骇鑰冭瘯鎴愮哗', '{b}:{c}鍒�', this.examInfo.userNames, this.examInfo.userScores)) }) - // 鑾峰彇鏈満鑰冭瘯鐨勬渶楂樺垎鍜屾渶浣庡垎 - examPaperAnswerApi.queryMaxAndMinScore(row.id).then(res => { - let data = res.data - if (!data || data.length === 0) { - this.examInfo.maxScore = 0 - this.examInfo.minScore = 0 - }else { - this.examInfo.maxScore = data[0].totalScore - this.examInfo.minScore = data[1].totalScore - } - }) + + }, option (title, formatter, label, vaule) { return { -- Gitblit v1.8.0