Browse Source

[新增]角色管理修改

beijing
邵佳豪 3 years ago
parent
commit
9ed61bbba1
  1. 7
      src/app/system-management/role/addrole/addrole.component.html
  2. 44
      src/app/system-management/role/addrole/addrole.component.ts
  3. 26
      src/app/system-management/role/role.component.ts

7
src/app/system-management/role/addrole/addrole.component.html

@ -19,5 +19,12 @@
</ng-template>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSm]="6" [nzXs]="24" nzFor="菜单">菜单</nz-form-label>
<nz-form-control>
<nz-tree-select formControlName="menus" [nzNodes]="nodes" nzShowSearch nzCheckable nzPlaceHolder="请选择菜单">
</nz-tree-select>
</nz-form-control>
</nz-form-item>
</form>
</div>

44
src/app/system-management/role/addrole/addrole.component.ts

@ -18,7 +18,8 @@ export class AddroleComponent implements OnInit {
this.loadMore();
this.validateForm = this.fb.group({
name: [null, [Validators.required]],
power: [null, [Validators.required]]
power: [null, [Validators.required]],
menus: [null]
});
}
destroyModal(): void {
@ -35,4 +36,45 @@ export class AddroleComponent implements OnInit {
console.log('所有权限', data)
})
}
nodes = [
{
title: 'Node1',
value: '0-0',
key: '0-0',
children: [
{
title: 'Child Node1',
value: '0-0-0',
key: '0-0-0',
isLeaf: true
}
]
},
{
title: 'Node2',
value: '0-1',
key: '0-1',
children: [
{
title: 'Child Node3',
value: '0-1-0',
key: '0-1-0',
isLeaf: true
},
{
title: 'Child Node4',
value: '0-1-1',
key: '0-1-1',
isLeaf: true
},
{
title: 'Child Node5',
value: '0-1-2',
key: '0-1-2',
isLeaf: true
}
]
}
];
}

26
src/app/system-management/role/role.component.ts

@ -37,6 +37,9 @@ export class RoleComponent implements OnInit {
this.listOfData = data.result.items
})
}
getAllMenus() {
}
addRole(): void {
const modal = this.modal.create({
@ -74,18 +77,8 @@ export class RoleComponent implements OnInit {
});
const instance = modal.getContentComponent();
modal.afterOpen.subscribe(() => console.log('[afterOpen] emitted!'));
// Return a result when closed
modal.afterClose.subscribe(result => console.log('[afterClose] The result is:', result));
}
optionList = [];
//获取权限列表
loadMore() {
this.http.get('/api/services/app/Role/GetAllPermissions').subscribe((data: any) => {
this.optionList = data.result.items
// this.modal.containerInstance.config.nzOkLoading = false
// console.log('所有权限',data)
})
}
edit(item) {
const modal = this.modal.create({
@ -132,6 +125,19 @@ export class RoleComponent implements OnInit {
modal.afterClose.subscribe(result => console.log('[afterClose] The result is:', result));
}
optionList = [];
//获取权限列表
loadMore() {
this.http.get('/api/services/app/Role/GetAllPermissions').subscribe((data: any) => {
this.optionList = data.result.items
// this.modal.containerInstance.config.nzOkLoading = false
// console.log('所有权限',data)
})
}
delete(item) {
console.log(item)
this.modal.confirm({

Loading…
Cancel
Save