终端一体化运控平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

122 lines
4.4 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Collections.ObjectModel;
  7. using Microsoft.Toolkit.Mvvm.ComponentModel;
  8. using BPASmartClient.CustomResource.Pages.Enums;
  9. using System.Windows;
  10. namespace BPASmartClient.CustomResource.Pages.Model
  11. {
  12. /// <summary>
  13. /// 在启动界面之前设置菜单项
  14. /// </summary>
  15. public class MenuManage : ObservableObject
  16. {
  17. private volatile static MenuManage _Instance;
  18. public static MenuManage GetInstance => _Instance ?? (_Instance = new MenuManage());
  19. private MenuManage() { }
  20. public ObservableCollection<MenuModel> menuModels { get; set; } = new ObservableCollection<MenuModel>();
  21. }
  22. public class MenuModel : ObservableObject
  23. {
  24. private Permission[] pers
  25. {
  26. get
  27. {
  28. List<Permission> permissionList = new List<Permission>();
  29. foreach (var item in subMenumodels)
  30. {
  31. foreach (var p in item.SubMenuPermission)
  32. {
  33. if (!permissionList.Contains(p)) permissionList.Add(p);
  34. }
  35. }
  36. return permissionList.ToArray();
  37. }
  38. }
  39. ///// <summary>
  40. ///// 主菜单权限
  41. ///// </summary>
  42. //public Permission[] MainMenuPermission { get { return _mMainMenuPermission; } set { _mMainMenuPermission = value; OnPropertyChanged(); } }
  43. //private Permission[] _mMainMenuPermission;
  44. /// <summary>
  45. /// 主菜单权限
  46. /// </summary>
  47. public Permission[] MainMenuPermission { get { return pers; } set { _mMainMenuPermission = value; OnPropertyChanged(); } }
  48. private Permission[] _mMainMenuPermission;
  49. /// <summary>
  50. /// 主菜单图标
  51. /// </summary>
  52. public string MainMenuIcon { get { return _mMainMenuIcon; } set { _mMainMenuIcon = value; OnPropertyChanged(); } }
  53. private string _mMainMenuIcon = string.Empty;
  54. /// <summary>
  55. /// 主菜单名称
  56. /// </summary>
  57. public string MainMenuName { get { return _mMainMenuName; } set { _mMainMenuName = value; OnPropertyChanged(); } }
  58. private string _mMainMenuName = string.Empty;
  59. /// <summary>
  60. /// 别名(英文名)
  61. /// </summary>
  62. public string Alias { get { return _mAlias; } set { _mAlias = value; OnPropertyChanged(); } }
  63. private string _mAlias = string.Empty;
  64. /// <summary>
  65. /// 主菜单的显示隐藏设置
  66. /// </summary>
  67. public Visibility MainMenuVisibility { get { return _mMainMenuVisibility; } set { _mMainMenuVisibility = value; OnPropertyChanged(); } }
  68. private Visibility _mMainMenuVisibility;
  69. /// <summary>
  70. /// 子菜单集合
  71. /// </summary>
  72. public ObservableCollection<SubMenumodel> subMenumodels { get; set; } = new ObservableCollection<SubMenumodel>();
  73. }
  74. public class SubMenumodel : ObservableObject
  75. {
  76. /// <summary>
  77. /// 子菜单名称
  78. /// </summary>
  79. public string SubMenuName { get { return _mSubMenuName; } set { _mSubMenuName = value; OnPropertyChanged(); } }
  80. private string _mSubMenuName = string.Empty;
  81. /// <summary>
  82. /// 子菜单权限管理
  83. /// </summary>
  84. public Permission[] SubMenuPermission { get { return _mSubMenuPermission; } set { _mSubMenuPermission = value; OnPropertyChanged(); } }
  85. private Permission[] _mSubMenuPermission;
  86. /// <summary>
  87. /// 切换界面路径
  88. /// </summary>
  89. public string ToggleWindowPath { get { return _mToggleWindowPath; } set { _mToggleWindowPath = value; OnPropertyChanged(); } }
  90. private string _mToggleWindowPath = string.Empty;
  91. /// <summary>
  92. /// 程序集名称
  93. /// </summary>
  94. public string AssemblyName { get { return _mAssemblyName; } set { _mAssemblyName = value; OnPropertyChanged(); } }
  95. private string _mAssemblyName = string.Empty;
  96. /// <summary>
  97. /// 子菜单的显示隐藏设置
  98. /// </summary>
  99. public Visibility SubMenuVisibility { get { return _mSubMenuVisibility; } set { _mSubMenuVisibility = value; OnPropertyChanged(); } }
  100. private Visibility _mSubMenuVisibility = Visibility.Collapsed;
  101. }
  102. }