From ded09a9c834fd80c5b885973f0ac1d10d2bf2b1b Mon Sep 17 00:00:00 2001 From: leejinho Date: Wed, 29 Jan 2020 11:15:57 +0900 Subject: [PATCH] =?UTF-8?q?=EC=82=AC=EC=9A=A9=EC=9E=90=20=EA=B2=80?= =?UTF-8?q?=EC=83=89=20>>=20=ED=94=84=EB=A0=88=EC=A6=8C=EC=8A=A4=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../left-sidenav/organization.component.ts | 10 -- .../integrated-search.dialog.component.html | 2 + .../integrated-search.dialog.component.ts | 21 +++- .../integrated-search.component.html | 12 ++- .../components/integrated-search.component.ts | 102 +++++++++++++++++- 5 files changed, 129 insertions(+), 18 deletions(-) diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/organization.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/organization.component.ts index 331fc941..53a0765f 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/organization.component.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/organization.component.ts @@ -305,16 +305,6 @@ export class OrganizationComponent // 검색 결과 처리. this.searchUserInfos = searchUserInfos; this.selectedDepartmentProcessing = false; - // 검색 결과에 따른 프레즌스 조회. - const userSeqList: number[] = []; - if (userSeqList.length > 0) { - this.store.dispatch( - StatusStore.bulkInfo({ - divCd: 'orgSrch', - userSeqs: this.searchUserInfos.map(user => user.seq) - }) - ); - } if (!!this.cvsvDeptSearchUser) { this.cvsvDeptSearchUser.scrollToOffset(0); diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/search/integrated-search.dialog.component.html b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/search/integrated-search.dialog.component.html index a2bf3c67..3cbb13b8 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/search/integrated-search.dialog.component.html +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/search/integrated-search.dialog.component.html @@ -1,4 +1,6 @@ ; searchSubscription: Subscription; searchUserInfos: UserInfoSS[] = []; searchingProcessing = false; @@ -65,10 +70,17 @@ export class IntegratedSearchDialogComponent implements OnInit, OnDestroy { this.environmentsInfo = this.sessionStorageService.get( KEY_ENVIRONMENTS_INFO ); + this.sessionVerinfo = this.sessionStorageService.get( + KEY_VER_INFO + ); } ngOnInit() { this.onSearch(this.data.keyword); + + this.presence$ = this.store.pipe( + select(AppStore.MessengerSelector.StatusSelector.selectAllStatusBulkInfo) + ); } onSearch(searchWord: string) { @@ -109,8 +121,7 @@ export class IntegratedSearchDialogComponent implements OnInit, OnDestroy { this.searchingProcessing = false; // 검색 결과에 따른 프레즌스 조회. - const userSeqList: number[] = []; - if (userSeqList.length > 0) { + if (searchUserInfos.length > 0) { this.store.dispatch( StatusStore.bulkInfo({ divCd: 'INT_SRCH', diff --git a/projects/ucap-webmessenger-ui/src/lib/components/integrated-search.component.html b/projects/ucap-webmessenger-ui/src/lib/components/integrated-search.component.html index 13be87ff..b3b14f24 100644 --- a/projects/ucap-webmessenger-ui/src/lib/components/integrated-search.component.html +++ b/projects/ucap-webmessenger-ui/src/lib/components/integrated-search.component.html @@ -39,7 +39,17 @@
- {{ element.name }} + {{ getPresence(element, PresenceType.PC) }} / + {{ getPresence(element, PresenceType.MOBILE) }} / + {{ getWorkstatus(element) }} / +
diff --git a/projects/ucap-webmessenger-ui/src/lib/components/integrated-search.component.ts b/projects/ucap-webmessenger-ui/src/lib/components/integrated-search.component.ts index ef2bf9bd..6f374da5 100644 --- a/projects/ucap-webmessenger-ui/src/lib/components/integrated-search.component.ts +++ b/projects/ucap-webmessenger-ui/src/lib/components/integrated-search.component.ts @@ -10,7 +10,22 @@ import { } from '@angular/core'; import { ucapAnimations } from '../animations'; import { UserInfoSS } from '@ucap-webmessenger/protocol-query'; -import { MatPaginator, PageEvent, MatTabLabel } from '@angular/material'; +import { MatPaginator, PageEvent } from '@angular/material'; +import { + StatusBulkInfo, + WorkStatusType +} from '@ucap-webmessenger/protocol-status'; +import { StatusCode } from '@ucap-webmessenger/core'; +import { VersionInfo2Response } from '@ucap-webmessenger/api-public'; + +export enum PresenceType { + PC = 'pc', + MOBILE = 'mobile', + CONFERENCE = 'conference', + MOBILE_CONFERENCE = 'mobileConference', + PHONE = 'phone', + IMESSENER = 'imessenger' +} @Component({ selector: 'ucap-integrated-search', @@ -19,6 +34,12 @@ import { MatPaginator, PageEvent, MatTabLabel } from '@angular/material'; animations: ucapAnimations }) export class IntegratedSearchComponent implements OnInit { + @Input() + profileImageRoot?: string; + @Input() + sessionVerinfo: VersionInfo2Response; + @Input() + presence?: StatusBulkInfo[] = []; @Input() searchWord?: string; @Input() @@ -36,6 +57,8 @@ export class IntegratedSearchComponent implements OnInit { search = new EventEmitter(); @Output() changePage = new EventEmitter(); + @Output() + openProfile = new EventEmitter(); @ViewChild(MatPaginator, { static: true }) paginator: MatPaginator; displayedColumns: string[] = [ @@ -58,12 +81,17 @@ export class IntegratedSearchComponent implements OnInit { resizableFnMousemove: () => void; resizableFnMouseup: () => void; + PresenceType = PresenceType; + constructor( private changeDetectorRef: ChangeDetectorRef, private renderer: Renderer2 ) {} - ngOnInit() {} + ngOnInit() { + this.profileImageRoot = + this.profileImageRoot || this.sessionVerinfo.profileRoot; + } onSearch(keyword: string) { this.search.emit(keyword); @@ -73,6 +101,76 @@ export class IntegratedSearchComponent implements OnInit { this.changePage.emit(event); } + getPresence(userInfo: UserInfoSS, type: PresenceType): string { + const presences = this.presence.filter(p => p.userSeq === userInfo.seq); + + let status: string; + let rtnClass = ''; + if (!!presences && presences.length > 0) { + const presence = presences[0]; + switch (type) { + case PresenceType.PC: + status = !!presence ? presence.pcStatus : undefined; + break; + case PresenceType.MOBILE: + status = !!presence ? presence.mobileStatus : undefined; + break; + } + + if (!!status) { + switch (status) { + case StatusCode.OnLine: + rtnClass = type + 'On'; + break; + case StatusCode.Away: + rtnClass = type + 'Out'; + break; + case StatusCode.Busy: + rtnClass = type + 'Other'; + break; + default: + rtnClass = type + 'Off'; + break; + } + } + } else { + rtnClass = type + 'Off'; + } + + return rtnClass; + } + getWorkstatus(userInfo: UserInfoSS): string { + let workstatus = ''; + if (!!userInfo && !!userInfo.workstatus) { + switch (userInfo.workstatus) { + case WorkStatusType.VacationAM: + workstatus = '오전'; + break; + case WorkStatusType.VacationPM: + workstatus = '오후'; + break; + case WorkStatusType.VacationAll: + workstatus = '휴가'; + break; + case WorkStatusType.LeaveOfAbsence: + workstatus = '휴직'; + break; + case WorkStatusType.LongtermRefresh: + workstatus = '장기'; + break; + } + } + + return workstatus; + } + + onClickOpenProfile(event: MouseEvent, userSeq: number) { + event.preventDefault(); + event.stopPropagation(); + + this.openProfile.emit(userSeq); + } + resizeTable(event: any, column: any) { this.start = event.target; this.pressed = true;