diff --git a/projects/ucap-webmessenger-app/src/app/layouts/native/components/top-bar.component.html b/projects/ucap-webmessenger-app/src/app/layouts/native/components/top-bar.component.html index 2d939702..3d65cdda 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/native/components/top-bar.component.html +++ b/projects/ucap-webmessenger-app/src/app/layouts/native/components/top-bar.component.html @@ -125,31 +125,6 @@ 결제 - { + 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; treeFlattener: MatTreeFlattener; dataSource: VirtualScrollTreeFlatDataSource; @@ -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; + } + } }