organization is modified
This commit is contained in:
parent
893ebae543
commit
9ab79fd494
|
@ -44,7 +44,7 @@
|
||||||
<div *ngIf="selectedDepartmentProcessing">
|
<div *ngIf="selectedDepartmentProcessing">
|
||||||
<mat-progress-bar mode="indeterminate"></mat-progress-bar>
|
<mat-progress-bar mode="indeterminate"></mat-progress-bar>
|
||||||
</div>
|
</div>
|
||||||
<div class="search-list">
|
<div *ngIf="!isShowSearch" class="search-list">
|
||||||
<cdk-virtual-scroll-viewport
|
<cdk-virtual-scroll-viewport
|
||||||
itemSize="80"
|
itemSize="80"
|
||||||
#cvsvDeptUser
|
#cvsvDeptUser
|
||||||
|
|
|
@ -24,10 +24,14 @@
|
||||||
<div class="tree-node-closer-top"></div>
|
<div class="tree-node-closer-top"></div>
|
||||||
<div
|
<div
|
||||||
class="tree-node-closer-bottom"
|
class="tree-node-closer-bottom"
|
||||||
[attr.lastNode]="isLastNode(node) ? '' : null"
|
[attr.last-node]="isLastNode(node) ? '' : null"
|
||||||
></div>
|
></div>
|
||||||
</div>
|
</div>
|
||||||
<li (click)="onClickNode(node)" matRipple>
|
<li
|
||||||
|
(click)="onClickNode(node)"
|
||||||
|
matRipple
|
||||||
|
[attr.sub-node]="isParentLastNode(node) ? '' : null"
|
||||||
|
>
|
||||||
<div class="tree-node-body">{{ node.name }}</div>
|
<div class="tree-node-body">{{ node.name }}</div>
|
||||||
</li>
|
</li>
|
||||||
</mat-tree-node>
|
</mat-tree-node>
|
||||||
|
@ -43,10 +47,14 @@
|
||||||
<div
|
<div
|
||||||
class="tree-node-closer-bottom"
|
class="tree-node-closer-bottom"
|
||||||
[attr.expanded]="treeControl.isExpanded(node) ? '' : null"
|
[attr.expanded]="treeControl.isExpanded(node) ? '' : null"
|
||||||
[attr.lastNode]="isLastNode(node) ? '' : null"
|
[attr.last-node]="isLastNode(node) ? '' : null"
|
||||||
></div>
|
></div>
|
||||||
</div>
|
</div>
|
||||||
<li (click)="onClickNode(node)" matRipple>
|
<li
|
||||||
|
(click)="onClickNode(node)"
|
||||||
|
matRipple
|
||||||
|
[attr.sub-node]="isParentLastNode(node) ? '' : null"
|
||||||
|
>
|
||||||
<div class="tree-node-body">
|
<div class="tree-node-body">
|
||||||
<span class="horizontal-line"></span>
|
<span class="horizontal-line"></span>
|
||||||
<button
|
<button
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
.tree-node-closer-bottom[expanded] {
|
.tree-node-closer-bottom[expanded] {
|
||||||
border-width: 0 0 1px 0px;
|
border-width: 0 0 1px 0px;
|
||||||
}
|
}
|
||||||
.tree-node-closer-bottom[lastNode] {
|
.tree-node-closer-bottom[last-node] {
|
||||||
border-width: 0 0 1px 0px;
|
border-width: 0 0 1px 0px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,6 +39,11 @@
|
||||||
list-style-type: none;
|
list-style-type: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// li[sub-node] {
|
||||||
|
// border: 1px dotted grey;
|
||||||
|
// border-width: 0 0 0 1px;
|
||||||
|
// }
|
||||||
|
|
||||||
// li:last-child {
|
// li:last-child {
|
||||||
// border-left: 1px solid white;
|
// border-left: 1px solid white;
|
||||||
// margin-left: -41px;
|
// margin-left: -41px;
|
||||||
|
|
|
@ -154,9 +154,7 @@ export class TreeComponent implements OnInit, OnDestroy, AfterViewInit {
|
||||||
hasChild = (_: number, node: FlatNode) => node.expandable;
|
hasChild = (_: number, node: FlatNode) => node.expandable;
|
||||||
|
|
||||||
isLastNode(node: FlatNode): boolean {
|
isLastNode(node: FlatNode): boolean {
|
||||||
const i = this.dataSource.expandedDataSubject.value.findIndex(n => {
|
const i = this.findNodeIndex(node);
|
||||||
return node.deptInfo.seq === n.deptInfo.seq;
|
|
||||||
});
|
|
||||||
|
|
||||||
if (i === this.dataSource.expandedDataSubject.value.length - 1) {
|
if (i === this.dataSource.expandedDataSubject.value.length - 1) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -168,7 +166,38 @@ export class TreeComponent implements OnInit, OnDestroy, AfterViewInit {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isParentLastNode(node: FlatNode): boolean {
|
||||||
|
const pi = this.findParentNodeIndex(node);
|
||||||
|
if (-1 === pi) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return this.isLastNode(this.dataSource.expandedDataSubject.value[pi]);
|
||||||
|
}
|
||||||
|
|
||||||
onClickNode(node: OrganizationNode) {
|
onClickNode(node: OrganizationNode) {
|
||||||
this.selected.emit(node.deptInfo);
|
this.selected.emit(node.deptInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private findNodeIndex(node: FlatNode): number {
|
||||||
|
return this.dataSource.expandedDataSubject.value.findIndex(n => {
|
||||||
|
return node.deptInfo.seq === n.deptInfo.seq;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private findParentNodeIndex(node: FlatNode): number {
|
||||||
|
const i = this.findNodeIndex(node);
|
||||||
|
if (-1 === i) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let idx = i - 1; idx >= 0; idx--) {
|
||||||
|
if (
|
||||||
|
this.dataSource.expandedDataSubject.value[idx].level ===
|
||||||
|
node.level - 1
|
||||||
|
) {
|
||||||
|
return idx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user