Forráskód Böngészése

解决用户为多角色时菜单重复加载问题

LT069288 2 hónapja
szülő
commit
298e7f83f6

BIN
Document/被装材料业务系统需求描述 v1.docx


+ 4 - 4
UniformMaterialManagementSystem/ViewModels/MainWindowViewModel.cs

@@ -59,21 +59,21 @@ namespace UniformMaterialManagementSystem.ViewModels
                     switch (menu)
                     {
                         case { Name: "用户信息", Children: not null }:
-                            if (UserMenuItems.Count == 0 || UserMenuItems.Any(x => x.Name != menu.Name))
+                            if (UserMenuItems.Count == 0 || !(UserMenuItems.Any(x => x.Name == menu.Name)))
                             {
                                 UserMenuItems.Add(new MenuItemModel(menu));
                             }
                             break;
                         case { Name: "基础数据", Children: not null }:
-                            if (BaseMenuItems.Count == 0 || BaseMenuItems.Any(x => x.Name != menu.Name))
+                            if (BaseMenuItems.Count == 0 || !(BaseMenuItems.Any(x => x.Name == menu.Name)))
                             {
                                 BaseMenuItems.Add(new MenuItemModel(menu));
                             }
                             break;
                         case { Name: "生产数据", Children: not null }:
-                            foreach (var menuItem in menu.Children.OrderBy(x=>x.OrderIndex))
+                            foreach (var menuItem in menu.Children.OrderBy(x => x.OrderIndex))
                             {
-                                if (ProduceMenuItems.Count == 0 || ProduceMenuItems.Any(x => x.Name != menuItem.Name))
+                                if (ProduceMenuItems.Count == 0 || !(ProduceMenuItems.Any(x => x.Guid == menuItem.Guid)))
                                 {
                                     ProduceMenuItems.Add(new MenuItemModel(menuItem));
                                 }

+ 1 - 1
UniformMaterialManagementSystem/ViewModels/RegisterPageViewModel.cs

@@ -102,7 +102,7 @@ namespace UniformMaterialManagementSystem.ViewModels
 
             _companies = context.Companies.ToList();
 
-            Units = context.SupervisionUnits.ToList();
+            Units = context.SupervisionUnits.Where(x=>x.IsEnabled).ToList();
         }
 
         [RelayCommand]