TreeSelectVo.cs 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. using Model;
  2. using Newtonsoft.Json;
  3. namespace Vo
  4. {
  5. /// <summary>
  6. /// Treeselect树结构实体类
  7. /// </summary>
  8. public class TreeSelectVo
  9. {
  10. /// <summary>
  11. /// 节点Id
  12. /// </summary>
  13. public long Id { get; set; }
  14. /// <summary>
  15. /// 节点名称
  16. /// </summary>
  17. public string Name { get; set; }
  18. public long ParentId { get; set; }
  19. public string MenuType { get; set; }
  20. public string Path { get; set; }
  21. public int SortOrder { get; set; }
  22. public TreeSelectMeta meta { get; set; }
  23. public string Permission { get; set; }
  24. public TreeSelectVo() { }
  25. public TreeSelectVo(SysMenu menu)
  26. {
  27. Id = menu.menuId;
  28. Name = menu.name;
  29. ParentId = menu.parentId;
  30. MenuType = menu.menuType;
  31. Path = menu.path;
  32. SortOrder = menu.sortOrder;
  33. meta = new TreeSelectMeta();
  34. meta.title = menu.name;
  35. meta.enName = menu.enName;
  36. meta.icon = menu.icon;
  37. // Permission = new List<string>();
  38. Permission = menu.permission;
  39. List<TreeSelectVo> child = new List<TreeSelectVo>();
  40. foreach (var item in menu.children)
  41. {
  42. // if(item.menuType == "0")
  43. // {
  44. child.Add(new TreeSelectVo(item));
  45. // }
  46. // else
  47. // {
  48. // Permission.Add(item.permission);
  49. // }
  50. }
  51. Children = child;
  52. }
  53. public TreeSelectVo(SysDept dept)
  54. {
  55. Id = dept.deptId;
  56. Name = dept.name;
  57. List<TreeSelectVo> child = new List<TreeSelectVo>();
  58. foreach (var item in dept.children)
  59. {
  60. child.Add(new TreeSelectVo(item));
  61. }
  62. Children = child;
  63. }
  64. [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
  65. public List<TreeSelectVo> Children { get; set; }
  66. }
  67. public class TreeSelectMeta
  68. {
  69. public string title { get; set; }
  70. public string enName { get; set; }
  71. public string icon { get; set; }
  72. public List<string> roles { get; set; }
  73. public List<string> auths { get; set; }
  74. }
  75. }