3 changed files with 89 additions and 66 deletions
@ -1,81 +1,108 @@
|
||||
import { Component, OnInit } from '@angular/core'; |
||||
import { Router } from '@angular/router'; |
||||
import { PatternService } from 'src/app/service/pattern.service'; |
||||
import { Component, OnInit } from "@angular/core"; |
||||
import { Router } from "@angular/router"; |
||||
import { PatternService } from "src/app/service/pattern.service"; |
||||
|
||||
@Component({ |
||||
selector: 'app-navigation', |
||||
templateUrl: './navigation.component.html', |
||||
styleUrls: ['./navigation.component.scss'] |
||||
selector: "app-navigation", |
||||
templateUrl: "./navigation.component.html", |
||||
styleUrls: ["./navigation.component.scss"], |
||||
}) |
||||
export class NavigationComponent implements OnInit { |
||||
|
||||
constructor(private router: Router, private patternService: PatternService) { } |
||||
userMenu = [] |
||||
menu = [] |
||||
tap = [] |
||||
menuList1 = [] |
||||
menuList2 = [] |
||||
constructor(private router: Router, private patternService: PatternService) {} |
||||
userMenu = []; |
||||
menu = []; |
||||
tap = []; |
||||
menuList1 = []; |
||||
menuList2 = []; |
||||
menu1 = [ |
||||
{ name: '首页', url: '/homepage' }, |
||||
{ name: '数字油站', url: '/plan' }, |
||||
{ name: '今日预警', url: '/todaywarning' }, |
||||
{ name: '预警记录', url: '/records_nav' }, |
||||
{ name: '证照管理', url: '/audit' }, |
||||
] |
||||
{ name: "首页", url: "/homepage" }, |
||||
{ name: "数字油站", url: "/plan" }, |
||||
{ name: "今日预警", url: "/todaywarning" }, |
||||
{ name: "预警记录", url: "/records_nav" }, |
||||
{ 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' }, |
||||
] |
||||
{ |
||||
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", |
||||
}, |
||||
]; |
||||
|
||||
name |
||||
isProd: boolean |
||||
name; |
||||
isProd: boolean; |
||||
ngOnInit(): void { |
||||
this.isProd = this.patternService.isProd |
||||
let a = sessionStorage.getItem('userdata') |
||||
this.userMenu = JSON.parse(a).menus |
||||
this.name = JSON.parse(a).name |
||||
this.isProd = this.patternService.isProd; |
||||
let a = sessionStorage.getItem("userdata"); |
||||
this.userMenu = JSON.parse(a).menus; |
||||
this.name = JSON.parse(a).name; |
||||
for (let index = 0; index < this.userMenu.length; index++) { |
||||
let a = this.userMenu[index].name |
||||
this.tap.push(a) |
||||
|
||||
let a = this.userMenu[index].name; |
||||
this.tap.push(a); |
||||
} |
||||
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.menuList1.push(this.menu1[index]); |
||||
} |
||||
} |
||||
// console.log(this.menuList1);
|
||||
} |
||||
for (let index = 0; index < this.menu3.length; index++) { |
||||
if (JSON.parse(a).userName == "admin") { |
||||
this.menuList2 = this.menu3 |
||||
this.menuList2 = this.menu3; |
||||
} else { |
||||
for (let k = 0; k < this.tap.length; k++) { |
||||
if (this.tap[k] == this.menu3[index].name) { |
||||
this.menuList2.push(this.menu3[index]) |
||||
|
||||
this.menuList2.push(this.menu3[index]); |
||||
} |
||||
|
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
} |
||||
signOut() { |
||||
sessionStorage.clear() |
||||
localStorage.removeItem("isautologin") |
||||
this.router.navigate(['/login']) |
||||
sessionStorage.clear(); |
||||
localStorage.removeItem("isautologin"); |
||||
this.router.navigate(["/login"]); |
||||
} |
||||
pages() { |
||||
sessionStorage.setItem('selectedMenu', this.menuList1[0].name) |
||||
this.router.navigate([this.menuList1[0].url]) |
||||
sessionStorage.setItem("selectedMenu", this.menuList1[0].name); |
||||
// this.router.navigate([this.menuList1[0].url])
|
||||
window.open(this.menuList1[0].url); |
||||
} |
||||
} |
||||
|
Loading…
Reference in new issue