| | |
| | | <script lang="ts" setup> |
| | | import type { GradeExamDetail, GradeExamItem } from './types'; |
| | | |
| | | import { computed, onMounted, reactive, ref } from 'vue'; |
| | | import { computed, onMounted, reactive, ref, watch } from 'vue'; |
| | | import { useRoute, useRouter } from 'vue-router'; |
| | | |
| | | import { useMessage } from '@jnpf/hooks'; |
| | | import { Modal } from 'ant-design-vue'; |
| | | |
| | | import { getGradeExamDetail, submitGrade } from '#/api/x/tms/examGrade'; |
| | | import { labelOfType } from '#/views/x/tms/question/constants'; |
| | | import { labelOfType, loadQuestionDics } from '#/views/x/tms/question/constants'; |
| | | import { TMS_BTN } from '#/views/x/tms/shared/ui'; |
| | | |
| | | import { colorOfGradeStatus, labelOfGradeStatus } from './constants'; |
| | | import { colorOfGradeStatus, labelOfGradeStatus, loadExamGradeDics } from './constants'; |
| | | |
| | | import '#/views/x/tms/shared/page.css'; |
| | | |
| | | defineOptions({ name: 'TmsExamGradeMark' }); |
| | | |
| | |
| | | return Number(detail.value.objectiveScore || 0) + subjectiveTotal.value; |
| | | }); |
| | | |
| | | onMounted(() => { |
| | | loadDetail(); |
| | | onMounted(async () => { |
| | | await Promise.all([loadExamGradeDics(), loadQuestionDics()]); |
| | | await loadDetail(); |
| | | }); |
| | | |
| | | watch( |
| | | () => String(route.params.id || ''), |
| | | async (id, prev) => { |
| | | if (!id || id === prev) return; |
| | | Object.keys(scoreMap).forEach((key) => { |
| | | delete scoreMap[key]; |
| | | }); |
| | | await loadDetail(); |
| | | }, |
| | | ); |
| | | |
| | | async function loadDetail() { |
| | | const id = String(route.params.id || ''); |
| | |
| | | } |
| | | |
| | | async function handleSubmit() { |
| | | if (!detail.value || readonly.value) return; |
| | | if (!detail.value || readonly.value || saving.value) return; |
| | | const err = validateScores(); |
| | | if (err) { |
| | | createMessage.warning(err); |
| | | return; |
| | | } |
| | | Modal.confirm({ |
| | | title: '确认提交', |
| | | content: '提交后不可修改,确定提交吗?', |
| | | okText: '确认', |
| | | cancelText: '取消', |
| | | onOk: () => doSubmit(), |
| | | }); |
| | | } |
| | | |
| | | async function doSubmit() { |
| | | if (!detail.value || readonly.value || saving.value) return; |
| | | saving.value = true; |
| | | try { |
| | | const items = detail.value.items |
| | | .filter((x) => x.isSubjective === '1') |
| | | .map((x) => ({ id: x.id, gotScore: Number(scoreMap[x.id] || 0) })); |
| | | await submitGrade({ examId: detail.value.examId, items }); |
| | | createMessage.success(`阅卷完成,总分 ${previewTotal.value}`); |
| | | const result = await submitGrade({ examId: detail.value.examId, items }); |
| | | createMessage.success(`阅卷完成,总分 ${result?.totalScore ?? previewTotal.value}`); |
| | | goBack(); |
| | | } catch (e: any) { |
| | | createMessage.error(e?.message || '提交失败'); |
| | |
| | | <div class="jnpf-content-wrapper-center tms-grade-center"> |
| | | <div class="jnpf-content-wrapper-content tms-grade-mark-wrap"> |
| | | <div class="mark-top"> |
| | | <div class="mark-header"> |
| | | <div class="mark-header tms-page-header"> |
| | | <div> |
| | | <div class="text-base font-medium"> |
| | | {{ detail?.paperName || '阅卷' }} · 阅卷 |
| | | </div> |
| | | <div v-if="detail" class="mt-1 text-gray-400 text-sm"> |
| | | <div class="tms-page-header__title">{{ detail?.paperName || '阅卷' }} · 阅卷</div> |
| | | <div v-if="detail" class="tms-page-header__sub"> |
| | | 考生:{{ detail.userName }} |
| | | <span v-if="detail.deptName">({{ detail.deptName }})</span> |
| | | <span class="ml-3">交卷:{{ detail.submitTime || '-' }}</span> |
| | |
| | | </span> |
| | | </div> |
| | | </div> |
| | | <a-space> |
| | | <a-button @click="goBack">返回</a-button> |
| | | <div class="tms-page-header__actions"> |
| | | <a-button @click="goBack">{{ TMS_BTN.back }}</a-button> |
| | | <a-button v-if="detail && !readonly" type="primary" :loading="saving" @click="handleSubmit"> |
| | | 提交阅卷 |
| | | </a-button> |
| | | </a-space> |
| | | </div> |
| | | </div> |
| | | |
| | | <div v-if="detail" class="score-bar"> |