Browse Source

[完善]用户树显示

beijing
邵佳豪 3 years ago
parent
commit
6489ac5ba0
  1. 8
      src/app/system-management/user/user.component.html
  2. 5
      src/app/system-management/user/user.component.scss
  3. 14
      src/app/system-management/user/user.component.ts

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

@ -19,15 +19,13 @@
<div class="treebox">
<nz-tree [nzSearchValue]="searchValue" #nzTreeComponent [nzData]="nodes" [nzExpandedKeys]="defaultExpandedKeys"
[nzSelectedKeys]='nzSelectedKeys' (nzClick)="nzClick($event)" [nzExpandedIcon]="multiExpandedIconTpl"
[nzHideUnMatched]="true"
[nzTreeTemplate]="nzTreeTemplate">
[nzHideUnMatched]="true" [nzTreeTemplate]="nzTreeTemplate">
</nz-tree>
<ng-template #nzTreeTemplate let-node let-origin="origin">
<div class="nodebox">
<span class="name">{{ node.title }}</span>
<span class="name"></span>
<span class="name" (click)="xxx(node)">{{ node.title }}</span>
<span class="name">({{node.origin.products.usersCount}})</span>
</div>
</ng-template>
<ng-template #multiExpandedIconTpl let-node let-origin="origin">
<ng-container *ngIf="node.children.length == 0; else elseTemplate">

5
src/app/system-management/user/user.component.scss

@ -75,12 +75,11 @@
flex: 1;
width: 100px;
margin-left: 55px;
// height: 55px;
// line-height: 55px;
}
}
.nodebox {
font-size: 15px;
display: flex;
justify-content: space-between;
}
tbody {
tr {

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

@ -105,7 +105,6 @@ export class UserComponent implements OnInit {
this.http.get('/api/services/app/Organization/GetAll', {
params: params
}).subscribe(async (data: any) => {
console.log(data,80801);
await this.getuser(data.result.items)
resolve(data)
this.getAllUsers()
@ -121,25 +120,18 @@ export class UserComponent implements OnInit {
params: params
}).subscribe((data: any) => {
resolve(data)
console.log(data,70);
this.organizationsList = data.result
const arrs = e.map(item => {
const data = this.organizationsList.find(i => item.id == i.organizationId)
return {
...item,
// ...data,
products: data ? data : false
}
})
for (let index = 0; index < arrs.length; index++) {
if(arrs[index].products){
arrs[index].title=arrs[index].displayName
}else{
arrs[index].title = arrs[index].displayName
}
arrs[index].key = arrs[index].id
}
this.nodes = [...this.toTree.toTree(arrs)]
@ -150,7 +142,9 @@ export class UserComponent implements OnInit {
})
})
}
xxx(node){
console.log(node)
}
//搜索框提交
submitForm(): void {
for (const i in this.validateForm.controls) {

Loading…
Cancel
Save