This commit is contained in:
richard-loafle 2020-02-10 17:06:05 +09:00
commit bd60c39bbe
2 changed files with 45 additions and 26 deletions

View File

@ -125,31 +125,6 @@
<span class="weblink approved">결제</span> <span class="weblink approved">결제</span>
</button> </button>
</ng-container> </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> </div>
<span <span
*ngIf="(!!weblink && weblink.length > 0) || (updateInfo$ | async)" *ngIf="(!!weblink && weblink.length > 0) || (updateInfo$ | async)"

View File

@ -12,7 +12,7 @@ import {
import { MatTreeFlattener, MatTree } from '@angular/material'; import { MatTreeFlattener, MatTree } from '@angular/material';
import { NGXLogger } from 'ngx-logger'; 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 { LoginResponse } from '@ucap-webmessenger/protocol-authentication';
import { FlatTreeControl } from '@angular/cdk/tree'; import { FlatTreeControl } from '@angular/cdk/tree';
import { CdkVirtualScrollViewport } from '@angular/cdk/scrolling'; import { CdkVirtualScrollViewport } from '@angular/cdk/scrolling';
@ -101,6 +101,26 @@ export class TreeComponent implements OnInit, OnDestroy, AfterViewInit {
} }
}); });
this.dataSource.data = rootNodeList; 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() @Input()
@ -118,6 +138,7 @@ export class TreeComponent implements OnInit, OnDestroy, AfterViewInit {
@ViewChild(PerfectScrollbarDirective, { static: false }) @ViewChild(PerfectScrollbarDirective, { static: false })
psDirectiveRef?: PerfectScrollbarDirective; psDirectiveRef?: PerfectScrollbarDirective;
myDeptRoot: number[];
treeControl: FlatTreeControl<FlatNode>; treeControl: FlatTreeControl<FlatNode>;
treeFlattener: MatTreeFlattener<OrganizationNode, FlatNode>; treeFlattener: MatTreeFlattener<OrganizationNode, FlatNode>;
dataSource: VirtualScrollTreeFlatDataSource<OrganizationNode, FlatNode>; dataSource: VirtualScrollTreeFlatDataSource<OrganizationNode, FlatNode>;
@ -183,6 +204,9 @@ export class TreeComponent implements OnInit, OnDestroy, AfterViewInit {
ngAfterViewInit(): void { ngAfterViewInit(): void {
this.dataSource.cdkVirtualScrollViewport = this.cvsvOrganization; this.dataSource.cdkVirtualScrollViewport = this.cvsvOrganization;
this.cvsvOrganization.scrollToOffset(100);
this.psDirectiveRef.update();
} }
hasChild = (_: number, node: FlatNode) => node.expandable; hasChild = (_: number, node: FlatNode) => node.expandable;
@ -253,4 +277,24 @@ export class TreeComponent implements OnInit, OnDestroy, AfterViewInit {
} }
return undefined; 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;
}
}
} }