|
|
|
@ -58,7 +58,10 @@ export class HomeComponent implements OnInit {
|
|
|
|
|
{ name: '预警记录', url: '/records_nav/petrolStation' }, |
|
|
|
|
{ name: '证照管理', url: '/license/petrolStation' }, |
|
|
|
|
] |
|
|
|
|
|
|
|
|
|
userMenu=[] |
|
|
|
|
tap=[] |
|
|
|
|
menuList1=[] |
|
|
|
|
menuList2=[] |
|
|
|
|
selectedItem |
|
|
|
|
routerChange(item) { |
|
|
|
|
if (item.name == this.selectedItem) { |
|
|
|
@ -70,7 +73,13 @@ export class HomeComponent implements OnInit {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ngOnInit(): void { |
|
|
|
|
|
|
|
|
|
let a= sessionStorage.getItem('userdata') |
|
|
|
|
this.userMenu=JSON.parse(a).menus |
|
|
|
|
for (let index = 0; index < this.userMenu.length; index++) { |
|
|
|
|
let a=this.userMenu[index].name |
|
|
|
|
this.tap.push(a) |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
if (sessionStorage.getItem('selectedMenu')) { |
|
|
|
|
this.selectedItem = sessionStorage.getItem('selectedMenu') |
|
|
|
|
} |
|
|
|
@ -79,9 +88,26 @@ export class HomeComponent implements OnInit {
|
|
|
|
|
//初始化登陆 如果是油站用户
|
|
|
|
|
if (this.isGasStation) { |
|
|
|
|
this.isGasStationNav = true |
|
|
|
|
for (let index = 0; index < this.menu2.length; index++) { |
|
|
|
|
for (let k = 0; k < this.tap.length; k++) { |
|
|
|
|
if (this.tap[k]==this.menu2[index].name) { |
|
|
|
|
this.menuList2.push(this.menu2[index])
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
console.log( this.menuList2); |
|
|
|
|
} else {//初始化登陆 如果是管理者用户
|
|
|
|
|
this.isGasStationNav = false |
|
|
|
|
this.isGasStationBack = false |
|
|
|
|
for (let index = 0; index < this.menu1.length; index++) { |
|
|
|
|
for (let k = 0; k < this.tap.length; k++) { |
|
|
|
|
if (this.tap[k]==this.menu1[index].name) { |
|
|
|
|
this.menuList1.push(this.menu1[index]) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
this.router.events.pipe( |
|
|
|
|