Browse Source

[完善]编辑框打开时loading控制

dev
邵佳豪 3 years ago
parent
commit
79e429ee8d
  1. 3
      src/app/system-management/role/editrole/editrole.component.ts
  2. 3
      src/app/system-management/role/role.component.ts
  3. 2
      src/app/system-management/user/adduser/adduser.component.html
  4. 2
      src/app/system-management/user/edituser/edituser.component.html
  5. 22
      src/app/system-management/user/edituser/edituser.component.ts
  6. 4
      src/app/system-management/user/user.component.ts

3
src/app/system-management/role/editrole/editrole.component.ts

@ -31,7 +31,8 @@ export class EditroleComponent implements OnInit {
loadMore() {
this.http.get('/api/services/app/Role/GetAllPermissions').subscribe((data:any) => {
this.optionList = data.result.items
console.log('所有权限',data)
this.modal.containerInstance.config.nzOkLoading = false
// console.log('所有权限',data)
})
}

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

@ -75,7 +75,8 @@ export class RoleComponent implements OnInit {
nzTitle: '编辑角色',
nzContent: EditroleComponent,
nzViewContainerRef: this.viewContainerRef,
nzWidth: 288,
nzWidth: 325,
nzOkLoading: true,
nzComponentParams: {
data: item
},

2
src/app/system-management/user/adduser/adduser.component.html

@ -24,7 +24,7 @@
<nz-form-item>
<nz-form-control>
<nz-select formControlName="role" nzPlaceHolder="请选择角色" nzMode="multiple">
<nz-option *ngFor="let item of listOfData" [nzValue]="item.name" [nzLabel]="item.displayName"></nz-option>
<nz-option *ngFor="let item of listOfData" [nzValue]="item.normalizedName" [nzLabel]="item.displayName"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>

2
src/app/system-management/user/edituser/edituser.component.html

@ -24,7 +24,7 @@
<nz-form-item>
<nz-form-control>
<nz-select [(ngModel)]="data.roleNames" formControlName="role" nzPlaceHolder="请选择角色" nzMode="multiple">
<nz-option *ngFor="let item of listOfData" [nzValue]="item.name" [nzLabel]="item.displayName"></nz-option>
<nz-option *ngFor="let item of listOfData" [nzValue]="item.normalizedName" [nzLabel]="item.displayName"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>

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

@ -23,11 +23,9 @@ export class EdituserComponent implements OnInit {
role: [null, [Validators.required]],
phonenum: [null, [Validators.required]]
});
console.log(this.data)
this.getAllRoles()
this.getAllOrganization()
Promise.all([this.getAllRoles(), this.getAllOrganization()]).then(()=>{
this.modal.containerInstance.config.nzOkLoading = false
})
}
destroyModal(): void {
this.modal.destroy({ data: 'this the result data' });
@ -36,20 +34,23 @@ export class EdituserComponent implements OnInit {
listOfData: any[] = [];
//获取角色列表
getAllRoles() {
async getAllRoles() {
await new Promise<void>((resolve, reject) => {
this.http.get('/api/services/app/Role/GetAll').subscribe((data: any) => {
console.log('角色列表', data.result.items)
resolve(data)
this.listOfData = data.result.items
})
})
}
//获取所有组织机构
nodes:any = []
getAllOrganization() {
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) => {
@ -58,7 +59,8 @@ export class EdituserComponent implements OnInit {
element.title = element.displayName
});
this.nodes = [...this.toTree.toTree(data.result.items)]
resolve(data)
})
})
}
}

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

@ -71,6 +71,7 @@ export class UserComponent implements OnInit {
subtitle: ''
},
nzOnOk: async () => {
// console.log(instance.validateForm.value)
if (instance.validateForm.valid) {
await new Promise(resolve => {
let body = {
@ -114,6 +115,7 @@ export class UserComponent implements OnInit {
nzContent: EdituserComponent,
nzViewContainerRef: this.viewContainerRef,
nzWidth: 288,
nzOkLoading: true,
nzComponentParams: {
data: data,
},
@ -122,7 +124,7 @@ export class UserComponent implements OnInit {
if (instance.validateForm.valid) {
await new Promise(resolve => {
let body = {
id:data.id,
id: data.id,
userName: instance.validateForm.value.account,
name: instance.validateForm.value.name,
organizationUnitId: instance.validateForm.value.organization,

Loading…
Cancel
Save