Commit 681fb74b authored by 黄奎's avatar 黄奎

页面修改

parent baa931a3
......@@ -34,7 +34,7 @@ namespace Edu.Model.ViewModel.User
public int IsCompany { get; set; }
/// <summary>
/// 数据类型(1-部门,2-员工)
/// 数据类型(1-部门,2-员工,3-岗位)
/// </summary>
public int DataType { get; set; }
......
......@@ -21,10 +21,11 @@ namespace Edu.Module.User
/// </summary>
private readonly RB_AccountRepository accountRepository = new RB_AccountRepository();
/// <summary>
/// 学校仓储层对象
/// 岗位仓储层对象
/// </summary>
private readonly RB_SchoolRepository schoolRepository = new RB_SchoolRepository();
private readonly RB_PostRepository postRepository = new RB_PostRepository();
/// <summary>
/// 获取部门分页列表
......@@ -132,19 +133,24 @@ namespace Edu.Module.User
/// 获取部门结构树
/// </summary>
/// <param name="query"></param>
/// <param name="query">是否查询员工</param>
/// <param name="isQueryEmployee">是否查询员工</param>
/// <param name="isQueryPost">是否岗位</param>
/// <returns></returns>
public List<DepartmentTree_ViewModel> GetDepartmentTreeModule(RB_Department_ViewModel query,bool isQueryEmployee=false)
public List<DepartmentTree_ViewModel> GetDepartmentTreeModule(RB_Department_ViewModel query,bool isQueryEmployee=false,bool isQueryPost=false)
{
//树形结构列表
List<DepartmentTree_ViewModel> list = new List<DepartmentTree_ViewModel>();
//所有的部门列表
var deptList = GetDepartmentListModule(query);
//员工列表
var empList = new List<Employee_ViewModel>();
//岗位列表
var postList = new List<RB_Post_ViewModel>();
if (deptList == null)
{
deptList = new List<RB_Department_ViewModel>();
}
//查询员工
if (isQueryEmployee)
{
empList = accountRepository.GetEmployeeListRepository(new Employee_ViewModel()
......@@ -153,6 +159,13 @@ namespace Edu.Module.User
School_Id = query.School_Id
});
}
if (isQueryPost)
{
postList= postRepository.GetPostListRepository(new RB_Post_ViewModel()
{
Group_Id = query.Group_Id,
});
}
if (deptList != null && deptList.Count > 0)
{
var firstList = new List<RB_Department_ViewModel>();
......@@ -200,7 +213,30 @@ namespace Edu.Module.User
}
}
#endregion
var childList = GetDeptTreeList(fItem.DeptId, deptList, empList: empList);
#region 添加岗位
if (isQueryPost)
{
var tempPostList = postList?.Where(qitem => qitem.RB_Dept_Id == fItem.DeptId)?.ToList();
if (tempPostList != null && tempPostList.Count > 0)
{
foreach (var pItem in tempPostList)
{
tModel.ChildList.Add(new DepartmentTree_ViewModel()
{
DeptId = pItem.PostId,
DeptName = pItem.PostName,
ParentId = 0,
ChildList = new List<DepartmentTree_ViewModel>(),
School_Id = fItem.School_Id,
DataType = 3,
});
}
}
}
#endregion
var childList = GetDeptTreeList(fItem.DeptId, deptList, empList: empList,postList:postList);
if (childList != null && childList.Count > 0)
{
tModel.ChildList.AddRange(childList);
......@@ -219,7 +255,7 @@ namespace Edu.Module.User
/// <param name="parentId">父节点编号</param>
/// <param name="sourceList">数据源列表</param>
/// <param name="empList">员工列表</param>
private List<DepartmentTree_ViewModel> GetDeptTreeList(int parentId, List<RB_Department_ViewModel> sourceList, List<Employee_ViewModel> empList=null)
private List<DepartmentTree_ViewModel> GetDeptTreeList(int parentId, List<RB_Department_ViewModel> sourceList, List<Employee_ViewModel> empList=null, List<RB_Post_ViewModel> postList=null)
{
List<DepartmentTree_ViewModel> treeList = new List<DepartmentTree_ViewModel>();
foreach (var item in sourceList.Where(qitem => qitem.ParentId == parentId))
......@@ -234,6 +270,7 @@ namespace Edu.Module.User
IsCompany = item.IsCompany,
DataType = 1,
};
#region 添加员工信息
if (empList != null && empList.Count > 0)
{
......@@ -255,7 +292,30 @@ namespace Edu.Module.User
}
}
#endregion
var childList= GetDeptTreeList(item.DeptId, sourceList);
#region 添加岗位
if (postList != null && postList.Count > 0)
{
var tempPostList = postList?.Where(qitem => qitem.RB_Dept_Id == item.DeptId)?.ToList();
if (tempPostList != null && tempPostList.Count > 0)
{
foreach (var pItem in tempPostList)
{
model.ChildList.Add(new DepartmentTree_ViewModel()
{
DeptId = pItem.PostId,
DeptName = pItem.PostName,
ParentId = 0,
ChildList = new List<DepartmentTree_ViewModel>(),
School_Id = item.School_Id,
DataType = 3,
});
}
}
}
#endregion
var childList = GetDeptTreeList(item.DeptId, sourceList, empList: empList, postList: postList);
if (childList != null && childList.Count > 0)
{
model.ChildList.AddRange(childList);
......
......@@ -912,6 +912,22 @@ namespace Edu.WebApi.Controllers.User
return ApiResult.Success(data: list);
}
/// <summary>
/// 获取部门岗位树形列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetDeptPostTree()
{
var query = new RB_Department_ViewModel()
{
Group_Id = base.UserInfo.Group_Id,
School_Id = base.ParmJObj.GetInt("School_Id")
};
var list = departmentModule.GetDepartmentTreeModule(query,isQueryPost:true);
return ApiResult.Success(data: list);
}
/// <summary>
/// 获取组织机构图
/// </summary>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment