From 612b79524f01be0853a707c543fb05d6901dd954 Mon Sep 17 00:00:00 2001 From: liangkun Date: Wed, 7 Apr 2021 12:09:32 +0800 Subject: [PATCH] =?UTF-8?q?=E9=83=A8=E9=97=A8=E5=8D=95=E9=80=89=E4=B8=8B?= =?UTF-8?q?=E6=8B=89=E5=8E=BB=E6=8E=89=E5=A4=8D=E9=80=89=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Department/DepartmentBLL.cs | 86 +++++++++++++++++++ .../Department/DepartmentIBLL.cs | 14 +++ .../Views/EmpInfo/Index.js | 9 +- .../Controllers/DepartmentController.cs | 22 +++++ 4 files changed, 130 insertions(+), 1 deletion(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Organization/Department/DepartmentBLL.cs b/Learun.Framework.Ultimate V7/Learun.Application.Organization/Department/DepartmentBLL.cs index 10b20d45f..7f009dba0 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Organization/Department/DepartmentBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Organization/Department/DepartmentBLL.cs @@ -223,6 +223,47 @@ namespace Learun.Application.Organization } } } + + public List GetTreeNoCheck(string companyId, string parentId) + { + try + { + if (string.IsNullOrEmpty(companyId)) + {// 如果公司主键没有的话,需要加载公司信息 + return new List(); + } + + List list = GetList(companyId); + List treeList = new List(); + 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); + } + } + } /// /// 获取树形数据 /// @@ -268,6 +309,51 @@ namespace Learun.Application.Organization } } } + /// + /// 获取部门树无复选框 + /// + /// + /// + public List GetTreeNoCheck(List companylist) + { + try + { + List treeList = new List(); + foreach (var companyone in companylist) + { + List 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); + } + } + } /// /// 获取部门本身和子部门的id diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Organization/Department/DepartmentIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Application.Organization/Department/DepartmentIBLL.cs index 16cff28d9..37df3ea63 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Organization/Department/DepartmentIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Organization/Department/DepartmentIBLL.cs @@ -62,6 +62,20 @@ namespace Learun.Application.Organization /// List GetTree(List companylist); /// + /// 获取树形数据无复选框 + /// + /// 公司id + /// 父级id + /// + List GetTreeNoCheck(string companyId, string parentId); + /// + /// 获取树形数据无复选框 + /// + /// 公司id + /// 父级id + /// + List GetTreeNoCheck(List companylist); + /// /// 获取部门本身和子部门的id /// /// 父级ID diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/EmpInfo/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/EmpInfo/Index.js index f1080e9ef..7da5f5dd1 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/EmpInfo/Index.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/EmpInfo/Index.js @@ -64,7 +64,14 @@ var bootstrap = function ($, learun) { //职称 $('#ProfessionalTitle').lrDataItemSelect({ code: 'jszc' }); // 部门选择 - $('#F_DepartmentId').lrselect(); + $('#F_DepartmentId').lrselect({ + type: 'tree', + // 是否允许搜索 + allowSearch: true, + // 访问数据接口地址 + url: top.$.rootUrl + '/LR_OrganizationModule/Department/GetTreeNoCheck', + // 访问数据接口参数 + }); // 刷新 $('#lr_refresh').on('click', function () { location.reload(); diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OrganizationModule/Controllers/DepartmentController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OrganizationModule/Controllers/DepartmentController.cs index f81b9b7c9..fc10f0a1f 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OrganizationModule/Controllers/DepartmentController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OrganizationModule/Controllers/DepartmentController.cs @@ -75,6 +75,28 @@ namespace Learun.Application.Web.Areas.LR_OrganizationModule.Controllers } } /// + /// 获取无复选框的部门树 + /// + /// + /// + /// + [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); + } + } + /// /// 获取部门实体数据 /// ///