修复其他考试提交

This commit is contained in:
2026-08-08 21:27:52 +08:00 Unverified
parent 87e0b208ef
commit 5f30dd6766
7 changed files with 182 additions and 48 deletions
+70 -29
View File
@@ -384,6 +384,10 @@ function scoreClass(score: number | null) {
return ''
}
function isFailingScore(score: number | string | null | undefined) {
return score != null && score !== '' && Number(score) < 60
}
function itemScore(record: any, gradeItemId: string) {
return record.itemScores?.find((itemScore: any) => itemScore.gradeItemId === gradeItemId)
}
@@ -473,7 +477,7 @@ onMounted(async () => {
:style="{ left: `${record.totalScore}%` }"
>{{ record.totalScore }}</span>
</div>
<div class="transcript-result">
<div class="transcript-result" :class="{ 'is-failed': isFailingScore(record.totalScore) }">
<span>{{ examStatusLabels[record.examStatus] }}</span>
<b v-if="record.totalScore != null">{{ record.totalScore }}</b>
<b v-else></b>
@@ -602,12 +606,14 @@ onMounted(async () => {
</el-table-column>
<el-table-column :label="`平时 ${detail.regularWeight}%`" width="110">
<template #default="{ row }">
<el-input-number
v-if="detail.canEdit && row.examStatus === 'Normal'"
v-model="row.regularScore"
:min="0" :max="100" :controls="false" size="small"
/>
<span v-else>{{ row.regularScore ?? '' }}</span>
<div class="score-cell" :class="{ 'is-failed': isFailingScore(row.regularScore) }">
<el-input-number
v-if="detail.canEdit && row.examStatus === 'Normal'"
v-model="row.regularScore"
:min="0" :max="100" :controls="false" size="small"
/>
<span v-else>{{ row.regularScore ?? '' }}</span>
</div>
</template>
</el-table-column>
<el-table-column
@@ -617,36 +623,45 @@ onMounted(async () => {
:width="item.sourceType === 'ExperimentSummary' ? 150 : 110"
>
<template #default="{ row }">
<el-input-number
v-if="detail.canEdit && row.examStatus === 'Normal' && item.sourceType !== 'ExperimentSummary'"
:model-value="itemScore(row, item.id)?.score"
@update:model-value="(val: number | undefined) => { const found = itemScore(row, item.id); if (found) found.score = val }"
:min="0" :max="100" :controls="false" size="small"
/>
<span v-else class="item-score-readonly">
{{ itemScore(row, item.id)?.score ?? '—' }}
<small v-if="item.sourceType === 'ExperimentSummary'">已锁定</small>
</span>
<div class="score-cell" :class="{ 'is-failed': isFailingScore(itemScore(row, item.id)?.score) }">
<el-input-number
v-if="detail.canEdit && row.examStatus === 'Normal' && item.sourceType !== 'ExperimentSummary'"
:model-value="itemScore(row, item.id)?.score"
@update:model-value="(val: number | undefined) => { const found = itemScore(row, item.id); if (found) found.score = val }"
:min="0" :max="100" :controls="false" size="small"
/>
<span v-else class="item-score-readonly">
{{ itemScore(row, item.id)?.score ?? '—' }}
<small v-if="item.sourceType === 'ExperimentSummary'">已锁定</small>
</span>
</div>
</template>
</el-table-column>
<el-table-column :label="`期末 ${detail.finalWeight}%`" width="110">
<template #default="{ row }">
<el-input-number
v-if="detail.canEdit && row.examStatus === 'Normal'"
v-model="row.finalScore"
:min="0" :max="100" :controls="false" size="small"
/>
<span v-else>{{ row.finalScore ?? '—' }}</span>
<div class="score-cell" :class="{ 'is-failed': isFailingScore(row.finalScore) }">
<el-input-number
v-if="detail.canEdit && row.examStatus === 'Normal'"
v-model="row.finalScore"
:min="0" :max="100" :controls="false" size="small"
/>
<span v-else>{{ row.finalScore ?? '—' }}</span>
</div>
</template>
</el-table-column>
<el-table-column label="总评" width="90">
<template #default="{ row }">
<template v-if="detail.canEdit && row.examStatus === 'Normal'">
<b class="total-score preview" :class="scoreClass(calcPreviewTotal(row))">
{{ calcPreviewTotal(row) ?? '—' }}
</b>
</template>
<b v-else class="total-score" :class="scoreClass(row.totalScore)">{{ row.totalScore ?? '—' }}</b>
<div
class="score-cell"
:class="{ 'is-failed': isFailingScore(detail.canEdit && row.examStatus === 'Normal' ? calcPreviewTotal(row) : row.totalScore) }"
>
<template v-if="detail.canEdit && row.examStatus === 'Normal'">
<b class="total-score preview" :class="scoreClass(calcPreviewTotal(row))">
{{ calcPreviewTotal(row) ?? '—' }}
</b>
</template>
<b v-else class="total-score" :class="scoreClass(row.totalScore)">{{ row.totalScore ?? '—' }}</b>
</div>
</template>
</el-table-column>
<el-table-column label="考试状态" width="115">
@@ -795,6 +810,32 @@ onMounted(async () => {
.item-row > span:first-child { flex: 1; font-size: 13px; font-weight: 650; }
.add-item-row { display: flex; align-items: center; gap: 8px; }
.score-cell {
min-height: 30px;
margin: -5px;
padding: 5px;
display: flex;
align-items: center;
justify-content: center;
border: 1px solid transparent;
border-radius: 4px;
}
.score-cell.is-failed {
color: #b42318;
background: #fdecec;
border-color: #f4b8b2;
font-weight: 700;
}
.score-cell.is-failed :deep(input) { color: #b42318; font-weight: 700; }
.transcript-result.is-failed {
color: #b42318;
background: #fdecec;
border: 1px solid #f4b8b2;
border-radius: 4px;
padding: 8px;
}
.transcript-result.is-failed b { color: #b42318; }
/* Preview total score */
.total-score.preview {
text-decoration: underline dashed;