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. 15
      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="">
<div class="nav">
<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>
<span *ngIf="isLevel == 2" [ngClass]="{'grey': selectedItem != '预警规则'}"
(click)="selectNav('预警规则')">预警规则</span>
@ -13,10 +13,10 @@
</div>
</div>
<div class="content">
<app-update-license-list *ngIf="selectedItem == navList[0]" #child2></app-update-license-list>
<app-file-license-list *ngIf="selectedItem == navList[1]" #child3></app-file-license-list>
<app-audit-ing *ngIf="selectedItem == navList[2]"></app-audit-ing>
<app-audit-record *ngIf="selectedItem == navList[3]"></app-audit-record>
<app-update-license-list *ngIf="selectedItem == menu[0]" #child2></app-update-license-list>
<app-file-license-list *ngIf="selectedItem == menu[1]" #child3></app-file-license-list>
<app-audit-ing *ngIf="selectedItem == menu[2]"></app-audit-ing>
<app-audit-record *ngIf="selectedItem == menu[3]"></app-audit-record>
<app-audit-inform-time *ngIf="selectedItem == '预警规则'"></app-audit-inform-time>
</div>
</div>

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

@ -9,9 +9,11 @@ export class AuditNavComponent implements OnInit {
constructor() { }
tap=[]
userMenu = []
menu=[]
navList = ['经营类证照', '资产类证照','待办', '审批记录']
selectedItem = '经营类证照'
selectedItem
selectNav(item) {
this.selectedItem = item
}
@ -19,6 +21,32 @@ export class AuditNavComponent implements OnInit {
isLevel
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
}

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

@ -13,6 +13,7 @@ export class RecordsNavComponent implements OnInit {
isEcharts = true
menuList = ['预警类型统计', '卸油统计', '证照预警统计']
tap=[]
userMenu = []
menu=[]
selectedMenu
@ -20,15 +21,21 @@ export class RecordsNavComponent implements OnInit {
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.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])
for (let k = 0; k < this.tap.length; k++) {
if (this.tap[k]==this.menuList[index]) {
this.menu.push(this.tap[k])
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()
}

Loading…
Cancel
Save