From 8b55d904d654ba496ca8e0da0275561cb07f5477 Mon Sep 17 00:00:00 2001 From: leejh Date: Wed, 23 Oct 2019 15:07:41 +0900 Subject: [PATCH] =?UTF-8?q?=EA=B8=B0=EB=8A=A5=EC=B6=94=EA=B0=80=20::=20?= =?UTF-8?q?=EA=B7=B8=EB=A3=B9=20>=20=EA=B2=80=EC=83=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../left-sidenav/group.component.html | 17 +++- .../left-sidenav/group.component.ts | 82 +++++++++++++++--- .../chat/create-chat.dialog.component.html | 51 ++++++++---- .../chat/create-chat.dialog.component.ts | 83 ++++++++++++++++--- .../components/tenant-search.component.html | 12 ++- .../lib/components/tenant-search.component.ts | 6 ++ 6 files changed, 208 insertions(+), 43 deletions(-) diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/group.component.html b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/group.component.html index 694962a3..ae9015ef 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/group.component.html +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/group.component.html @@ -19,6 +19,7 @@ [companyList]="companyList$ | async" [companyCode]="companyCode" (keyDownEnter)="onKeyDownEnterOrganizationTenantSearch($event)" + (cancel)="onClickCancel($event)" > -
+
+
+
+ +
+
검색결과({{ searchUserInfos.length }}명)
+ + +
, private sessionStorageService: SessionStorageService, private dialogService: DialogService, + private queryProtocolService: QueryProtocolService, + private statusProtocolService: StatusProtocolService, private logger: NGXLogger ) {} @@ -226,20 +238,64 @@ export class GroupComponent implements OnInit, OnDestroy { ); } + /** 유저검색 */ onKeyDownEnterOrganizationTenantSearch(params: { companyCode: string; searchWord: string; }) { - this.store.dispatch( - QueryStore.deptUser({ - divCd: 'GRP', - companyCode: params.companyCode, - searchRange: DeptSearchType.All, - search: params.searchWord, - senderCompanyCode: params.companyCode, - senderEmployeeType: this.loginRes.userInfo.employeeType - }) - ); + if (params.searchWord.trim().length > 1) { + this.isShowSearch = true; + this.searchProcessing = true; + + const searchUserInfos: UserInfoSS[] = []; + this.queryProtocolService + .deptUser({ + divCd: 'GRP', + companyCode: params.companyCode, + searchRange: DeptSearchType.All, + search: params.searchWord, + senderCompanyCode: params.companyCode, + senderEmployeeType: this.loginRes.userInfo.employeeType + }) + .pipe( + map(res => { + switch (res.SSVC_TYPE) { + case SSVC_TYPE_QUERY_DEPT_USER_DATA: + searchUserInfos.push(...(res as DeptUserData).userInfos); + break; + case SSVC_TYPE_QUERY_DEPT_USER_RES: + { + // 검색 결과 처리. + this.searchUserInfos = searchUserInfos; + this.searchProcessing = false; + + // 검색 결과에 따른 프레즌스 조회. + const userSeqList: number[] = []; + this.searchUserInfos.map(user => userSeqList.push(user.seq)); + if (userSeqList.length > 0) { + this.store.dispatch( + StatusStore.bulkInfo({ + divCd: 'groupSrch', + userSeqs: userSeqList + }) + ); + } + } + break; + } + }), + catchError(error => { + this.searchProcessing = false; + return of(this.logger.error(error)); + }) + ) + .subscribe(); + } + } + /** 검색 취소 */ + onClickCancel() { + this.isShowSearch = false; + this.searchUserInfos = []; } getShowContextMenu(userInfo: UserInfo | UserInfoF) { diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/chat/create-chat.dialog.component.html b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/chat/create-chat.dialog.component.html index 2bf4e6d5..6388a0b6 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/chat/create-chat.dialog.component.html +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/chat/create-chat.dialog.component.html @@ -31,21 +31,42 @@ group - - +
+ +
+
+ + + + +
+
+
+ +
+
검색결과({{ searchUserInfos.length }}명)
- +
diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/chat/create-chat.dialog.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/chat/create-chat.dialog.component.ts index 9c81d189..54b53207 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/chat/create-chat.dialog.component.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/chat/create-chat.dialog.component.ts @@ -3,12 +3,13 @@ import { Component, OnInit, OnDestroy, Inject } from '@angular/core'; import { FormGroup, FormBuilder, Validators } from '@angular/forms'; import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material'; import { NGXLogger } from 'ngx-logger'; -import { Observable, combineLatest, Subscription } from 'rxjs'; -import { map, tap } from 'rxjs/operators'; +import { Observable, combineLatest, Subscription, of } from 'rxjs'; +import { map, tap, catchError } from 'rxjs/operators'; import { Store, select } from '@ngrx/store'; import * as AppStore from '@app/store'; import * as QueryStore from '@app/store/messenger/query'; +import * as StatusStore from '@app/store/messenger/status'; import { SessionStorageService } from '@ucap-webmessenger/web-storage'; import { Company } from '@ucap-webmessenger/api-external'; @@ -26,7 +27,11 @@ import { DeptSearchType, UserInfoSS, UserInfoF, - UserInfoDN + UserInfoDN, + QueryProtocolService, + SSVC_TYPE_QUERY_DEPT_USER_DATA, + DeptUserData, + SSVC_TYPE_QUERY_DEPT_USER_RES } from '@ucap-webmessenger/protocol-query'; import { RoomInfo, @@ -62,6 +67,7 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy { @Inject(MAT_DIALOG_DATA) public data: CreateChatDialogData, private store: Store, private sessionStorageService: SessionStorageService, + private queryProtocolService: QueryProtocolService, private formBuilder: FormBuilder, private logger: NGXLogger ) {} @@ -74,6 +80,12 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy { KEY_VER_INFO ); + // 검색 + isShowSearch = false; + searchProcessing = false; + searchUserInfos: UserInfoSS[] = []; + + // 그룹 companyList$: Observable; companyCode: string; groupBuddyList$: Observable< @@ -81,6 +93,7 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy { >; favoritBuddyList$: Observable; + // 대화방 roomList: RoomInfo[]; roomUserList: RoomUserDetailData[]; roomUserShortList: RoomUserData[]; @@ -207,20 +220,64 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy { } } + /** 유저검색 */ onKeyDownEnterOrganizationTenantSearch(params: { companyCode: string; searchWord: string; }) { - this.store.dispatch( - QueryStore.deptUser({ - divCd: 'GRP', - companyCode: params.companyCode, - searchRange: DeptSearchType.All, - search: params.searchWord, - senderCompanyCode: params.companyCode, - senderEmployeeType: this.loginRes.userInfo.employeeType - }) - ); + if (params.searchWord.trim().length > 1) { + this.isShowSearch = true; + this.searchProcessing = true; + + const searchUserInfos: UserInfoSS[] = []; + this.queryProtocolService + .deptUser({ + divCd: 'GRP', + companyCode: params.companyCode, + searchRange: DeptSearchType.All, + search: params.searchWord, + senderCompanyCode: params.companyCode, + senderEmployeeType: this.loginRes.userInfo.employeeType + }) + .pipe( + map(res => { + switch (res.SSVC_TYPE) { + case SSVC_TYPE_QUERY_DEPT_USER_DATA: + searchUserInfos.push(...(res as DeptUserData).userInfos); + break; + case SSVC_TYPE_QUERY_DEPT_USER_RES: + { + // 검색 결과 처리. + this.searchUserInfos = searchUserInfos; + this.searchProcessing = false; + + // 검색 결과에 따른 프레즌스 조회. + const userSeqList: number[] = []; + this.searchUserInfos.map(user => userSeqList.push(user.seq)); + if (userSeqList.length > 0) { + this.store.dispatch( + StatusStore.bulkInfo({ + divCd: 'groupSrch', + userSeqs: userSeqList + }) + ); + } + } + break; + } + }), + catchError(error => { + this.searchProcessing = false; + return of(this.logger.error(error)); + }) + ) + .subscribe(); + } + } + /** 검색 취소 */ + onClickCancel() { + this.isShowSearch = false; + this.searchUserInfos = []; } /** 동료그룹 :: 그룹의 checkbox 의 이벤트를 받아 선택된 유저리스트를 수집. */ diff --git a/projects/ucap-webmessenger-ui-organization/src/lib/components/tenant-search.component.html b/projects/ucap-webmessenger-ui-organization/src/lib/components/tenant-search.component.html index e47c4b5a..d9ee6f40 100644 --- a/projects/ucap-webmessenger-ui-organization/src/lib/components/tenant-search.component.html +++ b/projects/ucap-webmessenger-ui-organization/src/lib/components/tenant-search.component.html @@ -16,7 +16,17 @@ placeholder="name" (keydown.enter)="onKeyDownEnter(searchWordInput.value)" /> - +
diff --git a/projects/ucap-webmessenger-ui-organization/src/lib/components/tenant-search.component.ts b/projects/ucap-webmessenger-ui-organization/src/lib/components/tenant-search.component.ts index 13b35fbd..3f0b6295 100644 --- a/projects/ucap-webmessenger-ui-organization/src/lib/components/tenant-search.component.ts +++ b/projects/ucap-webmessenger-ui-organization/src/lib/components/tenant-search.component.ts @@ -19,6 +19,8 @@ export class TenantSearchComponent implements OnInit { companyCode: string; searchWord: string; }>(); + @Output() + cancel = new EventEmitter(); constructor(private logger: NGXLogger) {} @@ -27,4 +29,8 @@ export class TenantSearchComponent implements OnInit { onKeyDownEnter(searchWord: string) { this.keyDownEnter.emit({ companyCode: this.companyCode, searchWord }); } + + onClickCancel() { + this.cancel.emit(); + } }