select-menu.component.ts 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import { Component, OnInit, Output, Input } from '@angular/core';
  2. import { EventEmitter } from '@angular/core';
  3. import { Router } from "@angular/router";
  4. @Component({
  5. selector: 'app-select-menu',
  6. templateUrl: './select-menu.component.html',
  7. styleUrls: ['./select-menu.component.less']
  8. })
  9. export class SelectMenuComponent implements OnInit {
  10. @Output() cancelMenuModal = new EventEmitter();
  11. @Input() iShowMenuModal: boolean = false;//模态框
  12. allHospital: any;//所有院区
  13. hosLoading: boolean = false;//确定按钮的loading
  14. configurationCenterMenus: any[] = [];//配置中心菜单
  15. constructor(
  16. private router: Router,
  17. ) { }
  18. ngOnInit() {
  19. let menus = JSON.parse(localStorage.getItem("menu"));
  20. let configurationCenterMenus = [];
  21. // 事件配置
  22. let incidentConfig = menus.find(item => item.link == 'incidentConfig');
  23. incidentConfig && configurationCenterMenus.push(incidentConfig);
  24. // 三方配置
  25. let otherConfig = menus.find(item => item.link == 'otherConfig');
  26. otherConfig && configurationCenterMenus.push(otherConfig);
  27. // 系统配置
  28. let systemConfig = menus.find(item => item.link == 'systemConfig');
  29. systemConfig && configurationCenterMenus.push(systemConfig);
  30. // 业务页面控制
  31. let pageConfig = menus.find(item => item.link == 'pageConfig');
  32. pageConfig && configurationCenterMenus.push(pageConfig);
  33. this.configurationCenterMenus = configurationCenterMenus;
  34. }
  35. clickHandle(item){
  36. this.router.navigateByUrl(item.link);
  37. }
  38. // 隐藏模态框
  39. hideModal() {
  40. this.cancelMenuModal.emit(false)
  41. }
  42. }