You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.3 KiB
54 lines
1.3 KiB
import { Component, OnInit, Input } from '@angular/core'; |
|
import { NzModalRef } from 'ng-zorro-antd/modal'; |
|
import { FormBuilder, FormGroup, Validators } from '@angular/forms'; |
|
import { HttpClient } from '@angular/common/http'; |
|
import { TreeService } from 'src/app/service/tree.service'; |
|
|
|
@Component({ |
|
selector: 'app-adduser', |
|
templateUrl: './adduser.component.html', |
|
styleUrls: ['./adduser.component.scss'] |
|
}) |
|
export class AdduserComponent implements OnInit { |
|
|
|
@Input() nodes?: any; |
|
@Input() roleList?: any; |
|
validateForm!: FormGroup; |
|
constructor(private modal: NzModalRef, private fb: FormBuilder, private http: HttpClient) { } |
|
|
|
ngOnInit(): void { |
|
this.validateForm = this.fb.group({ |
|
account: [null, [Validators.required]], |
|
name: [null], |
|
email: [null], |
|
organization: [null, [Validators.required]], |
|
role: [[]], |
|
posts: [[]] |
|
}); |
|
|
|
if (this.roleList.length == 0) { |
|
this.getAllRoles() |
|
} else { |
|
this.listOfData = this.roleList |
|
} |
|
|
|
} |
|
destroyModal(): void { |
|
this.modal.destroy({ data: 'this the result data' }); |
|
} |
|
|
|
listOfData: any[] = []; |
|
//获取角色列表 |
|
getAllRoles() { |
|
let params = { |
|
PageNumber: 1, |
|
PageSize: 100 |
|
} |
|
this.http.get('/api/Roles', { |
|
params: params |
|
}).subscribe((data: any) => { |
|
this.listOfData = data.items |
|
}) |
|
} |
|
|
|
}
|
|
|