group search is implemented

This commit is contained in:
병준 박 2019-10-08 17:57:57 +09:00
parent d7a1a398d3
commit 08c5d2825a
2 changed files with 29 additions and 5 deletions

View File

@ -1,7 +1,7 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { Observable, combineLatest } from 'rxjs';
import { map } from 'rxjs/operators';
import { Observable, combineLatest, Subscription } from 'rxjs';
import { map, tap } from 'rxjs/operators';
import { Store, select } from '@ngrx/store';
@ -10,6 +10,7 @@ import { UserInfo, GroupDetailData } from '@ucap-webmessenger/protocol-sync';
import * as AppStore from '@app/store';
import * as ChatStore from '@app/store/messenger/chat';
import * as QueryStore from '@app/store/messenger/query';
import { NGXLogger } from 'ngx-logger';
import { Company } from '@ucap-webmessenger/api-external';
import { SessionStorageService } from '@ucap-webmessenger/web-storage';
@ -20,6 +21,8 @@ import {
CreateGroupDialogData,
CreateGroupDialogResult
} from '@app/layouts/messenger/dialogs/create-group.dialog.component';
import { LoginResponse } from '@ucap-webmessenger/protocol-authentication';
import { DeptSearchType } from '@ucap-webmessenger/protocol-query';
@Component({
selector: 'app-layout-chat-left-sidenav-group',
@ -37,6 +40,9 @@ export class GroupComponent implements OnInit {
companyList$: Observable<Company[]>;
companyCode: string;
loginRes: LoginResponse;
loginResSubscription: Subscription;
constructor(
private store: Store<any>,
private sessionStorageService: SessionStorageService,
@ -48,6 +54,15 @@ export class GroupComponent implements OnInit {
const loginInfo = this.sessionStorageService.get<LoginInfo>(KEY_LOGIN_INFO);
this.companyCode = loginInfo.companyCode;
this.loginResSubscription = this.store
.pipe(
select(AppStore.AccountSelector.AuthenticationSelector.loginRes),
tap(loginRes => {
this.loginRes = loginRes;
})
)
.subscribe();
this.companyList$ = this.store.pipe(
select(AppStore.SettingSelector.CompanySelector.companyList)
);
@ -143,6 +158,15 @@ export class GroupComponent implements OnInit {
companyCode: string;
searchWord: string;
}) {
this.logger.debug('params', params);
this.store.dispatch(
QueryStore.deptUser({
divCd: 'GRP',
companyCode: params.companyCode,
searchRange: DeptSearchType.All,
search: params.searchWord,
senderCompanyCode: params.companyCode,
senderEmployeeType: this.loginRes.userInfo.employeeType
})
);
}
}

View File

@ -2,7 +2,7 @@ import { Component, OnInit, OnDestroy } from '@angular/core';
import { ucapAnimations } from '@ucap-webmessenger/ui';
import { Store, select } from '@ngrx/store';
import { NGXLogger } from 'ngx-logger';
import { Observable, Subscriber, Subscription } from 'rxjs';
import { Observable, Subscription } from 'rxjs';
import { Info, EventType } from '@ucap-webmessenger/protocol-event';
import * as AppStore from '@app/store';
@ -11,7 +11,7 @@ import { LoginResponse } from '@ucap-webmessenger/protocol-authentication';
import { SessionStorageService } from '@ucap-webmessenger/web-storage';
import { LoginInfo, KEY_LOGIN_INFO } from '@app/types';
import { RoomInfo } from '@ucap-webmessenger/protocol-room';
import { map, tap } from 'rxjs/operators';
import { tap } from 'rxjs/operators';
@Component({
selector: 'app-layout-messenger-messages',