diff --git a/WebFirst/database/sqlite.db b/WebFirst/database/sqlite.db index b49bcebf..6f14ee40 100644 Binary files a/WebFirst/database/sqlite.db and b/WebFirst/database/sqlite.db differ diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml index bc81ce88..0861a9b6 100644 --- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml +++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml @@ -148,6 +148,13 @@ + + + 插入 + + + + 得到树形菜单 diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/MenuController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/MenuController.cs index 81ab9f17..119554e9 100644 --- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/MenuController.cs +++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/MenuController.cs @@ -37,7 +37,20 @@ namespace Yi.Framework.ApiMicroservice.Controllers [HttpGet] public async Task GetList([FromQuery] MenuEntity menu) { - return Result.Success().SetData(await _iMenuService.SelctGetList(menu)); + var p= await _iMenuService.SelctGetList(menu); + p.ForEach(m => m.Children = new List()); + return Result.Success().SetData(p); + } + + /// + /// 插入 + /// + /// + /// + [HttpPost] + public async Task Add(MenuEntity menu) + { + return Result.Success().SetData(await _iMenuService._repository.InsertReturnSnowflakeIdAsync(menu)); } diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db index 793982e8..c254745d 100644 Binary files a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db and b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db differ diff --git a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/MenuEntity.cs b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/MenuEntity.cs index e4eb303b..fb6d363c 100644 --- a/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/MenuEntity.cs +++ b/Yi.Framework.Net6/Yi.Framework.Model/ModelsTemplate/MenuEntity.cs @@ -104,5 +104,15 @@ namespace Yi.Framework.Model.Models /// [SugarColumn(ColumnName="Remark" )] public string Remark { get; set; } + /// + /// 组件路径 + /// + [SugarColumn(ColumnName="Component" )] + public string Component { get; set; } + /// + /// 路由参数 + /// + [SugarColumn(ColumnName="Query" )] + public string Query { get; set; } } } diff --git a/Yi.Framework.Net6/Yi.Framework.Service/UserService.cs b/Yi.Framework.Net6/Yi.Framework.Service/UserService.cs index c330927b..cde1d7aa 100644 --- a/Yi.Framework.Net6/Yi.Framework.Service/UserService.cs +++ b/Yi.Framework.Net6/Yi.Framework.Service/UserService.cs @@ -124,14 +124,22 @@ namespace Yi.Framework.Service { userRoleMenu.RoleCodes.Add(role.RoleCode); - foreach (var menu in role.Menus) + if (role.Menus.IsNotNull()) { - if (!string.IsNullOrEmpty(menu.PermissionCode)) + foreach (var menu in role.Menus) { - userRoleMenu.PermissionCodes.Add(menu.PermissionCode); - userRoleMenu.Menus.Add(menu); + + + if (!string.IsNullOrEmpty(menu.PermissionCode)) + { + userRoleMenu.PermissionCodes.Add(menu.PermissionCode); + userRoleMenu.Menus.Add(menu); + } + + } } + //刚好可以去除一下多余的导航属性 role.Menus = null; userRoleMenu.Roles.Add(role); diff --git a/Yi.Vue3.X.RuoYi/src/api/system/menu.js b/Yi.Vue3.X.RuoYi/src/api/system/menu.js index 07d79630..5c04e404 100644 --- a/Yi.Vue3.X.RuoYi/src/api/system/menu.js +++ b/Yi.Vue3.X.RuoYi/src/api/system/menu.js @@ -36,7 +36,7 @@ export function roleMenuTreeselect(roleId) { // 新增菜单 export function addMenu(data) { return request({ - url: '/system/menu', + url: '/menu/add', method: 'post', data: data }) diff --git a/Yi.Vue3.X.RuoYi/src/utils/ruoyi.js b/Yi.Vue3.X.RuoYi/src/utils/ruoyi.js index 9a9dc3d3..e7993c1d 100644 --- a/Yi.Vue3.X.RuoYi/src/utils/ruoyi.js +++ b/Yi.Vue3.X.RuoYi/src/utils/ruoyi.js @@ -157,6 +157,7 @@ export function mergeRecursive(source, target) { * @param {*} children 孩子节点字段 默认 'children' */ export function handleTree(data, id, parentId, children) { + let config = { id: id || 'id', parentId: parentId || 'parentId', diff --git a/Yi.Vue3.X.RuoYi/src/views/system/menu/index.vue b/Yi.Vue3.X.RuoYi/src/views/system/menu/index.vue index 02f091dc..fc2c7220 100644 --- a/Yi.Vue3.X.RuoYi/src/views/system/menu/index.vue +++ b/Yi.Vue3.X.RuoYi/src/views/system/menu/index.vue @@ -106,8 +106,8 @@ @@ -122,8 +122,8 @@ - - + + - + - +