已按“实验成绩独立管理”完成修改。
每个实验项目独立建成绩单,支持评分项、参与状态、补做次数、安全违规、报告地址和教师评语。 流程为:录入 → 学院审核 → 教务发布;学生只能查看已发布成绩。 自主预约实验支持同步有效预约名单,已评分记录不会被误删。 课程成绩可将已发布实验成绩汇总为快照导入指定分项;导入后锁定,不能手工篡改。 实验项目成绩不完整时,对应课程分项保持空白,不按 0 分处理。 一级“实验管理”菜单下增加“项目与场次”“实验成绩”;学生端增加“实验安排”“实验成绩”。 已生成 MySQL 正式迁移及 SQLite 开发迁移,尚未操作生产数据库。 界面采用“实验项目 → 独立评分 → 审核发布”工作台设计。
This commit is contained in:
@@ -39,6 +39,7 @@ const taskTotal = ref(0)
|
||||
const recordKeyword = ref('')
|
||||
const recordPage = ref(1)
|
||||
const recordPageSize = 50
|
||||
const experimentGradeItemId = ref('')
|
||||
const createForm = reactive({
|
||||
regularWeight: 30,
|
||||
finalWeight: 70,
|
||||
@@ -186,6 +187,12 @@ async function loadDetail() {
|
||||
detail.value.canEdit = response.canEdit
|
||||
detail.value.canReview = response.canReview
|
||||
detail.value.canPublish = response.canPublish
|
||||
if (!detail.value.items?.some((item: any) => item.id === experimentGradeItemId.value)) {
|
||||
experimentGradeItemId.value =
|
||||
detail.value.items?.find((item: any) => item.name.includes('实验'))?.id
|
||||
?? detail.value.items?.[0]?.id
|
||||
?? ''
|
||||
}
|
||||
} catch (error) {
|
||||
ElMessage.error(apiErrorMessage(error))
|
||||
} finally {
|
||||
@@ -254,6 +261,29 @@ async function saveRecords() {
|
||||
}
|
||||
}
|
||||
|
||||
async function importExperimentScores() {
|
||||
if (!experimentGradeItemId.value) {
|
||||
ElMessage.warning('请先选择用于承接实验成绩的课程成绩项。')
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
const result = (await http.post(
|
||||
`/grades/sheets/${detail.value.id}/import-experiment-scores`,
|
||||
{ gradeItemId: experimentGradeItemId.value },
|
||||
)).data
|
||||
const missingHint = result.missingCount > 0
|
||||
? `;${result.missingCount} 名学生因实验成绩尚未完整发布而保持空白`
|
||||
: ''
|
||||
ElMessage.success(
|
||||
`已从 ${result.publishedProjectCount} 个实验项目导入 ${result.importedCount} 名学生的成绩快照${missingHint}`,
|
||||
)
|
||||
await loadDetail()
|
||||
} catch (error) {
|
||||
ElMessage.error(apiErrorMessage(error))
|
||||
}
|
||||
}
|
||||
|
||||
async function submitSheet() {
|
||||
try {
|
||||
await ElMessageBox.confirm(
|
||||
@@ -583,17 +613,20 @@ onMounted(async () => {
|
||||
<el-table-column
|
||||
v-for="item in detail.items"
|
||||
:key="item.id"
|
||||
:label="`${item.name} ${item.weight}%`"
|
||||
width="110"
|
||||
:label="`${item.name} ${item.weight}%${item.sourceType === 'ExperimentSummary' ? ' · 实验快照' : ''}`"
|
||||
:width="item.sourceType === 'ExperimentSummary' ? 150 : 110"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<el-input-number
|
||||
v-if="detail.canEdit && row.examStatus === 'Normal'"
|
||||
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>{{ itemScore(row, item.id)?.score ?? '—' }}</span>
|
||||
<span v-else class="item-score-readonly">
|
||||
{{ itemScore(row, item.id)?.score ?? '—' }}
|
||||
<small v-if="item.sourceType === 'ExperimentSummary'">已锁定</small>
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="`期末 ${detail.finalWeight}%`" width="110">
|
||||
@@ -654,6 +687,21 @@ onMounted(async () => {
|
||||
</small>
|
||||
</div>
|
||||
<div class="grade-actions-buttons">
|
||||
<div v-if="detail.canEdit && detail.items?.length" class="experiment-import">
|
||||
<el-select
|
||||
v-model="experimentGradeItemId"
|
||||
placeholder="选择课程成绩项"
|
||||
aria-label="实验成绩导入目标"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in detail.items"
|
||||
:key="item.id"
|
||||
:label="`${item.name} ${item.weight}%`"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
<el-button :icon="Refresh" @click="importExperimentScores">导入实验成绩</el-button>
|
||||
</div>
|
||||
<el-button v-if="detail.canEdit" :icon="Download" @click="downloadTemplate">下载模板</el-button>
|
||||
<el-button v-if="detail.canEdit" :icon="Upload" @click="chooseImportFile">Excel导入</el-button>
|
||||
<el-button v-if="detail.canEdit" :icon="EditPen" @click="saveRecords">保存成绩</el-button>
|
||||
@@ -765,6 +813,10 @@ onMounted(async () => {
|
||||
.workflow-status .college-hint { color: #6b4e16; font-weight: 600; }
|
||||
.grade-actions { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; padding: 12px 16px; border-top: 1px solid #e4e7ed; background: #fafbfc; }
|
||||
.grade-actions-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
|
||||
.experiment-import { display: flex; gap: 6px; align-items: center; padding-right: 8px; border-right: 1px solid var(--line); }
|
||||
.experiment-import .el-select { width: 165px; }
|
||||
.item-score-readonly { display: inline-flex; flex-direction: column; align-items: center; line-height: 1.1; }
|
||||
.item-score-readonly small { margin-top: 3px; color: #2d8975; font-size: 10px; font-weight: 650; }
|
||||
.grade-toolbar > .el-input { width: min(320px, 100%); }
|
||||
.grade-task-pagination { justify-content: center; padding: 14px 8px; border-top: 1px solid var(--line); }
|
||||
.grade-record-toolbar {
|
||||
@@ -777,5 +829,7 @@ onMounted(async () => {
|
||||
@media (max-width: 760px) {
|
||||
.grade-record-toolbar > span { width: 100%; margin-left: 0; }
|
||||
.grade-record-pagination { justify-content: center; }
|
||||
.experiment-import { width: 100%; padding-right: 0; padding-bottom: 8px; border-right: 0; border-bottom: 1px solid var(--line); }
|
||||
.experiment-import .el-select { flex: 1; width: auto; }
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user