Browse Source

完善菜单加载

yuanrf 1 year ago
parent
commit
9e201803a7

+ 33 - 6
OASystem/OASystem.Infrastructure/Repositories/System/SystemMenuPermissionRepository.cs

@@ -116,12 +116,24 @@ namespace OASystem.Infrastructure.Repositories.System
                             var modul = item.FirstOrDefault();
                             if (modul != null)
                             {
-                                arr.Add(new
+                                if (modul.modulName.Contains("主页"))
                                 {
-                                    modulName = modul.modulName,
-                                    modulid = modul.modulid,
-                                    pageList = item
-                                });
+                                    arr.Insert(0, new
+                                    {
+                                        modulName = modul.modulName,
+                                        modulid = modul.modulid,
+                                        pageList = item
+                                    });
+                                }
+                                else
+                                {
+                                    arr.Add(new
+                                    {
+                                        modulName = modul.modulName,
+                                        modulid = modul.modulid,
+                                        pageList = item
+                                    });
+                                }
                             }
                         }
 
@@ -129,7 +141,22 @@ namespace OASystem.Infrastructure.Repositories.System
                     else if (PortType == 2)
                     {
                         var pages = DBData.Select(x => x.pageid).ToArray();
-                        arr = ArrayList.Adapter(pages);
+
+                        //获取页面所有的操作
+                        var PageFunList = _sqlSugar.SqlQueryable<Sys_SystemMenuAndFunction>(@$"
+                              select * from Sys_SystemMenuAndFunction where SmId in ({string.Join(",", pages).TrimEnd(',')})
+                                and IsEnable = 1 and isdel = 0
+                        ").ToList();
+
+                        foreach (var item in pages)
+                        {
+
+                            arr.Add(new
+                            {
+                                pageid = item,
+                                opList = PageFunList.FindAll(x=>x.SmId == item),
+                            });
+                        }           
                     }
 
                     result.Data = arr;