فهرست منبع

我的考试,展示达标状态和最近一次得分;历史记录展示数据顺序的调整

lidie 1 سال پیش
والد
کامیت
f3c799b03e
3فایلهای تغییر یافته به همراه97 افزوده شده و 29 حذف شده
  1. 15 8
      src/views/platform/bpmn/my-test/examDetail.vue
  2. 0 2
      src/views/platform/bpmn/my-test/examPop.vue
  3. 82 19
      src/views/platform/bpmn/my-test/index.vue

+ 15 - 8
src/views/platform/bpmn/my-test/examDetail.vue

@@ -122,7 +122,7 @@
                                         <van-radio name="×" disabled>×</van-radio>
                                         <van-radio name="×" disabled>×</van-radio>
                                     </van-radio-group>
                                     </van-radio-group>
                                     <template v-else>
                                     <template v-else>
-                                        <van-input
+                                        <van-field
                                             v-for="(o, i) in q.answer"
                                             v-for="(o, i) in q.answer"
                                             :key="`${index}${qIndex}${i}`"
                                             :key="`${index}${qIndex}${i}`"
                                             :value="o"
                                             :value="o"
@@ -158,7 +158,7 @@
                                         <van-radio name="×" disabled>×</van-radio>
                                         <van-radio name="×" disabled>×</van-radio>
                                     </van-radio-group>
                                     </van-radio-group>
                                     <template v-else>
                                     <template v-else>
-                                        <van-input
+                                        <van-field
                                             v-for="(o, i) in q.rightKey"
                                             v-for="(o, i) in q.rightKey"
                                             :key="`${index}${qIndex}${i}`"
                                             :key="`${index}${qIndex}${i}`"
                                             :value="o"
                                             :value="o"
@@ -185,7 +185,7 @@
                     <h4>试题名称:{{ paper.paperName }}</h4>
                     <h4>试题名称:{{ paper.paperName }}</h4>
                     <div>开始时间:{{ paper.startTime }}</div>
                     <div>开始时间:{{ paper.startTime }}</div>
                     <div>结束时间:{{ paper.endTime }}</div>
                     <div>结束时间:{{ paper.endTime }}</div>
-                    <div>
+                    <div v-if="paper.status === '已完成'">
                         <span>{{ `得分:${paper.resultScore} ` }}</span>
                         <span>{{ `得分:${paper.resultScore} ` }}</span>
                         <van-tag
                         <van-tag
                             :type="paper.isQualified ? 'success' : 'danger'"
                             :type="paper.isQualified ? 'success' : 'danger'"
@@ -234,7 +234,7 @@ export default {
     },
     },
     data() {
     data() {
         return {
         return {
-            active: 0,
+            active: -1,
             paperList: this.listExam,
             paperList: this.listExam,
             paperData: [],
             paperData: [],
             showPaperId: '',
             showPaperId: '',
@@ -248,15 +248,20 @@ export default {
             this.paperList = val
             this.paperList = val
         }
         }
     },
     },
-    created() {
-        console.log('this.listExam', this.listExam)
-    },
 
 
     async mounted() {
     async mounted() {
         this.handelListData()
         this.handelListData()
     },
     },
 
 
     methods: {
     methods: {
+        initializeActive() {
+            if (this.listExam && this.listExam.length > 0) {
+                const index = this.listExam.findIndex(item => item.status === '已完成')
+                this.active = index !== -1 ? index : 0 // 如果没有找到,则设置为0或其他默认值
+            } else {
+                this.active = 0 // 默认值
+            }
+        },
         photos(data) {
         photos(data) {
             if (data) {
             if (data) {
                 const photos = data
                 const photos = data
@@ -302,9 +307,11 @@ export default {
                 this.handlerDetail()
                 this.handlerDetail()
                 return
                 return
             }
             }
+            this.initializeActive()
             // paperList时间线(考了多少次)
             // paperList时间线(考了多少次)
             // paperData上面题库名称开始时间,结束时间啥的
             // paperData上面题库名称开始时间,结束时间啥的
-            this.paperData = this.paperList.find(i => i.dataId === this.detailData.paperId) || this.paperList[0]
+            this.paperData = this.paperList.find(item => item.status === '已完成') || this.paperList[0]
+            // this.paperData = this.paperList.find(i => i.dataId === this.detailData.paperId) || this.paperList[0]
             this.showPaperId = this.paperData.dataId
             this.showPaperId = this.paperData.dataId
             const isAllNotFinish = this.paperList.every(item => item.status !== '已完成')
             const isAllNotFinish = this.paperList.every(item => item.status !== '已完成')
             if (isAllNotFinish) {
             if (isAllNotFinish) {

+ 0 - 2
src/views/platform/bpmn/my-test/examPop.vue

@@ -605,9 +605,7 @@ export default {
             const submitData = []
             const submitData = []
             const time = that.$common.getDateNow(19)
             const time = that.$common.getDateNow(19)
             that.popList.forEach((item, index) => {
             that.popList.forEach((item, index) => {
-                // console.log('答案item', item)
                 item.answer = that.popListAnswer[index]
                 item.answer = that.popListAnswer[index]
-                // console.log('that.popListAnswer', that.popListAnswer)
                 const autoType = ['单选题', '多选题', '判断题'].includes(item.questionType)
                 const autoType = ['单选题', '多选题', '判断题'].includes(item.questionType)
                 const multipleType = ['多选题', '填空题'].includes(item.questionType)
                 const multipleType = ['多选题', '填空题'].includes(item.questionType)
                 const selectType = ['多选题', '单选题'].includes(item.questionType)
                 const selectType = ['多选题', '单选题'].includes(item.questionType)

+ 82 - 19
src/views/platform/bpmn/my-test/index.vue

@@ -57,6 +57,15 @@
                                     <van-col span="12">考试题库</van-col>
                                     <van-col span="12">考试题库</van-col>
                                     <van-col span="12">{{ item.bankName===''?'/':item.bankName===null?'/':item.bankName===undefined?'/':item.bankName }}</van-col>
                                     <van-col span="12">{{ item.bankName===''?'/':item.bankName===null?'/':item.bankName===undefined?'/':item.bankName }}</van-col>
                                 </van-row>
                                 </van-row>
+                                <!-- 增加考试状态 -->
+                                <van-row v-if="tabActive==1">
+                                    <van-col span="12">考试达标状态</van-col>
+                                    <van-col span="12"> <span :class="examAttainment(item)">{{ examAttainmentText(item) }}</span></van-col>
+                                </van-row>
+                                <van-row v-if="tabActive==1&&item.recentScore">
+                                    <van-col span="12">最近得分</van-col>
+                                    <van-col span="12"> <span>{{ item.recentScore }}</span></van-col>
+                                </van-row>
                             </div>
                             </div>
                         </template>
                         </template>
                         <!-- 插入内容 -->
                         <!-- 插入内容 -->
@@ -352,21 +361,6 @@ export default {
             next()
             next()
         }
         }
     },
     },
-    // watch: {
-    //     moreParams: {
-    //         handler(val) {
-    //             console.log('val', val.length)
-    //             if (val) {
-    //                 console.log('1111')
-    //             } else {
-    //                 console.log('222')
-    //             }
-    //             // this.moreParams = val
-    //         }
-    //     // deep: true
-    //     }
-    // },
-
     methods: {
     methods: {
         onClickTab(index) {
         onClickTab(index) {
             // this.loadData()
             // this.loadData()
@@ -384,7 +378,7 @@ export default {
                 const examineeId = item.examinee
                 const examineeId = item.examinee
                 const bankId = item.bankId
                 const bankId = item.bankId
                 const param = examId ? `and e.exam_id_ = '${examId}'` : 'and e.exam_id_ is null'
                 const param = examId ? `and e.exam_id_ = '${examId}'` : 'and e.exam_id_ is null'
-                const sql = `select e.id_ as dataId, e.exam_id_ as examId, e.kao_shi_ren_ as examinee, e.bu_men_ as dept, e.zhuang_tai_ as status, e.bao_ming_shi_jian as applyTime, e.kai_shi_shi_jian_ as startTime, e.jie_shu_shi_jian_ as endTime, e.ti_ku_zong_fen_ as totalScore, e.de_fen_ as resultScore, ed.ti_mu_id_ as questionId, ed.ti_gan_ as stem, ed.ti_xing_ as questionType, ed.fen_zhi_ as questionScore, ed.fu_tu_ as img, ed.xuan_xiang_lei_xi as optionsType, ed.xuan_xiang_ as options, ed.can_kao_da_an_ as rightKey, ed.ping_fen_fang_shi as rateType, ed.ping_fen_ren_ as rater, ed.hui_da_ as answer, ed.ping_yue_shi_jian as rateTime, ed.de_fen_ as score, ed.jie_xi_ as analysis, q.ti_ku_ming_cheng_ as paperName, case when e.exam_id_ is not null then ex.da_biao_zhan_bi_ else q.da_biao_zhan_bi_ end as qualifiedRadio, case when e.exam_id_ is not null then ex.ji_fen_fang_shi_ else q.ji_fen_fang_shi_ end as scoringType, case when e.exam_id_ is not null then ex.kao_shi_ming_chen else '自主考核' end as examName, case when e.exam_id_ is not null then ex.xian_kao_shi_jian else '不限' end as limitDate from t_examination e left join t_examination_detail ed on e.id_ = ed.parent_id_ left join  t_question_bank q on e.ti_ku_id_ = q.id_ left join  t_exams ex on e.exam_id_ = ex.id_ where e.ti_ku_id_ = '${bankId}' ${param} and e.kao_shi_ren_ = '${examineeId}' and (e.zhuang_tai_ = '已完成' or e.zhuang_tai_ = '已交卷') order by field(ed.ti_xing_, '单选题', '多选题', '判断题', '填空题', '简答题')`
+                const sql = `select e.id_ as dataId, e.exam_id_ as examId, e.kao_shi_ren_ as examinee, e.bu_men_ as dept, e.zhuang_tai_ as status, e.bao_ming_shi_jian as applyTime, e.kai_shi_shi_jian_ as startTime, e.jie_shu_shi_jian_ as endTime, e.ti_ku_zong_fen_ as totalScore, e.de_fen_ as resultScore, ed.ti_mu_id_ as questionId, ed.ti_gan_ as stem, ed.ti_xing_ as questionType, ed.fen_zhi_ as questionScore, ed.fu_tu_ as img, ed.xuan_xiang_lei_xi as optionsType, ed.xuan_xiang_ as options, ed.can_kao_da_an_ as rightKey, ed.ping_fen_fang_shi as rateType, ed.ping_fen_ren_ as rater, ed.hui_da_ as answer, ed.ping_yue_shi_jian as rateTime, ed.de_fen_ as score, ed.jie_xi_ as analysis, q.ti_ku_ming_cheng_ as paperName, case when e.exam_id_ is not null then ex.da_biao_zhan_bi_ else q.da_biao_zhan_bi_ end as qualifiedRadio, case when e.exam_id_ is not null then ex.ji_fen_fang_shi_ else q.ji_fen_fang_shi_ end as scoringType, case when e.exam_id_ is not null then ex.kao_shi_ming_chen else '自主考核' end as examName, case when e.exam_id_ is not null then ex.xian_kao_shi_jian else '不限' end as limitDate from t_examination e left join t_examination_detail ed on e.id_ = ed.parent_id_ left join  t_question_bank q on e.ti_ku_id_ = q.id_ left join  t_exams ex on e.exam_id_ = ex.id_ where e.ti_ku_id_ = '${bankId}' ${param} and e.kao_shi_ren_ = '${examineeId}' and (e.zhuang_tai_ = '已完成' or e.zhuang_tai_ = '已交卷') order by field(ed.ti_xing_, '单选题', '多选题', '判断题', '填空题', '简答题'),applyTime DESC`
                 // return new Promise((resolve, reject) => {
                 // return new Promise((resolve, reject) => {
                 this.$common.request('sql', sql).then(res => {
                 this.$common.request('sql', sql).then(res => {
                     const { data = [] } = res.variables || {}
                     const { data = [] } = res.variables || {}
@@ -454,6 +448,7 @@ export default {
                         })
                         })
                         item.totalCount = count
                         item.totalCount = count
                     })
                     })
+
                     // 获取最高分最低分
                     // 获取最高分最低分
                     const { maxScore, minScore } = result.filter(i => i.status === '已完成').reduce((acc, curr) => {
                     const { maxScore, minScore } = result.filter(i => i.status === '已完成').reduce((acc, curr) => {
                         if (curr.resultScore > acc.maxScore) {
                         if (curr.resultScore > acc.maxScore) {
@@ -482,6 +477,7 @@ export default {
                         this.closeDetail(false)
                         this.closeDetail(false)
                         return
                         return
                     }
                     }
+                    // this.detailData = result.find(item => item.status === '已完成')
                     this.examDetail = true
                     this.examDetail = true
                     //     resolve(result)
                     //     resolve(result)
                     // }).catch(error => {
                     // }).catch(error => {
@@ -506,6 +502,65 @@ export default {
             }
             }
             this.ReachBottomShow = true
             this.ReachBottomShow = true
         },
         },
+        // 考试达标状态
+        examAttainment(data) {
+            const { paperState, submittedCount, totalScore, qualifiedRadio, averageScore, maxScore, recentScore, scoringType } = data
+            // 只要有一次已完成,就是完成
+            if (paperState === '已完成') {
+                // 计算是否达标
+                const passScore = +totalScore * +qualifiedRadio / 100
+                let curScore = null
+                if (scoringType === '平均分') {
+                    curScore = +averageScore
+                }
+                if (scoringType === '最高分') {
+                    curScore = +maxScore
+                }
+                if (scoringType === '最近得分') {
+                    curScore = +recentScore
+                }
+                return curScore >= passScore ? 'passed' : 'failed'
+                // if (curScore >= passScore) {
+                //     return `已达标`
+                // }
+                // return `未达标`
+            } else {
+                // 未完成分两种:未开始和待批阅
+                return submittedCount > 0 ? 'pending-review' : ''
+                // if (submittedCount > 0) {
+                //     return `待批阅`
+                // }
+                // return '/'
+            }
+        },
+        examAttainmentText(data) {
+            const { paperState, submittedCount, totalScore, qualifiedRadio, averageScore, maxScore, recentScore, scoringType } = data
+            // 只要有一次已完成,就是完成
+            if (paperState === '已完成') {
+                // 计算是否达标
+                const passScore = +totalScore * +qualifiedRadio / 100
+                let curScore = null
+                if (scoringType === '平均分') {
+                    curScore = +averageScore
+                }
+                if (scoringType === '最高分') {
+                    curScore = +maxScore
+                }
+                if (scoringType === '最近得分') {
+                    curScore = +recentScore
+                }
+                if (curScore >= passScore) {
+                    return `已达标`
+                }
+                return `未达标`
+            } else {
+                // 未完成分两种:未开始和待批阅
+                if (submittedCount > 0) {
+                    return `待批阅`
+                }
+                return '/'
+            }
+        },
 
 
         showPopup() {
         showPopup() {
             this.ReachBottomShow = true
             this.ReachBottomShow = true
@@ -726,9 +781,6 @@ export default {
             const canshu = (key1 !== '' || key2 !== '') ? `${canshu1} ${canshu2}`.trim() : key !== '' ? `and (examName like '%${key}%' or bankName like '%${key}%')` : ''
             const canshu = (key1 !== '' || key2 !== '') ? `${canshu1} ${canshu2}`.trim() : key !== '' ? `and (examName like '%${key}%' or bankName like '%${key}%')` : ''
             // let canshu = key != '' ? `and (examName like '%${key}%' or bankName like '%${key}%')` : ''
             // let canshu = key != '' ? `and (examName like '%${key}%' or bankName like '%${key}%')` : ''
             // const sql = `select * from v_examination where examinee = '${this.info.employee.id}' and examType like '%${this.name === '全部' ? '' : this.name}%' ${canshu} ORDER BY startDate DESC LIMIT ${page},10`
             // const sql = `select * from v_examination where examinee = '${this.info.employee.id}' and examType like '%${this.name === '全部' ? '' : this.name}%' ${canshu} ORDER BY startDate DESC LIMIT ${page},10`
-            // 已考待考(以考试次数是否使用完为区分点)
-            // const sql1 = `select * from (select * from v_examination where examinee = '${this.info.employee.id}' and examType like '%${this.name === '全部' ? '' : this.name}%' ${canshu}${canshu3}${canshu4} ORDER BY startDate DESC LIMIT ${page},10) a LEFT JOIN (select exam_id_,id_,COUNT(id_) as num from t_examination where kao_shi_ren_ = '${this.info.employee.id}' and zhuang_tai_ != '已取消' GROUP BY exam_id_) b on a.examId = b.exam_id_`
-            // const sql2 = `select * from (select * from v_examination where examinee = '${this.info.employee.id}' and examType like '%${this.name === '全部' ? '' : this.name}%' ${canshu}${canshu3}${canshu4} ) a INNER JOIN (select exam_id_,id_,COUNT(id_) as num from t_examination where kao_shi_ren_ = '${this.info.employee.id}' and  (zhuang_tai_ ='已完成' OR zhuang_tai_ ='已交卷'  )  GROUP BY exam_id_) b on a.examId = b.exam_id_ ORDER BY startDate DESC LIMIT ${page},10`
             // 已考待考(已0为区分点)
             // 已考待考(已0为区分点)
             // const sql1 = `select * from (select * from v_examination where examinee = '${this.info.employee.id}' and examType like '%${this.name === '全部' ? '' : this.name}%' ${canshu}${canshu3}${canshu4} ORDER BY startDate DESC LIMIT ${page},10) a LEFT JOIN (select exam_id_,id_,COUNT(id_) as num from t_examination where kao_shi_ren_ = '${this.info.employee.id}' and zhuang_tai_ != '已取消' GROUP BY exam_id_) b on a.examId = b.exam_id_ where num = 1 AND paperState='未开始' AND examState='已发布' `
             // const sql1 = `select * from (select * from v_examination where examinee = '${this.info.employee.id}' and examType like '%${this.name === '全部' ? '' : this.name}%' ${canshu}${canshu3}${canshu4} ORDER BY startDate DESC LIMIT ${page},10) a LEFT JOIN (select exam_id_,id_,COUNT(id_) as num from t_examination where kao_shi_ren_ = '${this.info.employee.id}' and zhuang_tai_ != '已取消' GROUP BY exam_id_) b on a.examId = b.exam_id_ where num = 1 AND paperState='未开始' AND examState='已发布' `
             // const sql2 = `select * from (select * from v_examination where examinee = '${this.info.employee.id}' and examType like '%${this.name === '全部' ? '' : this.name}%' ${canshu}${canshu3}${canshu4} ) a INNER JOIN (select exam_id_,id_,COUNT(id_) as num from t_examination where kao_shi_ren_ = '${this.info.employee.id}' and  (zhuang_tai_ ='已完成' OR zhuang_tai_ ='已交卷'  )  GROUP BY exam_id_) b on a.examId = b.exam_id_ where num>=1 AND paperState='已完成' ORDER BY startDate DESC LIMIT ${page},10`
             // const sql2 = `select * from (select * from v_examination where examinee = '${this.info.employee.id}' and examType like '%${this.name === '全部' ? '' : this.name}%' ${canshu}${canshu3}${canshu4} ) a INNER JOIN (select exam_id_,id_,COUNT(id_) as num from t_examination where kao_shi_ren_ = '${this.info.employee.id}' and  (zhuang_tai_ ='已完成' OR zhuang_tai_ ='已交卷'  )  GROUP BY exam_id_) b on a.examId = b.exam_id_ where num>=1 AND paperState='已完成' ORDER BY startDate DESC LIMIT ${page},10`
@@ -829,4 +881,15 @@ export default {
     overflow: auto; /* 当内容超出容器时显示滚动条 */
     overflow: auto; /* 当内容超出容器时显示滚动条 */
     // padding: 10px; /* 可选:内边距 */
     // padding: 10px; /* 可选:内边距 */
   }
   }
+  .passed {
+  color: #67c23a; /* 已达标 */
+}
+
+.failed {
+  color: #f43636; /* 未达标 */
+}
+
+.pending-review {
+  color: #ffa500; /* 待批阅 */
+}
 </style>
 </style>