| | |
| | | import type { GradeStatus } from './types'; |
| | | import { ref } from 'vue'; |
| | | |
| | | export const GRADE_STATUS_OPTIONS: { id: GradeStatus; fullName: string; color?: string }[] = [ |
| | | { id: 'auto', fullName: '无需阅卷', color: '#8c8c8c' }, |
| | | { id: 'pending', fullName: '待批改', color: '#fa8c16' }, |
| | | { id: 'graded', fullName: '已批改', color: '#52c41a' }, |
| | | ]; |
| | | import { useBaseStore } from '#/store'; |
| | | import { TMS_DIC, labelOfDic, loadTmsDic, type TmsDicOpt } from '#/views/x/tms/shared/dic'; |
| | | |
| | | const GRADE_STATUS_COLOR: Record<string, string> = { |
| | | auto: '#8c8c8c', |
| | | pending: '#fa8c16', |
| | | graded: '#52c41a', |
| | | }; |
| | | |
| | | export const GRADE_STATUS_OPTIONS = ref<TmsDicOpt[]>([]); |
| | | |
| | | export async function loadExamGradeDics() { |
| | | const baseStore = useBaseStore(); |
| | | GRADE_STATUS_OPTIONS.value = await loadTmsDic(baseStore, TMS_DIC.gradeStatus); |
| | | } |
| | | |
| | | export function labelOfGradeStatus(v?: string) { |
| | | return GRADE_STATUS_OPTIONS.find((x) => x.id === v)?.fullName ?? v ?? '-'; |
| | | return labelOfDic(GRADE_STATUS_OPTIONS.value, v); |
| | | } |
| | | |
| | | export function colorOfGradeStatus(v?: string) { |
| | | return GRADE_STATUS_OPTIONS.find((x) => x.id === v)?.color; |
| | | return (v && GRADE_STATUS_COLOR[v]) || undefined; |
| | | } |