|
|
|
@ -5,6 +5,7 @@ import { AdduserComponent } from './adduser/adduser.component';
|
|
|
|
|
import { NzMessageService } from 'ng-zorro-antd/message'; |
|
|
|
|
import { HttpClient } from '@angular/common/http'; |
|
|
|
|
import { EdituserComponent } from './edituser/edituser.component'; |
|
|
|
|
import { TreeService } from 'src/app/service/tree.service'; |
|
|
|
|
@Component({ |
|
|
|
|
selector: 'app-user', |
|
|
|
|
templateUrl: './user.component.html', |
|
|
|
@ -12,13 +13,16 @@ import { EdituserComponent } from './edituser/edituser.component';
|
|
|
|
|
}) |
|
|
|
|
export class UserComponent implements OnInit { |
|
|
|
|
validateForm!: FormGroup; |
|
|
|
|
constructor(private fb: FormBuilder, private modal: NzModalService, private viewContainerRef: ViewContainerRef, private message: NzMessageService, private http: HttpClient) { } |
|
|
|
|
constructor(private fb: FormBuilder, private modal: NzModalService, private viewContainerRef: ViewContainerRef, private message: NzMessageService, private http: HttpClient, private toTree: TreeService) { } |
|
|
|
|
|
|
|
|
|
ngOnInit(): void { |
|
|
|
|
this.validateForm = this.fb.group({ |
|
|
|
|
search: [null] |
|
|
|
|
}); |
|
|
|
|
this.getAllUsers() |
|
|
|
|
|
|
|
|
|
this.getAllRoles() |
|
|
|
|
this.getAllOrganization() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -48,6 +52,37 @@ export class UserComponent implements OnInit {
|
|
|
|
|
this.getAllUsers() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
listOfData:any = [] |
|
|
|
|
//获取角色列表
|
|
|
|
|
async getAllRoles() { |
|
|
|
|
await new Promise<void>((resolve, reject) => { |
|
|
|
|
this.http.get('/api/services/app/Role/GetAll').subscribe((data: any) => { |
|
|
|
|
resolve(data) |
|
|
|
|
this.listOfData = data.result.items |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
//获取所有组织机构
|
|
|
|
|
nodes: any = [] |
|
|
|
|
async getAllOrganization() { |
|
|
|
|
let OrganizationUnitId = sessionStorage.getItem('isGasStation') == 'true' ? JSON.parse(sessionStorage.getItem('userdataOfgasstation')).organization.id : JSON.parse(sessionStorage.getItem('userdata')).organization.id |
|
|
|
|
let params = { |
|
|
|
|
OrganizationUnitId: OrganizationUnitId, |
|
|
|
|
IsContainsChildren: "true" |
|
|
|
|
} |
|
|
|
|
await new Promise<void>((resolve, reject) => { |
|
|
|
|
this.http.get('/api/services/app/Organization/GetAll', { |
|
|
|
|
params: params |
|
|
|
|
}).subscribe((data: any) => { |
|
|
|
|
data.result.items.forEach(element => { |
|
|
|
|
element.key = element.id |
|
|
|
|
element.title = element.displayName |
|
|
|
|
}); |
|
|
|
|
this.nodes = [...this.toTree.toTree(data.result.items)] |
|
|
|
|
resolve(data) |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//搜索框提交
|
|
|
|
@ -115,12 +150,13 @@ export class UserComponent implements OnInit {
|
|
|
|
|
nzContent: EdituserComponent, |
|
|
|
|
nzViewContainerRef: this.viewContainerRef, |
|
|
|
|
nzWidth: 288, |
|
|
|
|
nzOkLoading: true, |
|
|
|
|
// nzOkLoading: true,
|
|
|
|
|
nzComponentParams: { |
|
|
|
|
data: data, |
|
|
|
|
listOfData:this.listOfData, |
|
|
|
|
nodes:this.nodes |
|
|
|
|
}, |
|
|
|
|
nzOnOk: async () => { |
|
|
|
|
console.log('hhhhhhh', instance.validateForm) |
|
|
|
|
if (instance.validateForm.valid) { |
|
|
|
|
await new Promise(resolve => { |
|
|
|
|
let body = { |
|
|
|
|