|
|
|
@ -52,7 +52,7 @@ export class RoleComponent implements OnInit {
|
|
|
|
|
this.http.get('/api/services/app/Menu/GetAll', { |
|
|
|
|
params: params |
|
|
|
|
}).subscribe((data: any) => { |
|
|
|
|
console.log(666, data) |
|
|
|
|
// console.log(666, data)
|
|
|
|
|
this.totalCount = data.result.totalCount |
|
|
|
|
data.result.items.forEach(element => { |
|
|
|
|
element.key = element.id |
|
|
|
@ -86,8 +86,20 @@ export class RoleComponent implements OnInit {
|
|
|
|
|
DisplayName: instance.validateForm.value.name, |
|
|
|
|
grantedPermissions: arr |
|
|
|
|
} |
|
|
|
|
this.http.post('/api/services/app/Role/Create', body).subscribe(data => { |
|
|
|
|
let body2=instance.validateForm.value.menus |
|
|
|
|
this.http.post('/api/services/app/Role/Create', body).subscribe((data:any) => { |
|
|
|
|
resolve(data) |
|
|
|
|
this.http.post('/api/services/app/Role/SetRoleMenus', body2, { |
|
|
|
|
params: { |
|
|
|
|
roleId: data.result.id |
|
|
|
|
} |
|
|
|
|
}).subscribe(data => { |
|
|
|
|
resolve(data) |
|
|
|
|
|
|
|
|
|
// this.message.create('success', '分配成功!');
|
|
|
|
|
|
|
|
|
|
return true |
|
|
|
|
}) |
|
|
|
|
this.message.create('success', '创建成功!'); |
|
|
|
|
this.getAllRoles() |
|
|
|
|
return true |
|
|
|
@ -103,7 +115,7 @@ export class RoleComponent implements OnInit {
|
|
|
|
|
modal.afterOpen.subscribe(() => console.log('[afterOpen] emitted!')); |
|
|
|
|
modal.afterClose.subscribe(result => console.log('[afterClose] The result is:', result)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
edit(item) { |
|
|
|
|
const modal = this.modal.create({ |
|
|
|
|
nzTitle: '编辑角色', |
|
|
|
@ -131,8 +143,20 @@ export class RoleComponent implements OnInit {
|
|
|
|
|
DisplayName: instance.validateForm.value.name, |
|
|
|
|
grantedPermissions: arr |
|
|
|
|
} |
|
|
|
|
this.http.put('/api/services/app/Role/Update', body).subscribe(data => { |
|
|
|
|
let body2=instance.validateForm.value.menus |
|
|
|
|
this.http.put('/api/services/app/Role/Update', body).subscribe((data:any) => { |
|
|
|
|
resolve(data) |
|
|
|
|
this.http.post('/api/services/app/Role/SetRoleMenus', body2, { |
|
|
|
|
params: { |
|
|
|
|
roleId: data.result.id |
|
|
|
|
} |
|
|
|
|
}).subscribe(data => { |
|
|
|
|
resolve(data) |
|
|
|
|
|
|
|
|
|
// this.message.create('success', '分配成功!');
|
|
|
|
|
|
|
|
|
|
return true |
|
|
|
|
}) |
|
|
|
|
this.message.create('success', '修改成功!'); |
|
|
|
|
this.getAllRoles() |
|
|
|
|
return true |
|
|
|
|