diff --git a/src/app/pages/records/records-nav/records-nav.component.html b/src/app/pages/records/records-nav/records-nav.component.html index 3c4e44d..63faa4d 100644 --- a/src/app/pages/records/records-nav/records-nav.component.html +++ b/src/app/pages/records/records-nav/records-nav.component.html @@ -4,7 +4,7 @@
- {{item}}
diff --git a/src/app/pages/records/records-nav/records-nav.component.ts b/src/app/pages/records/records-nav/records-nav.component.ts index e36d826..8eb1544 100644 --- a/src/app/pages/records/records-nav/records-nav.component.ts +++ b/src/app/pages/records/records-nav/records-nav.component.ts @@ -13,10 +13,29 @@ export class RecordsNavComponent implements OnInit { isEcharts = true menuList = ['预警类型统计', '卸油统计', '证照预警统计'] - + userMenu = [] + menu=[] selectedMenu ngOnInit(): void { - + let a= sessionStorage.getItem('userdata') + this.userMenu=JSON.parse(a).menus + console.log( this.userMenu); + + if (this.userMenu.length==0) { + this.menu=this.menuList + }else{ + for (let index = 0; index < this.menuList.length; index++) { + + for (let k = 0; k < this.userMenu.length; k++) { + if (this.userMenu[k]==this.menuList[index]) { + this.menu.push(this.userMenu[k]) + console.log( this.menu); + } + + } + + } + } this.selectedMenu = this.menuList[0] this.routerChange() diff --git a/src/app/system-management/menu/addmenu/addmenu.component.html b/src/app/system-management/menu/addmenu/addmenu.component.html index efaa6ba..980fb32 100644 --- a/src/app/system-management/menu/addmenu/addmenu.component.html +++ b/src/app/system-management/menu/addmenu/addmenu.component.html @@ -14,10 +14,10 @@ --> - + \ No newline at end of file diff --git a/src/app/system-management/menu/editmenu/editmenu.component.html b/src/app/system-management/menu/editmenu/editmenu.component.html index 77891a4..277bdcf 100644 --- a/src/app/system-management/menu/editmenu/editmenu.component.html +++ b/src/app/system-management/menu/editmenu/editmenu.component.html @@ -14,11 +14,11 @@ --> - + \ No newline at end of file diff --git a/src/app/system-management/menu/menu.component.ts b/src/app/system-management/menu/menu.component.ts index 24f4cbb..f674b0f 100644 --- a/src/app/system-management/menu/menu.component.ts +++ b/src/app/system-management/menu/menu.component.ts @@ -41,24 +41,30 @@ export class MenuComponent implements OnInit { allOrList: any getAllOrganization() { + let OrganizationUnitId = sessionStorage.getItem('isGasStation') == 'true' ? JSON.parse(sessionStorage.getItem('userdataOfgasstation')).organization.id : JSON.parse(sessionStorage.getItem('userdata')).organization.id let params = { OrganizationUnitId: OrganizationUnitId, IsContainsChildren: "true" } - this.http.get('/api/services/app/Organization/GetAll', { + this.http.get('/api/services/app/Menu/GetAll', { params: params }).subscribe((data: any) => { + this.totalCount = data.result.totalCount data.result.items.forEach(element => { element.key = element.id - element.title = element.displayName + element.title = element.name element.selectable = false }); this.allOrList = data.result.items this.nodes = [...this.toTree.toTree(data.result.items)] this.defaultExpandedKeys = [this.nodes[0].id] this.defaultExpandedKeys = [...this.defaultExpandedKeys] + // console.log(...this.nodes,444); + // console.log(this.defaultExpandedKeys,45); + + }) } @@ -68,7 +74,7 @@ export class MenuComponent implements OnInit { defaultExpandedKeys = []; nodes: any[] = [] - + datas:any[]=[{id:0,title:"首页",children:[]},{id:1,title:"数字油站",children:[]},{id:2,title:"今日预警",children:[]},{id:3,title:"预警记录",children:[{title:'预警类型统计',isGasStation:true},{title:'卸油统计',isGasStation:true},{title:'证照预警统计',isGasStation:true}]},{id:4,title:"证照管理",children:[{title:'经营类证照',isGasStation:true},{title:'资产类证照',isGasStation:true},{title:'待办',isGasStation:true},{title:'审批记录',isGasStation:true}]}] addOr(node?: any) { console.log(node) @@ -85,10 +91,10 @@ export class MenuComponent implements OnInit { let body = { parentId: node ? Number(node.key) : null, // code: instance.validateForm.value.code, - displayName: instance.validateForm.value.name, - isGasStation: instance.validateForm.value.isGasStation + name: instance.validateForm.value.name, + // isGasStation: instance.validateForm.value.isGasStation } - this.http.post('/api/services/app/Organization/Create', body).subscribe(data => { + this.http.post('/api/services/app/Menu/Create', body).subscribe(data => { resolve(data) this.message.create('success', '创建成功!'); this.nzTreeComponent.getExpandedNodeList().forEach((item) => { @@ -112,7 +118,7 @@ export class MenuComponent implements OnInit { } editOr(node) { - // console.log(node) + console.log(node) const modal = this.modal.create({ nzTitle: '编辑组织机构', nzContent: EditmenuComponent, @@ -129,10 +135,10 @@ export class MenuComponent implements OnInit { id: node.origin.id, parentId: node.origin.parentId, // code: instance.validateForm.value.code, - displayName: instance.validateForm.value.name, - isGasStation: instance.validateForm.value.isGasStation + name: instance.validateForm.value.name, + // isGasStation: instance.validateForm.value.isGasStation } - this.http.put('/api/services/app/Organization/Update', body).subscribe(data => { + this.http.put('/api/services/app/Menu/Update', body).subscribe(data => { resolve(data) this.message.create('success', '编辑成功!'); this.nzTreeComponent.getExpandedNodeList().forEach((item) => { @@ -164,7 +170,7 @@ export class MenuComponent implements OnInit { nzOkText: '确定', nzOkType: 'danger', nzOnOk: () => { - this.http.delete('/api/services/app/Organization/Delete', { + this.http.delete('/api/services/app/Menu/Delete', { params: { Id: item.origin.id }