Browse Source

【修改】框架-树型多选下拉框优化,包含选中的父级;

新疆体育高职分支
dyy 7 months ago
parent
commit
b22b785dbf
5 changed files with 33 additions and 9 deletions
  1. +4
    -2
      Learun.Framework.Ultimate V7/Learun.Application.Organization/Department/DepartmentBLL.cs
  2. +9
    -6
      Learun.Framework.Ultimate V7/Learun.Application.Organization/Post/PostBLL.cs
  3. +1
    -1
      Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/plugin/select/lr-select.js
  4. +15
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/plugin/tree/lr-tree.js
  5. +4
    -0
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Tree/TreeModel.cs

+ 4
- 2
Learun.Framework.Ultimate V7/Learun.Application.Organization/Department/DepartmentBLL.cs View File

@@ -289,7 +289,8 @@ namespace Learun.Application.Organization
parentId = "0",
hasChildren = true,
ChildNodes = departmentTree,
complete = true
complete = true,
isCompany = true
};
treeList.Add(node);
}
@@ -334,7 +335,8 @@ namespace Learun.Application.Organization
parentId = "0",
hasChildren = true,
ChildNodes = departmentTree,
complete = true
complete = true,
isCompany = true
};
treeList.Add(node);
}


+ 9
- 6
Learun.Framework.Ultimate V7/Learun.Application.Organization/Post/PostBLL.cs View File

@@ -16,7 +16,7 @@ namespace Learun.Application.Organization
{
private PostService postService = new PostService();
private DepartmentIBLL departmentIBLL = new DepartmentBLL();

#region 缓存定义
private ICache cache = CacheFactory.CaChe();
@@ -34,7 +34,8 @@ namespace Learun.Application.Organization
try
{
List<PostEntity> list = cache.Read<List<PostEntity>>(cacheKey + companyId, CacheId.post);
if (list == null) {
if (list == null)
{
list = (List<PostEntity>)postService.GetList(companyId);
cache.Write<List<PostEntity>>(cacheKey + companyId, list, CacheId.post);
}
@@ -134,7 +135,7 @@ namespace Learun.Application.Organization
TreeModel node = new TreeModel();
node.id = item.F_PostId;
node.text = item.F_Name;
DepartmentEntity departmentEntity = departmentList.Find(t=>t.F_DepartmentId == item.F_DepartmentId);
DepartmentEntity departmentEntity = departmentList.Find(t => t.F_DepartmentId == item.F_DepartmentId);
if (departmentEntity != null)
{
node.text = "【" + departmentEntity.F_FullName + "】" + node.text;
@@ -167,7 +168,8 @@ namespace Learun.Application.Organization
/// </summary>
/// <param name="keyValue">主键</param>
/// <returns></returns>
public PostEntity GetEntity(string keyValue) {
public PostEntity GetEntity(string keyValue)
{
try
{
return postService.GetEntity(keyValue);
@@ -217,7 +219,7 @@ namespace Learun.Application.Organization
{
PostEntity entity = GetEntity(keyValue);
cache.Remove(cacheKey + entity.F_CompanyId, CacheId.post);
postService.VirtualDelete(keyValue);
postService.VirtualDelete(keyValue);
}
catch (Exception ex)
{
@@ -320,7 +322,8 @@ namespace Learun.Application.Organization
parentId = "0",
hasChildren = true,
ChildNodes = departmentTree,
complete = true
complete = true,
isCompany = true
};
treeList.Add(node);
}


+ 1
- 1
Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/plugin/select/lr-select.js View File

@@ -421,7 +421,7 @@
var $select = $('#' + dfop.id);
var $inputText = $select.find('.lr-select-placeholder');
$select.removeClass('lr-select-focus');
var data = $tree.lrtreeSet('getCheckNodesEx');
var data = $tree.lrtreeSet('getCheckNodesPar');
dfop.currtentItems = data;
var text = "";
for (var i = 0, l = data.length; i < l; i++) {


+ 15
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/plugin/tree/lr-tree.js View File

@@ -515,6 +515,16 @@
}
}
};
var getCheck3 = function (items, buff, fn) {
for (var i = 0, l = items.length; i < l; i++) {
(items[i].showcheck == true && (items[i].checkstate == 1 || items[i].checkstate == 2) && !items[i].isCompany) && buff.push(fn(items[i]));
if (!items[i].showcheck || (items[i].showcheck == true && (items[i].checkstate == 1 || items[i].checkstate == 2))) {
if (items[i].ChildNodes != null && items[i].ChildNodes.length > 0) {
getCheck3(items[i].ChildNodes, buff, fn);
}
}
}
};

var setNoCheck = function (items, buff, fn) {
for (var i = 0, l = items.length; i < l; i++) {
@@ -563,6 +573,11 @@
getCheck2(dfop.data, buff, function (item) { return item; });
return buff;
break;
case 'getCheckNodesPar':// dyy获取最下面的和父级的选中元素,不包含校区
var buff = [];
getCheck3(dfop.data, buff, function (item) { return item; });
return buff;
break;
case 'getCheckNodes':
var buff = [];
getCheck(dfop.data, buff, function (item) {return item; });


+ 4
- 0
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Tree/TreeModel.cs View File

@@ -59,6 +59,10 @@ namespace Learun.Util
/// 父级节点ID
/// </summary>
public string parentId { get; set; }
/// <summary>
/// 是否是校区
/// </summary>
public bool isCompany { get; set; }
}
}

Loading…
Cancel
Save