From 6a746cf810e7c049d813efe829eff5fea950fa2e Mon Sep 17 00:00:00 2001 From: "DESKTOP-JKIE562\\PC" <1013397054@qq.com> Date: Mon, 30 Nov 2026 13:42:32 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E7=BB=84=E7=BB=87=E6=9E=B6=E6=9E=84):?= =?UTF-8?q?=E5=91=98=E5=B7=A5=E6=A1=A3=E6=A1=88=E8=B6=85500=E6=9D=A1?= =?UTF-8?q?=E5=88=86=E9=A1=B5=E5=99=A8=E8=AF=AF=E6=98=BE=E5=85=B1500?= =?UTF-8?q?=E6=9D=A1=20=E7=BB=84=E7=BB=87=E4=B8=AD=E5=BF=83loadEmployees?= =?UTF-8?q?=E5=8D=95=E9=A1=B5page=5Fsize=3D500=E6=8B=89=E5=8F=96=E5=90=8E?= =?UTF-8?q?=E4=B8=A2=E5=BC=83=E6=9C=8D=E5=8A=A1=E7=AB=AFtotal,=E6=9C=AC?= =?UTF-8?q?=E5=9C=B0=E5=88=86=E9=A1=B5=E5=8F=AA=E5=9C=A8=E5=8F=96=E5=9B=9E?= =?UTF-8?q?=E7=9A=84500=E6=9D=A1=E9=87=8C=E7=BF=BB,=E6=9C=80=E6=97=A9?= =?UTF-8?q?=E5=BB=BA=E6=A1=A3=E7=9A=84=E5=91=98=E5=B7=A5(=E7=8E=B0700?= =?UTF-8?q?=E4=BA=BA=E8=A2=AB=E6=88=AA=E6=96=AD200=E4=BA=BA)=E5=9C=A8?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E6=B0=B8=E8=BF=9C=E4=B8=8D=E5=8F=AF=E8=A7=81?= =?UTF-8?q?=E3=80=81=E6=90=9C=E7=B4=A2=E6=AD=A3=E5=B8=B8=E4=BD=86=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E7=BF=BB=E4=B8=8D=E5=88=B0=E3=80=82=E6=96=B0=E5=A2=9E?= =?UTF-8?q?listAllOrgEmployees=E5=88=86=E9=A1=B5=E5=BE=AA=E7=8E=AF?= =?UTF-8?q?=E6=8B=89=E5=85=A8=E9=87=8Fhelper(=E4=B8=8E4e071f9=20listAllTra?= =?UTF-8?q?iningMembers=E5=90=8C=E6=AC=BE),loadEmployees=E6=94=B9=E7=94=A8?= =?UTF-8?q?=E4=B9=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/api/org-center/index.ts | 22 +++++++++++++++++++++ frontend/src/views/org-center/OrgCenter.vue | 7 +++---- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/frontend/src/api/org-center/index.ts b/frontend/src/api/org-center/index.ts index a84259b..28ba902 100644 --- a/frontend/src/api/org-center/index.ts +++ b/frontend/src/api/org-center/index.ts @@ -1,4 +1,5 @@ import { get, post, put, del } from '@/utils/request' +import { unwrap } from '@/api/training' import type { WecomSyncSummary } from '@/api/training' // 组织中心(租户级共享组织架构)API 封装,对应后端 /api/v1/org/*(routes_org.go)。 @@ -79,6 +80,27 @@ export const deleteDept = (id: string) => del<{ success: boolean }>(`${base}/dep export const listEmployees = (query?: OrgListQuery) => get<{ success: boolean; data: OrgPagedData }>(`${base}/employees`, { params: query }) +// listAllOrgEmployees 拉取全量员工档案(分页循环,直到取满 total 或空页)。 +// [2026-11-30] 档案超过 500 条后,单页 page_size=500 会把最早建档的员工截断 +// 在第一页之外,组织架构员工档案分页器误显「共500条」—— 与 listAllTrainingMembers +// 同根因(4e071f9 修了培训侧 7 处,组织中心此处漏网),选人/列表场景一律用本 +// helper 拉全量,名册继续增长也不再复发。 +export async function listAllOrgEmployees( + query?: Omit, + pageSize = 500, +): Promise { + const out: OrgEmployee[] = [] + for (let page = 1; page <= 100; page++) { + const res = await listEmployees({ ...query, 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 OrgPlatformUser { id: string username: string diff --git a/frontend/src/views/org-center/OrgCenter.vue b/frontend/src/views/org-center/OrgCenter.vue index 617130d..c1707cf 100644 --- a/frontend/src/views/org-center/OrgCenter.vue +++ b/frontend/src/views/org-center/OrgCenter.vue @@ -305,8 +305,8 @@ import { deleteDept, importEmployees, listAdoptableUsers, + listAllOrgEmployees, listDepts, - listEmployees, listPlatformUsers, ORG_MODULE_TRAINING, previewOrgWecomSync, @@ -589,15 +589,14 @@ watch(pickerUserIds, (ids) => { }) // 员工列表:module_key='training' 联查职称角色展示;keyword 按姓名/工号/部门过滤。 +// 分页循环拉全量(page_size=500 单页会把最早建档的员工截断,分页器误显「共500条」)。 const loadEmployees = async () => { loading.value = true try { - const e = await listEmployees({ + employees.value = await listAllOrgEmployees({ module_key: ORG_MODULE_TRAINING, keyword: keyword.value.trim() || undefined, - page_size: 500, }) - employees.value = unwrap(e)?.items || [] } finally { loading.value = false }