@@ -223,6 +223,47 @@ namespace Learun.Application.Organization | |||
} | |||
} | |||
} | |||
public List<TreeModel> GetTreeNoCheck(string companyId, string parentId) | |||
{ | |||
try | |||
{ | |||
if (string.IsNullOrEmpty(companyId)) | |||
{// 如果公司主键没有的话,需要加载公司信息 | |||
return new List<TreeModel>(); | |||
} | |||
List<DepartmentEntity> list = GetList(companyId); | |||
List<TreeModel> treeList = new List<TreeModel>(); | |||
foreach (var item in list) | |||
{ | |||
TreeModel node = new TreeModel | |||
{ | |||
id = item.F_DepartmentId, | |||
text = item.F_FullName, | |||
value = item.F_DepartmentId, | |||
showcheck = false, | |||
checkstate = 0, | |||
isexpand = true, | |||
parentId = item.F_ParentId | |||
}; | |||
treeList.Add(node); | |||
} | |||
return treeList.ToTree(parentId); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 获取树形数据 | |||
/// </summary> | |||
@@ -268,6 +309,51 @@ namespace Learun.Application.Organization | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 获取部门树无复选框 | |||
/// </summary> | |||
/// <param name="companylist"></param> | |||
/// <returns></returns> | |||
public List<TreeModel> GetTreeNoCheck(List<CompanyEntity> companylist) | |||
{ | |||
try | |||
{ | |||
List<TreeModel> treeList = new List<TreeModel>(); | |||
foreach (var companyone in companylist) | |||
{ | |||
List<TreeModel> departmentTree = GetTreeNoCheck(companyone.F_CompanyId, ""); | |||
if (departmentTree.Count > 0) | |||
{ | |||
TreeModel node = new TreeModel | |||
{ | |||
id = companyone.F_CompanyId, | |||
text = companyone.F_FullName, | |||
value = companyone.F_CompanyId, | |||
showcheck = false, | |||
checkstate = 0, | |||
isexpand = true, | |||
parentId = "0", | |||
hasChildren = true, | |||
ChildNodes = departmentTree, | |||
complete = true | |||
}; | |||
treeList.Add(node); | |||
} | |||
} | |||
return treeList; | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 获取部门本身和子部门的id | |||
@@ -62,6 +62,20 @@ namespace Learun.Application.Organization | |||
/// <returns></returns> | |||
List<TreeModel> GetTree(List<CompanyEntity> companylist); | |||
/// <summary> | |||
/// 获取树形数据无复选框 | |||
/// </summary> | |||
/// <param name="companyId">公司id</param> | |||
/// <param name="parentId">父级id</param> | |||
/// <returns></returns> | |||
List<TreeModel> GetTreeNoCheck(string companyId, string parentId); | |||
/// <summary> | |||
/// 获取树形数据无复选框 | |||
/// </summary> | |||
/// <param name="companyId">公司id</param> | |||
/// <param name="parentId">父级id</param> | |||
/// <returns></returns> | |||
List<TreeModel> GetTreeNoCheck(List<CompanyEntity> companylist); | |||
/// <summary> | |||
/// 获取部门本身和子部门的id | |||
/// </summary> | |||
/// <param name="parentId">父级ID</param> | |||
@@ -69,7 +69,7 @@ var bootstrap = function ($, learun) { | |||
// 是否允许搜索 | |||
allowSearch: true, | |||
// 访问数据接口地址 | |||
url: top.$.rootUrl + '/LR_OrganizationModule/Department/GetTree', | |||
url: top.$.rootUrl + '/LR_OrganizationModule/Department/GetTreeNoCheck', | |||
// 访问数据接口参数 | |||
}); | |||
// 刷新 | |||
@@ -75,6 +75,28 @@ namespace Learun.Application.Web.Areas.LR_OrganizationModule.Controllers | |||
} | |||
} | |||
/// <summary> | |||
/// 获取无复选框的部门树 | |||
/// </summary> | |||
/// <param name="companyId"></param> | |||
/// <param name="parentId"></param> | |||
/// <returns></returns> | |||
[HttpGet] | |||
[AjaxOnly] | |||
public ActionResult GetTreeNoCheck(string companyId, string parentId) | |||
{ | |||
if (string.IsNullOrEmpty(companyId)) | |||
{ | |||
var companylist = companyIBLL.GetList(); | |||
var data = departmentIBLL.GetTreeNoCheck(companylist); | |||
return JsonResult(data); | |||
} | |||
else | |||
{ | |||
var data = departmentIBLL.GetTreeNoCheck(companyId, parentId); | |||
return JsonResult(data); | |||
} | |||
} | |||
/// <summary> | |||
/// 获取部门实体数据 | |||
/// </summary> | |||
/// <param name="companyId"></param> | |||