From 756c2ff214b8eeb48b70f967116138b099375402 Mon Sep 17 00:00:00 2001 From: yujialong <479214531@qq.com> Date: Thu, 12 Sep 2024 17:07:25 +0800 Subject: [PATCH] fix --- src/api/index.js | 2 + src/layouts/navbar/index.vue | 2 +- src/pages/allocationReview/list/index.vue | 86 ++- src/pages/allocationReview/list/setup.vue | 489 +++++------------- src/pages/allocationReview/records/index.vue | 35 +- src/pages/allocationReview/records/people.vue | 8 +- src/styles/common.scss | 45 +- 7 files changed, 221 insertions(+), 446 deletions(-) diff --git a/src/api/index.js b/src/api/index.js index fae092a..e6fff7f 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -13,4 +13,6 @@ export default { getDetailedExamScores: `/exam/exam/paper/getDetailedExamScores`, reviewSettingsList: `/competition/competition/readAndAppraise/reviewSettingsList`, + evaluationSave: `/nakadai/evaluation/saveOrUpdate`, + evaluationFind: `/nakadai/evaluation/findById`, } \ No newline at end of file diff --git a/src/layouts/navbar/index.vue b/src/layouts/navbar/index.vue index 576a577..420225f 100644 --- a/src/layouts/navbar/index.vue +++ b/src/layouts/navbar/index.vue @@ -77,7 +77,7 @@ export default { // 菜单选择 menuSelect (index) { this.collapse = false - this.$router.push(index) + this.$router.push(index).catch(_ => { }) }, // 初始化菜单 initMenu () { diff --git a/src/pages/allocationReview/list/index.vue b/src/pages/allocationReview/list/index.vue index e9da341..40941fb 100644 --- a/src/pages/allocationReview/list/index.vue +++ b/src/pages/allocationReview/list/index.vue @@ -40,23 +40,27 @@ - + - - - - - - - + + + + + + + + @@ -65,7 +69,7 @@ :current-page="page" layout="total, prev, pager, next, sizes" :total="total"> - + @@ -151,12 +155,16 @@ export default { taskAllocationStatus: '', keyWord: '', }, + now: '', + timer: null, list: [], page: +this.$route.query.page || 1, pageSize: 10, total: 0, setupVisible: false, + curRow: {}, + progressVisible: false, }; }, @@ -185,6 +193,10 @@ export default { }, }, mounted () { + this.$once('hook:beforeDestroy', function () { + clearInterval(this.timer) + }) + const { query } = this.$route if (query.page) { const { questionTypes, correctRateEnd, correctRateStart, difficultys, specialtyIds, status, keyWord, questionTypeSort, givenYearSort, difficultySort, correctRateSort, updateTimeSort, referenceCountSort, givenYears, knowledgePointIds, questionBankId, questionBankName, questionBankCategory } = query @@ -219,7 +231,22 @@ export default { pageSize: this.pageSize, platformSource: 0, }) - this.list = pageList.records + + const list = pageList.records + list.forEach(e => { + // e.reviewStageName = this.reviewStage.find(n => n.id === e.reviewStage).name + // if (e.reviewStatus !== null) e.reviewStatusName = this.reviewStatus.find(n => n.id === e.reviewStatus).name + // e.reviewStageName = this.reviewStage.find(n => n.id === e.reviewStage).name + e.stage = '-' + e.time = e.evaluationId ? + e.isTimed ? + e.startTime + ' ~ ' + e.endTime : + '不限时' : + '-' + }) + this.list = list + this.getNow() + this.handleStage() this.total = pageList.total }, // 切换页码 @@ -232,6 +259,38 @@ export default { this.page = 1 this.getList() }, + // 处理评阅阶段的显示 + async handleStage () { + this.list.forEach(e => { + let stage = '-' + if (e.evaluationId) { + if (e.isTimed) { + if (e.startTime && e.endTime) { + const startTime = new Date(e.startTime) + const endTime = new Date(e.endTime) + stage = this.now < startTime ? + '未开始' : + this.now > endTime ? + '已结束' : + '进行中' + } + } else { + stage = '进行中' + } + } + e.stage = stage + }) + console.log("🚀 ~ this.timer=setInterval ~ this.list:", this.list) + }, + // 获取最新时间自动计算 + async getNow () { + this.now = await Util.getNow() + clearInterval(this.timer) + this.timer = setInterval(() => { + this.now = new Date(this.now.setSeconds(this.now.getSeconds() + 1)) + this.handleStage() + }, 1000) + }, // 评阅进度 toProgress (row) { @@ -239,6 +298,7 @@ export default { }, // 设置 toSetup (row) { + this.curRow = row this.setupVisible = true }, // 任务分配 diff --git a/src/pages/allocationReview/list/setup.vue b/src/pages/allocationReview/list/setup.vue index 93fb0d3..6051558 100644 --- a/src/pages/allocationReview/list/setup.vue +++ b/src/pages/allocationReview/list/setup.vue @@ -3,81 +3,81 @@
- + - - - + + + - - - + + +
自动判分题最终得分取最新一次评分
- -
-
- - - 不限时 - -
成绩不公布时,可设置评阅时间不限时
- -
- 限时 -
- -
- - 人 - - - - 取平均分 - 取修剪平均分 - -
-

去掉最高分、最低分,取平均分

-

1.建议评阅人员≥3人;

-

2.若评阅人员为2人,则最终得分为2人评分的平均值;

-

3.若评阅人员为1人,则最终得分为评阅人的评分;

-
- -
- 取加权平均分 - -
每位评阅人员的最新评分乘以其对应的权重后求和
- -
- 取中位分 - 取最高分 +
+
- +
答卷信息
- - {{ item.name }} - + {{ item.name + }} - - - - + 自动判分题 + 人工判分题 - - - 公布时间:2024-12-12 12:12:12 - - + + 公布时间:{{ row.resultAnnouncementTime + }} +
@@ -96,8 +96,9 @@ import QuesConst from '@/const/ques' import TestPaperConst from '@/const/testPaper' import _ from 'lodash' import Decimal from 'decimal.js' +import dayjs from 'dayjs' export default { - props: ['visible'], + props: ['visible', 'row'], data () { return { arabicToChinese: Util.arabicToChinese, @@ -105,16 +106,27 @@ export default { questionTypes: QuesConst.questionTypes, setupVisible: false, form: { - + allowManualGrading: 0, + anonymizeStudents: 0, + evaluationId: '', + isTimed: '', + reviewersPerQuestion: '', + scoreAggregationRule: 0, + }, + originForm: {}, + timed: [], + pickerOptions: { + disabledDate: time => { + return this.row.resultsDetails ? false : time.getTime() > new Date(this.row.resultAnnouncementTime) // 成绩公布时结束时间不可晚于成绩公布时间 + } }, - date: [], types: [ { - id: 1, + id: 0, name: '实训' }, { - id: 2, + id: 1, name: '理论' }, { @@ -122,7 +134,7 @@ export default { name: '论文报告' }, { - id: 4, + id: 2, name: '其他' }, ], @@ -132,335 +144,72 @@ export default { watch: { visible () { this.setupVisible = this.visible - // this.visible && this.init() + this.visible && this.init() } }, mounted () { - + this.originForm = _.cloneDeep(this.form) }, methods: { // 初始化 - init () { - this.handleQuesList() - if (!this.loaded) { - this.loaded = 1 - this.yearCheck = this.years - this.getQuesBankType() - this.initQuesBank() - this.difficult = this.$parent.form.difficult - this.difficult && this.difficultChange(this.difficult) + async init () { + this.form = _.cloneDeep(this.originForm) + this.timed = [] + // 成绩公布 + if (!this.row.resultsDetails && this.row.hasManualScoreType) { + const now = await Util.getNow() + this.timed = [dayjs(now).format('YYYY-MM-DD HH:mm:ss'), ''] + this.form.isTimed = 1 // 成绩公布时,默认显示(有主观题时) } + this.getDetail() }, - // 获取题库分类 - async getQuesBankType () { - try { - const { data } = await this.$post(this.api.getAllQuestionBankCategories, { - createSource: 1, - status: 1, - }) - this.handleList(data) - this.quesBankTypes = data - } catch (e) { } - }, - // 获取题库 - async getQuesBank () { - try { - const type = this.quesBankTypeVal - const res = await this.$post(this.api.questionBankList, { - status: 1, - pageNum: 1, - pageSize: 1000, - questionCategoryId: type.length ? type[type.length - 1] : '', - name: this.quesBankKeyword - }) - this.quesBanks = res.message.records - this.totalQuesBank = res.message.total - } catch (e) { } - }, - initQuesBank () { - this.curQuesBank = {} - this.pageQuesBank = 1 - this.getQuesBank() - }, - // 切换页码 - currentChangeQuesBank (val) { - this.pageQuesBank = val - this.getQuesBank() - }, - // 题目多选回调 - questionBankClick (item) { - this.curQuesBank = item - this.knowledgeCheck = false - this.getKnowledgeType() - this.getKnowledge() - }, - - // 处理树形 - handleList (list) { - list.map(e => { - if (e.children && e.children.length) { - this.handleList(e.children) - } else { - delete e.children - } - }) - }, - // 获取知识点分类 - async getKnowledgeType () { - try { - const { data } = await this.$post(this.api.classificationTreeStructure, { - createSource: 1, - questionBankId: this.curQuesBank.id, - }) - this.handleList(data) - this.knowledgeTypes = data - } catch (e) { } - }, - // 获取知识点 - async getKnowledge () { + // 获取详情 + async getDetail () { try { - const { id } = this.curQuesBank + const id = this.row.evaluationId if (id) { - const type = this.knowledgeTypeVal - const res = await this.$post(this.api.knowledgeHierarchyList, { - pageNum: 1, - pageSize: 1000, - questionBankId: id, - knowledgePointCategoryId: type.length ? type[type.length - 1] : '', - name: this.knowledgeKeyword, - }) - const list = res.message.records - const { allKnowledges } = this - list.map(e => { - e.check = !!allKnowledges.find(n => n.id === e.id) - }) - this.knowledges = list - } - } catch (e) { } - }, - // 切换页码 - currentChangeKn (val) { - this.pageKn = val - this.getKnowledge() - }, - // 知识点全选回调 - knowledgeAllCheckChange (val) { - this.knowledges.map(e => { - e.check = val - this.knowledgeChange(val, e) - }) - }, - // 知识点勾选回调 - knowledgeChange (checked, data) { - const checkQues = this.curQuesBank - const index = this.checked.findIndex(e => e.quesBank.id === checkQues.id) - // 已选中的题库数组里有该题库,则往该题库的知识点数组里 - if (index !== -1) { - const ques = this.checked[index] - const i = ques.knowledges.findIndex(e => e.id === data.id) - if (checked && i === -1) { - ques.knowledges.push(data) - } else if (!checked && i >= 0) { - ques.knowledges.splice(i, 1) + const { data } = await this.$post(`${this.api.evaluationFind}?id=${id}`) + this.form = { + allowManualGrading: data.allowManualGrading, + anonymizeStudents: data.anonymizeStudents, + evaluationId: data.evaluationId, + isTimed: data.isTimed, + reviewersPerQuestion: data.reviewersPerQuestion, + scoreAggregationRule: data.scoreAggregationRule, + } + if (data.startTime) this.timed = [data.startTime, data.endTime] } - ques.knowledges.length || this.checked.splice(index, 1) - } else { - this.checked.push({ - quesBank: checkQues, - knowledges: [data] - }) - } - }, - // 处理大纲列表 - handleQuesList () { - this.list = _.cloneDeep(this.$parent.form.paperOutline) - }, - // 清空已选 - async clearChecked () { - try { - await this.$confirm(`确认要清空吗?`, '提示', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning', - closeOnClickModal: false, - }) - this.knowledges.map(e => e.check = false) - this.checked = [] - this.knowledgeCheck = false - } catch (e) { } - }, - // 删除题库 - async delQuesBank (i) { - try { - await this.$confirm(`确认要移除吗?`, '提示', { - confirmButtonText: '确定', - cancelButtonText: '取消', - type: 'warning', - closeOnClickModal: false, - }) - const k = this.knowledges - this.checked[i].knowledges.map(e => { - const cur = k.findIndex(n => n.id === e.id) - if (cur !== -1) k[cur].check = false - }) - this.checked.splice(i, 1) - this.knowledgeCheck = false } catch (e) { } }, - // 删除知识点 - delKnowledge (i, j, item, k) { - const cur = this.knowledges.findIndex(e => e.id === k.id) - if (cur !== -1) this.knowledges[cur].check = false - item.knowledges.splice(j, 1) - item.knowledges.length || this.checked.splice(i, 1) // 知识点清空了则把该题库删除 - this.knowledgeCheck = false - }, - - - // 试卷难度选择回调 - difficultChange (val) { - const difficultyWeights = [0.2, 0.4, 0.6, 0.8] - const names = ['basicDifficulty', 'normalDifficulty', 'hardDifficulty', 'veryHardDifficulty'] - // 遍历题型数组 - this.list.forEach(e => { - const total = e.questionNum - - let already = 0 // 已经分配的数量 - if (val === 1) { - this.$set(e, 'basicDifficulty', Math.floor(total * 0.7)) - this.$set(e, 'normalDifficulty', Math.floor(total * 0.3)) - this.$set(e, 'hardDifficulty', 0) - this.$set(e, 'veryHardDifficulty', 0) - } else if (val === 2) { - this.$set(e, 'basicDifficulty', Math.floor(total * 0.45)) - this.$set(e, 'normalDifficulty', Math.floor(total * 0.55)) - this.$set(e, 'hardDifficulty', 0) - this.$set(e, 'veryHardDifficulty', 0) - } else if (val === 3) { - this.$set(e, 'basicDifficulty', Math.floor(total * 0.3)) - this.$set(e, 'normalDifficulty', Math.floor(total * 0.3)) - this.$set(e, 'hardDifficulty', Math.floor(total * 0.4)) - this.$set(e, 'veryHardDifficulty', 0) - } else if (val === 4) { - this.$set(e, 'basicDifficulty', Math.floor(total * 0.1)) - this.$set(e, 'normalDifficulty', Math.floor(total * 0.1)) - this.$set(e, 'hardDifficulty', Math.floor(total * 0.3)) - this.$set(e, 'veryHardDifficulty', Math.floor(total * 0.5)) - } - - - already = Decimal(already).add(e.basicDifficulty).add(e.normalDifficulty).add(e.hardDifficulty).add(e.veryHardDifficulty).toNumber() - // 如果按比例分配还没分配完 - while (total > already) { - e[names[val - 1]]++ - already++ - } - this.$set(e, 'randomDifficulty', 0) - }) - }, - // 年份全选回调 - yearAllChange (val) { - this.yearCheck = val ? this.years : [] - }, - // 年份选择回调 - yearChange (val) { - this.yearAll = val.length === 11 - }, // 提交 async submit () { if (this.submiting) return false - const { list } = this - let invalid = 0 - let totalCount = 0 - for (const i in list) { - const e = list[i] - const name = `第${Util.arabicToChinese(+i + 1)}大题` - if (!e.questionType) { - Util.warningMsg(`${name}请先选择题型`) - invalid = 1 - break - } - if (!e.questionNum || isNaN(e.questionNum) || e.questionNum <= 0) { - Util.warningMsg(`${name}的目标题数请输入正整数`) - invalid = 1 - break - } - let total = Decimal(e.basicDifficulty || 0).add(e.normalDifficulty || 0).add(e.hardDifficulty || 0).add(e.veryHardDifficulty || 0).toNumber() // 先算前4个难度的题数 - if (total) { // 前面4个空有填1个,则清空随机 - this.$set(e, 'randomDifficulty', 0) - } else { - total = +e.randomDifficulty || 0 - } - - if (total > e.questionNum) { - Util.warningMsg(`${name}的小题总数大于目标题数,请重新输入`) - invalid = 1 - break - } - e.count = total - totalCount = Decimal(totalCount).add(total).toNumber() + const form = _.cloneDeep(this.form) + const { row } = this + if (form.isTimed && !this.timed.length) return Util.warningMsg(`请选择时间限制`) + if (this.timed.length) { + form.startTime = dayjs(this.timed[0]).format('YYYY-MM-DD HH:mm:ss') + form.endTime = dayjs(this.timed[1]).format('YYYY-MM-DD HH:mm:ss') } - if (invalid) return false - if (!totalCount) return Util.warningMsg(`请填写难度题数`) + form.competitionId = row.id + form.stageId = row.stageId this.submiting = true - const k = this.allKnowledges.map(e => e.id) - - const years = [] - this.yearCheck.map(e => { - if (e === '暂无年份') { - years.push('') - } else if (e === '更早') { - // 选的是更早则直接传1990~2005所有年份 - for (let i = 1990; i < 2006; i++) { - years.push(i) - } - } else { - years.push(+e) - } - }) - list.map(e => { - e.givenYears = years - e.knowledgePointsIds = k - }) try { - const res = await this.$post(this.api.selectQuestionsByTypeAndDifficulty, list) - - let invalid = 0 - let hasQues = 0 - list.map((e, i) => { - if (+e.count !== res.list[i].questions.length) invalid = 1 - if (e.examQuestions.length) hasQues = 1 - e.score = 0 - }) - - // 3种情况提示不一样 - const tips = invalid && hasQues ? - '此操作会清空当前试卷已添加的试题,并且满足自动选题设置的试题数量不足,确定要继续自动选题吗?' : - invalid && !hasQues ? - '满足自动选题设置的试题数量不足,确认要继续自动选题吗?' : - !invalid && hasQues ? '此操作会清空当前试卷已添加的试题,是否确定要继续自动选题吗?' : - '' + await this.$post(this.api.evaluationSave, form) + this.submiting = false - if (tips) { - await this.$confirm(tips, '提示', { - confirmButtonText: '确定', - cancelButtonText: '取消', + try { + await this.$confirm('保存成功!', '提示', { + confirmButtonText: '前往任务分配', + cancelButtonText: '关闭', type: 'warning', closeOnClickModal: false, }) + this.$router.push(`records`) + } catch (e) { + this.$parent.initData() + this.setupVisible = false } - list.map((e, i) => { - res.list[i].questions.map((e, i) => { - e.questionId = e.id - e.serialNumber = i + 1 - e.originSort = i + 1 - this.$parent.handleQuesInfo(e) - }) - this.$parent.form.paperOutline[i].examQuestions = res.list[i].questions - }) - this.setupVisible = false - this.$parent.calcDifficult() - this.submiting = false } catch (e) { this.submiting = false } @@ -476,7 +225,7 @@ export default {