diff --git a/src/app/pages/system/menu/menu.component.ts b/src/app/pages/system/menu/menu.component.ts index 794946f..1479a24 100644 --- a/src/app/pages/system/menu/menu.component.ts +++ b/src/app/pages/system/menu/menu.component.ts @@ -24,6 +24,7 @@ import {NzFlexDirective} from "ng-zorro-antd/flex"; import {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select"; import {NzInputNumberComponent} from "ng-zorro-antd/input-number"; import {NzMessageService} from "ng-zorro-antd/message"; +import {DATA} from "../../../data/login/localStorage.namespace"; @Component({ selector: 'app-menu', @@ -78,6 +79,7 @@ export class MenuComponent { private fb: NonNullableFormBuilder, private message: NzMessageService) { this.queryMenuData(); + this.queryMenuTree2(); this.editMenuForm = this.fb.group({ id: [], @@ -91,15 +93,20 @@ export class MenuComponent { }); } + queryMenuTree2() { + this.menuService.queryRoleMenuTree2('', (data: any) => { + this.menuTree = data['return_data']; + }); + } + /** * 查询菜单数据 */ queryMenuData() { this.menuService.queryMenuList((data: any) => { - console.log(data); this.menuData = data['return_data']; // 获取菜单树形结构 - this.queryMenuTree(); + // this.queryMenuTree(); }); } @@ -206,11 +213,12 @@ export class MenuComponent { console.log('submit', this.editMenuForm.value); this.menuService.editMenu(this.editMenuForm.value, (data: any) => { if (data['return_code'] == '000000') { + console.log("获取数据", data); // 刷新数据 - this.queryMenuData(); + this.queryMenuTree2(); this.message.create('success', '操作成功'); - + this.editMenuVisible = false; // 关闭弹窗 this.closeEditMenu(); } else { diff --git a/src/app/servies/menu/menu.service.ts b/src/app/servies/menu/menu.service.ts index bc76b22..5b39c68 100644 --- a/src/app/servies/menu/menu.service.ts +++ b/src/app/servies/menu/menu.service.ts @@ -23,7 +23,7 @@ export class MenuService { } /** - * 分盘菜单 + * 查询菜单 * @param roleId * @param callBack */ @@ -34,7 +34,7 @@ export class MenuService { } /** - * 分配菜单 + * 查询菜单树 * @param roleId * @param callBack */ @@ -48,6 +48,21 @@ export class MenuService { }); } + /** + * 分配菜单 + * @param roleId + * @param callBack + */ + public queryRoleMenuTree2(roleId: string, callBack:any) { + let paramStr = ''; + if (roleId != null && roleId != '') { + paramStr = '?roleId=' + roleId; + } + this.http.get(environment.baseUrl + 'secMenu/queryRoleMenuTree2'+paramStr).subscribe(data => { + callBack(data); + }); + } + /** * 编辑菜单 * @param params