Browse Source

[完善]完善代码

beijing
邵佳豪 3 years ago
parent
commit
d24cc0090f
  1. 8
      src/app/system-management/user/edituser/edituser.component.ts
  2. 9
      src/app/system-management/user/user.component.ts

8
src/app/system-management/user/edituser/edituser.component.ts

@ -25,9 +25,6 @@ export class EdituserComponent implements OnInit {
role: [null, [Validators.required]], role: [null, [Validators.required]],
phonenum: [null, [Validators.required]] phonenum: [null, [Validators.required]]
}); });
// Promise.all([this.getAllRoles(), this.getAllOrganization()]).then(()=>{
// this.modal.containerInstance.config.nzOkLoading = false
// })
if (this.listOfData.length == 0) { if (this.listOfData.length == 0) {
this.getAllRoles() this.getAllRoles()
} }
@ -35,11 +32,11 @@ export class EdituserComponent implements OnInit {
this.getAllOrganization() this.getAllOrganization()
} }
} }
destroyModal(): void { destroyModal(): void {
this.modal.destroy({ data: 'this the result data' }); this.modal.destroy({ data: 'this the result data' });
} }
//获取角色列表 //获取角色列表
async getAllRoles() { async getAllRoles() {
let params = { let params = {
@ -56,8 +53,8 @@ export class EdituserComponent implements OnInit {
}) })
}) })
} }
//获取所有组织机构
//获取所有组织机构
async getAllOrganization() { async getAllOrganization() {
let OrganizationUnitId = sessionStorage.getItem('isGasStation') == 'true' ? JSON.parse(sessionStorage.getItem('userdataOfgasstation')).organization.id : JSON.parse(sessionStorage.getItem('userdata')).organization.id let OrganizationUnitId = sessionStorage.getItem('isGasStation') == 'true' ? JSON.parse(sessionStorage.getItem('userdataOfgasstation')).organization.id : JSON.parse(sessionStorage.getItem('userdata')).organization.id
let params = { let params = {
@ -77,4 +74,5 @@ export class EdituserComponent implements OnInit {
}) })
}) })
} }
} }

9
src/app/system-management/user/user.component.ts

@ -17,16 +17,11 @@ export class UserComponent implements OnInit {
constructor(private fb: FormBuilder, private modal: NzModalService, private viewContainerRef: ViewContainerRef, private message: NzMessageService, private http: HttpClient, private toTree: TreeService) { } constructor(private fb: FormBuilder, private modal: NzModalService, private viewContainerRef: ViewContainerRef, private message: NzMessageService, private http: HttpClient, private toTree: TreeService) { }
ngOnInit(): void { ngOnInit(): void {
console.log(JSON.parse(sessionStorage.getItem('userdata')).organization.id);
this.validateForm = this.fb.group({ this.validateForm = this.fb.group({
search: [null] search: [null]
}); });
this.getAllOrganization() this.getAllOrganization()
// this.getAllUsers()
this.getAllRoles() this.getAllRoles()
} }
nzSelectedKeys: any[] = [] nzSelectedKeys: any[] = []
defaultExpandedKeys = []; defaultExpandedKeys = [];
@ -134,7 +129,6 @@ export class UserComponent implements OnInit {
subtitle: '' subtitle: ''
}, },
nzOnOk: async () => { nzOnOk: async () => {
// console.log(instance.validateForm.value)
if (instance.validateForm.valid) { if (instance.validateForm.valid) {
await new Promise(resolve => { await new Promise(resolve => {
let body = { let body = {
@ -153,7 +147,6 @@ export class UserComponent implements OnInit {
return true return true
}, err => { }, err => {
resolve(err) resolve(err)
console.log(4444, err)
this.message.create('warning', err.error.error.message); this.message.create('warning', err.error.error.message);
return false return false
}) })
@ -166,7 +159,6 @@ export class UserComponent implements OnInit {
}); });
const instance = modal.getContentComponent(); const instance = modal.getContentComponent();
modal.afterOpen.subscribe(() => console.log('[afterOpen] emitted!')); modal.afterOpen.subscribe(() => console.log('[afterOpen] emitted!'));
// Return a result when closed
modal.afterClose.subscribe(result => console.log('[afterClose] The result is:', result)); modal.afterClose.subscribe(result => console.log('[afterClose] The result is:', result));
} }
@ -179,7 +171,6 @@ export class UserComponent implements OnInit {
nzViewContainerRef: this.viewContainerRef, nzViewContainerRef: this.viewContainerRef,
nzWidth: 450, nzWidth: 450,
nzMaskClosable: false, nzMaskClosable: false,
// nzOkLoading: true,
nzComponentParams: { nzComponentParams: {
data: data, data: data,
listOfData: this.listOfData, listOfData: this.listOfData,

Loading…
Cancel
Save