Преглед изворни кода

部门单选下拉去掉复选框

master
liangkun пре 3 година
родитељ
комит
612b79524f
4 измењених фајлова са 130 додато и 1 уклоњено
  1. +86
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Organization/Department/DepartmentBLL.cs
  2. +14
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Organization/Department/DepartmentIBLL.cs
  3. +8
    -1
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/EmpInfo/Index.js
  4. +22
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OrganizationModule/Controllers/DepartmentController.cs

+ 86
- 0
Learun.Framework.Ultimate V7/Learun.Application.Organization/Department/DepartmentBLL.cs Прегледај датотеку

@@ -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


+ 14
- 0
Learun.Framework.Ultimate V7/Learun.Application.Organization/Department/DepartmentIBLL.cs Прегледај датотеку

@@ -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>


+ 8
- 1
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();


+ 22
- 0
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
}
}
/// <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>


Loading…
Откажи
Сачувај