fix(过滤离职):完善优化过滤离职人员
deploy-hxtesting / build-and-deploy (push) Successful in 1m35s

This commit is contained in:
runny committed 2026-12-01 18:21:46 +08:00
1 parent 381dd60bea
commit f55447a8f8
5 files changed
+17

No files matched your search

+2
View File
@@ -58,6 +58,8 @@ export interface OrgListQuery {
module_key?: string module_key?: string
dept_id?: string dept_id?: string
keyword?: string keyword?: string
/** 在职口径(000167):true 时仅保留成员管理在职人员(状态 1-5),过滤离职/退休 */
on_duty?: boolean
page?: number page?: number
page_size?: number page_size?: number
} }
@@ -589,6 +589,7 @@ watch(pickerUserIds, (ids) => {
}) })
// 员工列表:module_key='training' 联查职称角色展示;keyword 按姓名/工号/部门过滤。 // 员工列表:module_key='training' 联查职称角色展示;keyword 按姓名/工号/部门过滤。
// on_duty 只保留成员管理在职人员(1-5),离职/退休不再出现在员工档案。
// 分页循环拉全量(page_size=500 单页会把最早建档的员工截断,分页器误显「共500条」)。 // 分页循环拉全量(page_size=500 单页会把最早建档的员工截断,分页器误显「共500条」)。
const loadEmployees = async () => { const loadEmployees = async () => {
loading.value = true loading.value = true
@@ -596,6 +597,7 @@ const loadEmployees = async () => {
employees.value = await listAllOrgEmployees({ employees.value = await listAllOrgEmployees({
module_key: ORG_MODULE_TRAINING, module_key: ORG_MODULE_TRAINING,
keyword: keyword.value.trim() || undefined, keyword: keyword.value.trim() || undefined,
on_duty: true,
}) })
} finally { } finally {
loading.value = false loading.value = false
@@ -81,6 +81,12 @@ func (r *orgCenterRepository) employeeFilter(ctx context.Context, tenantID uint6
if q.EmploymentStatus > 0 { if q.EmploymentStatus > 0 {
tx = tx.Where("u.employment_status = ?", q.EmploymentStatus) tx = tx.Where("u.employment_status = ?", q.EmploymentStatus)
} }
// 在职口径过滤:员工档案列表只保留成员管理在职人员(状态 1-5),
// 离职(6)/退休(7)不再展示;users 联查不上的档案行同样视作不在职隐藏。
if q.OnDutyOnly {
tx = tx.Where("u.employment_status BETWEEN ? AND ?",
types.EmploymentStatusProbation, types.EmploymentStatusIntern)
}
if q.Keyword != "" { if q.Keyword != "" {
// 按姓名/工号/部门名/岗位模糊查找;姓名取真实姓名(display_name) // 按姓名/工号/部门名/岗位模糊查找;姓名取真实姓名(display_name)
// 回退平台账号(username),与列表展示口径一致。 // 回退平台账号(username),与列表展示口径一致。
+4
View File
@@ -40,6 +40,10 @@ func orgListQueryFromRequest(c *gin.Context) *types.OrgListQuery {
if v, err := strconv.Atoi(c.Query("employment_status")); err == nil && types.IsValidEmploymentStatus(v) { if v, err := strconv.Atoi(c.Query("employment_status")); err == nil && types.IsValidEmploymentStatus(v) {
q.EmploymentStatus = v q.EmploymentStatus = v
} }
// 在职口径(on_duty=true):员工档案列表仅保留在职人员(1-5),过滤离职/退休。
if v, err := strconv.ParseBool(c.Query("on_duty")); err == nil {
q.OnDutyOnly = v
}
if v, err := strconv.Atoi(c.Query("page")); err == nil { if v, err := strconv.Atoi(c.Query("page")); err == nil {
q.Page = v q.Page = v
} }
+3
View File
@@ -93,10 +93,13 @@ func (OrgModuleMember) TableName() string { return "org_module_members" }
// OrgListQuery 组织中心通用列表查询(分页 + 关键词 + 部门过滤)。 // OrgListQuery 组织中心通用列表查询(分页 + 关键词 + 部门过滤)。
// EmploymentStatus 在职状态过滤(000167):0 = 不过滤;选人场景传 // EmploymentStatus 在职状态过滤(000167):0 = 不过滤;选人场景传
// EmploymentStatusFormal(3) 仅拉取正式员工。 // EmploymentStatusFormal(3) 仅拉取正式员工。
// OnDutyOnly 在职口径过滤:员工档案列表只保留成员管理在职人员(状态 1-5),
// 离职(6)/退休(7)不再展示。
type OrgListQuery struct { type OrgListQuery struct {
DeptID string DeptID string
Keyword string Keyword string
EmploymentStatus int EmploymentStatus int
OnDutyOnly bool
Page int Page int
PageSize int PageSize int
} }