Explorar o código

考试详情页面数据bug修复

cfort %!s(int64=2) %!d(string=hai) anos
pai
achega
f717fecd9b
Modificáronse 1 ficheiros con 10 adicións e 4 borrados
  1. 10 4
      src/views/platform/examination/exam/detail.vue

+ 10 - 4
src/views/platform/examination/exam/detail.vue

@@ -82,7 +82,7 @@
                 </div>
                 <div class="info-item">
                     <span class="label">达标率:</span>
-                    <span class="value">-</span>
+                    <span class="value">{{ passRate }}</span>
                 </div>
             </div>
             <div class="paper-table">
@@ -226,7 +226,8 @@ export default {
             examineeId: '',
             maxScore: '',
             minScore: '',
-            avgScore: ''
+            avgScore: '',
+            passRate: ''
         }
     },
     watch: {
@@ -285,6 +286,11 @@ export default {
             const minutes = Math.floor((parseInt(timeStamp) % 3600000) / 60000)
             return hours + '小时' + minutes + '分钟'
         },
+        getPassRate (list) {
+            const passScore = parseFloat(list[0].qualifiedRadio) / 100 * parseFloat(list[0].totalScore)
+            const passList = list.filter(i => i.resultScore >= passScore)
+            return (passList.length / list.length * 100).toFixed(2) + '%'
+        },
         getQuestionData () {
             const sql = `select qb.ti_ku_ming_cheng_ as bankName, ex.id_ as examId, ex.ti_ku_id_ as bankId, e.id_ as paperId, ex.zhuang_tai_ as examState, e.zhuang_tai_ as paperState, qb.ti_shu_ as questionCount, qb.zong_fen_ as totalScore, ex.kao_shi_ming_chen as examName, ex.can_kao_ren_yuan_ as examinee, e.kao_shi_ren_ as examineeId, ex.create_by_ as createBy, ex.chuang_jian_shi_j as createTime, ex.fa_bu_shi_jian_ as publishDate, ex.xian_kao_shi_jian as limitDate, ex.kao_shi_shi_chang as duration, ex.xian_kao_ci_shu_ as limitCount, ex.da_biao_zhan_bi_ as qualifiedRadio, ex.ji_fen_fang_shi_ as scoringType, ex.yun_xu_bao_ming_ as allowRegist, ex.kao_shi_miao_shu_ as examDesc, e.de_fen_ as score, e.bao_ming_shi_jian as applyTime, e.kai_shi_shi_jian_ as startTime, e.jie_shu_shi_jian_ as endTime from t_exams ex, t_question_bank qb, t_examination e where ex.ti_ku_id_ = qb.id_ and e.exam_id_ = ex.id_ and ex.id_ = '${this.examId}' order by e.kao_shi_ren_ desc, e.jie_shu_shi_jian_ desc`
             return new Promise((resolve, reject) => {
@@ -335,7 +341,8 @@ export default {
                     const finishList = result.filter(i => i.examStatus === '已完成')
                     this.maxScore = finishList.length ? maxBy(finishList, 'max').max : nodatadesc
                     this.minScore = finishList.length ? minBy(finishList, 'min').min : nodatadesc
-                    this.avgScore = finishList.length ? meanBy(finishList, 'avg').avg : nodatadesc
+                    this.avgScore = finishList.length ? meanBy(finishList, 'avg').toFixed(2) : nodatadesc
+                    this.passRate = finishList.length ? this.getPassRate(finishList) : nodatadesc
                     resolve(result)
                 }).catch(error => {
                     reject(error)
@@ -343,7 +350,6 @@ export default {
             })
         },
         handleRowDblclick (row) {
-            console.log('???')
             this.paperId = row.paperId
             this.examineeId = row.examineeId
             this.paperDialogVisible = true