From 4e071f9da0343875193467c124b5a55d8cb0a902 Mon Sep 17 00:00:00 2001 From: "DESKTOP-JKIE562\\PC" <1013397054@qq.com> Date: Sun, 29 Nov 2026 14:49:00 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E9=80=89=E4=BA=BA=E6=88=AA=E6=96=AD):?= =?UTF-8?q?=E5=91=98=E5=B7=A5=E5=90=8D=E5=86=8C=E8=B6=85500=E4=BA=BA?= =?UTF-8?q?=E5=90=8E=E9=80=89=E4=BA=BA=E4=B8=8B=E6=8B=89=E6=BC=8F=E4=BA=BA?= =?UTF-8?q?=201.=E5=B9=B4=E5=BA=A6=E8=AE=A1=E5=88=92=E6=94=B6=E9=9B=86?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E8=AF=BE=E9=95=BF=E4=B8=BA=E7=A9=BA:?= =?UTF-8?q?=E6=89=B9=E9=87=8F=E5=AF=BC=E5=85=A5=E5=90=8E=E5=90=8D=E5=86=8C?= =?UTF-8?q?=E8=BE=BE702=E4=BA=BA,=E6=8C=89=E5=88=9B=E5=BB=BA=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E5=80=92=E5=BA=8F=E5=89=8D500=E4=BA=BA=E9=87=8C0?= =?UTF-8?q?=E5=90=8D=E8=AF=BE=E9=95=BF(37=E5=90=8D=E8=AF=BE=E9=95=BF?= =?UTF-8?q?=E6=8E=92=E5=9C=A8500=E5=90=8D=E4=B9=8B=E5=A4=96)=202.=E6=89=8B?= =?UTF-8?q?=E5=8A=A8=E6=8E=A8=E9=80=81/=E5=B9=B4=E5=BA=A6=E8=AE=A1?= =?UTF-8?q?=E5=88=92=E6=8C=89=E4=BA=BA=E5=91=98=E6=90=9C=E7=B4=A2"?= =?UTF-8?q?=E5=88=98=E4=B9=89=E4=BA=AE"=E6=8F=90=E7=A4=BA=E6=9A=82?= =?UTF-8?q?=E6=97=A0=E6=95=B0=E6=8D=AE:=E5=85=B6=E6=A1=A3=E6=A1=88?= =?UTF-8?q?=E6=8E=92=E5=9C=A8=E7=AC=AC701=E5=90=8D,=E4=B8=8D=E5=9C=A8?= =?UTF-8?q?=E5=8D=95=E9=A1=B5500=E6=9D=A1=E5=86=85=203.=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=20listAllTrainingMembers=20=E5=88=86=E9=A1=B5=E6=8B=89?= =?UTF-8?q?=E5=85=A8=E9=87=8F=E5=90=8D=E5=86=8Chelper,=E7=BB=9F=E4=B8=80?= =?UTF-8?q?=E6=9B=BF=E6=8D=A27=E5=A4=84=20listMembers({page=5Fsize:500})?= =?UTF-8?q?=20=E5=8D=95=E9=A1=B5=E6=88=AA=E6=96=AD:=E5=B9=B4=E5=BA=A6?= =?UTF-8?q?=E8=AE=A1=E5=88=92=E6=94=B6=E9=9B=86/=E9=9C=80=E6=B1=82?= =?UTF-8?q?=E5=AF=BC=E5=85=A5=E8=AE=B2=E5=B8=88=E5=8C=B9=E9=85=8D/?= =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E7=AE=A1=E7=90=86=E5=8F=82=E5=8A=A0=E4=BA=BA?= =?UTF-8?q?=E5=91=98/=E5=9F=B9=E8=AE=AD=E7=AD=BE=E5=88=B0/=E8=80=83?= =?UTF-8?q?=E8=AF=95=E6=88=90=E7=BB=A9/=E8=AF=BE=E7=A8=8B=E5=BA=93/?= =?UTF-8?q?=E6=89=8B=E5=8A=A8=E6=8E=A8=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/api/training/index.ts | 18 ++++++++++++++++++ .../views/training/components/CoursePanel.vue | 7 ++++--- .../views/training/components/ExamPanel.vue | 10 +++++----- .../views/training/components/LibraryPanel.vue | 7 ++++--- .../views/training/components/PlanPanel.vue | 10 +++++----- .../views/training/components/RulePanel.vue | 9 +++++---- .../views/training/components/SignPanel.vue | 10 +++++----- 7 files changed, 46 insertions(+), 25 deletions(-) diff --git a/frontend/src/api/training/index.ts b/frontend/src/api/training/index.ts index dd83381..69364ea 100644 --- a/frontend/src/api/training/index.ts +++ b/frontend/src/api/training/index.ts @@ -86,6 +86,24 @@ export const deleteDept = (id: string) => export const listMembers = (query?: ListQuery) => get<{ success: boolean; data: PagedData }>(`${base}/members`, { params: query }) +// listAllTrainingMembers 拉取全量员工名册(分页循环,直到取满 total 或空页)。 +// [2026-11-29 复测] 名册超过 500 人后,单页 page_size=500 会把老批次员工 +// (含默认课长、搜索目标)截断在第一页之外 —— 年度计划收集默认课长消失、 +// 手动推送/课程管理/签到/考试等选人下拉搜不到人的共同根因;选人场景一律 +// 用本 helper 拉全量,名册继续增长也不再复发。 +export async function listAllTrainingMembers(pageSize = 500): Promise { + const out: TrainingMember[] = [] + for (let page = 1; page <= 100; page++) { + const res = await listMembers({ page, page_size: pageSize }) + const pageData = unwrap>(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 { id: string username: string diff --git a/frontend/src/views/training/components/CoursePanel.vue b/frontend/src/views/training/components/CoursePanel.vue index 70d6de6..160f187 100644 --- a/frontend/src/views/training/components/CoursePanel.vue +++ b/frontend/src/views/training/components/CoursePanel.vue @@ -585,7 +585,7 @@ import { listLecturers, listLibraryCourseQuestionBanks, listMaterials, - listMembers, + listAllTrainingMembers, listQuestionBanks, listSessions, publishCourse, @@ -1445,7 +1445,8 @@ const loadAll = async () => { const [c, d, m, l, s, lib, banks] = await Promise.all([ listCourses({ page_size: 100 }), listDepts(), - listMembers({ page_size: 500 }), + // 全量名册([2026-11-29 复测] 单页 500 截断,参加人员选择会漏老批次员工) + listAllTrainingMembers().catch(() => []), listLecturers().catch(() => []), listSessions({ year: 0, month: 0 }).catch(() => []), // scope=plan(000163):创建月度计划选课口径 —— 维护角色可选全部部门课程, @@ -1455,7 +1456,7 @@ const loadAll = async () => { ]) courses.value = unwrap(c)?.items || [] depts.value = unwrap(d) || [] - members.value = unwrap(m)?.items || [] + members.value = m || [] lecturers.value = (l && unwrap(l)) || [] sessions.value = (s && unwrap(s)) || [] libraryCourses.value = (lib && unwrap(lib)?.items) || [] diff --git a/frontend/src/views/training/components/ExamPanel.vue b/frontend/src/views/training/components/ExamPanel.vue index 2080347..6015a09 100644 --- a/frontend/src/views/training/components/ExamPanel.vue +++ b/frontend/src/views/training/components/ExamPanel.vue @@ -155,7 +155,7 @@ import { listCoursePapers, listDepts, listEnrollments, - listMembers, + listAllTrainingMembers, listPaperRecords, listSessions, submitExam, @@ -331,7 +331,8 @@ watch(filteredRecords, resetRecordPage) const loadAll = async () => { const [s, m, c, d] = await Promise.all([ listSessions({ page_size: 200 }), - listMembers({ page_size: 500 }).catch(() => null), + // 全量名册([2026-11-29 复测] 单页 500 截断会漏人,考生/代交卷按全量口径) + listAllTrainingMembers().catch(() => []), listCourses({ page_size: 100 }).catch(() => null), listDepts().catch(() => null), ]) @@ -340,9 +341,8 @@ const loadAll = async () => { deptNames.value = Object.fromEntries( ((d && unwrap(d) || []) as TrainingDept[]).map((dep) => [dep.id, dep.name]), ) - const memberItems = (m && unwrap(m)?.items) || [] - if (memberItems.length) { - members.value = memberItems + if (m?.length) { + members.value = m const labels: Record = {} for (const mem of members.value) { labels[mem.id] = `${mem.employee_no || '-'} ${mem.post || ''}`.trim() || mem.id.slice(0, 8) diff --git a/frontend/src/views/training/components/LibraryPanel.vue b/frontend/src/views/training/components/LibraryPanel.vue index 50a0f9d..094cec4 100644 --- a/frontend/src/views/training/components/LibraryPanel.vue +++ b/frontend/src/views/training/components/LibraryPanel.vue @@ -557,7 +557,7 @@ import { listCourseLibrary, listDepts, listLibraryCourseQuestionBanks, - listMembers, + listAllTrainingMembers, listQuestions, offlineCourseLibraryItem, removeCourseLibraryMaterial, @@ -860,14 +860,15 @@ const loadAll = async () => { try { const [lib, m, d, cats, me] = await Promise.all([ listCourseLibrary({ page_size: 500 }), - listMembers({ page_size: 500 }).catch(() => null), + // 全量名册([2026-11-29 复测] 单页 500 截断会漏人,讲师/权限人员选择按全量) + listAllTrainingMembers().catch(() => []), listDepts().catch(() => null), fetchCourseCategories(), // 本人档案:新增课程「所属部门」默认当前登录用户所在部门 getMyProfile().catch(() => null), ]) items.value = unwrap(lib)?.items || [] - members.value = (m && unwrap(m)?.items) || [] + members.value = m || [] depts.value = (d && unwrap(d)) || [] configCategories.value = cats const meBody = me && unwrap(me) diff --git a/frontend/src/views/training/components/PlanPanel.vue b/frontend/src/views/training/components/PlanPanel.vue index 35bded9..b187094 100644 --- a/frontend/src/views/training/components/PlanPanel.vue +++ b/frontend/src/views/training/components/PlanPanel.vue @@ -278,8 +278,8 @@ import { listDemandYears, listDemands, listDepts, + listAllTrainingMembers, listLecturers, - listMembers, saveDemand, type TrainingDept, type TrainingDemand, @@ -855,8 +855,8 @@ const onImportDemandExcel = async (e: Event) => { if (members.value.length) return membersLoading.value = true try { - const res = await listMembers({ page_size: 500 }) - members.value = unwrap(res)?.items || [] + // 全量名册:讲师按姓名匹配不能漏人(单页 500 会截断,见 listAllTrainingMembers) + members.value = await listAllTrainingMembers() } catch { /* 拉取失败时按空名册处理,讲师全部按外部姓名落库 */ } finally { @@ -1016,8 +1016,8 @@ const openCollect = async () => { if (!members.value.length) { membersLoading.value = true try { - const res = await listMembers({ page_size: 500 }) - members.value = unwrap(res)?.items || [] + // 全量名册([2026-11-29 复测] 单页 500 截断会漏掉老批次课长,默认推荐为空) + members.value = await listAllTrainingMembers() } catch { /* 拉取失败时保留空态,可手动搜索添加 */ } finally { diff --git a/frontend/src/views/training/components/RulePanel.vue b/frontend/src/views/training/components/RulePanel.vue index 53f2184..7b195a3 100644 --- a/frontend/src/views/training/components/RulePanel.vue +++ b/frontend/src/views/training/components/RulePanel.vue @@ -514,8 +514,8 @@ import { deleteTrainingTemplate, fetchRoleDict, listDepts, + listAllTrainingMembers, listManualPushTasks, - listMembers, listPosts, listRuleConfigs, listTrainingPushLogs, @@ -1156,13 +1156,14 @@ const loadRosters = async () => { if (rostersLoaded.value) return rostersLoaded.value = true try { - const [deptRes, memberRes, postRes] = await Promise.all([ + const [deptRes, memberList, postRes] = await Promise.all([ listDepts(), - listMembers({ page_size: 500 }), + // 全量名册([2026-11-29 复测] 单页 500 截断会漏人,手动推送选人按全量) + listAllTrainingMembers(), listPosts(), ]) depts.value = unwrap(deptRes) || [] - members.value = unwrap<{ items: TrainingMember[] }>(memberRes)?.items || [] + members.value = memberList postOptions.value = unwrap(postRes) || [...new Set(members.value.map((m) => m.post).filter(Boolean))].sort() diff --git a/frontend/src/views/training/components/SignPanel.vue b/frontend/src/views/training/components/SignPanel.vue index a22bb7c..9c99b2a 100644 --- a/frontend/src/views/training/components/SignPanel.vue +++ b/frontend/src/views/training/components/SignPanel.vue @@ -193,7 +193,7 @@ import { getSignCode, getSignSummary, listCourses, - listMembers, + listAllTrainingMembers, listSessions, listSessionEvidence, listSignRecords, @@ -405,13 +405,13 @@ const loadAll = async () => { const [s, c, m] = await Promise.all([ listSessions({ page_size: 200 }), listCourses({ page_size: 200 }), - listMembers({ page_size: 500 }).catch(() => null), + // 全量名册([2026-11-29 复测] 单页 500 截断会漏人,签到明细姓名映射按全量) + listAllTrainingMembers().catch(() => []), ]) sessions.value = unwrap(s) || [] courses.value = unwrap(c)?.items || [] - const memberItems = (m && unwrap(m)?.items) || [] - if (memberItems.length) { - members.value = memberItems + if (m?.length) { + members.value = m const labels: Record = {} for (const mem of members.value) { // 签到明细学员列(000165):「姓名 工号」,无姓名时回退工号