Browse Source

菜单管理

beijing
陈鹏飞 2 years ago
parent
commit
2033b669e0
  1. 10
      src/app/pages/audit/audit-nav/audit-nav.component.html
  2. 32
      src/app/pages/audit/audit-nav/audit-nav.component.ts
  3. 17
      src/app/pages/records/records-nav/records-nav.component.ts

10
src/app/pages/audit/audit-nav/audit-nav.component.html

@ -4,7 +4,7 @@
<img src="../../../assets/images/logosm.png" alt=""> <img src="../../../assets/images/logosm.png" alt="">
<div class="nav"> <div class="nav">
<div class="navitem"> <div class="navitem">
<span *ngFor="let item of navList" [ngClass]="{'grey': selectedItem != item}" <span *ngFor="let item of menu" [ngClass]="{'grey': selectedItem != item}"
(click)="selectNav(item)">{{item}}</span> (click)="selectNav(item)">{{item}}</span>
<span *ngIf="isLevel == 2" [ngClass]="{'grey': selectedItem != '预警规则'}" <span *ngIf="isLevel == 2" [ngClass]="{'grey': selectedItem != '预警规则'}"
(click)="selectNav('预警规则')">预警规则</span> (click)="selectNav('预警规则')">预警规则</span>
@ -13,10 +13,10 @@
</div> </div>
</div> </div>
<div class="content"> <div class="content">
<app-update-license-list *ngIf="selectedItem == navList[0]" #child2></app-update-license-list> <app-update-license-list *ngIf="selectedItem == menu[0]" #child2></app-update-license-list>
<app-file-license-list *ngIf="selectedItem == navList[1]" #child3></app-file-license-list> <app-file-license-list *ngIf="selectedItem == menu[1]" #child3></app-file-license-list>
<app-audit-ing *ngIf="selectedItem == navList[2]"></app-audit-ing> <app-audit-ing *ngIf="selectedItem == menu[2]"></app-audit-ing>
<app-audit-record *ngIf="selectedItem == navList[3]"></app-audit-record> <app-audit-record *ngIf="selectedItem == menu[3]"></app-audit-record>
<app-audit-inform-time *ngIf="selectedItem == '预警规则'"></app-audit-inform-time> <app-audit-inform-time *ngIf="selectedItem == '预警规则'"></app-audit-inform-time>
</div> </div>
</div> </div>

32
src/app/pages/audit/audit-nav/audit-nav.component.ts

@ -9,9 +9,11 @@ export class AuditNavComponent implements OnInit {
constructor() { } constructor() { }
tap=[]
userMenu = []
menu=[]
navList = ['经营类证照', '资产类证照','待办', '审批记录'] navList = ['经营类证照', '资产类证照','待办', '审批记录']
selectedItem = '经营类证照' selectedItem
selectNav(item) { selectNav(item) {
this.selectedItem = item this.selectedItem = item
} }
@ -19,6 +21,32 @@ export class AuditNavComponent implements OnInit {
isLevel isLevel
ngOnInit(): void { ngOnInit(): void {
let a= sessionStorage.getItem('userdata')
this.userMenu=JSON.parse(a).menus
console.log(this.userMenu);
for (let index = 0; index < this.userMenu.length; index++) {
let a=this.userMenu[index].name
this.tap.push(a)
}
console.log(this.tap);
if (this.userMenu.length==0) {
this.menu=this.navList
}else{
for (let index = 0; index < this.navList.length; index++) {
for (let k = 0; k < this.tap.length; k++) {
if (this.tap[k]==this.navList[index]) {
this.menu.push(this.tap[k])
console.log( this.menu);
}
}
}
}
this.selectedItem = this.menu[0]
this.isLevel = JSON.parse(sessionStorage.getItem('userdata')).organization.level this.isLevel = JSON.parse(sessionStorage.getItem('userdata')).organization.level
} }

17
src/app/pages/records/records-nav/records-nav.component.ts

@ -13,22 +13,29 @@ export class RecordsNavComponent implements OnInit {
isEcharts = true isEcharts = true
menuList = ['预警类型统计', '卸油统计', '证照预警统计'] menuList = ['预警类型统计', '卸油统计', '证照预警统计']
tap=[]
userMenu = [] userMenu = []
menu=[] menu=[]
selectedMenu selectedMenu
ngOnInit(): void { ngOnInit(): void {
let a= sessionStorage.getItem('userdata') let a= sessionStorage.getItem('userdata')
this.userMenu=JSON.parse(a).menus this.userMenu=JSON.parse(a).menus
console.log( this.userMenu); console.log(this.userMenu);
for (let index = 0; index < this.userMenu.length; index++) {
let a=this.userMenu[index].name
this.tap.push(a)
}
console.log(this.tap);
if (this.userMenu.length==0) { if (this.userMenu.length==0) {
this.menu=this.menuList this.menu=this.menuList
}else{ }else{
for (let index = 0; index < this.menuList.length; index++) { for (let index = 0; index < this.menuList.length; index++) {
for (let k = 0; k < this.userMenu.length; k++) { for (let k = 0; k < this.tap.length; k++) {
if (this.userMenu[k]==this.menuList[index]) { if (this.tap[k]==this.menuList[index]) {
this.menu.push(this.userMenu[k]) this.menu.push(this.tap[k])
console.log( this.menu); console.log( this.menu);
} }
@ -36,7 +43,7 @@ export class RecordsNavComponent implements OnInit {
} }
} }
this.selectedMenu = this.menuList[0] this.selectedMenu = this.menu[0]
this.routerChange() this.routerChange()
} }

Loading…
Cancel
Save