From eae8f9111e19d812b9c0ee32333cea4960d6dced Mon Sep 17 00:00:00 2001 From: leejinho Date: Mon, 10 Feb 2020 17:05:39 +0900 Subject: [PATCH] =?UTF-8?q?=EC=A1=B0=EC=A7=81=EB=8F=84=20=ED=8A=B8?= =?UTF-8?q?=EB=A6=AC=20=EB=82=B4=EB=B6=80=EC=84=9C=20=EC=97=B4=EC=96=B4?= =?UTF-8?q?=EC=A3=BC=EA=B8=B0.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../native/components/top-bar.component.html | 25 ---------- .../src/lib/components/tree.component.ts | 46 ++++++++++++++++++- 2 files changed, 45 insertions(+), 26 deletions(-) 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; + } + } }