2726 lines
82 KiB
Vue
2726 lines
82 KiB
Vue
<script setup lang="ts">
|
||
import { useI18n } from "vue-i18n";
|
||
const { t } = useI18n();
|
||
import ArchiveDialog from "../components/ArchiveDialog.vue";
|
||
import GradeAppealPanel from "../components/GradeAppealPanel.vue";
|
||
import { computed, onMounted, reactive, ref, watch } from "vue";
|
||
import {
|
||
Check,
|
||
ArrowRight,
|
||
Delete,
|
||
DocumentChecked,
|
||
Download,
|
||
EditPen,
|
||
Plus,
|
||
Promotion,
|
||
Refresh,
|
||
Search,
|
||
Upload,
|
||
} from "@element-plus/icons-vue";
|
||
import http, { apiErrorMessage } from "../api/http";
|
||
import { downloadApiFile, importExcel } from "../api/excel";
|
||
import { useAuthStore } from "../stores/auth";
|
||
import { useRoute, useRouter } from "vue-router";
|
||
import {
|
||
academicTermLabel,
|
||
academicTermOptionClass,
|
||
defaultAcademicTermId,
|
||
} from "../utils/academicTerms";
|
||
import { useScoreGridNavigation } from "../utils/scoreGridNavigation";
|
||
|
||
const auth = useAuthStore();
|
||
const router = useRouter();
|
||
const route = useRoute();
|
||
const { handleScoreGridKeydown } = useScoreGridNavigation("course-grade-entry");
|
||
const isStudent = computed(
|
||
() =>
|
||
auth.user?.roles.includes("Student") &&
|
||
!auth.user.roles.some((role) =>
|
||
["SuperAdmin", "AcademicAdmin", "CollegeAdmin", "Teacher"].includes(role),
|
||
),
|
||
);
|
||
const terms = ref<any[]>([]);
|
||
const tasks = ref<any[]>([]);
|
||
const selectedTask = ref<any | null>(null);
|
||
const detail = ref<any | null>(null);
|
||
const transcript = ref<any>({ student: null, records: [] });
|
||
const gradeAppealPanel = ref<InstanceType<typeof GradeAppealPanel>>();
|
||
const loading = ref(false);
|
||
const detailLoading = ref(false);
|
||
const createDialog = ref(false);
|
||
const evaluationToolDialog = ref(false);
|
||
const partialSubmitDialog = ref(false);
|
||
const returnDialog = ref(false);
|
||
const termId = ref<string | undefined>();
|
||
const status = ref<string | undefined>();
|
||
const archiveDialog = ref<InstanceType<typeof ArchiveDialog>>();
|
||
const archiveFilter = ref<boolean | undefined>(false);
|
||
const archiveSelection = ref<string[]>([]);
|
||
const canArchive = computed(() =>
|
||
auth.user?.roles.some((r) =>
|
||
["SuperAdmin", "AcademicAdmin", "CollegeAdmin"].includes(r),
|
||
),
|
||
);
|
||
const selectedArchiveRows = computed(() =>
|
||
archiveSelection.value.map((id) => ({ id })),
|
||
);
|
||
const taskKeyword = ref(
|
||
typeof route.query.keyword === "string" ? route.query.keyword : "",
|
||
);
|
||
const teacherKeyword = ref("");
|
||
const classKeyword = ref("");
|
||
const taskPage = ref(1);
|
||
const taskPageSize = 12;
|
||
const taskTotal = ref(0);
|
||
const recordKeyword = ref("");
|
||
const recordPage = ref(1);
|
||
const recordPageSize = 50;
|
||
const experimentGradeItemId = ref("");
|
||
const selectedGradeRecords = ref<any[]>([]);
|
||
const createForm = reactive({
|
||
regularWeight: 30,
|
||
finalWeight: 70,
|
||
items: [] as { name: string; weight: number }[],
|
||
});
|
||
const evaluationToolForm = reactive({
|
||
passScore: 60,
|
||
aMinimum: 90,
|
||
bMinimum: 80,
|
||
cMinimum: 70,
|
||
dMinimum: 60,
|
||
});
|
||
const partialSubmitForm = reactive({
|
||
regularScore: true,
|
||
finalScore: false,
|
||
gradeItemIds: [] as string[],
|
||
finalEvaluation: false,
|
||
});
|
||
const newItemName = ref("");
|
||
const newItemWeight = ref(0);
|
||
const returnComment = ref("");
|
||
const returnBatchId = ref<string | null>(null);
|
||
const autoSaveState = ref<"idle" | "saving" | "saved" | "error">("idle");
|
||
let autoSaveTimer: ReturnType<typeof setTimeout> | undefined;
|
||
let savedRecordSnapshot = "";
|
||
let autoSaving = false;
|
||
|
||
const targetSheetId = computed(() => {
|
||
const value = route.query.sheetId;
|
||
return typeof value === "string" ? value : undefined;
|
||
});
|
||
|
||
const presetItems = ["实验", "实习", "课程设计", "作业", "课堂表现", "期中"];
|
||
|
||
const statusLabels = computed<Record<string, string>>(() => ({
|
||
Draft: t("gradesScript.enteringGrades"),
|
||
Submitted: t("gradesScript.awaitingReview"),
|
||
Approved: t("gradesScript.approved"),
|
||
Published: t("gradesScript.published"),
|
||
Returned: t("gradesScript.returned"),
|
||
}));
|
||
const statusMeta = computed<
|
||
Record<string, { icon: string; description: string }>
|
||
>(() => ({
|
||
Draft: {
|
||
icon: "📝",
|
||
description: t("gradesScript.theInstructorIsEnteringGrades"),
|
||
},
|
||
Submitted: {
|
||
icon: "📤",
|
||
description: t("gradesScript.submittedForCollegeReview"),
|
||
},
|
||
Approved: {
|
||
icon: "✅",
|
||
description: t(
|
||
"gradesScript.approvedByTheCollegeAwaitingUniversityPublication",
|
||
),
|
||
},
|
||
Published: {
|
||
icon: "📢",
|
||
description: t("gradesScript.gradesPublishedToStudents"),
|
||
},
|
||
Returned: {
|
||
icon: "↩️",
|
||
description: t(
|
||
"gradesScript.returnedByTheCollegeTheInstructorMustReviseAndResubmit",
|
||
),
|
||
},
|
||
}));
|
||
const examStatusLabels = computed<Record<string, string>>(() => ({
|
||
Normal: t("gradesScript.normal"),
|
||
Absent: t("gradesScript.absent"),
|
||
Deferred: t("gradesScript.deferred"),
|
||
Exempt: t("gradesScript.exempt"),
|
||
Makeup: t("gradesScript.makeup"),
|
||
Disqualified: t("gradesScript.disqualified"),
|
||
}));
|
||
const evaluationMethodLabels = computed<Record<string, string>>(() => ({
|
||
Percentage: t("gradesScript.percentage"),
|
||
PassFail: t("gradesScript.passFail"),
|
||
LetterGrade: t("gradesScript.abcdeLetterGrades"),
|
||
}));
|
||
const gradeResultLabels = computed<Record<string, string>>(() => ({
|
||
Pass: t("gradesScript.pass"),
|
||
Fail: t("gradesScript.fail"),
|
||
A: "A",
|
||
B: "B",
|
||
C: "C",
|
||
D: "D",
|
||
E: "E",
|
||
}));
|
||
const gradeResultOptions = computed(() =>
|
||
detail.value?.evaluationMethod === "PassFail"
|
||
? ["Pass", "Fail"]
|
||
: ["A", "B", "C", "D", "E"],
|
||
);
|
||
const itemsWeight = computed(() =>
|
||
createForm.items.reduce((sum, item) => sum + item.weight, 0),
|
||
);
|
||
const weightSum = computed(
|
||
() => createForm.regularWeight + createForm.finalWeight + itemsWeight.value,
|
||
);
|
||
const completedCount = computed(
|
||
() => selectedTask.value?.sheet?.completedCount ?? 0,
|
||
);
|
||
const averageScore = computed(() => {
|
||
const scores = (detail.value?.records ?? [])
|
||
.map((record: any) => Number(record.totalScore))
|
||
.filter((value: number) => Number.isFinite(value));
|
||
if (!scores.length) return "—";
|
||
return (
|
||
scores.reduce((sum: number, value: number) => sum + value, 0) /
|
||
scores.length
|
||
).toFixed(1);
|
||
});
|
||
const passRate = computed(() => {
|
||
const completed = Number(selectedTask.value?.sheet?.completedCount ?? 0);
|
||
if (!completed) return "—";
|
||
return `${Math.round((Number(selectedTask.value?.sheet?.passedCount ?? 0) / completed) * 100)}%`;
|
||
});
|
||
const transcriptGpa = computed(() => {
|
||
const numeric = transcript.value.records.filter(
|
||
(record: any) => record.gradePoint != null,
|
||
);
|
||
const credits = numeric.reduce(
|
||
(sum: number, record: any) => sum + Number(record.credits),
|
||
0,
|
||
);
|
||
if (!credits) return "—";
|
||
const points = numeric.reduce(
|
||
(sum: number, record: any) =>
|
||
sum + Number(record.gradePoint) * Number(record.credits),
|
||
0,
|
||
);
|
||
return (points / credits).toFixed(2);
|
||
});
|
||
const earnedCredits = computed(() =>
|
||
transcript.value.records
|
||
.filter(
|
||
(record: any) =>
|
||
record.isPassed === true ||
|
||
(record.isPassed == null && Number(record.totalScore) >= 60),
|
||
)
|
||
.reduce((sum: number, record: any) => sum + Number(record.credits), 0),
|
||
);
|
||
|
||
function addItem() {
|
||
const name = newItemName.value.trim() || "自定义分项";
|
||
if (createForm.items.some((item) => item.name === name)) {
|
||
ElMessage.warning(t("gradesScript.itemNamesMustBeUnique"));
|
||
return;
|
||
}
|
||
createForm.items.push({ name, weight: newItemWeight.value || 0 });
|
||
newItemName.value = "";
|
||
newItemWeight.value = 0;
|
||
}
|
||
|
||
function addPresetItem(name: string) {
|
||
if (createForm.items.some((item) => item.name === name)) {
|
||
ElMessage.warning(t("gradesScript.thisItemAlreadyExists"));
|
||
return;
|
||
}
|
||
createForm.items.push({ name, weight: 0 });
|
||
}
|
||
|
||
function removeItem(index: number) {
|
||
createForm.items.splice(index, 1);
|
||
}
|
||
|
||
function openStatistics(record: any) {
|
||
if (record.evaluationMethod !== "Percentage") return;
|
||
router.push({
|
||
name: "course-grade-statistics",
|
||
params: { sheetId: record.gradeSheetId },
|
||
});
|
||
}
|
||
|
||
async function load(resetPage = false) {
|
||
loading.value = true;
|
||
try {
|
||
if (isStudent.value) {
|
||
transcript.value = (
|
||
await http.get("/grades/student/transcript", {
|
||
params: { academicTermId: termId.value },
|
||
})
|
||
).data;
|
||
return;
|
||
}
|
||
if (resetPage) taskPage.value = 1;
|
||
const locatingSheet = targetSheetId.value;
|
||
const response = (
|
||
await http.get("/grades/sheets", {
|
||
params: {
|
||
academicTermId: locatingSheet ? undefined : termId.value,
|
||
status: locatingSheet ? undefined : status.value,
|
||
keyword: locatingSheet
|
||
? undefined
|
||
: taskKeyword.value.trim() || undefined,
|
||
teacherKeyword: locatingSheet
|
||
? undefined
|
||
: teacherKeyword.value.trim() || undefined,
|
||
classKeyword: locatingSheet
|
||
? undefined
|
||
: classKeyword.value.trim() || undefined,
|
||
sheetId: locatingSheet,
|
||
isArchived: locatingSheet ? undefined : archiveFilter.value,
|
||
page: taskPage.value,
|
||
pageSize: taskPageSize,
|
||
},
|
||
})
|
||
).data;
|
||
archiveSelection.value = [];
|
||
tasks.value = response.items;
|
||
taskTotal.value = response.total;
|
||
const preferred = tasks.value.find(
|
||
(item) =>
|
||
item.sheet?.id === targetSheetId.value ||
|
||
item.id === selectedTask.value?.id,
|
||
);
|
||
if (preferred) {
|
||
selectedTask.value = preferred;
|
||
if (preferred.sheet) await loadDetail();
|
||
} else {
|
||
selectedTask.value = null;
|
||
detail.value = null;
|
||
}
|
||
} catch (error) {
|
||
ElMessage.error(apiErrorMessage(error));
|
||
} finally {
|
||
loading.value = false;
|
||
}
|
||
}
|
||
|
||
async function selectTask(task: any) {
|
||
selectedTask.value = task;
|
||
recordPage.value = 1;
|
||
recordKeyword.value = "";
|
||
detail.value = null;
|
||
if (!task.sheet) return;
|
||
await loadDetail();
|
||
}
|
||
|
||
async function loadDetail() {
|
||
if (!selectedTask.value?.sheet) return;
|
||
detailLoading.value = true;
|
||
try {
|
||
const response = (
|
||
await http.get(`/grades/sheets/${selectedTask.value.sheet.id}`, {
|
||
params: {
|
||
recordPage: recordPage.value,
|
||
recordPageSize,
|
||
studentKeyword: recordKeyword.value.trim() || undefined,
|
||
},
|
||
})
|
||
).data;
|
||
detail.value = response.sheet;
|
||
selectedGradeRecords.value = [];
|
||
detail.value.canEdit = response.canEdit;
|
||
detail.value.canReview = response.canReview;
|
||
detail.value.canPublish = response.canPublish;
|
||
detail.value.canReviewBatches = response.canReviewBatches;
|
||
detail.value.canPublishBatches = response.canPublishBatches;
|
||
savedRecordSnapshot = gradeRecordSnapshot();
|
||
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 {
|
||
detailLoading.value = false;
|
||
}
|
||
}
|
||
|
||
async function changeTaskPage(page: number) {
|
||
taskPage.value = page;
|
||
await load();
|
||
}
|
||
|
||
function resetTaskFilters() {
|
||
archiveFilter.value = false;
|
||
taskKeyword.value = "";
|
||
teacherKeyword.value = "";
|
||
classKeyword.value = "";
|
||
status.value = undefined;
|
||
termId.value = defaultAcademicTermId(terms.value);
|
||
load(true);
|
||
}
|
||
|
||
async function searchRecords() {
|
||
recordPage.value = 1;
|
||
await loadDetail();
|
||
}
|
||
|
||
function openCreate() {
|
||
createForm.regularWeight = 30;
|
||
createForm.finalWeight = 70;
|
||
createForm.items = [];
|
||
newItemName.value = "";
|
||
newItemWeight.value = 0;
|
||
createDialog.value = true;
|
||
}
|
||
|
||
async function createSheet() {
|
||
if (weightSum.value !== 100) {
|
||
ElMessage.warning(t("gradesScript.weights", { weight: weightSum.value }));
|
||
return;
|
||
}
|
||
try {
|
||
await http.post("/grades/sheets", {
|
||
teachingTaskId: selectedTask.value.id,
|
||
regularWeight: createForm.regularWeight,
|
||
finalWeight: createForm.finalWeight,
|
||
items: createForm.items.map((item) => ({
|
||
name: item.name,
|
||
weight: item.weight,
|
||
})),
|
||
});
|
||
createDialog.value = false;
|
||
ElMessage.success(t("gradesScript.gradeSheetCreated"));
|
||
await load();
|
||
} catch (error) {
|
||
ElMessage.error(apiErrorMessage(error));
|
||
}
|
||
}
|
||
|
||
function gradeRecordPayload() {
|
||
return detail.value.records.filter((record: any) => record.examStatus !== "Disqualified").map((record: any) => ({
|
||
id: record.id,
|
||
regularScore: record.regularScore,
|
||
finalScore: record.finalScore,
|
||
itemScores: record.itemScores?.map((itemScore: any) => ({
|
||
gradeItemId: itemScore.gradeItemId,
|
||
score: itemScore.score,
|
||
})),
|
||
examStatus: record.examStatus,
|
||
result: record.result,
|
||
notes: record.notes,
|
||
}));
|
||
}
|
||
|
||
function isSubmitted(
|
||
record: any,
|
||
componentType: string,
|
||
gradeItemId = "00000000-0000-0000-0000-000000000000",
|
||
) {
|
||
return record.scoreSubmissions?.some(
|
||
(submission: any) =>
|
||
submission.componentType === componentType &&
|
||
submission.gradeItemId === gradeItemId,
|
||
);
|
||
}
|
||
|
||
function hasSubmittedComponent(record: any) {
|
||
return Boolean(record.scoreSubmissions?.length);
|
||
}
|
||
|
||
function handleGradeSelectionChange(rows: any[]) {
|
||
selectedGradeRecords.value = rows;
|
||
}
|
||
|
||
function canSelectGradeRecord(record: any) {
|
||
return (
|
||
!record.publishedAt &&
|
||
!record.scoreSubmissions?.some(
|
||
(submission: any) => submission.gradeSubmissionBatchId,
|
||
)
|
||
);
|
||
}
|
||
|
||
function openPartialSubmit() {
|
||
if (!selectedGradeRecords.value.length) {
|
||
ElMessage.warning(t("gradesScript.selectStudentsForBatchSubmission"));
|
||
return;
|
||
}
|
||
partialSubmitForm.regularScore = true;
|
||
partialSubmitForm.finalScore = false;
|
||
partialSubmitForm.gradeItemIds = [];
|
||
partialSubmitForm.finalEvaluation = false;
|
||
partialSubmitDialog.value = true;
|
||
}
|
||
|
||
async function submitPartialGrades() {
|
||
const hasComponent =
|
||
partialSubmitForm.regularScore ||
|
||
partialSubmitForm.finalScore ||
|
||
partialSubmitForm.gradeItemIds.length > 0 ||
|
||
partialSubmitForm.finalEvaluation;
|
||
if (!hasComponent) {
|
||
ElMessage.warning(t("gradesScript.selectAtLeastOneGradeItem"));
|
||
return;
|
||
}
|
||
try {
|
||
const records = gradeRecordPayload();
|
||
await http.put(`/grades/sheets/${detail.value.id}/records`, { records });
|
||
const result = (
|
||
await http.post(`/grades/sheets/${detail.value.id}/partial-submit`, {
|
||
recordIds: selectedGradeRecords.value.map((record) => record.id),
|
||
regularScore: partialSubmitForm.regularScore,
|
||
finalScore: partialSubmitForm.finalScore,
|
||
gradeItemIds: partialSubmitForm.gradeItemIds,
|
||
finalEvaluation: partialSubmitForm.finalEvaluation,
|
||
})
|
||
).data;
|
||
partialSubmitDialog.value = false;
|
||
ElMessage.success(
|
||
t("gradesScript.locked", {
|
||
students: result.submittedRecordCount,
|
||
components: result.submittedComponentCount,
|
||
}),
|
||
);
|
||
await loadDetail();
|
||
} catch (error) {
|
||
ElMessage.error(apiErrorMessage(error));
|
||
}
|
||
}
|
||
|
||
async function submitSelectedStudentsForReview() {
|
||
if (!selectedGradeRecords.value.length) {
|
||
ElMessage.warning(t("gradesScript.selectStudentsForEarlyGradePublication"));
|
||
return;
|
||
}
|
||
try {
|
||
await ElMessageBox.confirm(
|
||
t("gradesScript.submitBatch", {
|
||
count: selectedGradeRecords.value.length,
|
||
}),
|
||
t("gradesScript.submitSelectedStudentGradesForReview"),
|
||
{
|
||
type: "warning",
|
||
confirmButtonText: t("gradesScript.confirmSubmission"),
|
||
cancelButtonText: t("gradesScript.cancel"),
|
||
},
|
||
);
|
||
const records = gradeRecordPayload();
|
||
await http.put(`/grades/sheets/${detail.value.id}/records`, { records });
|
||
await http.post(`/grades/sheets/${detail.value.id}/submit-records`, {
|
||
recordIds: selectedGradeRecords.value.map((record) => record.id),
|
||
});
|
||
ElMessage.success(
|
||
t("gradesScript.selectedGradesSubmittedForCollegeReview"),
|
||
);
|
||
await loadDetail();
|
||
} catch (error: any) {
|
||
if (error !== "cancel" && error !== "close")
|
||
ElMessage.error(apiErrorMessage(error));
|
||
}
|
||
}
|
||
|
||
async function approveSubmissionBatch(batch: any) {
|
||
try {
|
||
await http.post(`/grades/submission-batches/${batch.id}/approve`);
|
||
ElMessage.success(t("gradesScript.thisBatchPassedCollegeReview"));
|
||
await loadDetail();
|
||
} catch (error) {
|
||
ElMessage.error(apiErrorMessage(error));
|
||
}
|
||
}
|
||
|
||
function openReturnBatch(batch: any) {
|
||
returnBatchId.value = batch.id;
|
||
returnComment.value = "";
|
||
returnDialog.value = true;
|
||
}
|
||
|
||
async function publishSubmissionBatch(batch: any) {
|
||
try {
|
||
await ElMessageBox.confirm(
|
||
t("gradesScript.publishBatch", { count: batch.studentCount }),
|
||
t("gradesScript.publishSelectedStudentGrades"),
|
||
{
|
||
type: "warning",
|
||
confirmButtonText: t("gradesScript.confirmPublication"),
|
||
cancelButtonText: t("gradesScript.cancel"),
|
||
},
|
||
);
|
||
await http.post(`/grades/submission-batches/${batch.id}/publish`);
|
||
ElMessage.success(t("gradesScript.thisBatchOfGradesHasBeenPublished"));
|
||
await loadDetail();
|
||
} catch (error: any) {
|
||
if (error !== "cancel" && error !== "close")
|
||
ElMessage.error(apiErrorMessage(error));
|
||
}
|
||
}
|
||
|
||
async function applyEvaluationTool() {
|
||
try {
|
||
await http.put(`/grades/sheets/${detail.value.id}/records`, {
|
||
records: gradeRecordPayload(),
|
||
});
|
||
const response = (
|
||
await http.post(
|
||
`/grades/sheets/${detail.value.id}/apply-evaluation-tool`,
|
||
evaluationToolForm,
|
||
)
|
||
).data;
|
||
evaluationToolDialog.value = false;
|
||
ElMessage.success(
|
||
t("gradesScript.evaluations", { count: response.updated }),
|
||
);
|
||
await loadDetail();
|
||
} catch (error) {
|
||
ElMessage.error(apiErrorMessage(error));
|
||
}
|
||
}
|
||
|
||
function gradeRecordSnapshot() {
|
||
return detail.value ? JSON.stringify(gradeRecordPayload()) : "";
|
||
}
|
||
|
||
function scheduleAutoSave() {
|
||
if (!detail.value?.canEdit || gradeRecordSnapshot() === savedRecordSnapshot)
|
||
return;
|
||
autoSaveState.value = "idle";
|
||
clearTimeout(autoSaveTimer);
|
||
autoSaveTimer = setTimeout(() => {
|
||
void saveRecords(true);
|
||
}, 60_000);
|
||
}
|
||
|
||
async function saveRecords(automatic = false) {
|
||
if (!detail.value || (automatic && autoSaving)) return;
|
||
const records = gradeRecordPayload();
|
||
const snapshot = JSON.stringify(records);
|
||
if (automatic) {
|
||
autoSaving = true;
|
||
autoSaveState.value = "saving";
|
||
}
|
||
try {
|
||
await http.put(`/grades/sheets/${detail.value.id}/records`, {
|
||
records,
|
||
});
|
||
savedRecordSnapshot = snapshot;
|
||
if (automatic) autoSaveState.value = "saved";
|
||
else {
|
||
ElMessage.success(
|
||
t("gradesScript.gradesSavedAndFinalScoresRecalculated"),
|
||
);
|
||
await loadDetail();
|
||
}
|
||
} catch (error) {
|
||
if (automatic) autoSaveState.value = "error";
|
||
else ElMessage.error(apiErrorMessage(error));
|
||
} finally {
|
||
if (automatic) {
|
||
autoSaving = false;
|
||
if (gradeRecordSnapshot() !== savedRecordSnapshot) scheduleAutoSave();
|
||
}
|
||
}
|
||
}
|
||
|
||
watch(() => detail.value?.records, scheduleAutoSave, { deep: true });
|
||
watch(targetSheetId, async () => {
|
||
if (!isStudent.value) await load(true);
|
||
});
|
||
|
||
async function importExperimentScores() {
|
||
if (!experimentGradeItemId.value) {
|
||
ElMessage.warning(
|
||
t("gradesScript.selectTheCourseGradeItemThatWillReceiveLabGrades"),
|
||
);
|
||
return;
|
||
}
|
||
|
||
try {
|
||
const result = (
|
||
await http.post(
|
||
`/grades/sheets/${detail.value.id}/import-experiment-scores`,
|
||
{ gradeItemId: experimentGradeItemId.value },
|
||
)
|
||
).data;
|
||
const missingHint =
|
||
result.missingCount > 0
|
||
? t("gradesScript.missing", { count: result.missingCount })
|
||
: "";
|
||
const lockedHint =
|
||
result.lockedCount > 0
|
||
? t("gradesScript.lockedHint", { count: result.lockedCount })
|
||
: "";
|
||
ElMessage.success(
|
||
t("gradesScript.importLab", {
|
||
projects: result.publishedProjectCount,
|
||
students: result.importedCount,
|
||
missing: missingHint,
|
||
locked: lockedHint,
|
||
}),
|
||
);
|
||
await loadDetail();
|
||
} catch (error) {
|
||
ElMessage.error(apiErrorMessage(error));
|
||
}
|
||
}
|
||
|
||
async function submitSheet() {
|
||
try {
|
||
await ElMessageBox.confirm(
|
||
t(
|
||
"gradesScript.submissionLocksGradesAndSendsThemForCollegeReviewHaveAllGradesBeenChecked",
|
||
),
|
||
t("gradesScript.submitGrades"),
|
||
{
|
||
type: "warning",
|
||
confirmButtonText: t("gradesScript.confirmSubmission2"),
|
||
cancelButtonText: t("gradesScript.continueChecking"),
|
||
},
|
||
);
|
||
await http.post(`/grades/sheets/${detail.value.id}/submit`);
|
||
ElMessage.success(t("gradesScript.gradeSheetSubmittedForReview"));
|
||
await load();
|
||
} catch (error: any) {
|
||
if (error !== "cancel" && error !== "close")
|
||
ElMessage.error(apiErrorMessage(error));
|
||
}
|
||
}
|
||
|
||
const importFileInput = ref<HTMLInputElement>();
|
||
|
||
function downloadTemplate() {
|
||
downloadApiFile(
|
||
`/grades/sheets/${detail.value.id}/template`,
|
||
t("gradesScript.gradeImportTemplateXlsx"),
|
||
);
|
||
}
|
||
|
||
function chooseImportFile() {
|
||
importFileInput.value?.click();
|
||
}
|
||
|
||
async function handleImport(event: Event) {
|
||
const input = event.target as HTMLInputElement;
|
||
const file = input.files?.[0];
|
||
if (!file) return;
|
||
try {
|
||
const result = await importExcel(
|
||
`/grades/sheets/${detail.value.id}/import`,
|
||
file,
|
||
);
|
||
ElMessage.success(
|
||
t("gradesScript.imported", { count: result.data.updated }),
|
||
);
|
||
await loadDetail();
|
||
} catch (error) {
|
||
ElMessage.error(apiErrorMessage(error));
|
||
} finally {
|
||
input.value = "";
|
||
}
|
||
}
|
||
|
||
async function approveSheet() {
|
||
try {
|
||
await http.post(`/grades/sheets/${detail.value.id}/approve`);
|
||
ElMessage.success(t("gradesScript.gradeSheetApproved"));
|
||
await load();
|
||
} catch (error) {
|
||
ElMessage.error(apiErrorMessage(error));
|
||
}
|
||
}
|
||
|
||
function openReturn() {
|
||
returnBatchId.value = null;
|
||
returnComment.value = "";
|
||
returnDialog.value = true;
|
||
}
|
||
|
||
async function returnSheet() {
|
||
if (!returnComment.value.trim()) {
|
||
ElMessage.warning(
|
||
t("gradesScript.describeWhatTheInstructorNeedsToCorrect"),
|
||
);
|
||
return;
|
||
}
|
||
try {
|
||
const url = returnBatchId.value
|
||
? `/grades/submission-batches/${returnBatchId.value}/return`
|
||
: `/grades/sheets/${detail.value.id}/return`;
|
||
await http.post(url, {
|
||
comment: returnComment.value,
|
||
});
|
||
returnDialog.value = false;
|
||
ElMessage.success(
|
||
returnBatchId.value
|
||
? t("gradesScript.thisBatchWasReturnedToTheInstructor")
|
||
: t("gradesScript.gradeSheetReturnedToTheInstructor"),
|
||
);
|
||
if (returnBatchId.value) await loadDetail();
|
||
else await load();
|
||
} catch (error) {
|
||
ElMessage.error(apiErrorMessage(error));
|
||
}
|
||
}
|
||
|
||
async function publishSheet() {
|
||
try {
|
||
await ElMessageBox.confirm(
|
||
t(
|
||
"gradesScript.studentsCanSeeGradesAfterPublicationAndThisVersionWillBeLockedPublish",
|
||
),
|
||
t("gradesScript.publishGrades"),
|
||
{
|
||
type: "warning",
|
||
confirmButtonText: t("gradesScript.confirmPublication"),
|
||
cancelButtonText: t("gradesScript.cancel"),
|
||
},
|
||
);
|
||
await http.post(`/grades/sheets/${detail.value.id}/publish`);
|
||
ElMessage.success(t("gradesScript.gradesPublishedToStudents"));
|
||
await load();
|
||
} catch (error: any) {
|
||
if (error !== "cancel" && error !== "close")
|
||
ElMessage.error(apiErrorMessage(error));
|
||
}
|
||
}
|
||
|
||
function scoreClass(score: number | null) {
|
||
if (score == null) return "pending";
|
||
if (score < 60) return "failed";
|
||
if (score >= 90) return "excellent";
|
||
return "";
|
||
}
|
||
|
||
function isFailingScore(score: number | string | null | undefined) {
|
||
return score != null && score !== "" && Number(score) < 60;
|
||
}
|
||
|
||
function transcriptComponents(record: any) {
|
||
return [
|
||
{
|
||
name: t("gradesScript.coursework"),
|
||
weight: record.regularWeight,
|
||
score: record.regularScore,
|
||
},
|
||
...(record.itemScores ?? []).map((item: any) => ({
|
||
name: item.name,
|
||
weight: item.weight,
|
||
score: item.score,
|
||
})),
|
||
{
|
||
name: t("gradesScript.finalExam"),
|
||
weight: record.finalWeight,
|
||
score: record.finalScore,
|
||
},
|
||
].filter((item) => Number(item.weight) > 0);
|
||
}
|
||
|
||
function formatScore(score: number | string | null | undefined) {
|
||
if (score == null || score === "") return "—";
|
||
return Number(score).toFixed(1).replace(/\.0$/, "");
|
||
}
|
||
|
||
function itemScore(record: any, gradeItemId: string) {
|
||
return record.itemScores?.find(
|
||
(itemScore: any) => itemScore.gradeItemId === gradeItemId,
|
||
);
|
||
}
|
||
|
||
/** Client-side preview calculation — mirrors backend GradeCalculator.CalculateTotal */
|
||
function calcPreviewTotal(record: any): number | null {
|
||
if (!detail.value) return null;
|
||
if (!["Normal", "Deferred"].includes(record.examStatus)) return null;
|
||
|
||
const { regularWeight, finalWeight, items } = detail.value;
|
||
const itemWeightById: Record<string, number> = {};
|
||
for (const item of items ?? []) itemWeightById[item.id] = item.weight;
|
||
|
||
// Check required scores are present
|
||
if (
|
||
regularWeight > 0 &&
|
||
(record.regularScore == null || record.regularScore === "")
|
||
)
|
||
return null;
|
||
if (
|
||
finalWeight > 0 &&
|
||
(record.finalScore == null || record.finalScore === "")
|
||
)
|
||
return null;
|
||
for (const itemScore of record.itemScores ?? []) {
|
||
const weight = itemWeightById[itemScore.gradeItemId];
|
||
if (weight > 0 && (itemScore.score == null || itemScore.score === ""))
|
||
return null;
|
||
}
|
||
|
||
let total = ((Number(record.regularScore) || 0) * regularWeight) / 100;
|
||
for (const itemScore of record.itemScores ?? []) {
|
||
const weight = itemWeightById[itemScore.gradeItemId] || 0;
|
||
total += ((Number(itemScore.score) || 0) * weight) / 100;
|
||
}
|
||
total += ((Number(record.finalScore) || 0) * finalWeight) / 100;
|
||
return Math.round(total * 10) / 10;
|
||
}
|
||
|
||
onMounted(async () => {
|
||
try {
|
||
terms.value = (await http.get("/base-data/terms")).data;
|
||
termId.value = defaultAcademicTermId(terms.value);
|
||
await load();
|
||
} catch (error) {
|
||
ElMessage.error(apiErrorMessage(error));
|
||
}
|
||
});
|
||
</script>
|
||
|
||
<template>
|
||
<div class="page-stack grade-page">
|
||
<section class="page-intro">
|
||
<div>
|
||
<span class="section-kicker">ACADEMIC RECORD</span>
|
||
<h2>
|
||
{{
|
||
isStudent
|
||
? t("gradesTemplate.courseGradesThisTerm")
|
||
: t("dashboard.admin.actions.grades.label")
|
||
}}
|
||
</h2>
|
||
<p v-if="isStudent">
|
||
{{
|
||
t(
|
||
"gradesTemplate.viewOfficiallyPublishedGradesCreditsAndGPAForThisTermForAllCoursesSeeTheAcademicOverview",
|
||
)
|
||
}}
|
||
</p>
|
||
<p v-else>
|
||
{{
|
||
t(
|
||
"gradesTemplate.manageGradeEntryCollegeReviewAndUniversityPublicationWithCustomizableCourseworkLabAndInternshipComponents",
|
||
)
|
||
}}
|
||
</p>
|
||
</div>
|
||
<el-button :icon="Refresh" @click="load()">{{
|
||
t("businessLabels.refresh")
|
||
}}</el-button>
|
||
</section>
|
||
|
||
<template v-if="isStudent">
|
||
<section class="transcript-identity">
|
||
<div>
|
||
<span>STUDENT TRANSCRIPT</span>
|
||
<h3>{{ transcript.student?.name ?? t("gradesTemplate.student") }}</h3>
|
||
<p>
|
||
{{ transcript.student?.studentNumber }} ·
|
||
{{ transcript.student?.majorName }} ·
|
||
{{ transcript.student?.className }}
|
||
</p>
|
||
</div>
|
||
<span class="current-term-note">{{ t("calendar.currentTerm") }}</span>
|
||
</section>
|
||
|
||
<section class="transcript-ribbon">
|
||
<div>
|
||
<span>{{ t("gradesTemplate.publishedCourses") }}</span
|
||
><b>{{ transcript.records.length }}</b
|
||
><small>{{ t("studentCurriculum.courseUnit") }}</small>
|
||
</div>
|
||
<div>
|
||
<span>{{ t("gradesTemplate.creditsEarned") }}</span
|
||
><b>{{ earnedCredits }}</b
|
||
><small>{{ t("gradesTemplate.credits") }}</small>
|
||
</div>
|
||
<div>
|
||
<span>{{ t("gradesTemplate.weightedGPAThisTerm") }}</span
|
||
><b>{{ transcriptGpa }}</b
|
||
><small>GPA</small>
|
||
</div>
|
||
</section>
|
||
|
||
<section class="transcript-list" v-loading="loading">
|
||
<article
|
||
v-for="record in transcript.records"
|
||
:key="record.id"
|
||
class="transcript-course-card"
|
||
:class="{ clickable: record.evaluationMethod === 'Percentage' }"
|
||
:role="
|
||
record.evaluationMethod === 'Percentage' ? 'button' : undefined
|
||
"
|
||
:tabindex="record.evaluationMethod === 'Percentage' ? 0 : undefined"
|
||
:aria-label="
|
||
record.evaluationMethod === 'Percentage'
|
||
? t('gradesTemplate.viewGradeAnalysisForName', {
|
||
name: record.courseName,
|
||
})
|
||
: undefined
|
||
"
|
||
@click="openStatistics(record)"
|
||
@keydown.enter="openStatistics(record)"
|
||
@keydown.space.prevent="openStatistics(record)"
|
||
>
|
||
<div class="transcript-course">
|
||
<span>{{ record.termName }}</span>
|
||
<h3>{{ record.courseName }}</h3>
|
||
<p>
|
||
{{
|
||
t("gradesTemplate.codeTaskCreditsCredits", {
|
||
code: record.courseCode,
|
||
task: record.taskNumber,
|
||
credits: record.credits,
|
||
})
|
||
}}
|
||
</p>
|
||
</div>
|
||
<div class="grade-scale">
|
||
<i v-for="tick in 11" :key="tick" />
|
||
<span
|
||
v-if="
|
||
record.evaluationMethod === 'Percentage' &&
|
||
record.totalScore != null
|
||
"
|
||
:class="scoreClass(record.totalScore)"
|
||
:style="{ left: `${record.totalScore}%` }"
|
||
>{{ record.totalScore }}</span
|
||
>
|
||
</div>
|
||
<div
|
||
class="transcript-result"
|
||
:class="{ 'is-failed': record.isPassed === false }"
|
||
>
|
||
<span>{{ examStatusLabels[record.examStatus] }}</span>
|
||
<b
|
||
v-if="
|
||
record.evaluationMethod === 'Percentage' &&
|
||
record.totalScore != null
|
||
"
|
||
>{{ record.totalScore }}</b
|
||
>
|
||
<b v-else-if="record.result">{{
|
||
gradeResultLabels[record.result]
|
||
}}</b>
|
||
<b v-else>—</b>
|
||
<small>{{
|
||
t("gradesTemplate.gpaValue", { value: record.gradePoint ?? "—" })
|
||
}}</small>
|
||
<span
|
||
v-if="record.evaluationMethod === 'Percentage'"
|
||
class="card-entry"
|
||
>{{ t("gradesTemplate.viewGradeAnalysis") }}
|
||
<el-icon><ArrowRight /></el-icon
|
||
></span>
|
||
<el-button
|
||
link
|
||
type="warning"
|
||
@click.stop="gradeAppealPanel?.openForRecord(record)"
|
||
>{{ t("gradesTemplate.appealGrade") }}</el-button
|
||
>
|
||
</div>
|
||
<section
|
||
v-if="
|
||
record.evaluationMethod === 'Percentage' &&
|
||
transcriptComponents(record).length
|
||
"
|
||
class="grade-breakdown"
|
||
:aria-label="
|
||
t('gradesTemplate.gradeComponentsForName', {
|
||
name: record.courseName,
|
||
})
|
||
"
|
||
>
|
||
<div class="grade-breakdown-label">
|
||
{{ t("batchBusiness.gradeComponents") }}
|
||
</div>
|
||
<div class="grade-formula">
|
||
<template
|
||
v-for="(component, index) in transcriptComponents(record)"
|
||
:key="`${component.name}-${index}`"
|
||
>
|
||
<div class="grade-formula-component">
|
||
<span class="component-name"
|
||
>{{ component.name }} {{ component.weight }}%</span
|
||
>
|
||
<strong
|
||
>{{ formatScore(component.score) }} ×
|
||
{{ component.weight }}%</strong
|
||
>
|
||
</div>
|
||
<span
|
||
v-if="index < transcriptComponents(record).length - 1"
|
||
class="formula-operator"
|
||
>+</span
|
||
>
|
||
</template>
|
||
<span class="formula-operator equals">=</span>
|
||
<div class="grade-formula-total">
|
||
<span>{{ t("batchBusiness.totalScore") }}</span>
|
||
<strong>{{ formatScore(record.totalScore) }}</strong>
|
||
</div>
|
||
</div>
|
||
</section>
|
||
</article>
|
||
<el-empty
|
||
v-if="!transcript.records.length"
|
||
:description="t('workflowBatch.noPublishedGradesThisTerm')"
|
||
/>
|
||
</section>
|
||
<GradeAppealPanel
|
||
ref="gradeAppealPanel"
|
||
:student="true"
|
||
:records="transcript.records"
|
||
/>
|
||
</template>
|
||
|
||
<template v-else>
|
||
<GradeAppealPanel :student="false" />
|
||
<section class="grade-toolbar">
|
||
<el-input
|
||
v-model="taskKeyword"
|
||
clearable
|
||
:prefix-icon="Search"
|
||
:placeholder="
|
||
t('workflowBatch.searchCourseCourseNumberOrTeachingClassNumber')
|
||
"
|
||
@keyup.enter="load(true)"
|
||
@clear="load(true)"
|
||
/>
|
||
<el-select
|
||
v-model="termId"
|
||
clearable
|
||
:placeholder="t('businessLabels.allTerms')"
|
||
@change="load(true)"
|
||
>
|
||
<el-option
|
||
v-for="term in terms"
|
||
:key="term.id"
|
||
:label="academicTermLabel(term)"
|
||
:value="term.id"
|
||
:class="academicTermOptionClass(term)"
|
||
/>
|
||
</el-select>
|
||
<el-select
|
||
v-model="archiveFilter"
|
||
clearable
|
||
:placeholder="t('courses.allArchives')"
|
||
@change="load(true)"
|
||
><el-option
|
||
:label="t('archive.notArchived')"
|
||
:value="false" /><el-option
|
||
:label="t('appUpdates.statuses.Archived')"
|
||
:value="true"
|
||
/></el-select>
|
||
<el-select
|
||
v-model="status"
|
||
clearable
|
||
:placeholder="t('businessLabels.allStatus')"
|
||
@change="load(true)"
|
||
>
|
||
<el-option
|
||
v-for="(label, value) in statusLabels"
|
||
:key="value"
|
||
:label="label"
|
||
:value="value"
|
||
/>
|
||
</el-select>
|
||
<el-input
|
||
v-model="teacherKeyword"
|
||
clearable
|
||
:prefix-icon="Search"
|
||
:placeholder="t('batchBusiness.instructorNameOrEmployeeNumber')"
|
||
@keyup.enter="load(true)"
|
||
@clear="load(true)"
|
||
/>
|
||
<el-input
|
||
v-model="classKeyword"
|
||
clearable
|
||
:prefix-icon="Search"
|
||
:placeholder="t('batchBusiness.administrativeClassMajorOrClassCode')"
|
||
@keyup.enter="load(true)"
|
||
@clear="load(true)"
|
||
/>
|
||
<el-button :icon="Search" @click="load(true)">{{
|
||
t("businessLabels.search")
|
||
}}</el-button>
|
||
<el-button :icon="Refresh" @click="resetTaskFilters">{{
|
||
t("businessLabels.reset")
|
||
}}</el-button>
|
||
<span>{{
|
||
t("gradesTemplate.countTeachingClassesAvailableToManage", {
|
||
count: taskTotal,
|
||
})
|
||
}}</span>
|
||
</section>
|
||
|
||
<div
|
||
v-if="canArchive"
|
||
style="display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0"
|
||
>
|
||
<el-select
|
||
v-model="archiveSelection"
|
||
multiple
|
||
collapse-tags
|
||
collapse-tags-tooltip
|
||
:placeholder="t('workflowBatch.selectGradeSheetsOnThisPage')"
|
||
style="width: 260px"
|
||
>
|
||
<el-option
|
||
v-for="task in tasks.filter((t) => t.sheet)"
|
||
:key="task.sheet.id"
|
||
:value="task.sheet.id"
|
||
:label="`${task.courseName} · ${task.taskNumber}`"
|
||
/>
|
||
</el-select>
|
||
<el-button
|
||
:disabled="!archiveSelection.length"
|
||
@click="archiveDialog?.open('grades', selectedArchiveRows, true)"
|
||
>{{ t("courses.archiveMany") }}</el-button
|
||
>
|
||
<el-button
|
||
:disabled="!archiveSelection.length"
|
||
@click="archiveDialog?.open('grades', selectedArchiveRows, false)"
|
||
>{{ t("courses.restoreMany") }}</el-button
|
||
>
|
||
<template v-if="selectedTask?.sheet">
|
||
<el-button
|
||
@click="
|
||
archiveDialog?.open(
|
||
'grades',
|
||
[selectedTask.sheet],
|
||
!selectedTask.sheet.isArchived,
|
||
)
|
||
"
|
||
>{{
|
||
selectedTask.sheet.isArchived
|
||
? t("gradesTemplate.restoreCurrentGradeSheet")
|
||
: t("gradesTemplate.archiveCurrentGradeSheet")
|
||
}}</el-button
|
||
>
|
||
<el-button
|
||
@click="archiveDialog?.showHistory('grades', selectedTask.sheet.id)"
|
||
>{{ t("courses.archiveHistory") }}</el-button
|
||
>
|
||
</template>
|
||
</div>
|
||
<section class="grade-workspace" v-loading="loading">
|
||
<aside class="grade-sheet-list">
|
||
<button
|
||
v-for="task in tasks"
|
||
:key="task.id"
|
||
type="button"
|
||
:class="{ active: selectedTask?.id === task.id }"
|
||
@click="selectTask(task)"
|
||
>
|
||
<span>{{ task.courseCode }} · {{ task.taskNumber }}</span>
|
||
<b>{{ task.courseName }}</b>
|
||
<small
|
||
>{{ task.teacherNames.join(t("academicPlanning.separator")) }} ·
|
||
{{ task.classNames.join(t("academicPlanning.separator")) }}</small
|
||
>
|
||
<i :class="task.sheet?.status?.toLowerCase()">
|
||
{{
|
||
task.sheet
|
||
? statusLabels[task.sheet.status]
|
||
: t("gradesTemplate.noGradeSheet")
|
||
}}{{ task.sheet?.isArchived ? t("gradesTemplate.archived") : "" }}
|
||
<template v-if="task.sheet?.pendingBatchCount">{{
|
||
t("gradesTemplate.countBatchesPendingReview", {
|
||
count: task.sheet.pendingBatchCount,
|
||
})
|
||
}}</template>
|
||
<template v-else-if="task.sheet?.approvedBatchCount">{{
|
||
t("gradesTemplate.countBatchesAwaitingPublication", {
|
||
count: task.sheet.approvedBatchCount,
|
||
})
|
||
}}</template>
|
||
<template
|
||
v-else-if="
|
||
task.sheet?.partialPublishedStudentCount &&
|
||
task.sheet.status !== 'Published'
|
||
"
|
||
>{{
|
||
t("gradesTemplate.countStudentsPublishedEarly", {
|
||
count: task.sheet.partialPublishedStudentCount,
|
||
})
|
||
}}</template
|
||
>
|
||
</i>
|
||
</button>
|
||
<el-empty
|
||
v-if="!tasks.length"
|
||
:description="t('workflowBatch.noTeachingClassesAvailableToManage')"
|
||
/>
|
||
<el-pagination
|
||
v-if="taskTotal > taskPageSize"
|
||
class="grade-task-pagination"
|
||
small
|
||
layout="prev, pager, next"
|
||
:current-page="taskPage"
|
||
:page-size="taskPageSize"
|
||
:total="taskTotal"
|
||
@current-change="changeTaskPage"
|
||
/>
|
||
</aside>
|
||
|
||
<main class="grade-register" v-loading="detailLoading">
|
||
<el-empty
|
||
v-if="!selectedTask"
|
||
:description="
|
||
t(
|
||
'workflowBatch.selectATeachingClassFromTheLeftToOpenItsGradeSheet',
|
||
)
|
||
"
|
||
/>
|
||
<section v-else-if="!selectedTask.sheet" class="grade-create-empty">
|
||
<el-icon><DocumentChecked /></el-icon>
|
||
<h3>{{ selectedTask.courseName }}</h3>
|
||
<p>
|
||
{{
|
||
t(
|
||
"gradesTemplate.noGradeSheetExistsForTaskStudentRowsAreCreatedFromTheActiveEnrollmentRoster",
|
||
{ task: selectedTask.taskNumber },
|
||
)
|
||
}}
|
||
</p>
|
||
<el-button type="primary" :icon="Plus" @click="openCreate">{{
|
||
t("workflowBatch.createGradeSheet2")
|
||
}}</el-button>
|
||
</section>
|
||
<template v-else-if="detail">
|
||
<header class="grade-register-head">
|
||
<div>
|
||
<span>{{ detail.courseCode }} · {{ detail.taskNumber }}</span>
|
||
<h3>
|
||
{{
|
||
t("gradesTemplate.courseGradeSheet", {
|
||
course: detail.courseName,
|
||
})
|
||
}}
|
||
</h3>
|
||
<p>
|
||
{{ detail.termName }} ·
|
||
{{
|
||
detail.teacherNames.join(t("academicPlanning.separator"))
|
||
}}
|
||
·
|
||
{{ detail.classNames.join(t("academicPlanning.separator")) }}
|
||
</p>
|
||
<p v-if="detail.courseCollegeName" class="college-meta">
|
||
{{
|
||
t("gradesTemplate.offeringCollegeCollege", {
|
||
college: detail.courseCollegeName,
|
||
})
|
||
}}
|
||
</p>
|
||
</div>
|
||
<div class="status-badge-group">
|
||
<i :class="detail.status.toLowerCase()">{{
|
||
statusLabels[detail.status]
|
||
}}</i>
|
||
<el-button
|
||
text
|
||
type="primary"
|
||
@click="
|
||
$router.push({
|
||
path: '/approvals',
|
||
query: {
|
||
progressType: 'GradeSheet',
|
||
progressId: detail.id,
|
||
},
|
||
})
|
||
"
|
||
>{{ t("approvalProgress.title") }}</el-button
|
||
>
|
||
<small
|
||
v-if="
|
||
detail.status === 'Submitted' && detail.needsCollegeReview
|
||
"
|
||
>
|
||
{{
|
||
t("pageTemplate.reviewRequired", {
|
||
college: detail.needsCollegeReview,
|
||
})
|
||
}}
|
||
</small>
|
||
</div>
|
||
</header>
|
||
|
||
<section class="grade-register-ruler">
|
||
<div>
|
||
<span>{{ t("eventAnalytics.students") }}</span
|
||
><b>{{ detail.recordTotal }}</b>
|
||
</div>
|
||
<div>
|
||
<span>{{ t("graduationClearance.statuses.Completed") }}</span
|
||
><b>{{ completedCount }}</b>
|
||
</div>
|
||
<div>
|
||
<span>{{ t("workflowBatch.pageAverage") }}</span
|
||
><b>{{ averageScore }}</b>
|
||
</div>
|
||
<div>
|
||
<span>{{ t("workflowBatch.passRate") }}</span
|
||
><b>{{ passRate }}</b>
|
||
</div>
|
||
<p>
|
||
{{ evaluationMethodLabels[detail.evaluationMethod] }} ·
|
||
{{
|
||
t("gradesTemplate.courseworkWeight", {
|
||
weight: detail.regularWeight,
|
||
})
|
||
}}
|
||
<template v-if="detail.items?.length">{{
|
||
detail.items
|
||
.map((item: any) => ` · ${item.name} ${item.weight}%`)
|
||
.join("")
|
||
}}</template>
|
||
{{
|
||
t("gradesTemplate.finalExamWeight", {
|
||
weight: detail.finalWeight,
|
||
})
|
||
}}
|
||
</p>
|
||
</section>
|
||
|
||
<el-alert
|
||
v-if="detail.status === 'Returned'"
|
||
:title="
|
||
t('gradesTemplate.returnedForRevisionComment', {
|
||
comment: detail.reviewComment,
|
||
})
|
||
"
|
||
type="warning"
|
||
:closable="false"
|
||
show-icon
|
||
/>
|
||
|
||
<section
|
||
v-if="detail.submissionBatches?.length"
|
||
class="grade-submission-batches"
|
||
>
|
||
<header>
|
||
<div>
|
||
<b>{{
|
||
t("workflowBatch.partialStudentGradePublicationBatches")
|
||
}}</b>
|
||
<small>{{
|
||
t(
|
||
"workflowBatch.eachBatchIsReviewedByTheCollegeAndPublishedByTheUniversitySeparately",
|
||
)
|
||
}}</small>
|
||
</div>
|
||
</header>
|
||
<article
|
||
v-for="batch in detail.submissionBatches"
|
||
:key="batch.id"
|
||
>
|
||
<div class="batch-summary">
|
||
<i :class="batch.status.toLowerCase()">{{
|
||
statusLabels[batch.status]
|
||
}}</i>
|
||
<b>{{
|
||
t("gradesTemplate.countStudents", {
|
||
count: batch.studentCount,
|
||
})
|
||
}}</b>
|
||
<span
|
||
>{{
|
||
batch.students
|
||
.map((student: any) => student.name)
|
||
.join(t("academicPlanning.separator"))
|
||
}}{{
|
||
batch.studentCount > batch.students.length
|
||
? t("gradesTemplate.andOthers")
|
||
: ""
|
||
}}</span
|
||
>
|
||
<small v-if="batch.reviewComment">{{
|
||
t("gradesTemplate.returnCommentComment", {
|
||
comment: batch.reviewComment,
|
||
})
|
||
}}</small>
|
||
</div>
|
||
<div class="batch-actions">
|
||
<el-button
|
||
text
|
||
type="primary"
|
||
size="small"
|
||
@click="
|
||
$router.push({
|
||
path: '/approvals',
|
||
query: {
|
||
progressType: 'GradeSubmissionBatch',
|
||
progressId: batch.id,
|
||
},
|
||
})
|
||
"
|
||
>{{ t("approvalProgress.title") }}</el-button
|
||
>
|
||
<el-button
|
||
v-if="
|
||
detail.canReviewBatches && batch.status === 'Submitted'
|
||
"
|
||
type="danger"
|
||
plain
|
||
size="small"
|
||
@click="openReturnBatch(batch)"
|
||
>{{ t("adjustmentBatch.return") }}</el-button
|
||
>
|
||
<el-button
|
||
v-if="
|
||
detail.canReviewBatches && batch.status === 'Submitted'
|
||
"
|
||
type="success"
|
||
size="small"
|
||
:icon="Check"
|
||
@click="approveSubmissionBatch(batch)"
|
||
>{{ t("workflowBatch.approve") }}</el-button
|
||
>
|
||
<el-button
|
||
v-if="
|
||
detail.canPublishBatches && batch.status === 'Approved'
|
||
"
|
||
type="primary"
|
||
size="small"
|
||
:icon="Promotion"
|
||
@click="publishSubmissionBatch(batch)"
|
||
>{{ t("batchBusiness.finalPublication") }}</el-button
|
||
>
|
||
</div>
|
||
</article>
|
||
</section>
|
||
|
||
<section class="grade-record-toolbar">
|
||
<el-input
|
||
v-model="recordKeyword"
|
||
clearable
|
||
:prefix-icon="Search"
|
||
:placeholder="
|
||
t(
|
||
'gradesTemplate.searchNameStudentNumberOrAdministrativeClass',
|
||
)
|
||
"
|
||
@keyup.enter="searchRecords"
|
||
@clear="searchRecords"
|
||
/>
|
||
<el-button :icon="Search" @click="searchRecords">{{
|
||
t("workflowBatch.findStudents")
|
||
}}</el-button>
|
||
<el-button
|
||
v-if="detail.canEdit"
|
||
plain
|
||
:disabled="!selectedGradeRecords.length"
|
||
@click="openPartialSubmit"
|
||
>{{
|
||
t("gradesTemplate.submitSelectedComponentsCount", {
|
||
count: selectedGradeRecords.length,
|
||
})
|
||
}}</el-button
|
||
>
|
||
<el-button
|
||
v-if="detail.canEdit"
|
||
type="primary"
|
||
:disabled="!selectedGradeRecords.length"
|
||
@click="submitSelectedStudentsForReview"
|
||
>{{
|
||
t("workflowBatch.submitSelectedStudentsForReview")
|
||
}}</el-button
|
||
>
|
||
<span>{{
|
||
t("gradesTemplate.upToSizeStudentsPerPagePagePage", {
|
||
size: recordPageSize,
|
||
page: detail.recordPage,
|
||
})
|
||
}}</span>
|
||
</section>
|
||
|
||
<div class="grade-table-scroll">
|
||
<el-table
|
||
:data="detail.records"
|
||
class="data-table grade-entry-table"
|
||
@selection-change="handleGradeSelectionChange"
|
||
>
|
||
<el-table-column
|
||
v-if="detail.canEdit"
|
||
type="selection"
|
||
fixed
|
||
width="44"
|
||
:selectable="canSelectGradeRecord"
|
||
/>
|
||
<el-table-column
|
||
:label="t('batchBusiness.student')"
|
||
fixed
|
||
min-width="165"
|
||
>
|
||
<template #default="{ row }">
|
||
<div class="record-name">
|
||
<b>{{ row.name }}</b>
|
||
<span>{{ row.studentNumber }} · {{ row.className }}</span>
|
||
<small v-if="row.publishedAt" class="published-record">{{
|
||
t("workflowBatch.publishedEarly")
|
||
}}</small>
|
||
</div>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column
|
||
:label="
|
||
t('gradesTemplate.courseworkWeight', {
|
||
weight: detail.regularWeight,
|
||
})
|
||
"
|
||
width="110"
|
||
>
|
||
<template #default="{ row }">
|
||
<div
|
||
class="score-cell"
|
||
:class="{ 'is-failed': isFailingScore(row.regularScore) }"
|
||
data-score-grid="course-grade-entry"
|
||
:data-score-row="detail.records.indexOf(row)"
|
||
data-score-column="0"
|
||
@keydown="handleScoreGridKeydown"
|
||
>
|
||
<el-input-number
|
||
v-if="
|
||
detail.canEdit &&
|
||
!isSubmitted(row, 'RegularScore') &&
|
||
['Normal', 'Deferred'].includes(row.examStatus)
|
||
"
|
||
v-model="row.regularScore"
|
||
:min="0"
|
||
:max="100"
|
||
:controls="false"
|
||
size="small"
|
||
/>
|
||
<span v-else class="item-score-readonly">
|
||
{{ row.regularScore ?? "—" }}
|
||
<small v-if="isSubmitted(row, 'RegularScore')">{{
|
||
t("workflowBatch.submitted")
|
||
}}</small>
|
||
</span>
|
||
</div>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column
|
||
v-for="item in detail.items"
|
||
:key="item.id"
|
||
:label="`${item.name} ${item.weight}%${item.sourceType === 'ExperimentSummary' ? t('gradesTemplate.labSnapshot') : ''}`"
|
||
:width="item.sourceType === 'ExperimentSummary' ? 150 : 110"
|
||
>
|
||
<template #default="{ row }">
|
||
<div
|
||
class="score-cell"
|
||
:class="{
|
||
'is-failed': isFailingScore(
|
||
itemScore(row, item.id)?.score,
|
||
),
|
||
}"
|
||
data-score-grid="course-grade-entry"
|
||
:data-score-row="detail.records.indexOf(row)"
|
||
:data-score-column="detail.items.indexOf(item) + 1"
|
||
@keydown="handleScoreGridKeydown"
|
||
>
|
||
<el-input-number
|
||
v-if="
|
||
detail.canEdit &&
|
||
!isSubmitted(row, 'GradeItemScore', item.id) &&
|
||
['Normal', 'Deferred'].includes(row.examStatus) &&
|
||
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="isSubmitted(row, 'GradeItemScore', item.id)"
|
||
>{{ t("workflowBatch.submitted") }}</small
|
||
>
|
||
<small
|
||
v-else-if="item.sourceType === 'ExperimentSummary'"
|
||
>{{ t("workflowBatch.locked") }}</small
|
||
>
|
||
</span>
|
||
</div>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column
|
||
:label="
|
||
t('gradesTemplate.finalExamWeight2', {
|
||
weight: detail.finalWeight,
|
||
})
|
||
"
|
||
width="110"
|
||
>
|
||
<template #default="{ row }">
|
||
<div
|
||
class="score-cell"
|
||
:class="{ 'is-failed': isFailingScore(row.finalScore) }"
|
||
data-score-grid="course-grade-entry"
|
||
:data-score-row="detail.records.indexOf(row)"
|
||
:data-score-column="detail.items.length + 1"
|
||
@keydown="handleScoreGridKeydown"
|
||
>
|
||
<el-input-number
|
||
v-if="
|
||
detail.canEdit &&
|
||
!isSubmitted(row, 'FinalScore') &&
|
||
row.examStatus === 'Normal'
|
||
"
|
||
v-model="row.finalScore"
|
||
:min="0"
|
||
:max="100"
|
||
:controls="false"
|
||
size="small"
|
||
/>
|
||
<span v-else class="item-score-readonly">
|
||
{{ row.finalScore ?? "—" }}
|
||
<small v-if="isSubmitted(row, 'FinalScore')">{{
|
||
t("workflowBatch.submitted")
|
||
}}</small>
|
||
</span>
|
||
</div>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column
|
||
:label="t('gradesTemplate.finalScore')"
|
||
width="90"
|
||
>
|
||
<template #default="{ row }">
|
||
<div
|
||
class="score-cell"
|
||
:class="{
|
||
'is-failed': isFailingScore(
|
||
detail.canEdit &&
|
||
['Normal', 'Deferred'].includes(row.examStatus)
|
||
? calcPreviewTotal(row)
|
||
: row.totalScore,
|
||
),
|
||
}"
|
||
>
|
||
<template
|
||
v-if="
|
||
detail.canEdit &&
|
||
['Normal', 'Deferred'].includes(row.examStatus)
|
||
"
|
||
>
|
||
<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
|
||
v-if="detail.evaluationMethod !== 'Percentage'"
|
||
:label="t('workflowBatch.finalEvaluation')"
|
||
width="125"
|
||
>
|
||
<template #default="{ row }">
|
||
<el-select
|
||
v-if="
|
||
detail.canEdit &&
|
||
!isSubmitted(row, 'FinalEvaluation') &&
|
||
['Normal', 'Deferred', 'Makeup'].includes(
|
||
row.examStatus,
|
||
)
|
||
"
|
||
v-model="row.result"
|
||
clearable
|
||
size="small"
|
||
>
|
||
<el-option
|
||
v-for="value in gradeResultOptions"
|
||
:key="value"
|
||
:label="gradeResultLabels[value]"
|
||
:value="value"
|
||
/>
|
||
</el-select>
|
||
<span v-else class="item-score-readonly">
|
||
<b :class="{ 'is-failed': row.isPassed === false }">{{
|
||
gradeResultLabels[row.result] ?? "—"
|
||
}}</b>
|
||
<small v-if="isSubmitted(row, 'FinalEvaluation')">{{
|
||
t("workflowBatch.submitted")
|
||
}}</small>
|
||
</span>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column
|
||
:label="t('workflowBatch.examStatus')"
|
||
width="115"
|
||
>
|
||
<template #default="{ row }">
|
||
<el-select
|
||
v-if="detail.canEdit && !hasSubmittedComponent(row) && row.examStatus !== 'Disqualified'"
|
||
v-model="row.examStatus"
|
||
size="small"
|
||
>
|
||
<el-option
|
||
v-for="(label, value) in examStatusLabels"
|
||
:key="value"
|
||
:label="label"
|
||
:value="value"
|
||
:disabled="value === 'Disqualified'"
|
||
/>
|
||
</el-select>
|
||
<span v-else>{{ examStatusLabels[row.examStatus] }}</span>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column
|
||
:label="t('businessLabels.notes')"
|
||
min-width="140"
|
||
>
|
||
<template #default="{ row }">
|
||
<el-input
|
||
v-if="detail.canEdit && row.examStatus !== 'Disqualified'"
|
||
v-model="row.notes"
|
||
maxlength="300"
|
||
size="small"
|
||
/>
|
||
<span v-else>{{ row.notes || "—" }}</span>
|
||
</template>
|
||
</el-table-column>
|
||
</el-table>
|
||
</div>
|
||
<el-pagination
|
||
v-if="detail.recordTotal > recordPageSize"
|
||
class="grade-record-pagination"
|
||
background
|
||
layout="total, prev, pager, next"
|
||
:current-page="recordPage"
|
||
:page-size="recordPageSize"
|
||
:total="detail.recordTotal"
|
||
@current-change="
|
||
(page: number) => {
|
||
recordPage = page;
|
||
loadDetail();
|
||
}
|
||
"
|
||
/>
|
||
|
||
<input
|
||
ref="importFileInput"
|
||
type="file"
|
||
accept=".xlsx"
|
||
style="display: none"
|
||
@change="handleImport"
|
||
/>
|
||
|
||
<footer class="grade-actions">
|
||
<div class="workflow-status">
|
||
<span
|
||
>{{ statusMeta[detail.status]?.icon }}
|
||
{{ statusLabels[detail.status] }}</span
|
||
>
|
||
<small>{{ statusMeta[detail.status]?.description }}</small>
|
||
<small
|
||
v-if="
|
||
detail.needsCollegeReview &&
|
||
(detail.status === 'Submitted' ||
|
||
detail.status === 'Approved')
|
||
"
|
||
class="college-hint"
|
||
>
|
||
{{
|
||
t("gradesTemplate.offeringCollegeCollege", {
|
||
college: detail.needsCollegeReview,
|
||
})
|
||
}}
|
||
</small>
|
||
<small v-if="detail.canEdit" class="autosave-state">
|
||
{{
|
||
autoSaveState === "saving"
|
||
? t("experimentGradeTemplate.autosaving")
|
||
: autoSaveState === "saved"
|
||
? t("experimentGradeTemplate.autosaved")
|
||
: autoSaveState === "error"
|
||
? t(
|
||
"experimentGradeTemplate.autosaveFailedSaveManually",
|
||
)
|
||
: t(
|
||
"experimentGradeTemplate.autosavesAfterOneMinuteOfInactivity",
|
||
)
|
||
}}
|
||
</small>
|
||
</div>
|
||
<div class="grade-actions-buttons">
|
||
<div
|
||
v-if="detail.canEdit && detail.items?.length"
|
||
class="experiment-import"
|
||
>
|
||
<el-select
|
||
v-model="experimentGradeItemId"
|
||
:placeholder="
|
||
t('gradesTemplate.selectACourseGradeComponent')
|
||
"
|
||
aria-:label="t('gradesTemplate.labGradeImportTarget')"
|
||
>
|
||
<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">{{
|
||
t("workflowBatch.importLabGrades")
|
||
}}</el-button>
|
||
</div>
|
||
<el-button
|
||
v-if="detail.canEdit"
|
||
:icon="Download"
|
||
@click="downloadTemplate"
|
||
>{{ t("businessLabels.downloadTemplate") }}</el-button
|
||
>
|
||
<el-button
|
||
v-if="detail.canEdit"
|
||
:icon="Upload"
|
||
@click="chooseImportFile"
|
||
>{{ t("workflowBatch.importExcel") }}</el-button
|
||
>
|
||
<el-button
|
||
v-if="
|
||
detail.canEdit && detail.evaluationMethod !== 'Percentage'
|
||
"
|
||
:icon="Refresh"
|
||
@click="evaluationToolDialog = true"
|
||
>{{ t("workflowBatch.gradingTool") }}</el-button
|
||
>
|
||
<el-button
|
||
v-if="detail.canEdit"
|
||
:icon="EditPen"
|
||
@click="saveRecords()"
|
||
>{{ t("workflowBatch.saveGrades") }}</el-button
|
||
>
|
||
<el-button
|
||
v-if="detail.canEdit"
|
||
plain
|
||
:icon="DocumentChecked"
|
||
@click="openPartialSubmit"
|
||
>{{ t("workflowBatch.submitSelectedComponents") }}</el-button
|
||
>
|
||
<el-button
|
||
v-if="detail.canEdit"
|
||
type="primary"
|
||
plain
|
||
:icon="Promotion"
|
||
@click="submitSelectedStudentsForReview"
|
||
>{{
|
||
t("workflowBatch.submitSelectedStudentsForReview")
|
||
}}</el-button
|
||
>
|
||
<el-button
|
||
v-if="detail.canEdit"
|
||
type="primary"
|
||
:icon="Promotion"
|
||
@click="submitSheet"
|
||
>{{ t("workflowBatch.submitForReview") }}</el-button
|
||
>
|
||
<el-button
|
||
v-if="detail.canReview"
|
||
type="danger"
|
||
plain
|
||
@click="openReturn"
|
||
>{{ t("workflowBatch.returnForRevision") }}</el-button
|
||
>
|
||
<el-button
|
||
v-if="detail.canReview"
|
||
type="success"
|
||
:icon="Check"
|
||
@click="approveSheet"
|
||
>{{ t("workflowBatch.approve") }}</el-button
|
||
>
|
||
<el-button
|
||
v-if="detail.canPublish"
|
||
type="primary"
|
||
:icon="Promotion"
|
||
@click="publishSheet"
|
||
>{{ t("workflowBatch.publishGrades") }}</el-button
|
||
>
|
||
</div>
|
||
</footer>
|
||
</template>
|
||
</main>
|
||
</section>
|
||
</template>
|
||
|
||
<el-dialog
|
||
v-model="createDialog"
|
||
:title="t('workflowBatch.createGradeSheet2')"
|
||
width="620px"
|
||
>
|
||
<el-alert
|
||
:title="
|
||
t('gradesTemplate.thisCourseUsesMethod', {
|
||
method:
|
||
evaluationMethodLabels[
|
||
selectedTask?.gradeEvaluationMethod ?? 'Percentage'
|
||
],
|
||
})
|
||
"
|
||
:description="
|
||
selectedTask?.gradeEvaluationMethod === 'LetterGrade'
|
||
? t('gradesTemplate.aDPassAndEFailsABCDECountAs43210GPAPoints')
|
||
: selectedTask?.gradeEvaluationMethod === 'PassFail'
|
||
? t('gradesTemplate.passFailCoursesAreExcludedFromGPA')
|
||
: t('gradesTemplate.gpaIsCalculatedFromThePercentageScore')
|
||
"
|
||
type="success"
|
||
:closable="false"
|
||
style="margin-bottom: 12px"
|
||
/>
|
||
<el-alert
|
||
:title="
|
||
t(
|
||
'gradesTemplate.courseworkFinalExamAndAllComponentWeightsMustTotal100',
|
||
)
|
||
"
|
||
type="info"
|
||
:closable="false"
|
||
/>
|
||
<el-form label-position="top" class="grade-weight-form">
|
||
<div class="form-grid three">
|
||
<el-form-item :label="t('workflowBatch.coursework')">
|
||
<el-input-number
|
||
v-model="createForm.regularWeight"
|
||
:min="0"
|
||
:max="100"
|
||
/>
|
||
</el-form-item>
|
||
<el-form-item :label="t('workflowBatch.finalExam')">
|
||
<el-input-number
|
||
v-model="createForm.finalWeight"
|
||
:min="0"
|
||
:max="100"
|
||
/>
|
||
</el-form-item>
|
||
<el-form-item :label="t('workflowBatch.currentTotal')">
|
||
<div class="weight-sum" :class="{ invalid: weightSum !== 100 }">
|
||
<b>{{ weightSum }}%</b>
|
||
<span v-if="weightSum !== 100">{{
|
||
t("workflowBatch.mustTotal100")
|
||
}}</span>
|
||
<span v-else class="valid">✓</span>
|
||
</div>
|
||
</el-form-item>
|
||
</div>
|
||
|
||
<el-divider>{{
|
||
t("workflowBatch.gradeComponentsLabsInternshipsCourseProjectsEtc")
|
||
}}</el-divider>
|
||
|
||
<div class="preset-items">
|
||
<span>{{ t("workflowBatch.quickAdd") }}</span>
|
||
<el-button
|
||
v-for="(name, index) in presetItems"
|
||
:key="name"
|
||
size="small"
|
||
@click="addPresetItem(name)"
|
||
>{{ t(`gradesScript.preset${index}`) }}</el-button
|
||
>
|
||
</div>
|
||
|
||
<div v-if="createForm.items.length" class="item-list">
|
||
<div
|
||
v-for="(item, index) in createForm.items"
|
||
:key="index"
|
||
class="item-row"
|
||
>
|
||
<span>{{ item.name }}</span>
|
||
<el-input-number
|
||
v-model="item.weight"
|
||
:min="0"
|
||
:max="100"
|
||
size="small"
|
||
/>
|
||
<span>%</span>
|
||
<el-button
|
||
:icon="Delete"
|
||
link
|
||
type="danger"
|
||
@click="removeItem(index)"
|
||
/>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="add-item-row">
|
||
<el-input
|
||
v-model="newItemName"
|
||
:placeholder="t('workflowBatch.customName')"
|
||
size="small"
|
||
style="width: 160px"
|
||
/>
|
||
<el-input-number
|
||
v-model="newItemWeight"
|
||
:min="0"
|
||
:max="100"
|
||
size="small"
|
||
/>
|
||
<span>%</span>
|
||
<el-button size="small" :icon="Plus" @click="addItem">{{
|
||
t("repairManagement.add")
|
||
}}</el-button>
|
||
</div>
|
||
</el-form>
|
||
<template #footer>
|
||
<el-button @click="createDialog = false">{{
|
||
t("businessLabels.cancel")
|
||
}}</el-button>
|
||
<el-button
|
||
type="primary"
|
||
:disabled="weightSum !== 100"
|
||
@click="createSheet"
|
||
>{{ t("workflowBatch.createGradeSheet3") }}</el-button
|
||
>
|
||
</template>
|
||
</el-dialog>
|
||
|
||
<el-dialog
|
||
v-model="partialSubmitDialog"
|
||
:title="t('workflowBatch.submitGradesInBatches')"
|
||
width="560px"
|
||
>
|
||
<el-alert
|
||
:title="
|
||
t('gradesTemplate.countStudentsSelected', {
|
||
count: selectedGradeRecords.length,
|
||
})
|
||
"
|
||
:description="
|
||
t(
|
||
'workflowBatch.theSelectedComponentsForSelectedStudentsLockImmediatelyOtherEntriesRemainEditableStudentsCannotSeeTheseGradesBeforeTheWholeSheetIsSubmittedForReview',
|
||
)
|
||
"
|
||
type="info"
|
||
:closable="false"
|
||
show-icon
|
||
style="margin-bottom: 16px"
|
||
/>
|
||
<el-form label-position="top">
|
||
<el-form-item
|
||
:label="t('workflowBatch.selectComponentsForThisSubmission')"
|
||
required
|
||
>
|
||
<el-checkbox v-model="partialSubmitForm.regularScore">
|
||
{{
|
||
t("gradesTemplate.courseworkWeight2", {
|
||
weight: detail?.regularWeight,
|
||
})
|
||
}}
|
||
</el-checkbox>
|
||
<el-checkbox-group
|
||
v-model="partialSubmitForm.gradeItemIds"
|
||
class="partial-submit-items"
|
||
>
|
||
<el-checkbox
|
||
v-for="item in detail?.items ?? []"
|
||
:key="item.id"
|
||
:value="item.id"
|
||
>
|
||
{{ item.name }}({{ item.weight }}%)
|
||
</el-checkbox>
|
||
</el-checkbox-group>
|
||
<el-checkbox v-model="partialSubmitForm.finalScore">
|
||
{{
|
||
t("gradesTemplate.finalExamWeight3", {
|
||
weight: detail?.finalWeight,
|
||
})
|
||
}}
|
||
</el-checkbox>
|
||
<el-checkbox
|
||
v-if="detail?.evaluationMethod !== 'Percentage'"
|
||
v-model="partialSubmitForm.finalEvaluation"
|
||
>
|
||
{{ t("workflowBatch.finalEvaluation") }}
|
||
</el-checkbox>
|
||
</el-form-item>
|
||
</el-form>
|
||
<template #footer>
|
||
<el-button @click="partialSubmitDialog = false">{{
|
||
t("businessLabels.cancel")
|
||
}}</el-button>
|
||
<el-button type="primary" @click="submitPartialGrades">{{
|
||
t("workflowBatch.confirmBatchSubmission")
|
||
}}</el-button>
|
||
</template>
|
||
</el-dialog>
|
||
|
||
<el-dialog
|
||
v-model="evaluationToolDialog"
|
||
:title="t('workflowBatch.instructorGradingTool')"
|
||
width="560px"
|
||
>
|
||
<el-alert
|
||
:title="
|
||
t(
|
||
'workflowBatch.generateFinalEvaluationsFromCurrentTotalScoresTheyCanBeAdjustedIndividuallyAfterward',
|
||
)
|
||
"
|
||
type="info"
|
||
:closable="false"
|
||
style="margin-bottom: 16px"
|
||
/>
|
||
<el-form
|
||
v-if="detail?.evaluationMethod === 'PassFail'"
|
||
label-position="top"
|
||
>
|
||
<el-form-item :label="t('workflowBatch.passingThreshold')">
|
||
<el-input-number
|
||
v-model="evaluationToolForm.passScore"
|
||
:min="0"
|
||
:max="100"
|
||
/>
|
||
</el-form-item>
|
||
</el-form>
|
||
<el-form v-else label-position="top">
|
||
<div class="form-grid">
|
||
<el-form-item
|
||
:label="t('gradesTemplate.minimumScoreForGrade', { grade: 'A' })"
|
||
><el-input-number
|
||
v-model="evaluationToolForm.aMinimum"
|
||
:min="0"
|
||
:max="100"
|
||
/></el-form-item>
|
||
<el-form-item
|
||
:label="t('gradesTemplate.minimumScoreForGrade', { grade: 'B' })"
|
||
><el-input-number
|
||
v-model="evaluationToolForm.bMinimum"
|
||
:min="0"
|
||
:max="100"
|
||
/></el-form-item>
|
||
<el-form-item
|
||
:label="t('gradesTemplate.minimumScoreForGrade', { grade: 'C' })"
|
||
><el-input-number
|
||
v-model="evaluationToolForm.cMinimum"
|
||
:min="0"
|
||
:max="100"
|
||
/></el-form-item>
|
||
<el-form-item
|
||
:label="t('gradesTemplate.minimumScoreForGrade', { grade: 'D' })"
|
||
><el-input-number
|
||
v-model="evaluationToolForm.dMinimum"
|
||
:min="0"
|
||
:max="100"
|
||
/></el-form-item>
|
||
</div>
|
||
<p class="field-hint">
|
||
{{
|
||
t(
|
||
"workflowBatch.scoresBelowTheDThresholdAreAssignedEEIsAFailingGrade",
|
||
)
|
||
}}
|
||
</p>
|
||
</el-form>
|
||
<template #footer>
|
||
<el-button @click="evaluationToolDialog = false">{{
|
||
t("businessLabels.cancel")
|
||
}}</el-button>
|
||
<el-button type="primary" @click="applyEvaluationTool">{{
|
||
t("workflowBatch.generateEvaluations")
|
||
}}</el-button>
|
||
</template>
|
||
</el-dialog>
|
||
|
||
<el-dialog
|
||
v-model="returnDialog"
|
||
:title="
|
||
returnBatchId
|
||
? t('gradesTemplate.returnSelectedStudentsGrades')
|
||
: t('gradesTemplate.returnGradeSheet')
|
||
"
|
||
width="560px"
|
||
>
|
||
<el-form label-position="top">
|
||
<el-form-item :label="t('workflowBatch.revisionInstructions')" required>
|
||
<el-input
|
||
v-model="returnComment"
|
||
type="textarea"
|
||
:rows="4"
|
||
maxlength="500"
|
||
show-word-limit
|
||
/>
|
||
</el-form-item>
|
||
</el-form>
|
||
<template #footer>
|
||
<el-button @click="returnDialog = false">{{
|
||
t("businessLabels.cancel")
|
||
}}</el-button>
|
||
<el-button type="danger" @click="returnSheet">{{
|
||
t("workflowBatch.confirmReturn")
|
||
}}</el-button>
|
||
</template>
|
||
</el-dialog>
|
||
</div>
|
||
<ArchiveDialog ref="archiveDialog" @changed="load()" />
|
||
</template>
|
||
|
||
<style scoped>
|
||
.grade-weight-form {
|
||
margin-top: 16px;
|
||
}
|
||
.weight-sum {
|
||
display: flex;
|
||
align-items: baseline;
|
||
gap: 8px;
|
||
padding: 12px;
|
||
border-radius: 6px;
|
||
background: #f5f7fa;
|
||
}
|
||
.weight-sum b {
|
||
font:
|
||
700 22px/1 Consolas,
|
||
monospace;
|
||
color: var(--indigo);
|
||
}
|
||
.weight-sum.invalid b {
|
||
color: #b34e48;
|
||
}
|
||
.weight-sum span {
|
||
font-size: 11px;
|
||
color: var(--muted);
|
||
}
|
||
.weight-sum .valid {
|
||
color: #2d8975;
|
||
font-weight: 700;
|
||
}
|
||
.preset-items {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 6px;
|
||
flex-wrap: wrap;
|
||
margin-bottom: 12px;
|
||
}
|
||
.preset-items > span {
|
||
font-size: 11px;
|
||
color: var(--muted);
|
||
}
|
||
.item-list {
|
||
display: grid;
|
||
gap: 6px;
|
||
margin-bottom: 12px;
|
||
}
|
||
.item-row {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 8px;
|
||
padding: 6px 10px;
|
||
background: #eef5f0;
|
||
border-radius: 4px;
|
||
}
|
||
.item-row > span:first-child {
|
||
flex: 1;
|
||
font-size: 13px;
|
||
font-weight: 650;
|
||
}
|
||
.add-item-row {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 8px;
|
||
}
|
||
.partial-submit-items {
|
||
display: grid;
|
||
width: 100%;
|
||
padding-left: 24px;
|
||
}
|
||
.grade-submission-batches {
|
||
margin: 12px 16px 0;
|
||
border: 1px solid #d8e2ef;
|
||
border-radius: 8px;
|
||
background: #f8fbff;
|
||
}
|
||
.grade-submission-batches > header {
|
||
padding: 10px 12px;
|
||
border-bottom: 1px solid #d8e2ef;
|
||
}
|
||
.grade-submission-batches > header div {
|
||
display: flex;
|
||
align-items: baseline;
|
||
gap: 10px;
|
||
}
|
||
.grade-submission-batches > header small {
|
||
color: var(--muted);
|
||
}
|
||
.grade-submission-batches article {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
gap: 12px;
|
||
padding: 10px 12px;
|
||
}
|
||
.grade-submission-batches article + article {
|
||
border-top: 1px solid #e5ebf3;
|
||
}
|
||
.batch-summary {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 8px;
|
||
flex-wrap: wrap;
|
||
}
|
||
.batch-summary i {
|
||
padding: 2px 7px;
|
||
border-radius: 999px;
|
||
background: #e7edf6;
|
||
font-style: normal;
|
||
font-size: 11px;
|
||
}
|
||
.batch-summary i.submitted {
|
||
color: #8a5a00;
|
||
background: #fff1ce;
|
||
}
|
||
.batch-summary i.approved {
|
||
color: #176b52;
|
||
background: #dff4eb;
|
||
}
|
||
.batch-summary i.published {
|
||
color: #315a9b;
|
||
background: #e4edfb;
|
||
}
|
||
.batch-summary i.returned {
|
||
color: #a33b35;
|
||
background: #fde7e5;
|
||
}
|
||
.batch-summary span,
|
||
.batch-summary small {
|
||
color: var(--muted);
|
||
font-size: 12px;
|
||
}
|
||
.batch-summary small {
|
||
width: 100%;
|
||
}
|
||
.batch-actions {
|
||
display: flex;
|
||
gap: 6px;
|
||
flex-shrink: 0;
|
||
}
|
||
.record-name .published-record {
|
||
color: #2d8975;
|
||
font-size: 10px;
|
||
font-weight: 700;
|
||
}
|
||
|
||
.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;
|
||
}
|
||
.transcript-course-card {
|
||
transition:
|
||
transform 0.18s ease,
|
||
border-color 0.18s ease,
|
||
box-shadow 0.18s ease;
|
||
}
|
||
.transcript-course-card.clickable {
|
||
cursor: pointer;
|
||
}
|
||
.transcript-course-card.clickable:hover {
|
||
transform: translateY(-2px);
|
||
border-color: #91a8c8;
|
||
box-shadow: 0 10px 24px rgb(31 66 112 / 9%);
|
||
}
|
||
.transcript-course-card:focus-visible {
|
||
outline: 2px solid #315a9b;
|
||
outline-offset: 3px;
|
||
}
|
||
.card-entry {
|
||
display: inline-flex !important;
|
||
align-items: center;
|
||
justify-content: flex-end;
|
||
gap: 4px;
|
||
margin-top: 8px;
|
||
color: #315a9b !important;
|
||
font-size: 10px !important;
|
||
font-weight: 700;
|
||
}
|
||
.grade-breakdown {
|
||
grid-column: 1 / -1;
|
||
display: grid;
|
||
grid-template-columns: 70px minmax(0, 1fr);
|
||
gap: 16px;
|
||
padding-top: 15px;
|
||
border-top: 1px solid #e7ebf1;
|
||
}
|
||
.grade-breakdown-label {
|
||
padding-top: 5px;
|
||
color: #657386;
|
||
font-size: 10px;
|
||
font-weight: 700;
|
||
letter-spacing: 0.08em;
|
||
}
|
||
.grade-formula {
|
||
display: flex;
|
||
align-items: stretch;
|
||
gap: 8px;
|
||
min-width: 0;
|
||
overflow-x: auto;
|
||
padding-bottom: 2px;
|
||
}
|
||
.grade-formula-component {
|
||
flex: 0 0 auto;
|
||
min-width: 132px;
|
||
display: grid;
|
||
grid-template-rows: 1fr 1fr;
|
||
background: linear-gradient(#f7f9fc 50%, #fff 50%);
|
||
box-shadow:
|
||
inset 0 1px #d9e1eb,
|
||
inset 0 -1px #d9e1eb;
|
||
}
|
||
.component-name {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
padding: 6px 10px 5px;
|
||
color: #405875;
|
||
border-bottom: 1px solid #d9e1eb;
|
||
font-size: 11px;
|
||
font-weight: 700;
|
||
white-space: nowrap;
|
||
}
|
||
.grade-formula-component strong,
|
||
.grade-formula-total strong {
|
||
color: #233d68;
|
||
font:
|
||
700 14px/1.25 Consolas,
|
||
"Courier New",
|
||
monospace;
|
||
white-space: nowrap;
|
||
}
|
||
.grade-formula-component strong {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
padding: 6px 10px;
|
||
}
|
||
.formula-operator {
|
||
flex: 0 0 26px;
|
||
align-self: center;
|
||
color: #8190a3;
|
||
font:
|
||
400 20px/1 Georgia,
|
||
serif;
|
||
text-align: center;
|
||
}
|
||
.formula-operator.equals {
|
||
color: #315a9b;
|
||
}
|
||
.grade-formula-total {
|
||
flex: 0 0 auto;
|
||
min-width: 88px;
|
||
display: grid;
|
||
grid-template-rows: 1fr 1fr;
|
||
background: #eaf5f3;
|
||
box-shadow:
|
||
inset 0 1px #9fcfc7,
|
||
inset 0 -1px #9fcfc7;
|
||
}
|
||
.grade-formula-total span {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
padding: 6px 10px 5px;
|
||
color: #176b70;
|
||
border-bottom: 1px solid #9fcfc7;
|
||
font-size: 11px;
|
||
font-weight: 700;
|
||
}
|
||
.grade-formula-total strong {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
padding: 6px 10px;
|
||
color: #176b70;
|
||
font-size: 19px;
|
||
}
|
||
|
||
/* Preview total score */
|
||
.total-score.preview {
|
||
text-decoration: underline dashed;
|
||
text-underline-offset: 3px;
|
||
text-decoration-color: var(--muted);
|
||
cursor: help;
|
||
}
|
||
|
||
/* College review */
|
||
.college-meta {
|
||
color: var(--muted);
|
||
font-size: 12px;
|
||
margin-top: 2px;
|
||
}
|
||
.status-badge-group {
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: flex-end;
|
||
gap: 4px;
|
||
}
|
||
.status-badge-group small {
|
||
font-size: 11px;
|
||
color: var(--muted);
|
||
}
|
||
.workflow-status {
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 2px;
|
||
}
|
||
.workflow-status span {
|
||
font-weight: 650;
|
||
font-size: 13px;
|
||
}
|
||
.workflow-status small {
|
||
color: var(--muted);
|
||
font-size: 11px;
|
||
}
|
||
.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 {
|
||
flex-wrap: wrap;
|
||
}
|
||
.grade-toolbar > .el-input {
|
||
width: min(260px, 100%);
|
||
}
|
||
.grade-task-pagination {
|
||
justify-content: center;
|
||
padding: 14px 8px;
|
||
border-top: 1px solid var(--line);
|
||
}
|
||
.grade-record-toolbar {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 8px;
|
||
flex-wrap: wrap;
|
||
padding: 12px 16px;
|
||
border-bottom: 1px solid var(--line);
|
||
background: #f7f9fb;
|
||
}
|
||
.grade-record-toolbar .el-input {
|
||
width: min(300px, 100%);
|
||
}
|
||
.grade-record-toolbar > span {
|
||
margin-left: auto;
|
||
color: var(--muted);
|
||
font-size: 11px;
|
||
}
|
||
.grade-record-pagination {
|
||
justify-content: flex-end;
|
||
padding: 14px 16px;
|
||
border-top: 1px solid var(--line);
|
||
}
|
||
@media (max-width: 760px) {
|
||
.grade-breakdown {
|
||
grid-template-columns: 1fr;
|
||
gap: 7px;
|
||
}
|
||
.grade-breakdown-label {
|
||
padding-top: 0;
|
||
}
|
||
.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>
|