update Tree
This commit is contained in:
@@ -3969,6 +3969,16 @@
|
|||||||
名称-对应字典值的value
|
名称-对应字典值的value
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="P:Ewide.Core.Service.DictTreeOutput.Remark">
|
||||||
|
<summary>
|
||||||
|
备注
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:Ewide.Core.Service.DictTreeOutput.Sort">
|
||||||
|
<summary>
|
||||||
|
排序
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
<member name="P:Ewide.Core.Service.DictTreeOutput.Children">
|
<member name="P:Ewide.Core.Service.DictTreeOutput.Children">
|
||||||
<summary>
|
<summary>
|
||||||
子节点集合
|
子节点集合
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Ewide.Core.Service
|
namespace Ewide.Core.Service
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 字典类型与字典值构造的树
|
/// 字典类型与字典值构造的树
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class DictTreeOutput
|
public class DictTreeOutput : ITreeNode
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Id
|
/// Id
|
||||||
@@ -27,9 +28,33 @@ namespace Ewide.Core.Service
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 备注
|
||||||
|
/// </summary>
|
||||||
|
public string Remark { set; get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 排序
|
||||||
|
/// </summary>
|
||||||
|
public int Sort { set; get; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 子节点集合
|
/// 子节点集合
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<DictTreeOutput> Children { get; set; } = new List<DictTreeOutput>();
|
public List<DictTreeOutput> Children { get; set; } = new List<DictTreeOutput>();
|
||||||
|
|
||||||
|
public string GetId()
|
||||||
|
{
|
||||||
|
return Id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetPid()
|
||||||
|
{
|
||||||
|
return Pid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetChildren(IList children)
|
||||||
|
{
|
||||||
|
Children = (List<DictTreeOutput>)children;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -178,19 +178,16 @@ namespace Ewide.Core.Service
|
|||||||
[HttpGet("/sysDictType/tree")]
|
[HttpGet("/sysDictType/tree")]
|
||||||
public async Task<List<DictTreeOutput>> GetDictTree()
|
public async Task<List<DictTreeOutput>> GetDictTree()
|
||||||
{
|
{
|
||||||
return await _sysDictTypeRep.DetachedEntities.Select(u => new DictTreeOutput
|
var DictTypeList = await _sysDictTypeRep.AsQueryable().ToListAsync();
|
||||||
|
return new TreeBuildUtil<DictTreeOutput>().DoTreeBuild(DictTypeList.Select(u => new DictTreeOutput
|
||||||
{
|
{
|
||||||
Id = u.Id,
|
Name=u.Name,
|
||||||
Code = u.Code,
|
Code = u.Code,
|
||||||
Name = u.Name,
|
Pid=u.Pid,
|
||||||
Children = u.SysDictDatas.Select(c => new DictTreeOutput
|
Id=u.Id,
|
||||||
{
|
Remark=u.Remark,
|
||||||
Id = c.Id,
|
Sort =u.Sort
|
||||||
Pid = c.TypeId,
|
}).OrderBy(s => s.Sort).ToList());
|
||||||
Code = c.Code,
|
|
||||||
Name = c.Value
|
|
||||||
}).ToList()
|
|
||||||
}).ToListAsync();
|
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 创建Pids格式
|
/// 创建Pids格式
|
||||||
|
|||||||
Reference in New Issue
Block a user