fix(选人截断):员工名册超500人后选人下拉漏人 1.年度计划收集默认课长为空:批量导入后名册达702人,按创建时间倒序前500人里0名课长(37名课长排在500名之外) 2.手动推送/年度计划按人员搜索"刘义亮"提示暂无数据:其档案排在第701名,不在单页500条内 3.新增 listAllTrainingMembers 分页拉全量名册helper,统一替换7处 listMembers({page_size:500}) 单页截断:年度计划收集/需求导入讲师匹配/课程管理参加人员/培训签到/考试成绩/课程库/手动推送
deploy-hxtesting / build-and-deploy (push) Successful in 1m2s

This commit is contained in:
runny authored and testing committed 2026-11-29 14:50:33 +08:00
1 parent 61fb94744a
commit 4e071f9da0
7 files changed
+46 -25

No files matched your search

+18
View File
@@ -86,6 +86,24 @@ export const deleteDept = (id: string) =>
export const listMembers = (query?: ListQuery) => export const listMembers = (query?: ListQuery) =>
get<{ success: boolean; data: PagedData<TrainingMember> }>(`${base}/members`, { params: query }) get<{ success: boolean; data: PagedData<TrainingMember> }>(`${base}/members`, { params: query })
// listAllTrainingMembers 拉取全量员工名册(分页循环,直到取满 total 或空页)。
// [2026-11-29 复测] 名册超过 500 人后,单页 page_size=500 会把老批次员工
// (含默认课长、搜索目标)截断在第一页之外 —— 年度计划收集默认课长消失、
// 手动推送/课程管理/签到/考试等选人下拉搜不到人的共同根因;选人场景一律
// 用本 helper 拉全量,名册继续增长也不再复发。
export async function listAllTrainingMembers(pageSize = 500): Promise<TrainingMember[]> {
const out: TrainingMember[] = []
for (let page = 1; page <= 100; page++) {
const res = await listMembers({ page, page_size: pageSize })
const pageData = unwrap<PagedData<TrainingMember>>(res)
const items = pageData?.items || []
out.push(...items)
const total = Number(pageData?.total || 0)
if (!items.length || (total > 0 && out.length >= total)) break
}
return out
}
export interface PlatformUser { export interface PlatformUser {
id: string id: string
username: string username: string
@@ -585,7 +585,7 @@ import {
listLecturers, listLecturers,
listLibraryCourseQuestionBanks, listLibraryCourseQuestionBanks,
listMaterials, listMaterials,
listMembers, listAllTrainingMembers,
listQuestionBanks, listQuestionBanks,
listSessions, listSessions,
publishCourse, publishCourse,
@@ -1445,7 +1445,8 @@ const loadAll = async () => {
const [c, d, m, l, s, lib, banks] = await Promise.all([ const [c, d, m, l, s, lib, banks] = await Promise.all([
listCourses({ page_size: 100 }), listCourses({ page_size: 100 }),
listDepts(), listDepts(),
listMembers({ page_size: 500 }), // 全量名册([2026-11-29 复测] 单页 500 截断,参加人员选择会漏老批次员工)
listAllTrainingMembers().catch(() => []),
listLecturers().catch(() => []), listLecturers().catch(() => []),
listSessions({ year: 0, month: 0 }).catch(() => []), listSessions({ year: 0, month: 0 }).catch(() => []),
// scope=plan(000163):创建月度计划选课口径 —— 维护角色可选全部部门课程, // scope=plan(000163):创建月度计划选课口径 —— 维护角色可选全部部门课程,
@@ -1455,7 +1456,7 @@ const loadAll = async () => {
]) ])
courses.value = unwrap(c)?.items || [] courses.value = unwrap(c)?.items || []
depts.value = unwrap(d) || [] depts.value = unwrap(d) || []
members.value = unwrap(m)?.items || [] members.value = m || []
lecturers.value = (l && unwrap(l)) || [] lecturers.value = (l && unwrap(l)) || []
sessions.value = (s && unwrap(s)) || [] sessions.value = (s && unwrap(s)) || []
libraryCourses.value = (lib && unwrap(lib)?.items) || [] libraryCourses.value = (lib && unwrap(lib)?.items) || []
@@ -155,7 +155,7 @@ import {
listCoursePapers, listCoursePapers,
listDepts, listDepts,
listEnrollments, listEnrollments,
listMembers, listAllTrainingMembers,
listPaperRecords, listPaperRecords,
listSessions, listSessions,
submitExam, submitExam,
@@ -331,7 +331,8 @@ watch(filteredRecords, resetRecordPage)
const loadAll = async () => { const loadAll = async () => {
const [s, m, c, d] = await Promise.all([ const [s, m, c, d] = await Promise.all([
listSessions({ page_size: 200 }), listSessions({ page_size: 200 }),
listMembers({ page_size: 500 }).catch(() => null), // 全量名册([2026-11-29 复测] 单页 500 截断会漏人,考生/代交卷按全量口径)
listAllTrainingMembers().catch(() => []),
listCourses({ page_size: 100 }).catch(() => null), listCourses({ page_size: 100 }).catch(() => null),
listDepts().catch(() => null), listDepts().catch(() => null),
]) ])
@@ -340,9 +341,8 @@ const loadAll = async () => {
deptNames.value = Object.fromEntries( deptNames.value = Object.fromEntries(
((d && unwrap(d) || []) as TrainingDept[]).map((dep) => [dep.id, dep.name]), ((d && unwrap(d) || []) as TrainingDept[]).map((dep) => [dep.id, dep.name]),
) )
const memberItems = (m && unwrap(m)?.items) || [] if (m?.length) {
if (memberItems.length) { members.value = m
members.value = memberItems
const labels: Record<string, string> = {} const labels: Record<string, string> = {}
for (const mem of members.value) { for (const mem of members.value) {
labels[mem.id] = `${mem.employee_no || '-'} ${mem.post || ''}`.trim() || mem.id.slice(0, 8) labels[mem.id] = `${mem.employee_no || '-'} ${mem.post || ''}`.trim() || mem.id.slice(0, 8)
@@ -557,7 +557,7 @@ import {
listCourseLibrary, listCourseLibrary,
listDepts, listDepts,
listLibraryCourseQuestionBanks, listLibraryCourseQuestionBanks,
listMembers, listAllTrainingMembers,
listQuestions, listQuestions,
offlineCourseLibraryItem, offlineCourseLibraryItem,
removeCourseLibraryMaterial, removeCourseLibraryMaterial,
@@ -860,14 +860,15 @@ const loadAll = async () => {
try { try {
const [lib, m, d, cats, me] = await Promise.all([ const [lib, m, d, cats, me] = await Promise.all([
listCourseLibrary({ page_size: 500 }), listCourseLibrary({ page_size: 500 }),
listMembers({ page_size: 500 }).catch(() => null), // 全量名册([2026-11-29 复测] 单页 500 截断会漏人,讲师/权限人员选择按全量)
listAllTrainingMembers().catch(() => []),
listDepts().catch(() => null), listDepts().catch(() => null),
fetchCourseCategories(), fetchCourseCategories(),
// 本人档案:新增课程「所属部门」默认当前登录用户所在部门 // 本人档案:新增课程「所属部门」默认当前登录用户所在部门
getMyProfile().catch(() => null), getMyProfile().catch(() => null),
]) ])
items.value = unwrap(lib)?.items || [] items.value = unwrap(lib)?.items || []
members.value = (m && unwrap(m)?.items) || [] members.value = m || []
depts.value = (d && unwrap(d)) || [] depts.value = (d && unwrap(d)) || []
configCategories.value = cats configCategories.value = cats
const meBody = me && unwrap(me) const meBody = me && unwrap(me)
@@ -278,8 +278,8 @@ import {
listDemandYears, listDemandYears,
listDemands, listDemands,
listDepts, listDepts,
listAllTrainingMembers,
listLecturers, listLecturers,
listMembers,
saveDemand, saveDemand,
type TrainingDept, type TrainingDept,
type TrainingDemand, type TrainingDemand,
@@ -855,8 +855,8 @@ const onImportDemandExcel = async (e: Event) => {
if (members.value.length) return if (members.value.length) return
membersLoading.value = true membersLoading.value = true
try { try {
const res = await listMembers({ page_size: 500 }) // 全量名册:讲师按姓名匹配不能漏人(单页 500 会截断,见 listAllTrainingMembers)
members.value = unwrap(res)?.items || [] members.value = await listAllTrainingMembers()
} catch { } catch {
/* 拉取失败时按空名册处理,讲师全部按外部姓名落库 */ /* 拉取失败时按空名册处理,讲师全部按外部姓名落库 */
} finally { } finally {
@@ -1016,8 +1016,8 @@ const openCollect = async () => {
if (!members.value.length) { if (!members.value.length) {
membersLoading.value = true membersLoading.value = true
try { try {
const res = await listMembers({ page_size: 500 }) // 全量名册([2026-11-29 复测] 单页 500 截断会漏掉老批次课长,默认推荐为空)
members.value = unwrap(res)?.items || [] members.value = await listAllTrainingMembers()
} catch { } catch {
/* 拉取失败时保留空态,可手动搜索添加 */ /* 拉取失败时保留空态,可手动搜索添加 */
} finally { } finally {
@@ -514,8 +514,8 @@ import {
deleteTrainingTemplate, deleteTrainingTemplate,
fetchRoleDict, fetchRoleDict,
listDepts, listDepts,
listAllTrainingMembers,
listManualPushTasks, listManualPushTasks,
listMembers,
listPosts, listPosts,
listRuleConfigs, listRuleConfigs,
listTrainingPushLogs, listTrainingPushLogs,
@@ -1156,13 +1156,14 @@ const loadRosters = async () => {
if (rostersLoaded.value) return if (rostersLoaded.value) return
rostersLoaded.value = true rostersLoaded.value = true
try { try {
const [deptRes, memberRes, postRes] = await Promise.all([ const [deptRes, memberList, postRes] = await Promise.all([
listDepts(), listDepts(),
listMembers({ page_size: 500 }), // 全量名册([2026-11-29 复测] 单页 500 截断会漏人,手动推送选人按全量)
listAllTrainingMembers(),
listPosts(), listPosts(),
]) ])
depts.value = unwrap<TrainingDept[]>(deptRes) || [] depts.value = unwrap<TrainingDept[]>(deptRes) || []
members.value = unwrap<{ items: TrainingMember[] }>(memberRes)?.items || [] members.value = memberList
postOptions.value = postOptions.value =
unwrap<string[]>(postRes) || unwrap<string[]>(postRes) ||
[...new Set(members.value.map((m) => m.post).filter(Boolean))].sort() [...new Set(members.value.map((m) => m.post).filter(Boolean))].sort()
@@ -193,7 +193,7 @@ import {
getSignCode, getSignCode,
getSignSummary, getSignSummary,
listCourses, listCourses,
listMembers, listAllTrainingMembers,
listSessions, listSessions,
listSessionEvidence, listSessionEvidence,
listSignRecords, listSignRecords,
@@ -405,13 +405,13 @@ const loadAll = async () => {
const [s, c, m] = await Promise.all([ const [s, c, m] = await Promise.all([
listSessions({ page_size: 200 }), listSessions({ page_size: 200 }),
listCourses({ page_size: 200 }), listCourses({ page_size: 200 }),
listMembers({ page_size: 500 }).catch(() => null), // 全量名册([2026-11-29 复测] 单页 500 截断会漏人,签到明细姓名映射按全量)
listAllTrainingMembers().catch(() => []),
]) ])
sessions.value = unwrap(s) || [] sessions.value = unwrap(s) || []
courses.value = unwrap(c)?.items || [] courses.value = unwrap(c)?.items || []
const memberItems = (m && unwrap(m)?.items) || [] if (m?.length) {
if (memberItems.length) { members.value = m
members.value = memberItems
const labels: Record<string, string> = {} const labels: Record<string, string> = {}
for (const mem of members.value) { for (const mem of members.value) {
// 签到明细学员列(000165):「姓名 工号」,无姓名时回退工号 // 签到明细学员列(000165):「姓名 工号」,无姓名时回退工号