This commit is contained in:
commit
7206529938
2 files changed
+25
-4
No files matched your search
@@ -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<OrgEmployee> }>(`${base}/employees`, { params: query })
|
||||
|
||||
// listAllOrgEmployees 拉取全量员工档案(分页循环,直到取满 total 或空页)。
|
||||
// [2026-11-30] 档案超过 500 条后,单页 page_size=500 会把最早建档的员工截断
|
||||
// 在第一页之外,组织架构员工档案分页器误显「共500条」—— 与 listAllTrainingMembers
|
||||
// 同根因(4e071f9 修了培训侧 7 处,组织中心此处漏网),选人/列表场景一律用本
|
||||
// helper 拉全量,名册继续增长也不再复发。
|
||||
export async function listAllOrgEmployees(
|
||||
query?: Omit<OrgListQuery, 'page' | 'page_size'>,
|
||||
pageSize = 500,
|
||||
): Promise<OrgEmployee[]> {
|
||||
const out: OrgEmployee[] = []
|
||||
for (let page = 1; page <= 100; page++) {
|
||||
const res = await listEmployees({ ...query, page, page_size: pageSize })
|
||||
const pageData = unwrap<OrgPagedData<OrgEmployee>>(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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user