Browse Source

菜单管理

beijing
陈鹏飞 2 years ago
parent
commit
7832fe3acb
  1. 3
      src/app/pages/home/home.component.html
  2. 32
      src/app/pages/home/home.component.ts
  3. 10
      src/app/system-management/navigation/navigation.component.html
  4. 21
      src/app/system-management/navigation/navigation.component.ts

3
src/app/pages/home/home.component.html

@ -48,7 +48,8 @@
<li *ngIf="isGasStation" nz-menu-item (click)="navChange('/oliStationInfo')">基本信息</li> <li *ngIf="isGasStation" nz-menu-item (click)="navChange('/oliStationInfo')">基本信息</li>
<li *ngIf="isGasStation" nz-menu-item (click)="navChange('/equipmentInfo')">器材信息</li> <li *ngIf="isGasStation" nz-menu-item (click)="navChange('/equipmentInfo')">器材信息</li>
<li nz-menu-item (click)="changePassword()">修改密码</li> <li nz-menu-item (click)="changePassword()">修改密码</li>
<li *ngIf="userName == 'admin'" nz-menu-item (click)="navChange('/system/organization')">系统管理</li> <!-- <li *ngIf="userName == 'admin'" nz-menu-item (click)="navChange('/system/organization')">系统管理</li> -->
<li *ngIf="xitongguanli" nz-menu-item (click)="navChange2()">系统管理</li>
<li nz-menu-item (click)="signOut()">退出系统</li> <li nz-menu-item (click)="signOut()">退出系统</li>
</ul> </ul>
</nz-dropdown-menu> </nz-dropdown-menu>

32
src/app/pages/home/home.component.ts

@ -58,6 +58,17 @@ export class HomeComponent implements OnInit {
{ name: '预警记录', url: '/records_nav/petrolStation' }, { name: '预警记录', url: '/records_nav/petrolStation' },
{ name: '证照管理', url: '/license/petrolStation' }, { name: '证照管理', url: '/license/petrolStation' },
] ]
menu3 = [
{ name: '组织机构管理', url: '/system/organization' },
{ name: '用户管理', url: '/system/user' },
{ name: '角色管理', url: '/system/role' },
{ name: '分析主机管理', url: '/system/host' },
{ name: '推送管理', url: '/system/push' },
{ name: '经营类证照管理', url: '/system/updateOfLicense' },
{ name: '资产类证照管理', url: '/system/fileOfLicense' },
{ name: '菜单管理', url: '/system/menu' },
]
xitongguanli=false
userMenu=[] userMenu=[]
tap=[] tap=[]
menuList1=[] menuList1=[]
@ -91,12 +102,11 @@ export class HomeComponent implements OnInit {
for (let index = 0; index < this.menu2.length; index++) { for (let index = 0; index < this.menu2.length; index++) {
for (let k = 0; k < this.tap.length; k++) { for (let k = 0; k < this.tap.length; k++) {
if (this.tap[k]==this.menu2[index].name) { if (this.tap[k]==this.menu2[index].name) {
this.menuList2.push(this.menu2[index]) this.menuList1.push(this.menu2[index])
} }
} }
} }
console.log( this.menuList2);
} else {//初始化登陆 如果是管理者用户 } else {//初始化登陆 如果是管理者用户
this.isGasStationNav = false this.isGasStationNav = false
this.isGasStationBack = false this.isGasStationBack = false
@ -107,8 +117,13 @@ export class HomeComponent implements OnInit {
} }
} }
} }
for (let index = 0; index < this.tap.length; index++) {
if (this.tap[index]=="系统管理") {
this.xitongguanli=true
}
} }
}
this.router.events.pipe( this.router.events.pipe(
filter(event => event instanceof NavigationEnd) filter(event => event instanceof NavigationEnd)
@ -436,7 +451,20 @@ export class HomeComponent implements OnInit {
navChange(router) { navChange(router) {
this.router.navigate([router]) this.router.navigate([router])
} }
navChange2() {
for (let index = 0; index < this.menu3.length; index++) {
let url=""
for (let k = 0; k < this.tap.length; k++) {
if (this.tap[k]==this.menu3[index].name) {
this.menuList2.push(this.menu3[index])
}
}
}
this.router.navigate([this.menuList2[0].url])
}
goback() { goback() {
this.router.navigate(['/plan']) this.router.navigate(['/plan'])
this.isGasStationNav = false this.isGasStationNav = false

10
src/app/system-management/navigation/navigation.component.html

@ -13,14 +13,8 @@
</div> </div>
<div class="nav"> <div class="nav">
<ul> <ul>
<li [routerLink]="['/system/organization']" routerLinkActive="router-link-active"><img src="../../../assets/images/icon/organization.png" alt="">组织机构管理</li> <li *ngFor="let item of menuList2" [routerLink]="item.url" routerLinkActive="router-link-active"><img [src]="item.img" alt="">{{item.name}}</li>
<li [routerLink]="['/system/user']" routerLinkActive="router-link-active"><img src="../../../assets/images/icon/user.png" alt="">用户管理</li>
<li [routerLink]="['/system/role']" routerLinkActive="router-link-active"><img src="../../../assets/images/icon/role.png" alt="">角色管理</li>
<li [routerLink]="['/system/host']" routerLinkActive="router-link-active"><img src="../../../assets/images/icon/host.png" alt="">分析主机管理</li>
<li [routerLink]="['/system/push']" routerLinkActive="router-link-active"><img src="../../../assets/images/icon/push.png" alt="">推送管理</li>
<li [routerLink]="['/system/updateOfLicense']" routerLinkActive="router-link-active"><img src="../../../assets/images/icon/license.png" alt="">经营类证照管理</li>
<li [routerLink]="['/system/fileOfLicense']" routerLinkActive="router-link-active"><img src="../../../assets/images/icon/license.png" alt="">资产类证照管理</li>
<li [routerLink]="['/system/menu']" routerLinkActive="router-link-active"><img src="../../../assets/images/icon/license.png" alt="">菜单管理</li>
</ul> </ul>
</div> </div>
</nz-sider> </nz-sider>

21
src/app/system-management/navigation/navigation.component.ts

@ -13,6 +13,7 @@ export class NavigationComponent implements OnInit {
menu=[] menu=[]
tap=[] tap=[]
menuList1=[] menuList1=[]
menuList2=[]
menu1 = [ menu1 = [
{ name: '首页', url: '/homepage' }, { name: '首页', url: '/homepage' },
{ name: '数字油站', url: '/plan' }, { name: '数字油站', url: '/plan' },
@ -20,6 +21,16 @@ export class NavigationComponent implements OnInit {
{ name: '预警记录', url: '/records_nav' }, { name: '预警记录', url: '/records_nav' },
{ name: '证照管理', url: '/audit' }, { name: '证照管理', url: '/audit' },
] ]
menu3 = [
{ name: '组织机构管理', url: '/system/organization' ,img:'../../../assets/images/icon/organization.png'},
{ name: '用户管理', url: '/system/user' ,img:'../../../assets/images/icon/user.png'},
{ name: '角色管理', url: '/system/role' ,img:'../../../assets/images/icon/role.png'},
{ name: '分析主机管理', url: '/system/host' ,img:'../../../assets/images/icon/host.png'},
{ name: '推送管理', url: '/system/push' ,img:'../../../assets/images/icon/push.png'},
{ name: '经营类证照管理', url: '/system/updateOfLicense' ,img:'../../../assets/images/icon/license.png'},
{ name: '资产类证照管理', url: '/system/fileOfLicense' ,img:'../../../assets/images/icon/license.png'},
{ name: '菜单管理', url: '/system/menu' ,img:'../../../assets/images/icon/license.png'},
]
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
@ -36,7 +47,17 @@ export class NavigationComponent implements OnInit {
} }
console.log(this.menuList1); console.log(this.menuList1);
} }
for (let index = 0; index < this.menu3.length; index++) {
let url=""
for (let k = 0; k < this.tap.length; k++) {
if (this.tap[k]==this.menu3[index].name) {
this.menuList2.push(this.menu3[index])
}
}
}
} }
signOut() { signOut() {

Loading…
Cancel
Save