feat(admin): 班级花名册导入确认流程与教师候选人

- 提交体条件化:空数组不发送,修复全匹配/全新建两种场景被后端 @ArrayMinSize 拒 400
- 无论是否新建学生都先确认,避免已匹配学生被一键加入无提示
- 学员下拉保留学号/ID 兜底区分同名;科目去重键小写对齐后端唯一索引
- 任课老师空科目前端拦截;教师候选人相关调整
This commit is contained in:
2026-08-11 11:54:09 +08:00
parent f19e72ca40
commit 48d06b29c1
6 changed files with 486 additions and 66 deletions

View File

@@ -10,7 +10,6 @@ export interface TeacherCandidateUser {
isArchived: boolean;
studentStatus?: string | null;
roles?: TeacherCandidateRole[];
profile?: { subjects?: string[] } | null;
}
const isSuperAdminRole = (role: TeacherCandidateRole) =>
@@ -31,16 +30,7 @@ export const buildTeacherCandidateLabel = (user: TeacherCandidateUser) => {
const roleNames = [
...new Set((user.roles || []).flatMap((role) => (role.name ? [role.name] : []))),
];
const subjects = [
...new Set(
(user.profile?.subjects || []).flatMap((subject) => {
const trimmed = subject.trim();
return trimmed ? [trimmed] : [];
}),
),
];
return [identity, roleNames.join('/'), subjects.join('/')].filter(Boolean).join(' · ');
return [identity, roleNames.join('/')].filter(Boolean).join(' · ');
};
export const buildTeacherCandidateOptions = (users: TeacherCandidateUser[]) =>