# HumanResources 人力资源管理模块

HumanResources 模块是 DarkM 框架的企业人力资源管理模块,提供了完整的组织架构管理、员工信息管理、合同管理、转正管理、考勤管理等功能。支持多层级组织架构、员工全生命周期管理、丰富的导出功能,满足企业人力资源管理需求。


# 📋 模块概述

属性 说明
模块名称 HumanResources(人力资源管理)
模块类型 业务模块
依赖关系 依赖 Admin 模块、Common 模块
必需性 可选(企业用户推荐)
Git 仓库 framework/darkm/darkm (opens new window)

# 🎯 核心功能

# 功能清单

功能分类 功能 说明 重要性
组织架构 机构管理 公司/分公司/部门管理 ⭐⭐⭐⭐⭐
部门管理 部门层级管理 ⭐⭐⭐⭐⭐
岗位管理 岗位定义和配置 ⭐⭐⭐⭐
职位管理 职位体系管理 ⭐⭐⭐⭐
员工信息 员工基本信息 员工档案管理 ⭐⭐⭐⭐⭐
员工联系信息 联系方式管理 ⭐⭐⭐⭐
员工教育经历 教育背景管理 ⭐⭐⭐
员工家庭信息 家庭成员管理 ⭐⭐⭐
员工银行卡 工资卡管理 ⭐⭐⭐⭐
员工关系 员工合同 劳动合同管理 ⭐⭐⭐⭐⭐
员工转正 转正流程管理 ⭐⭐⭐⭐⭐
员工层级 汇报关系管理 ⭐⭐⭐⭐
员工岗位 岗位变动管理 ⭐⭐⭐⭐
考勤管理 员工考勤 考勤记录管理 ⭐⭐⭐⭐
员工请假 请假信息管理 ⭐⭐⭐⭐
员工工作记录 工作履历管理 ⭐⭐⭐
其他功能 数据导出 Excel 导出功能 ⭐⭐⭐⭐
数据统计 人力资源报表 ⭐⭐⭐

# 📦 安装配置

# NuGet 包安装

Install-Package DarkM.Module.HumanResources.Web -Version 1.0.0
1

# NPM 包安装

npm i -S darkm-module-humanresources
1

# 配置文件

{
  "Db": {
    "Modules": [
      {
        "Name": "HumanResources",
        "Database": "Nm_HumanResources",
        "Prefix": ""
      }
    ]
  },
  "HumanResources": {
    // 默认组织机构 ID
    "OrganizationId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    // 是否开启员工层级管理
    "EnableHierarchical": true,
    // 是否开启合同到期提醒
    "EnableContractReminder": true,
    // 合同到期提前提醒天数
    "ContractReminderDays": 30
  }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

配置说明:

配置项 说明 默认值
OrganizationId 默认组织机构 ID -
EnableHierarchical 是否开启员工层级管理 true
EnableContractReminder 是否开启合同到期提醒 true
ContractReminderDays 合同到期提前提醒天数 30

# 🗄️ 数据库表结构

# 组织架构表

表名 说明 主键
Organization 组织机构表 Id (Guid)
Department 部门表 Id (Guid)
DepartmentHierarchical 部门层级关系表 Id (long)
Post 岗位表 Id (long)
Position 职位表 Id (long)
DepartmentPost 部门岗位关联表 Id (long)

# 员工信息表

表名 说明 主键
Employee 员工基本信息表 Id (Guid)
EmployeeContact 员工联系信息表 Id (long)
EmployeeEducation 员工教育经历表 Id (long)
EmployeeFamily 员工家庭成员表 Id (long)
EmployeeBank 员工银行卡信息表 Id (long)
EmployeePersonal 员工个人信息表 Id (long)

# 员工关系表

表名 说明 主键
EmployeeContract 员工劳动合同表 Id (long)
EmployeeRegular 员工转正管理表 Id (long)
EmployeeHierarchical 员工层级关系表 Id (long)
EmployeePost 员工岗位关联表 Id (long)
EmployeeWork 员工工作履历表 Id (long)

# 考勤管理表

表名 说明 主键
EmployeeLeaveInfo 员工请假信息表 Id (long)
EmployeeLatestSelect 员工最新选择表 Id (long)

# 🔐 权限系统设计

# Controller 定义

# 1. 员工转正管理

using System;
using System.ComponentModel;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using DarkM.Lib.Auth.Web.Attributes;
using DarkM.Lib.Utils.Core.Models;

namespace DarkM.Module.HumanResources.Web.Controllers
{
    [Description("员工转正管理")]
    public class EmployeeRegularController : ModuleController
    {
        private readonly IEmployeeRegularService _service;

        public EmployeeRegularController(IEmployeeRegularService service)
        {
            _service = service;
        }

        [HttpGet]
        [Description("查询")]
        public Task<IResultModel<QueryResultModel<EmployeeRegularListModel>>> Query(
            [FromQuery]EmployeeRegularQueryModel model)
        {
            return _service.Query(model);
        }

        [HttpPost]
        [Description("添加")]
        public Task<IResultModel> Add(EmployeeRegularAddModel model)
        {
            return _service.Add(model);
        }

        [HttpDelete]
        [Description("删除")]
        public Task<IResultModel> Delete([BindRequired]long id)
        {
            return _service.Delete(id);
        }

        [HttpGet]
        [Description("编辑")]
        public Task<IResultModel> Edit([BindRequired]long id)
        {
            return _service.Edit(id);
        }

        [HttpPost]
        [Description("修改")]
        public Task<IResultModel> Update(EmployeeRegularUpdateModel model)
        {
            return _service.Update(model);
        }

        [HttpPost]
        [Description("导出")]
        public async Task<IActionResult> Export(EmployeeRegularQueryModel model)
        {
            model.Export.ModuleCode = "HumanResources";
            model.Export.Group = "EmployeeRegular";
            var result = await _service.Export(model);
            if (result.Successful)
            {
                return ExportFile(result.Data.Path, result.Data.FileName, model.Export.Format.ToDescription());
            }
            return Ok(result);
        }
    }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71

# 2. 员工银行信息管理

[Description("员工银行信息管理")]
public class EmployeeBankController : ModuleController
{
    private readonly IEmployeeBankService _service;

    public EmployeeBankController(IEmployeeBankService service)
    {
        _service = service;
    }

    [HttpGet]
    [Description("查询")]
    public Task<IResultModel<QueryResultModel<EmployeeBankListModel>>> Query(
        [FromQuery]EmployeeBankQueryModel model)
    {
        return _service.Query(model);
    }

    [HttpPost]
    [Description("添加")]
    public Task<IResultModel> Add(EmployeeBankAddModel model)
    {
        return _service.Add(model);
    }

    [HttpDelete]
    [Description("删除")]
    public Task<IResultModel> Delete([BindRequired]long id)
    {
        return _service.Delete(id);
    }

    [HttpGet]
    [Description("编辑")]
    public Task<IResultModel> Edit([BindRequired]long id)
    {
        return _service.Edit(id);
    }

    [HttpPost]
    [Description("修改")]
    public Task<IResultModel> Update(EmployeeBankUpdateModel model)
    {
        return _service.Update(model);
    }

    [HttpPost]
    [Description("导出")]
    public async Task<IActionResult> Export(EmployeeBankQueryModel model)
    {
        model.Export.ModuleCode = "HumanResources";
        model.Export.Group = "EmployeeBank";
        var result = await _service.Export(model);
        if (result.Successful)
        {
            return ExportFile(result.Data.Path, result.Data.FileName, model.Export.Format.ToDescription());
        }
        return Ok(result);
    }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60

# 权限解析结果

权限编码 说明 访问级别
humanresources_employee_query_get 员工管理 - 查询 需授权
humanresources_employee_add_post 员工管理 - 添加 需授权
humanresources_employee_edit_get 员工管理 - 编辑 需授权
humanresources_employee_update_post 员工管理 - 修改 需授权
humanresources_employee_delete_delete 员工管理 - 删除 需授权
humanresources_employee_export_post 员工管理 - 导出 需授权
humanresources_employeeregular_query_get 转正管理 - 查询 需授权
humanresources_employeeregular_add_post 转正管理 - 添加 需授权
humanresources_employeeregular_update_post 转正管理 - 修改 需授权
humanresources_employeeregular_export_post 转正管理 - 导出 需授权
humanresources_employeebank_query_get 银行卡管理 - 查询 需授权
humanresources_employeebank_add_post 银行卡管理 - 添加 需授权
humanresources_employeebank_update_post 银行卡管理 - 修改 需授权
humanresources_employeebank_export_post 银行卡管理 - 导出 需授权

# 🎨 核心功能详解

# 一、组织架构管理

# 1. 组织机构管理

public interface IOrganizationService : IService<OrganizationEntity, IOrganizationRepository>
{
    /// <summary>
    /// 查询组织机构列表
    /// </summary>
    Task<IResultModel<QueryResultModel<OrganizationListModel>>> Query(OrganizationQueryModel model);

    /// <summary>
    /// 按照机构编号查询
    /// </summary>
    Task<IResultModel<OrganizationEntity>> GetByCode(string code);

    /// <summary>
    /// 创建组织机构
    /// </summary>
    Task<IResultModel> Add(OrganizationAddModel model);

    /// <summary>
    /// 删除组织机构
    /// </summary>
    Task<IResultModel> Delete(long id);

    /// <summary>
    /// 编辑组织机构
    /// </summary>
    Task<IResultModel> Edit(long id);

    /// <summary>
    /// 修改组织机构
    /// </summary>
    Task<IResultModel> Update(OrganizationUpdateModel model);

    /// <summary>
    /// 获取下拉选择数据
    /// </summary>
    Task<IResultModel> Select(bool withShortName = false);

    /// <summary>
    /// 导出
    /// </summary>
    Task<IResultModel<ExcelExportResultModel>> Export(OrganizationQueryModel model);
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42

# 2. 组织机构实体

[Table("Organization")]
public partial class OrganizationEntity : EntityBase
{
    /// <summary>
    /// 机构编码
    /// </summary>
    [Length(50)]
    public string Code { get; set; }

    /// <summary>
    /// 机构名称
    /// </summary>
    [Length(100)]
    public string Name { get; set; }

    /// <summary>
    /// 机构简称
    /// </summary>
    [Length(50)]
    public string AbbrName { get; set; }

    /// <summary>
    /// 上级机构 ID
    /// </summary>
    [Nullable]
    public Guid? ParentId { get; set; }

    /// <summary>
    /// 层级
    /// </summary>
    public int Level { get; set; }

    /// <summary>
    /// 排序
    /// </summary>
    public int Sort { get; set; }

    /// <summary>
    /// 地址
    /// </summary>
    [Length(500)]
    [Nullable]
    public string Address { get; set; }

    /// <summary>
    /// 联系人
    /// </summary>
    [Length(50)]
    [Nullable]
    public string Contact { get; set; }

    /// <summary>
    /// 联系电话
    /// </summary>
    [Length(20)]
    [Nullable]
    public string Phone { get; set; }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58

# 二、员工信息管理

# 1. 员工基本信息

[Table("Employee")]
public partial class EmployeeEntity : EntityBase
{
    /// <summary>
    /// 员工编号
    /// </summary>
    [Length(50)]
    public string Code { get; set; }

    /// <summary>
    /// 姓名
    /// </summary>
    [Length(50)]
    public string Name { get; set; }

    /// <summary>
    /// 性别
    /// </summary>
    public Gender Gender { get; set; }

    /// <summary>
    /// 身份证号
    /// </summary>
    [Length(18)]
    public string IdCard { get; set; }

    /// <summary>
    /// 入职日期
    /// </summary>
    public DateTime? EntryDate { get; set; }

    /// <summary>
    /// 转正日期
    /// </summary>
    public DateTime? RegularDate { get; set; }

    /// <summary>
    /// 员工性质
    /// </summary>
    public EmployeeNature Nature { get; set; }

    /// <summary>
    /// 员工状态
    /// </summary>
    public EmployeeStatus Status { get; set; }

    /// <summary>
    /// 所属机构 ID
    /// </summary>
    public Guid OrganizationId { get; set; }

    /// <summary>
    /// 所属部门 ID
    /// </summary>
    public Guid DepartmentId { get; set; }

    /// <summary>
    /// 岗位 ID
    /// </summary>
    [Nullable]
    public long? PostId { get; set; }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62

# 2. 员工 enums

/// <summary>
/// 性别枚举
/// </summary>
public enum Gender
{= 0,= 1
}

/// <summary>
/// 员工性质枚举
/// </summary>
public enum EmployeeNature
{
    试用 = 0,
    正式 = 1,
    实习 = 2,
    兼职 = 3,
    离职 = 4
}

/// <summary>
/// 员工状态枚举
/// </summary>
public enum EmployeeStatus
{
    在职 = 0,
    离职 = 1,
    休假 = 2,
    调岗 = 3
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

# 三、员工转正管理

# 1. 转正服务接口

public interface IEmployeeRegularService : IService<EmployeeRegularEntity, IEmployeeRegularRepository>
{
    /// <summary>
    /// 查询转正列表
    /// </summary>
    Task<IResultModel<QueryResultModel<EmployeeRegularListModel>>> Query(EmployeeRegularQueryModel model);

    /// <summary>
    /// 创建转正申请
    /// </summary>
    Task<IResultModel> Add(EmployeeRegularAddModel model);

    /// <summary>
    /// 删除转正申请
    /// </summary>
    Task<IResultModel> Delete(long id);

    /// <summary>
    /// 编辑转正申请
    /// </summary>
    Task<IResultModel> Edit(long id);

    /// <summary>
    /// 修改转正申请
    /// </summary>
    Task<IResultModel> Update(EmployeeRegularUpdateModel model);

    /// <summary>
    /// 导出
    /// </summary>
    Task<IResultModel<ExcelExportResultModel>> Export(EmployeeRegularQueryModel model);

    /// <summary>
    /// 转正添加修改表单
    /// </summary>
    Task<IResultModel> AddForm(EmployeeRegularUpdateModel model);

    /// <summary>
    /// 获取转正表单数据
    /// </summary>
    Task<IResultModel<EmployeeRegularListModel>> EditForm(Guid? TaskNo, int? Id = null);

    /// <summary>
    /// 获取邮件内容
    /// </summary>
    Task<string> GetRegularEmailContent(Guid TaskNo);

    /// <summary>
    /// 获取待转正员工
    /// </summary>
    Task<IResultModel<QueryResultModel<EmployeeEntity>>> GetEmployeesRegularQuery(EmployeeQueryModel model);

    /// <summary>
    /// 流程结束更新人员为正式
    /// </summary>
    Task<bool> UpdateEmployeeNature(Guid TaskNo);

    /// <summary>
    /// 结束发送邮件
    /// </summary>
    Task<bool> SendEndEmail(Guid TaskNo);
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62

# 2. 转正流程

1. HR 创建转正申请
   ↓
2. 员工填写转正总结
   ↓
3. 直属领导评价
   ↓
4. 部门负责人审批
   ↓
5. HR 确认
   ↓
6. 更新员工状态为正式
   ↓
7. 发送转正通知邮件
   ↓
8. 完成✅
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

# 四、数据导出功能

# 1. 导出配置

[HttpPost]
[Description("导出")]
public async Task<IActionResult> Export(EmployeeBankQueryModel model)
{
    model.Export.ModuleCode = "HumanResources";
    model.Export.Group = "EmployeeBank";
    var result = await _service.Export(model);
    if (result.Successful)
    {
        return ExportFile(result.Data.Path, result.Data.FileName, model.Export.Format.ToDescription());
    }
    return Ok(result);
}
1
2
3
4
5
6
7
8
9
10
11
12
13

# 2. 导出格式

格式 说明 扩展名
Excel Microsoft Excel .xlsx
CSV 逗号分隔值 .csv
PDF PDF 文档 .pdf

# 3. 支持导出的模块

  • ✅ 员工基本信息
  • ✅ 员工联系信息
  • ✅ 员工教育经历
  • ✅ 员工家庭信息
  • ✅ 员工银行卡信息
  • ✅ 员工合同信息
  • ✅ 员工转正信息
  • ✅ 组织机构信息
  • ✅ 部门信息

# 🔧 核心服务接口

# IOrganizationService(组织机构服务)

public interface IOrganizationService : IService<OrganizationEntity, IOrganizationRepository>
{
    Task<IResultModel<QueryResultModel<OrganizationListModel>>> Query(OrganizationQueryModel model);
    Task<IResultModel<OrganizationEntity>> GetByCode(string code);
    Task<IResultModel> Add(OrganizationAddModel model);
    Task<IResultModel> Delete(long id);
    Task<IResultModel> Edit(long id);
    Task<IResultModel> Update(OrganizationUpdateModel model);
    Task<IResultModel> Select(bool withShortName = false);
    Task<IResultModel> QuerySortList();
    Task<IResultModel> UpdateSortList(SortUpdateModel<long> model);
    Task<IResultModel<ExcelExportResultModel>> Export(OrganizationQueryModel model);
}
1
2
3
4
5
6
7
8
9
10
11
12
13

# IEmployeeRegularService(员工转正服务)

public interface IEmployeeRegularService : IService<EmployeeRegularEntity, IEmployeeRegularRepository>
{
    Task<IResultModel<QueryResultModel<EmployeeRegularListModel>>> Query(EmployeeRegularQueryModel model);
    Task<IResultModel> Add(EmployeeRegularAddModel model);
    Task<IResultModel> Delete(long id);
    Task<IResultModel> Edit(long id);
    Task<IResultModel> Update(EmployeeRegularUpdateModel model);
    Task<IResultModel<ExcelExportResultModel>> Export(EmployeeRegularQueryModel model);
    Task<IResultModel> AddForm(EmployeeRegularUpdateModel model);
    Task<IResultModel<EmployeeRegularListModel>> EditForm(Guid? TaskNo, int? Id = null);
    Task<string> GetRegularEmailContent(Guid TaskNo);
    Task<IResultModel<QueryResultModel<EmployeeEntity>>> GetEmployeesRegularQuery(EmployeeQueryModel model);
    Task<bool> UpdateEmployeeNature(Guid TaskNo);
    Task<bool> SendEndEmail(Guid TaskNo);
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

# IEmployeeBankService(员工银行服务)

public interface IEmployeeBankService : IService<EmployeeBankEntity, IEmployeeBankRepository>
{
    Task<IResultModel<QueryResultModel<EmployeeBankListModel>>> Query(EmployeeBankQueryModel model);
    Task<IResultModel> Add(EmployeeBankAddModel model);
    Task<IResultModel> Delete(long id);
    Task<IResultModel> Edit(long id);
    Task<IResultModel> Update(EmployeeBankUpdateModel model);
    Task<IResultModel> QuerySortList();
    Task<IResultModel> UpdateSortList(SortUpdateModel<long> model);
    Task<IResultModel<ExcelExportResultModel>> Export(EmployeeBankQueryModel model);
}
1
2
3
4
5
6
7
8
9
10
11

# 🖥️ 前端组件说明

# NPM 包信息

{
  "name": "darkm-module-humanresources",
  "version": "1.5.0-beta-3.0",
  "code": "humanResources",
  "title": "人事管理",
  "dependencies": {
    "darkm-module-admin": "^1.5.0-beta-2.0",
    "darkm-module-common": "^1.5.0-beta-2.0",
    "darkm-ui": "^1.5.0-beta-2.0",
    "darkm-module-chart": "^1.5.0-beta-2.0"
  }
}
1
2
3
4
5
6
7
8
9
10
11
12

# 组件目录结构

src/UI/module-humanresources/
├── src/
│   ├── views/                      # 页面组件
│   │   ├── organization/           # 组织机构管理
│   │   ├── employee/               # 员工信息管理
│   │   └── ...
│   └── components/                 # 通用组件
│       ├── organization-select/    # 组织机构选择器
│       ├── department-tree-select/ # 部门树选择器
│       ├── post-select/            # 岗位选择器
│       ├── position-select/        # 职位选择器
│       ├── employee-select/        # 员工选择器
│       └── employee-search-select/ # 员工搜索选择器
└── package.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14

# 📦 通用组件详解

# 1. OrganizationSelect 组织机构选择器

组件路径: components/organization-select

功能: 下拉选择组织机构

使用示例:

<template>
  <organization-select v-model="orgId" :showShortName="true" />
</template>

<script>
import { components } from 'darkm-module-humanresources'
const { OrganizationSelect } = components

export default {
  components: { OrganizationSelect },
  data() {
    return {
      orgId: ''
    }
  }
}
</script>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

Props 参数:

参数 类型 必填 默认值 说明
value String/Number - 选中的组织机构 ID(v-model)
showShortName Boolean false 是否显示简称
disabled Boolean false 是否禁用
placeholder String '请选择' 占位文本

Events 事件:

事件名 参数 说明
input (value: String) 选中值变化时触发(v-model)
change (value: String, data: Object) 选中值变化时触发,返回完整数据

# 2. DepartmentTreeSelect 部门树选择器

组件路径: components/department-tree-select

功能: 树形选择部门,支持多选

使用示例:

<template>
  <department-tree-select 
    v-model="deptIds"
    :orgId="orgId"
    :showCode="true"
    :fullpath="true"
    multiple
  />
</template>

<script>
import { components } from 'darkm-module-humanresources'
const { DepartmentTreeSelect } = components

export default {
  components: { DepartmentTreeSelect },
  data() {
    return {
      deptIds: [],
      orgId: 'xxx'
    }
  }
}
</script>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

Props 参数:

参数 类型 必填 默认值 说明
value Array/String - 选中的部门 ID(v-model)
orgId String/Number - 组织机构 ID
orgCode String/Number - 组织机构编码
allOrg Boolean false 是否显示所有机构
title String '部门选择' 弹窗标题
icon String 'department' 图标
collapseAll Boolean true 是否默认折叠所有节点
lang String 'zh-CN' 语言(zh-CN/zh_en)
showCode Boolean false 是否显示部门编码
delayedDate String '' 延迟日期(用于历史数据)
fullpath Boolean false 是否显示完整路径
multiple Boolean true 是否多选
disabled Boolean false 是否禁用

Events 事件:

事件名 参数 说明
input (value: Array) 选中值变化时触发
change (value: Array, data: Array) 选中值变化时触发,返回完整数据

# 3. PostSelect 岗位选择器

组件路径: components/post-select

功能: 下拉选择岗位

使用示例:

<template>
  <post-select 
    v-model="postId"
    :orgId="orgId"
    :departmentId="deptId"
    :showShortName="true"
  />
</template>

<script>
import { components } from 'darkm-module-humanresources'
const { PostSelect } = components

export default {
  components: { PostSelect },
  data() {
    return {
      postId: '',
      orgId: 'xxx',
      deptId: 'xxx'
    }
  }
}
</script>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

Props 参数:

参数 类型 必填 默认值 说明
value String/Number - 选中的岗位 ID(v-model)
orgId String/Number - 组织机构 ID
orgCode String/Number - 组织机构编码
departmentId String '' 部门 ID(按部门筛选岗位)
positionId String/Number - 职位 ID(按职位筛选)
allOrg Boolean false 是否显示所有机构
showShortName Boolean false 是否显示简称
specialOptions Array [] 特殊选项(追加到列表)
applyEmployeeId String/Number '' 申请人 ID(用于过滤)
disabled Boolean false 是否禁用

Events 事件:

事件名 参数 说明
input (value: String) 选中值变化时触发
change (value: String, data: Object) 选中值变化时触发

# 4. PositionSelect 职位选择器

组件路径: components/position-select

功能: 下拉选择职位

使用示例:

<template>
  <position-select 
    v-model="positionId"
    :orgId="orgId"
    :keyIsLevel="true"
  />
</template>

<script>
import { components } from 'darkm-module-humanresources'
const { PositionSelect } = components

export default {
  components: { PositionSelect },
  data() {
    return {
      positionId: '',
      orgId: 'xxx'
    }
  }
}
</script>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

Props 参数:

参数 类型 必填 默认值 说明
value String/Number - 选中的职位 ID(v-model)
orgId String/Number - 组织机构 ID
orgCode String/Number - 组织机构编码
allOrg Boolean false 是否显示所有机构
keyIsLevel Boolean false key 是否使用层级
showShortName Boolean false 是否显示简称
disabled Boolean false 是否禁用

Events 事件:

事件名 参数 说明
input (value: String) 选中值变化时触发
change (value: String, data: Object) 选中值变化时触发

# 5. EmployeeSelect 员工选择器

组件路径: components/employee-select

功能: 下拉选择员工,支持多种筛选条件

使用示例:

<template>
  <employee-select 
    v-model="employeeId"
    :orgId="orgId"
    :dept="deptId"
    :position="positionId"
    :showEmployeeNo="true"
  />
</template>

<script>
import { components } from 'darkm-module-humanresources'
const { EmployeeSelect } = components

export default {
  components: { EmployeeSelect },
  data() {
    return {
      employeeId: '',
      orgId: 'xxx',
      deptId: 'xxx',
      positionId: 'xxx'
    }
  }
}
</script>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

Props 参数:

参数 类型 必填 默认值 说明
value String/Number - 选中的员工 ID(v-model)
keys String/Number - 指定返回的字段
orgId String/Number - 组织机构 ID
orgCode String/Number - 组织机构编码
allOrg Boolean false 是否显示所有机构
dept String/Number - 部门 ID(按部门筛选)
role String/Number - 角色 ID(按角色筛选)
position String/Number - 职位 ID(按职位筛选)
group String/Number - 组 ID(按组筛选)
manager String/Number - 主管 ID(按主管筛选)
showEmployeeNo Boolean true 是否显示员工编号
disabled Boolean false 是否禁用

Events 事件:

事件名 参数 说明
input (value: String) 选中值变化时触发
change (value: String, data: Object) 选中值变化时触发

# 6. EmployeeSearchSelect 员工搜索选择器

组件路径: components/employee-search-select

功能: 弹窗式员工搜索选择,支持多选、最近选择、同部门选择

使用示例:

<template>
  <employee-search-select 
    v-model="employeeIds"
    :showPost="true"
    :limit="5"
    @change="handleChange"
  />
</template>

<script>
import { components } from 'darkm-module-humanresources'
const { EmployeeSearchSelect } = components

export default {
  components: { EmployeeSearchSelect },
  data() {
    return {
      employeeIds: []
    }
  },
  methods: {
    handleChange(ids, employees) {
      console.log('选中的员工:', employees)
    }
  }
}
</script>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

Props 参数:

参数 类型 必填 默认值 说明
value Array [] 选中的员工 ID 数组(v-model)
showPost Boolean true 是否显示岗位
maxHeight String '120px' 组件最大高度
limit Number 0 选择数量限制(0 为不限制)
disabled Boolean false 是否禁用
placeholder String '请选择' 占位文本

Events 事件:

事件名 参数 说明
input (value: Array) 选中值变化时触发(v-model)
change (ids: Array, employees: Array) 选中值变化时触发,返回完整数据
open - 弹窗打开时触发
close - 弹窗关闭时触发
opened - 弹窗打开后触发
reset - 重置时触发
tag-click (id: String, item: Object) 点击已选人员标签时触发

功能特点:

  • 最近选择:自动记录最近选择的员工
  • 同部门选择:快速选择同部门员工
  • 组织架构:按组织架构树选择
  • 多选支持:支持批量选择
  • 数量限制:可设置最大选择数量
  • 搜索功能:支持姓名、工号搜索

内部子组件:

子组件 说明
latest-box 最近选择列表
samedep-box 同部门员工列表
department-box 组织架构树
selection-box 已选择人员列表

# 📋 组件使用注意事项

# 1. 组件引入方式

// 方式一:引入单个组件
import { components } from 'darkm-module-humanresources'
const { OrganizationSelect } = components

// 方式二:全局注册
import HumanResources from 'darkm-module-humanresources'
Vue.use(HumanResources)
1
2
3
4
5
6
7

# 2. v-model 双向绑定

所有选择器组件都支持 v-model 双向绑定:

<!-- 推荐用法 -->
<organization-select v-model="orgId" />

<!-- 等价于 -->
<organization-select 
  :value="orgId" 
  @input="orgId = $event" 
/>
1
2
3
4
5
6
7
8

# 3. 级联选择

多个选择器可以级联使用:

<template>
  <div>
    <organization-select v-model="orgId" />
    <department-tree-select v-model="deptId" :orgId="orgId" />
    <post-select v-model="postId" :orgId="orgId" :departmentId="deptId" />
    <employee-select v-model="employeeId" :orgId="orgId" :dept="deptId" />
  </div>
</template>
1
2
3
4
5
6
7
8

# 4. 数据格式

所有组件返回的数据格式:

  • 单选: 返回 ID(String/Number)
  • 多选: 返回 ID 数组(Array)
  • change 事件: 返回 (value, data),data 为完整对象

# 🔍 常见问题


# 📊 使用流程

# 新员工入职流程

1. 创建/选择组织机构
   ↓
2. 创建/选择部门
   ↓
3. 添加员工基本信息
   ↓
4. 填写员工联系信息
   ↓
5. 填写员工教育经历
   ↓
6. 填写员工家庭信息
   ↓
7. 填写员工银行卡信息
   ↓
8. 签订劳动合同
   ↓
9. 配置员工岗位
   ↓
10. 完成入职✅
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

# 员工转正流程

1. HR 创建转正申请(转正前 30 天)
   ↓
2. 系统发送通知给员工
   ↓
3. 员工填写转正总结
   ↓
4. 直属领导评价
   ↓
5. 部门负责人审批
   ↓
6. HR 确认并归档
   ↓
7. 系统自动更新员工状态为"正式"
   ↓
8. 发送转正通知邮件
   ↓
9. 完成✅
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

# 🔍 常见问题

# 1. 组织机构数据不显示

问题: 组织机构列表为空

解决:

# 检查是否已添加组织机构数据
# 检查当前用户是否有查看权限
# 检查数据库连接是否正常

# 清除缓存后重试
1
2
3
4
5

# 2. 员工导出失败

问题: 点击导出按钮无响应

解决:

  1. 检查是否有导出权限
  2. 检查导出目录是否有写权限
  3. 检查数据量是否过大
  4. 查看后端日志错误信息

# 3. 合同到期提醒不生效

问题: 合同到期未收到提醒

解决:

// 检查配置
"HumanResources": {
  "EnableContractReminder": true,  // 确保开启
  "ContractReminderDays": 30       // 提前 30 天提醒
}

// 检查 Quartz 任务调度是否正常运行
// 检查邮件服务配置是否正确
1
2
3
4
5
6
7
8

# 4. 员工层级关系混乱

问题: 汇报关系显示不正确

解决:

  1. 检查员工层级关系表数据
  2. 重新配置汇报关系
  3. 检查是否有循环汇报
  4. 清理错误的层级数据

# 📚 相关文档


# 🔗 参考链接


最后更新: 2026-03-20