feat(组织架构): 完成员工与组织节点管理
This commit is contained in:
@@ -90,6 +90,7 @@ function mapUser(dto: UserResponseDto): UserRecord {
|
||||
|
||||
return {
|
||||
id: dto.id,
|
||||
employeeId: dto.employeeId,
|
||||
name: dto.displayName,
|
||||
account: dto.username,
|
||||
department: dto.departmentName ?? (dto.departmentId ? '未知科室' : '未指定科室'),
|
||||
@@ -97,6 +98,8 @@ function mapUser(dto: UserResponseDto): UserRecord {
|
||||
status: normalizeStatus(dto.status),
|
||||
lastLoginAt: formatDateTime(dto.lastLoginAt),
|
||||
employeeNo: dto.employeeNo,
|
||||
position: dto.position,
|
||||
professionalTitle: dto.professionalTitle,
|
||||
phone: dto.phone,
|
||||
email: dto.email,
|
||||
campusId: dto.campusId,
|
||||
@@ -105,6 +108,7 @@ function mapUser(dto: UserResponseDto): UserRecord {
|
||||
departmentName: dto.departmentName ?? undefined,
|
||||
roleNames,
|
||||
roleIds: roles.map((role) => role.id),
|
||||
roleDataScopes: roles.map((role) => role.dataScope ?? 'SELF'),
|
||||
version: dto.version ?? undefined,
|
||||
passwordChangeRequired: dto.passwordChangeRequired,
|
||||
}
|
||||
@@ -139,6 +143,10 @@ function toBackendQuery(query: UserQuery) {
|
||||
params.campusId = query.campusId
|
||||
}
|
||||
|
||||
if (query.departmentId) {
|
||||
params.departmentId = query.departmentId
|
||||
}
|
||||
|
||||
return params
|
||||
}
|
||||
|
||||
@@ -163,10 +171,13 @@ export function getUsers(query: UserQuery): Promise<UserListResponse> {
|
||||
const matchesKeyword =
|
||||
!keyword || [record.name, record.account].join(' ').toLowerCase().includes(keyword)
|
||||
const matchesDepartment = !query.department || record.department === query.department
|
||||
const matchesDepartmentId = !query.departmentId || record.departmentId === query.departmentId
|
||||
const matchesStatus = !query.status || query.status === 'all' || record.status === query.status
|
||||
const matchesCampus = !query.campusId || record.campusId === query.campusId
|
||||
|
||||
return matchesKeyword && matchesDepartment && matchesStatus && matchesCampus
|
||||
return (
|
||||
matchesKeyword && matchesDepartment && matchesDepartmentId && matchesStatus && matchesCampus
|
||||
)
|
||||
})
|
||||
const page = Math.max(query.page, 1)
|
||||
const pageSize = Math.max(query.pageSize, 1)
|
||||
|
||||
Reference in New Issue
Block a user