Compare commits

...

2 Commits

  1. 11
      src/app/system-management/user/user.component.html
  2. 49
      src/app/system-management/user/user.component.ts

11
src/app/system-management/user/user.component.html

@ -19,12 +19,21 @@
<div class="treebox"> <div class="treebox">
<nz-tree [nzSearchValue]="searchValue" #nzTreeComponent [nzData]="nodes" [nzExpandedKeys]="defaultExpandedKeys" <nz-tree [nzSearchValue]="searchValue" #nzTreeComponent [nzData]="nodes" [nzExpandedKeys]="defaultExpandedKeys"
[nzSelectedKeys]='nzSelectedKeys' (nzClick)="nzClick($event)" [nzExpandedIcon]="multiExpandedIconTpl" [nzSelectedKeys]='nzSelectedKeys' (nzClick)="nzClick($event)" [nzExpandedIcon]="multiExpandedIconTpl"
[nzHideUnMatched]="true"> [nzHideUnMatched]="true"
[nzTreeTemplate]="nzTreeTemplate">
</nz-tree> </nz-tree>
<ng-template #nzTreeTemplate let-node let-origin="origin">
<div class="nodebox">
<span class="name">{{ node.title }}</span>
<span class="name"></span>
</div>
</ng-template>
<ng-template #multiExpandedIconTpl let-node let-origin="origin"> <ng-template #multiExpandedIconTpl let-node let-origin="origin">
<ng-container *ngIf="node.children.length == 0; else elseTemplate"> <ng-container *ngIf="node.children.length == 0; else elseTemplate">
</ng-container> </ng-container>
<ng-template #elseTemplate> <ng-template #elseTemplate>
<i nz-icon [nzType]="node.isExpanded ? 'caret-down' : 'caret-right'" class="ant-tree-switcher-line-icon"></i> <i nz-icon [nzType]="node.isExpanded ? 'caret-down' : 'caret-right'" class="ant-tree-switcher-line-icon"></i>
</ng-template> </ng-template>

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

@ -50,6 +50,7 @@ export class UserComponent implements OnInit {
usersNum: string usersNum: string
OrganizationUnitId OrganizationUnitId
loading: boolean; loading: boolean;
organizationsList=[]
getAllUsers() { getAllUsers() {
this.loading = true this.loading = true
let params = { let params = {
@ -103,23 +104,49 @@ export class UserComponent implements OnInit {
await new Promise<void>((resolve, reject) => { await new Promise<void>((resolve, reject) => {
this.http.get('/api/services/app/Organization/GetAll', { this.http.get('/api/services/app/Organization/GetAll', {
params: params params: params
}).subscribe((data: any) => { }).subscribe(async (data: any) => {
console.log(data,80801); console.log(data,80801);
await this.getuser(data.result.items)
resolve(data)
this.getAllUsers()
})
})
}
async getuser(e) {
let params = {
IsContainsChildren: 'true'
}
await new Promise<void>((resolve, reject) => {
this.http.get('/api/services/app/User/GetCountsByOrganizations', {
params: params
}).subscribe((data: any) => {
resolve(data)
console.log(data,70);
data.result.items.forEach(element => { this.organizationsList = data.result
if (element.id == OrganizationUnitId) {
element.parentId = null const arrs = e.map(item => {
const data = this.organizationsList.find(i => item.id == i.organizationId)
return {
...item,
// ...data,
products: data ? data : false
} }
element.key = element.id })
element.title = element.displayName
//+"&nbsp;&nbsp;共有"+this.usersNum+"位用户" for (let index = 0; index < arrs.length; index++) {
}); if(arrs[index].products){
this.nodes = [...this.toTree.toTree(data.result.items)] arrs[index].title=arrs[index].displayName
resolve(data) }else{
arrs[index].title=arrs[index].displayName
}
}
this.nodes = [...this.toTree.toTree(arrs)]
this.defaultExpandedKeys = [this.nodes[0].id] this.defaultExpandedKeys = [this.nodes[0].id]
this.nzSelectedKeys = [this.nodes[0].id] this.nzSelectedKeys = [this.nodes[0].id]
this.OrganizationUnitId = [this.nodes[0].id] this.OrganizationUnitId = [this.nodes[0].id]
this.getAllUsers() console.log(this.nodes,9000);
}) })
}) })
} }

Loading…
Cancel
Save