From 7eb7d85da921f9792c29a562cb5786b541625fd1 Mon Sep 17 00:00:00 2001 From: leejinho Date: Fri, 3 Apr 2020 10:33:02 +0900 Subject: [PATCH] =?UTF-8?q?1.=20=EC=A1=B0=EC=A7=81=EB=8F=84=20=EA=B2=80?= =?UTF-8?q?=EC=83=89=EC=8B=9C=20200=EA=B1=B4=20=EC=9D=B4=EC=83=81=20?= =?UTF-8?q?=EC=A1=B0=ED=9A=8C=20=EA=B0=80=EB=8A=A5=ED=95=98=EB=8F=84?= =?UTF-8?q?=EB=A1=9D=20=EC=88=98=EC=A0=95,=202.=20=EC=A1=B0=EC=A7=81?= =?UTF-8?q?=EB=8F=84=20=ED=85=8C=EC=9D=B4=EB=B8=94=20virture=20scroll=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 --- package.json | 3 +- .../src/app/store/messenger/query/actions.ts | 4 + .../src/app/store/messenger/query/effects.ts | 243 +++++++++++++----- .../components/detail-table.component.html | 14 +- .../lib/components/detail-table.component.ts | 4 + .../src/lib/ucap-ui-organization.module.ts | 2 + 6 files changed, 195 insertions(+), 75 deletions(-) diff --git a/package.json b/package.json index cbf09012..8b45d702 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ucap-webmessenger", - "version": "1.0.16", + "version": "1.0.0", "author": { "name": "LG CNS", "email": "lgucap@lgcns.com" @@ -137,6 +137,7 @@ "moment": "^2.24.0", "moment-timezone": "^0.5.27", "ng-packagr": "^5.7.1", + "ng-table-virtual-scroll": "^1.3.1", "ngrx-store-freeze": "^0.2.4", "ngx-logger": "^4.0.8", "ngx-perfect-scrollbar": "^8.0.0", diff --git a/projects/ucap-webmessenger-app/src/app/store/messenger/query/actions.ts b/projects/ucap-webmessenger-app/src/app/store/messenger/query/actions.ts index 61d88ab4..909cc542 100644 --- a/projects/ucap-webmessenger-app/src/app/store/messenger/query/actions.ts +++ b/projects/ucap-webmessenger-app/src/app/store/messenger/query/actions.ts @@ -95,6 +95,8 @@ export const searchDeptUser = createAction( props<{ companyCode: string; search: string; + pageCurrent?: number; + userList?: UserInfoSS[]; }>() ); @@ -119,6 +121,8 @@ export const integrateSearchDeptUser = createAction( props<{ companyCode: string; search: string; + pageCurrent?: number; + userList?: UserInfoSS[]; }>() ); diff --git a/projects/ucap-webmessenger-app/src/app/store/messenger/query/effects.ts b/projects/ucap-webmessenger-app/src/app/store/messenger/query/effects.ts index a4ce8abd..fe02f4ae 100644 --- a/projects/ucap-webmessenger-app/src/app/store/messenger/query/effects.ts +++ b/projects/ucap-webmessenger-app/src/app/store/messenger/query/effects.ts @@ -10,8 +10,7 @@ import { map, tap, switchMap, - withLatestFrom, - take + withLatestFrom } from 'rxjs/operators'; import { @@ -28,7 +27,6 @@ import { selectedDeptSuccess, searchDeptUser, searchDeptUserSuccess, - clearSearchDeptUser, integrateSearchDeptUser, integrateSearchDeptUserSuccess, integrateSearchDeptUserFailure, @@ -45,13 +43,12 @@ import { SSVC_TYPE_QUERY_DEPT_USER_DATA, DeptUserData, SSVC_TYPE_QUERY_DEPT_USER_RES, - DeptUserResponse, - DeptSearchType + DeptSearchType, + DeptUserRequest } from '@ucap-webmessenger/protocol-query'; import { Store, select } from '@ngrx/store'; import { LoginResponse } from '@ucap-webmessenger/protocol-authentication'; -import { KEY_LOGIN_RES_INFO } from '@app/types'; import { SessionStorageService } from '@ucap-webmessenger/web-storage'; import { OrganizationService } from '@ucap-webmessenger/ui-organization'; import { NGXLogger } from 'ngx-logger'; @@ -171,38 +168,106 @@ export class Effects { ) ), switchMap(([req, loginResInfo]) => { - return this.organizationService - .getDeptUser({ - divCd: 'INT_SRCH', - companyCode: req.companyCode, - search: req.search, - searchRange: DeptSearchType.All, - senderCompanyCode: loginResInfo.companyCode, - senderEmployeeType: loginResInfo.userInfo.employeeType - }) - .pipe( - map(datas => { - const userInfos: UserInfoSS[] = datas.userInfos; - this.store.dispatch( - integrateSearchDeptUserSuccess({ - userInfos - }) - ); + const pageListCount = 180; + const pageCurrent = !!req.pageCurrent ? req.pageCurrent : 1; + const request = { + divCd: 'INT_SRCH', + companyCode: req.companyCode, + search: req.search, + searchRange: DeptSearchType.All, + senderCompanyCode: loginResInfo.companyCode, + senderEmployeeType: loginResInfo.userInfo.employeeType, + pageListCount, + pageCurrent + } as DeptUserRequest; - // 검색 결과에 따른 프레즌스 조회. - const userSeqList: number[] = []; - userInfos.map(user => userSeqList.push(user.seq)); - if (userSeqList.length > 0) { - this.store.dispatch( - StatusStore.bulkInfo({ - divCd: 'inttrSrch', - userSeqs: userSeqList - }) - ); - } - }), - catchError(error => of(integrateSearchDeptUserFailure({ error }))) - ); + let mergedUserList: UserInfoSS[] = !!req.userList ? req.userList : []; + + const userInfos: UserInfoSS[] = []; + return this.queryProtocolService.deptUser(request).pipe( + map(res => { + switch (res.SSVC_TYPE) { + case SSVC_TYPE_QUERY_DEPT_USER_DATA: + userInfos.push(...(res as DeptUserData).userInfos); + break; + case SSVC_TYPE_QUERY_DEPT_USER_RES: + if (!!userInfos && userInfos.length > 0) { + mergedUserList = [...mergedUserList, ...userInfos]; + } + + // 검색 결과에 따른 프레즌스 조회. + const userSeqList: number[] = []; + userInfos.map(user => userSeqList.push(user.seq)); + if (userSeqList.length > 0) { + this.store.dispatch( + StatusStore.bulkInfo({ + divCd: 'inttrSrch', + userSeqs: userSeqList + }) + ); + } + + // 재귀 할지 판단. + if (!!userInfos && userInfos.length >= pageListCount) { + // 추가 조회. + this.store.dispatch( + integrateSearchDeptUser({ + ...req, + pageCurrent: pageCurrent + 1, + userList: mergedUserList + }) + ); + } else { + mergedUserList.sort((a, b) => + a.order < b.order + ? -1 + : a.order > b.order + ? 1 + : a.name < b.name + ? -1 + : a.name > b.name + ? 1 + : 0 + ); + + // 최종 조회건. + this.store.dispatch( + integrateSearchDeptUserSuccess({ + userInfos: mergedUserList + }) + ); + } + break; + } + }), + catchError(error => of(integrateSearchDeptUserFailure({ error }))) + ); + + // return this.organizationService + // .getDeptUser(request) + // .pipe( + // map(datas => { + // const userInfos: UserInfoSS[] = datas.userInfos; + // this.store.dispatch( + // integrateSearchDeptUserSuccess({ + // userInfos + // }) + // ); + + // // 검색 결과에 따른 프레즌스 조회. + // const userSeqList: number[] = []; + // userInfos.map(user => userSeqList.push(user.seq)); + // if (userSeqList.length > 0) { + // this.store.dispatch( + // StatusStore.bulkInfo({ + // divCd: 'inttrSrch', + // userSeqs: userSeqList + // }) + // ); + // } + // }), + // catchError(error => of(integrateSearchDeptUserFailure({ error }))) + // ); }) ); }, @@ -222,38 +287,80 @@ export class Effects { ) ), switchMap(([req, loginResInfo]) => { - return this.organizationService - .getDeptUser({ - divCd: 'ORG_SRCH', - companyCode: req.companyCode, - search: req.search, - searchRange: DeptSearchType.All, - senderCompanyCode: loginResInfo.companyCode, - senderEmployeeType: loginResInfo.userInfo.employeeType - }) - .pipe( - map(datas => { - const userInfos: UserInfoSS[] = datas.userInfos; - this.store.dispatch( - searchDeptUserSuccess({ - userInfos - }) - ); + const pageListCount = 180; + const pageCurrent = !!req.pageCurrent ? req.pageCurrent : 1; + const request = { + divCd: 'ORG_SRCH', + companyCode: req.companyCode, + search: req.search, + searchRange: DeptSearchType.All, + senderCompanyCode: loginResInfo.companyCode, + senderEmployeeType: loginResInfo.userInfo.employeeType, + pageListCount, + pageCurrent + } as DeptUserRequest; - // 검색 결과에 따른 프레즌스 조회. - const userSeqList: number[] = []; - userInfos.map(user => userSeqList.push(user.seq)); - if (userSeqList.length > 0) { - this.store.dispatch( - StatusStore.bulkInfo({ - divCd: 'orgtrSrch', - userSeqs: userSeqList - }) - ); - } - }), - catchError(error => of(deptUserFailure({ error }))) - ); + let mergedUserList: UserInfoSS[] = !!req.userList ? req.userList : []; + + const userInfos: UserInfoSS[] = []; + return this.queryProtocolService.deptUser(request).pipe( + map(res => { + switch (res.SSVC_TYPE) { + case SSVC_TYPE_QUERY_DEPT_USER_DATA: + userInfos.push(...(res as DeptUserData).userInfos); + break; + case SSVC_TYPE_QUERY_DEPT_USER_RES: + if (!!userInfos && userInfos.length > 0) { + mergedUserList = [...mergedUserList, ...userInfos]; + } + + // 검색 결과에 따른 프레즌스 조회. + const userSeqList: number[] = []; + userInfos.map(user => userSeqList.push(user.seq)); + if (userSeqList.length > 0) { + this.store.dispatch( + StatusStore.bulkInfo({ + divCd: 'orgtrSrch', + userSeqs: userSeqList + }) + ); + } + + // 재귀 할지 판단. + if (!!userInfos && userInfos.length >= pageListCount) { + // 추가 조회. + this.store.dispatch( + searchDeptUser({ + ...req, + pageCurrent: pageCurrent + 1, + userList: mergedUserList + }) + ); + } else { + mergedUserList.sort((a, b) => + a.order < b.order + ? -1 + : a.order > b.order + ? 1 + : a.name < b.name + ? -1 + : a.name > b.name + ? 1 + : 0 + ); + + // 최종 조회건. + this.store.dispatch( + searchDeptUserSuccess({ + userInfos: mergedUserList + }) + ); + } + break; + } + }), + catchError(error => of(deptUserFailure({ error }))) + ); }) ); }, diff --git a/projects/ucap-webmessenger-ui-organization/src/lib/components/detail-table.component.html b/projects/ucap-webmessenger-ui-organization/src/lib/components/detail-table.component.html index db74d489..b53a31f8 100644 --- a/projects/ucap-webmessenger-ui-organization/src/lib/components/detail-table.component.html +++ b/projects/ucap-webmessenger-ui-organization/src/lib/components/detail-table.component.html @@ -1,11 +1,13 @@ - @@ -151,7 +153,7 @@ - +
-
+
([]); PresenceType = PresenceType; displayedColumns: string[] = [ @@ -227,6 +230,7 @@ export class DetailTableComponent implements OnInit, OnDestroy { return 0; } }); + this.dataSource.data = this.sortedData; } compare(a: number | string, b: number | string, isAsc: boolean) { return (a < b ? -1 : 1) * (isAsc ? 1 : -1); diff --git a/projects/ucap-webmessenger-ui-organization/src/lib/ucap-ui-organization.module.ts b/projects/ucap-webmessenger-ui-organization/src/lib/ucap-ui-organization.module.ts index 8d788e20..80f769b5 100644 --- a/projects/ucap-webmessenger-ui-organization/src/lib/ucap-ui-organization.module.ts +++ b/projects/ucap-webmessenger-ui-organization/src/lib/ucap-ui-organization.module.ts @@ -16,6 +16,7 @@ import { MatTreeModule } from '@angular/material/tree'; import { PerfectScrollbarModule } from 'ngx-perfect-scrollbar'; import { VirtualScrollerModule } from 'ngx-virtual-scroller'; +import { TableVirtualScrollModule } from 'ng-table-virtual-scroll'; import { TranslateModule } from '@ngx-translate/core'; import { UCapUiModule } from '@ucap-webmessenger/ui'; @@ -56,6 +57,7 @@ const DIRECTIVES = []; PerfectScrollbarModule, VirtualScrollerModule, + TableVirtualScrollModule, UCapUiModule ],