Browse Source

[完善]用户树显示

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

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

@ -8,10 +8,10 @@
<nz-input-group nzPrefixIcon="search">
<input type="text" nz-input placeholder="请输入机构名称" [(ngModel)]="searchValue" />
</nz-input-group>
</div>
</div>
<div class="treeTitle">
组织机构
<div><label nz-checkbox [(ngModel)]="IsContainsChildren" (ngModelChange)="getAllUsers()">是否包含子节点</label></div>
@ -19,21 +19,19 @@
<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">
</ng-container>
<ng-template #elseTemplate>
<i nz-icon [nzType]="node.isExpanded ? 'caret-down' : 'caret-right'" class="ant-tree-switcher-line-icon"></i>
</ng-template>

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 {

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

@ -42,7 +42,7 @@ export class UserComponent implements OnInit {
}
nzSelectedKeys: any[] = []
defaultExpandedKeys = [];
IsContainsChildren=true
IsContainsChildren = true
searchValue = '';
totalCount: string
//获取所有用户
@ -50,7 +50,7 @@ export class UserComponent implements OnInit {
usersNum: string
OrganizationUnitId
loading: boolean;
organizationsList=[]
organizationsList = []
getAllUsers() {
this.loading = true
let params = {
@ -105,8 +105,7 @@ 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)
await this.getuser(data.result.items)
resolve(data)
this.getAllUsers()
})
@ -121,36 +120,31 @@ 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].title = arrs[index].displayName
arrs[index].key = arrs[index].id
}
this.nodes = [...this.toTree.toTree(arrs)]
this.defaultExpandedKeys = [this.nodes[0].id]
this.nzSelectedKeys = [this.nodes[0].id]
this.OrganizationUnitId = [this.nodes[0].id]
console.log(this.nodes,9000);
console.log(this.nodes, 9000);
})
})
}
xxx(node){
console.log(node)
}
//搜索框提交
submitForm(): void {
for (const i in this.validateForm.controls) {
@ -302,7 +296,7 @@ export class UserComponent implements OnInit {
let url
if (this.level == 1) {
type ? url = '/api/services/app/User/Activate' : url = '/api/services/app/User/DeActivate'
} else {
type ? url = '/api/services/app/EdittingUser/Activate' : url = '/api/services/app/EdittingUser/DeActivate'
}

Loading…
Cancel
Save