조직도 트리 내부서 열어주기.
This commit is contained in:
parent
abdcf44af1
commit
eae8f9111e
|
@ -125,31 +125,6 @@
|
|||
<span class="weblink approved">결제</span>
|
||||
</button>
|
||||
</ng-container>
|
||||
<button
|
||||
*ngIf="updateInfo$ | async as updateInfo"
|
||||
mat-icon-button
|
||||
class="button app-layout-native-title-bar-setting"
|
||||
matTooltip="{{ 'update.label' | translate }}"
|
||||
(click)="onClickUpdate()"
|
||||
>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="18"
|
||||
height="18"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="1.5"
|
||||
stroke-linecap="butt"
|
||||
stroke-linejoin="round"
|
||||
alt="Update"
|
||||
>
|
||||
<circle cx="12" cy="12" r="3"></circle>
|
||||
<path
|
||||
d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"
|
||||
></path>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
<span
|
||||
*ngIf="(!!weblink && weblink.length > 0) || (updateInfo$ | async)"
|
||||
|
|
|
@ -12,7 +12,7 @@ import {
|
|||
import { MatTreeFlattener, MatTree } from '@angular/material';
|
||||
import { NGXLogger } from 'ngx-logger';
|
||||
|
||||
import { DeptInfo } from '@ucap-webmessenger/protocol-query';
|
||||
import { DeptInfo, DeptType } from '@ucap-webmessenger/protocol-query';
|
||||
import { LoginResponse } from '@ucap-webmessenger/protocol-authentication';
|
||||
import { FlatTreeControl } from '@angular/cdk/tree';
|
||||
import { CdkVirtualScrollViewport } from '@angular/cdk/scrolling';
|
||||
|
@ -101,6 +101,26 @@ export class TreeComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||
}
|
||||
});
|
||||
this.dataSource.data = rootNodeList;
|
||||
|
||||
// 내부서 트리 오픈
|
||||
if (!this.myDeptRoot) {
|
||||
this.myDeptRoot = this.getMyRoot(
|
||||
deptInfoList,
|
||||
this.loginRes.departmentCode,
|
||||
[]
|
||||
);
|
||||
}
|
||||
|
||||
if (!!this.myDeptRoot) {
|
||||
this.myDeptRoot.reverse().forEach(seq => {
|
||||
this.treeControl.dataNodes.some(dn => {
|
||||
if (dn.deptInfo.seq === seq) {
|
||||
this.treeControl.expand(dn);
|
||||
return;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Input()
|
||||
|
@ -118,6 +138,7 @@ export class TreeComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||
@ViewChild(PerfectScrollbarDirective, { static: false })
|
||||
psDirectiveRef?: PerfectScrollbarDirective;
|
||||
|
||||
myDeptRoot: number[];
|
||||
treeControl: FlatTreeControl<FlatNode>;
|
||||
treeFlattener: MatTreeFlattener<OrganizationNode, FlatNode>;
|
||||
dataSource: VirtualScrollTreeFlatDataSource<OrganizationNode, FlatNode>;
|
||||
|
@ -183,6 +204,9 @@ export class TreeComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||
|
||||
ngAfterViewInit(): void {
|
||||
this.dataSource.cdkVirtualScrollViewport = this.cvsvOrganization;
|
||||
|
||||
this.cvsvOrganization.scrollToOffset(100);
|
||||
this.psDirectiveRef.update();
|
||||
}
|
||||
|
||||
hasChild = (_: number, node: FlatNode) => node.expandable;
|
||||
|
@ -253,4 +277,24 @@ export class TreeComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
private getMyRoot(
|
||||
deptInfoList: DeptInfo[],
|
||||
srcDeptSeq: number,
|
||||
data: number[]
|
||||
): number[] {
|
||||
const arr = deptInfoList.filter(info => info.seq === srcDeptSeq);
|
||||
|
||||
if (!!arr && arr.length > 0) {
|
||||
const info = arr[0];
|
||||
data.push(info.seq);
|
||||
if (info.type === DeptType.Root) {
|
||||
return data;
|
||||
} else {
|
||||
return this.getMyRoot(deptInfoList, info.parentSeq, data);
|
||||
}
|
||||
} else {
|
||||
return data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user