|
|
@@ -7,11 +7,10 @@
|
|
|
left-arrow
|
|
|
@click-left="$router.push({ name: 'dashboard' })"
|
|
|
/>
|
|
|
+ <van-tabs v-model="tabActive" color="#3396FB" @click="onClickTab">
|
|
|
+ <van-tab v-for="data in tabDatas" :key="data.name" :name="data.name" :title="data.title" />
|
|
|
+ </van-tabs>
|
|
|
<van-search v-model="subject" show-action placeholder="请输入搜索关键词" @search="onSearch">
|
|
|
- <!-- <template #left>
|
|
|
- <van-icon name="bars" :class="{'ibps-active':$utils.isNotEmpty(typeId)}" class="ibps-pr-5"
|
|
|
- @click="clickType" />
|
|
|
- </template> -->
|
|
|
<template #action>
|
|
|
<van-icon name="filter-o" :class="{'ibps-active':stateActive}" @click="clickMoreSearch" />
|
|
|
</template>
|
|
|
@@ -21,7 +20,7 @@
|
|
|
<van-pull-refresh v-model="refreshing" @refresh="onRefresh">
|
|
|
<van-list v-model="loading" :finished="finished" @load="loadData">
|
|
|
<van-checkbox-group v-model="checkedIds">
|
|
|
- <van-cell v-for="(item,index) in listData" :key="item.id+index" :title="item.examName">
|
|
|
+ <van-cell v-for="(item,index) in listData" :key="item.id+index" :title="item.examName" @click="onDialogShow(item)">
|
|
|
<!-- :label="getTaskDesc(item.subject)" @click="onClick(item,index)"> -->
|
|
|
<!-- 插入图标 -->
|
|
|
<template slot="icon">
|
|
|
@@ -60,7 +59,7 @@
|
|
|
</template>
|
|
|
<!-- 插入内容 -->
|
|
|
<span>{{ item.createTime|formatRelativeTime }}</span>
|
|
|
- <div style="margin-top: 90%;height: 100%;">
|
|
|
+ <div v-if="tabActive==0" style="margin-top: 90%;height: 100%;">
|
|
|
<van-tag type="primary" size="medium" @click="onClick(item,index)">开始考试</van-tag>
|
|
|
</div>
|
|
|
<!-- <div> -->
|
|
|
@@ -184,14 +183,26 @@
|
|
|
<van-popup v-model="showPop" :style="{ width: '100%', height: '100%' }">
|
|
|
<exam-pop
|
|
|
v-if="showPop"
|
|
|
+ :id="id"
|
|
|
ref="childPop"
|
|
|
- :id1="id1"
|
|
|
:not-start="countTotal.notStart"
|
|
|
:list-data="examPopup"
|
|
|
:bank-id=" examPopup.bankId"
|
|
|
:show="showPop"
|
|
|
@updataSet="updataSet"
|
|
|
/></van-popup>
|
|
|
+ <!--
|
|
|
+ <van-popup v-model="examDetail" :style="{ width: '100%', height: 'auto', maxHeight: '100vh' }">
|
|
|
+ <exam-detail -->
|
|
|
+ <van-popup v-model="examDetail" :style="{ width: '100%', height: '100%' }">
|
|
|
+ <exam-detail
|
|
|
+ v-if="examDetail"
|
|
|
+ :detail-data="detailData"
|
|
|
+ :exam-detail="examDetail"
|
|
|
+ :list-exam="listExam"
|
|
|
+ @closeDetail="closeDetail"
|
|
|
+ />
|
|
|
+ </van-popup>
|
|
|
<van-divider v-if="footText">到底了~</van-divider>
|
|
|
<van-empty v-if="noData" description="暂无数据" />
|
|
|
|
|
|
@@ -199,7 +210,7 @@
|
|
|
</template>
|
|
|
<script>
|
|
|
import { mapState } from 'vuex'
|
|
|
-import examPop from './examPop.vue'
|
|
|
+
|
|
|
import ActionUtils from '@/utils/action'
|
|
|
import i18n from '@/utils/i18n'
|
|
|
import random from '@/mixins/random'
|
|
|
@@ -211,6 +222,8 @@ import IbpsToolbar from '@/components/ibps-toolbar'
|
|
|
import IbpsListResultPage from '@/components/ibps-list-result-page'
|
|
|
import IbpsBpmnFormrenderDialog from '@/business/platform/bpmn/form/dialog'
|
|
|
import { Notify } from 'vant'
|
|
|
+import examPop from './examPop.vue'
|
|
|
+import examDetail from './examDetail.vue'
|
|
|
|
|
|
export default {
|
|
|
components: {
|
|
|
@@ -220,15 +233,32 @@ export default {
|
|
|
IbpsToolbar,
|
|
|
IbpsListResultPage,
|
|
|
IbpsBpmnFormrenderDialog,
|
|
|
- examPop
|
|
|
+ examPop,
|
|
|
+ examDetail
|
|
|
},
|
|
|
mixins: [random, bpmnStatus],
|
|
|
data() {
|
|
|
const { userId, userList = [], deptList = [], menus, userInfo } = this.$store.getters
|
|
|
return {
|
|
|
+ tabActive: 0,
|
|
|
+ tabDatas: [{
|
|
|
+ name: 0,
|
|
|
+ title: '待考'
|
|
|
+ }, {
|
|
|
+ name: 1,
|
|
|
+ title: '已考'
|
|
|
+ }],
|
|
|
+ id: '',
|
|
|
+ listExam: [],
|
|
|
+ dataList: [],
|
|
|
+ paperList: [],
|
|
|
+ detailData: '',
|
|
|
+ paperData: [],
|
|
|
+ showPaperId: '',
|
|
|
userId: userId,
|
|
|
footText: false,
|
|
|
showPop: false,
|
|
|
+ examDetail: false,
|
|
|
noData: false,
|
|
|
showConfirmationBoxList: true,
|
|
|
countTotal: {},
|
|
|
@@ -317,6 +347,223 @@ export default {
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
+ onClickTab(index) {
|
|
|
+ // this.loadData()
|
|
|
+ // 清空查询条件
|
|
|
+ this.subject = ''
|
|
|
+ // this.typeId = ''
|
|
|
+ // this.moreParams = {}
|
|
|
+
|
|
|
+ this.onSearch()
|
|
|
+ },
|
|
|
+ async onDialogShow(item) {
|
|
|
+ if (this.tabActive === 1) {
|
|
|
+ this.detailData = item
|
|
|
+ const examId = item.examId
|
|
|
+ const examineeId = item.examinee
|
|
|
+ const bankId = item.bankId
|
|
|
+ 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_, '单选题', '多选题', '判断题', '填空题', '简答题')`
|
|
|
+ // return new Promise((resolve, reject) => {
|
|
|
+ this.$common.request('sql', sql).then(res => {
|
|
|
+ const { data = [] } = res.variables || {}
|
|
|
+ if (!data.length) {
|
|
|
+ // this.$message.error('未查询到已提交的考试记录,请先完成考试!')
|
|
|
+ Notify({ type: 'primary', message: '未查询到已提交的考试记录,请先完成考试!' })
|
|
|
+ this.closeDialog()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ const result = []
|
|
|
+ data.map(item => {
|
|
|
+ // 数据转换
|
|
|
+ if (['单选题', '多选题'].includes(item.questionType)) {
|
|
|
+ item.options = JSON.parse(item.options)
|
|
|
+ item.rightKey = item.questionType === '多选题' ? item.rightKey.split(',') : item.rightKey
|
|
|
+ item.answer = item.questionType === '多选题' ? JSON.parse(item.answer) : item.answer
|
|
|
+ } else if (item.questionType === '填空题') {
|
|
|
+ item.rightKey = item.rightKey ? JSON.parse(item.rightKey) : []
|
|
|
+ item.answer = item.answer ? JSON.parse(item.answer) : Array(item.rightKey.length).fill('')
|
|
|
+ } else if (item.questionType === '简答题') {
|
|
|
+ item.rightKey = [item.rightKey]
|
|
|
+ item.answer = [item.answer]
|
|
|
+ }
|
|
|
+ item.img = item.img ? JSON.parse(item.img) : ''
|
|
|
+
|
|
|
+ // 数据分组
|
|
|
+ const index = result.findIndex(i => i.dataId === item.dataId)
|
|
|
+ if (index === -1) {
|
|
|
+ const { dataId, examinee, dept, status, applyTime, startTime, endTime, qualifiedRadio, paperName, totalScore, resultScore, scoringType } = item || {}
|
|
|
+ result.push({
|
|
|
+ dataId,
|
|
|
+ examinee,
|
|
|
+ dept,
|
|
|
+ status,
|
|
|
+ applyTime,
|
|
|
+ startTime,
|
|
|
+ endTime,
|
|
|
+ qualifiedRadio,
|
|
|
+ isQualified: status === '已完成' ? parseFloat(resultScore) >= (parseFloat(qualifiedRadio) / 100 * parseFloat(totalScore)) : '',
|
|
|
+ paperName,
|
|
|
+ totalScore: parseFloat(totalScore),
|
|
|
+ resultScore: parseFloat(resultScore),
|
|
|
+ // totalCount: data.length,
|
|
|
+ scoringType,
|
|
|
+ list: [{
|
|
|
+ type: item.questionType,
|
|
|
+ questions: [item]
|
|
|
+ }]
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ const qIndex = result[index].list.findIndex(i => i.type === item.questionType)
|
|
|
+ if (qIndex === -1) {
|
|
|
+ result[index].list.push({
|
|
|
+ type: item.questionType,
|
|
|
+ questions: [item]
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ result[index].list[qIndex].questions.push(item)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ result.forEach(item => {
|
|
|
+ let count = 0
|
|
|
+ item.list.forEach(i => {
|
|
|
+ count += i.questions.length
|
|
|
+ i.totalScore = i.questions.reduce((a, b) => a + parseFloat(b.questionScore), 0)
|
|
|
+ })
|
|
|
+ item.totalCount = count
|
|
|
+ })
|
|
|
+ // 获取最高分最低分
|
|
|
+ const { maxScore, minScore } = result.filter(i => i.status === '已完成').reduce((acc, curr) => {
|
|
|
+ if (curr.resultScore > acc.maxScore) {
|
|
|
+ acc.maxScore = curr.resultScore
|
|
|
+ }
|
|
|
+ if (curr.resultScore < acc.minScore) {
|
|
|
+ acc.minScore = curr.resultScore
|
|
|
+ }
|
|
|
+ return acc
|
|
|
+ }, { maxScore: -Infinity, minScore: Infinity })
|
|
|
+ this.maxScore = maxScore
|
|
|
+ this.minScore = minScore
|
|
|
+ this.listExam = result
|
|
|
+ if (!bankId) {
|
|
|
+ Notify({ type: 'danger', message: '获取题目信息失败,请重试!' })
|
|
|
+ this.closeDetail(false)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.paperList = result
|
|
|
+ this.paperData = this.paperList.find(i => i.dataId === item.paperId) || this.paperList[0]
|
|
|
+ this.showPaperId = this.paperData.dataId
|
|
|
+ const isAllNotFinish = this.paperList.every(item => item.status !== '已完成')
|
|
|
+ if (isAllNotFinish) {
|
|
|
+ Notify({ type: 'warning', message: '考试未完成或未评分,请稍后再试!' })
|
|
|
+ // this.$message.error('考试未完成或未评分,请稍后再试!')
|
|
|
+ this.closeDetail(false)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.examDetail = true
|
|
|
+ // resolve(result)
|
|
|
+ // }).catch(error => {
|
|
|
+ // reject(error)
|
|
|
+ // })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // getQuestionData() {
|
|
|
+ // const param = this.examId ? `and e.exam_id_ = '${this.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_ = '${this.bankId}' ${param} and e.kao_shi_ren_ = '${this.examineeId}' and (e.zhuang_tai_ = '已完成' or e.zhuang_tai_ = '已交卷') order by field(ed.ti_xing_, '单选题', '多选题', '判断题', '填空题', '简答题')`
|
|
|
+ // return new Promise((resolve, reject) => {
|
|
|
+ // this.$common.request('sql', sql).then(res => {
|
|
|
+ // const { data = [] } = res.variables || {}
|
|
|
+ // if (!data.length) {
|
|
|
+ // Notify({ type: 'primary', message: '未查询到已提交的考试记录,请先完成考试!' })
|
|
|
+ // // this.$message.error('未查询到已提交的考试记录,请先完成考试!')
|
|
|
+ // this.closeDialog()
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ // const result = []
|
|
|
+ // data.map(item => {
|
|
|
+ // // 数据转换
|
|
|
+ // if (['单选题', '多选题'].includes(item.questionType)) {
|
|
|
+ // item.options = JSON.parse(item.options)
|
|
|
+ // item.rightKey = item.questionType === '多选题' ? item.rightKey.split(',') : item.rightKey
|
|
|
+ // item.answer = item.questionType === '多选题' ? JSON.parse(item.answer) : item.answer
|
|
|
+ // } else if (item.questionType === '填空题') {
|
|
|
+ // item.rightKey = item.rightKey ? JSON.parse(item.rightKey) : []
|
|
|
+ // item.answer = item.answer ? JSON.parse(item.answer) : Array(item.rightKey.length).fill('')
|
|
|
+ // } else if (item.questionType === '简答题') {
|
|
|
+ // item.rightKey = [item.rightKey]
|
|
|
+ // item.answer = [item.answer]
|
|
|
+ // }
|
|
|
+ // item.img = item.img ? JSON.parse(item.img) : ''
|
|
|
+
|
|
|
+ // // 数据分组
|
|
|
+ // const index = result.findIndex(i => i.dataId === item.dataId)
|
|
|
+ // if (index === -1) {
|
|
|
+ // const { dataId, examinee, dept, status, applyTime, startTime, endTime, qualifiedRadio, paperName, totalScore, resultScore, scoringType } = item || {}
|
|
|
+ // result.push({
|
|
|
+ // dataId,
|
|
|
+ // examinee,
|
|
|
+ // dept,
|
|
|
+ // status,
|
|
|
+ // applyTime,
|
|
|
+ // startTime,
|
|
|
+ // endTime,
|
|
|
+ // qualifiedRadio,
|
|
|
+ // isQualified: status === '已完成' ? parseFloat(resultScore) >= (parseFloat(qualifiedRadio) / 100 * parseFloat(totalScore)) : '',
|
|
|
+ // paperName,
|
|
|
+ // totalScore: parseFloat(totalScore),
|
|
|
+ // resultScore: parseFloat(resultScore),
|
|
|
+ // // totalCount: data.length,
|
|
|
+ // scoringType,
|
|
|
+ // list: [{
|
|
|
+ // type: item.questionType,
|
|
|
+ // questions: [item]
|
|
|
+ // }]
|
|
|
+ // })
|
|
|
+ // } else {
|
|
|
+ // const qIndex = result[index].list.findIndex(i => i.type === item.questionType)
|
|
|
+ // if (qIndex === -1) {
|
|
|
+ // result[index].list.push({
|
|
|
+ // type: item.questionType,
|
|
|
+ // questions: [item]
|
|
|
+ // })
|
|
|
+ // } else {
|
|
|
+ // result[index].list[qIndex].questions.push(item)
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // result.forEach(item => {
|
|
|
+ // let count = 0
|
|
|
+ // item.list.forEach(i => {
|
|
|
+ // count += i.questions.length
|
|
|
+ // i.totalScore = i.questions.reduce((a, b) => a + parseFloat(b.questionScore), 0)
|
|
|
+ // })
|
|
|
+ // item.totalCount = count
|
|
|
+ // })
|
|
|
+ // // 获取最高分最低分
|
|
|
+ // const { maxScore, minScore } = result.filter(i => i.status === '已完成').reduce((acc, curr) => {
|
|
|
+ // if (curr.resultScore > acc.maxScore) {
|
|
|
+ // acc.maxScore = curr.resultScore
|
|
|
+ // }
|
|
|
+ // if (curr.resultScore < acc.minScore) {
|
|
|
+ // acc.minScore = curr.resultScore
|
|
|
+ // }
|
|
|
+ // return acc
|
|
|
+ // }, { maxScore: -Infinity, minScore: Infinity })
|
|
|
+ // this.maxScore = maxScore
|
|
|
+ // this.minScore = minScore
|
|
|
+ // resolve(result)
|
|
|
+ // }).catch(error => {
|
|
|
+ // console.log('111')
|
|
|
+ // reject(error)
|
|
|
+ // })
|
|
|
+ // })
|
|
|
+ // },
|
|
|
+ closeDetail(val) {
|
|
|
+ this.examDetail = val
|
|
|
+ this.onSearch()
|
|
|
+ },
|
|
|
// 点击开始考试
|
|
|
async onClick(item, index) {
|
|
|
this.id1 = item.id_
|
|
|
@@ -355,8 +602,11 @@ export default {
|
|
|
}
|
|
|
}]
|
|
|
}
|
|
|
- this.$common.request('update', updataParams)
|
|
|
- this.showPop = true
|
|
|
+ this.$common.request('update', updataParams).then(() => {
|
|
|
+ // 2024-9-26
|
|
|
+ this.id = this.countTotal.notStart
|
|
|
+ this.showPop = true
|
|
|
+ })
|
|
|
} else {
|
|
|
// 无未开始试卷
|
|
|
const mid = this.examPopup
|
|
|
@@ -380,6 +630,7 @@ export default {
|
|
|
})
|
|
|
})
|
|
|
},
|
|
|
+ // 当没有未开始的时候创建一条未开始数据
|
|
|
createPaper(data, examinees) {
|
|
|
const that = this
|
|
|
// const { first, second } = uni.getStorageSync('level') || {}
|
|
|
@@ -409,6 +660,8 @@ export default {
|
|
|
that.$common.request('add', addParams).then(res => {
|
|
|
const { cont } = res.variables || {}
|
|
|
if (cont.length) {
|
|
|
+ // 2024-9-26
|
|
|
+ this.id = cont[0].id_
|
|
|
that.showPop = true
|
|
|
}
|
|
|
})
|
|
|
@@ -535,8 +788,11 @@ export default {
|
|
|
// 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 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`
|
|
|
+ const sql = this.tabActive === 0 ? sql1 : sql2
|
|
|
// let sql2 = `select * from (select * from t-exams ) a LEFT JOIN () B ON a.examId=b.exam_id_`
|
|
|
- this.$common.request('sql', sql1).then(res => {
|
|
|
+ // const { variables: { data }} = await this.$common.request('sql', sql)
|
|
|
+ this.$common.request('sql', sql).then(res => {
|
|
|
if (res.variables.data.length === 0) {
|
|
|
if (this.current === 0) {
|
|
|
this.noData = true
|