fengxiang
2018-07-11 12b04f145bae740e1971036b1e2dfc1bc224d17b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import { Component } from '@angular/core';
import { ACLService } from '@delon/acl';
import { MenuService } from '@delon/theme';
 
@Component({
  selector: 'app-acl',
  templateUrl: './acl.component.html',
})
export class ACLComponent {
  full = true;
  roleA = '';
  roleB = '';
 
  constructor(public aclSrv: ACLService, private menuSrv: MenuService) {}
 
  private reMenu() {
    this.menuSrv.resume();
  }
 
  toggleFull() {
    this.full = !this.full;
    this.aclSrv.setFull(this.full);
    this.reMenu();
  }
 
  toggleRoleA() {
    this.full = false;
    this.roleA = this.roleA === 'role-a' ? '' : 'role-a';
    this.aclSrv.setFull(this.full);
    this.aclSrv.setRole([this.roleA]);
    this.reMenu();
  }
 
  toggleRoleB() {
    this.full = false;
    this.roleB = this.roleB === 'role-b' ? '' : 'role-b';
    this.aclSrv.setFull(this.full);
    this.aclSrv.setRole([this.roleB]);
    this.reMenu();
  }
}