This commit is contained in:
병준 박 2019-10-17 18:11:46 +09:00
commit d488edd0a4
8 changed files with 123 additions and 36 deletions

View File

@ -10,6 +10,7 @@ import { Observable } from 'rxjs';
import { Store, select } from '@ngrx/store'; import { Store, select } from '@ngrx/store';
import * as AppStore from '@app/store'; import * as AppStore from '@app/store';
import * as ChatStore from '@app/store/messenger/chat';
@Component({ @Component({
selector: 'app-layout-messenger-left-side', selector: 'app-layout-messenger-left-side',
@ -45,11 +46,14 @@ export class LeftSideComponent implements OnInit {
} }
}); });
this.logger.debug(result.choice); if (!!result && !!result.choice && result.choice) {
// if (result.choice) { this.logger.debug(result.selectedUserList);
if (!!result.selectedUserList && result.selectedUserList.length > 0) {
const userSeqs: number[] = [];
result.selectedUserList.map(user => userSeqs.push(user.seq));
// } else { this.store.dispatch(ChatStore.openRoom({ userSeqList: userSeqs }));
}
// } }
} }
} }

View File

@ -1,28 +1,19 @@
<div <div class="oraganization-tab" fxLayout="column" *ngIf="departmentInfoList$ | async">
class="oraganization-tab"
fxLayout="column"
*ngIf="departmentInfoList$ | async"
>
<div class="oraganization-tab-tree" fxFlex="50" style="overflow: scroll"> <div class="oraganization-tab-tree" fxFlex="50" style="overflow: scroll">
<ucap-organization-tree <ucap-organization-tree [oraganizationList]="departmentInfoList$ | async"
[oraganizationList]="departmentInfoList$ | async" (selected)="onSelectedOrganization($event)"></ucap-organization-tree>
(selected)="onSelectedOrganization($event)"
></ucap-organization-tree>
</div> </div>
<div fxFlex="50" style="overflow: scroll"> <div fxFlex="50" style="overflow: scroll">
<div> <div>
(선택된부서명) (선택된부서명)
</div> </div>
<div> <div>
<ucap-profile-user-list-item <ucap-profile-user-list-item *ngFor="let userInfo of selectedDepartmentUserInfoList$ | async"
*ngFor="let userInfo of selectedDepartmentUserInfoList$ | async" [userInfo]="userInfo" [checkable]="true" [sessionVerinfo]="sessionVerinfo" [selectedUserList]="selectedUserList"
[userInfo]="userInfo" [isChecked]="getCheckedUser(userInfo)" (checkUser)="onCheckUser($event)">
[checkable]="true"
[sessionVerinfo]="sessionVerinfo"
>
</ucap-profile-user-list-item> </ucap-profile-user-list-item>
</div> </div>
<div> <div *ngIf="!isUserSelect">
(하단버튼영역) (하단버튼영역)
</div> </div>
</div> </div>

View File

@ -1,4 +1,4 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit, Output, EventEmitter, Input } from '@angular/core';
import { ucapAnimations } from '@ucap-webmessenger/ui'; import { ucapAnimations } from '@ucap-webmessenger/ui';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { import {
@ -6,8 +6,11 @@ import {
QueryProtocolService, QueryProtocolService,
DeptSearchType, DeptSearchType,
UserInfoSS, UserInfoSS,
DeptUserResponse DeptUserResponse,
UserInfoF,
UserInfoDN
} from '@ucap-webmessenger/protocol-query'; } from '@ucap-webmessenger/protocol-query';
import { UserInfo } from '@ucap-webmessenger/protocol-sync';
import { Store, select } from '@ngrx/store'; import { Store, select } from '@ngrx/store';
import { NGXLogger } from 'ngx-logger'; import { NGXLogger } from 'ngx-logger';
@ -26,6 +29,19 @@ import { KEY_VER_INFO } from '@app/types/ver-info.type';
animations: ucapAnimations animations: ucapAnimations
}) })
export class OrganizationComponent implements OnInit { export class OrganizationComponent implements OnInit {
@Input()
/** 사용자 선택용으로 사용시 true 로 유입 */
isUserSelect = false;
@Input()
/** 선택된 사용자의 리스트 */
selectedUserList?: (UserInfo | UserInfoSS | UserInfoF | UserInfoDN)[] = [];
@Output()
checkUser = new EventEmitter<{
isChecked: boolean;
userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN;
}>();
departmentInfoList$: Observable<DeptInfo[]>; departmentInfoList$: Observable<DeptInfo[]>;
selectedDepartmentUserInfoList$: Observable<UserInfoSS[]>; selectedDepartmentUserInfoList$: Observable<UserInfoSS[]>;
selectedDepartmentStatus$: Observable<DeptUserResponse>; selectedDepartmentStatus$: Observable<DeptUserResponse>;
@ -97,4 +113,24 @@ export class OrganizationComponent implements OnInit {
) )
.subscribe(); .subscribe();
} }
/** 리스트 checkable 할 경우 checkbox 의 isChecked 를 관장하며 리스트의 전체선택 여부를 판단한다. */
getCheckedUser(userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN) {
if (!!this.selectedUserList && this.selectedUserList.length > 0) {
return (
this.selectedUserList.filter(item => item.seq === userInfo.seq).length >
0
);
}
return false;
}
/** 리스트가 checkable 할 경우 checkbox 의 change 이벤트를 상위 컴포넌트로 전달한다. */
onCheckUser(params: {
isChecked: boolean;
userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN;
}) {
console.log(this.selectedUserList);
this.checkUser.emit(params);
}
} }

View File

@ -13,9 +13,11 @@
<ucap-organization-tenant-search [companyList]="companyList$ | async" [companyCode]="companyCode" <ucap-organization-tenant-search [companyList]="companyList$ | async" [companyCode]="companyCode"
(keyDownEnter)="onKeyDownEnterOrganizationTenantSearch($event)"></ucap-organization-tenant-search> (keyDownEnter)="onKeyDownEnterOrganizationTenantSearch($event)"></ucap-organization-tenant-search>
<ucap-group-expansion-panel #groupExpansionPanel [groupBuddyList]="groupBuddyList$ | async" <ucap-group-expansion-panel #groupExpansionPanel [groupBuddyList]="groupBuddyList$ | async"
[favoritBuddyList]="favoritBuddyList$ | async" [checkable]="true" (checkGroup)="onCheckGroup($event)"> [favoritBuddyList]="favoritBuddyList$ | async" [selectedUserList]="selectedUserList" [checkable]="true"
(checkGroup)="onCheckGroup($event)">
<ucap-profile-user-list-item *ucapGroupExpansionPanelItem="let userInfo" [userInfo]="userInfo" <ucap-profile-user-list-item *ucapGroupExpansionPanelItem="let userInfo" [userInfo]="userInfo"
[sessionVerinfo]="sessionVerinfo" (checkUser)="onCheckUser($event)" [checkable]="true"> [sessionVerinfo]="sessionVerinfo" [selectedUserList]="selectedUserList"
[isChecked]="getCheckedUser(userInfo)" [checkable]="true" (checkUser)="onCheckUser($event)">
</ucap-profile-user-list-item> </ucap-profile-user-list-item>
</ucap-group-expansion-panel> </ucap-group-expansion-panel>
</mat-tab> </mat-tab>
@ -23,7 +25,9 @@
<ng-template mat-tab-label> <ng-template mat-tab-label>
<mat-icon>device_hub</mat-icon> <mat-icon>device_hub</mat-icon>
</ng-template> </ng-template>
<app-layout-chat-left-sidenav-organization></app-layout-chat-left-sidenav-organization> <app-layout-chat-left-sidenav-organization [selectedUserList]="selectedUserList" [isUserSelect]="true"
(checkUser)="onCheckUser($event)">
</app-layout-chat-left-sidenav-organization>
</mat-tab> </mat-tab>
<mat-tab> <mat-tab>
<ng-template mat-tab-label> <ng-template mat-tab-label>

View File

@ -38,6 +38,7 @@ export interface CreateChatDialogData {
export interface CreateChatDialogResult { export interface CreateChatDialogResult {
choice: boolean; choice: boolean;
selectedUserList?: (UserInfo | UserInfoSS | UserInfoF | UserInfoDN)[];
} }
@Component({ @Component({
@ -197,6 +198,7 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy {
); );
} }
/** 동료그룹 :: 그룹의 checkbox 의 이벤트를 받아 선택된 유저리스트를 수집. */
onCheckGroup(params: { onCheckGroup(params: {
isChecked: boolean; isChecked: boolean;
groupBuddyList: { group: GroupDetailData; buddyList: UserInfo[] }; groupBuddyList: { group: GroupDetailData; buddyList: UserInfo[] };
@ -207,7 +209,7 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy {
this.selectedUserList.filter(user => user.seq === item.seq).length === this.selectedUserList.filter(user => user.seq === item.seq).length ===
0 0
) { ) {
this.selectedUserList.push(item); this.selectedUserList = [...this.selectedUserList, item];
} }
}); });
} else { } else {
@ -219,6 +221,7 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy {
} }
} }
/** 동료그룹>부서원, 조직도>부서원 :: 리스트의 checkbox 의 이벤트를 받아 선택된 유저리스트를 수집. */
onCheckUser(params: { onCheckUser(params: {
isChecked: boolean; isChecked: boolean;
userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN; userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN;
@ -226,9 +229,10 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy {
if (params.isChecked) { if (params.isChecked) {
if ( if (
this.selectedUserList.filter(user => user.seq === params.userInfo.seq) this.selectedUserList.filter(user => user.seq === params.userInfo.seq)
.length === 0 .length === 0 &&
params.userInfo
) { ) {
this.selectedUserList.push(params.userInfo); this.selectedUserList = [...this.selectedUserList, params.userInfo];
} }
} else { } else {
this.selectedUserList = this.selectedUserList.filter( this.selectedUserList = this.selectedUserList.filter(
@ -237,9 +241,22 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy {
} }
} }
/** 그룹>부서원 리스트의 ischecked 를 판단. */
getCheckedUser(userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN) {
if (!!this.selectedUserList && this.selectedUserList.length > 0) {
return (
this.selectedUserList.filter(item => item.seq === userInfo.seq).length >
0
);
}
return false;
}
/** 팝업의 선택 이벤트 전달. */
onClickChoice(choice: boolean): void { onClickChoice(choice: boolean): void {
// this.dialogRef.close({ this.dialogRef.close({
// choice choice,
// }); selectedUserList: this.selectedUserList
});
} }
} }

View File

@ -28,8 +28,8 @@
(click)="onClickMore($event, groupBuddy.group)"> (click)="onClickMore($event, groupBuddy.group)">
<mat-icon>more_vert</mat-icon> <mat-icon>more_vert</mat-icon>
</button> </button>
<mat-checkbox *ngIf="checkable" #checkbox (change)="onChangeCheck(checkbox.checked, groupBuddy)" <mat-checkbox *ngIf="checkable" #checkbox [checked]="getCheckedGroup(groupBuddy)"
(click)="$event.stopPropagation()"></mat-checkbox> (change)="onChangeCheck(checkbox.checked, groupBuddy)" (click)="$event.stopPropagation()"></mat-checkbox>
</mat-panel-description> </mat-panel-description>
</mat-expansion-panel-header> </mat-expansion-panel-header>

View File

@ -14,6 +14,11 @@ import { ucapAnimations } from '@ucap-webmessenger/ui';
import { GroupDetailData, UserInfo } from '@ucap-webmessenger/protocol-sync'; import { GroupDetailData, UserInfo } from '@ucap-webmessenger/protocol-sync';
import { MatAccordion } from '@angular/material'; import { MatAccordion } from '@angular/material';
import { ExpansionPanelItemDirective } from '../directives/expansion-panel-item.directive'; import { ExpansionPanelItemDirective } from '../directives/expansion-panel-item.directive';
import {
UserInfoSS,
UserInfoF,
UserInfoDN
} from '@ucap-webmessenger/protocol-query';
@Component({ @Component({
selector: 'ucap-group-expansion-panel', selector: 'ucap-group-expansion-panel',
@ -24,12 +29,13 @@ import { ExpansionPanelItemDirective } from '../directives/expansion-panel-item.
export class ExpansionPanelComponent implements OnInit { export class ExpansionPanelComponent implements OnInit {
@Input() @Input()
groupBuddyList: { group: GroupDetailData; buddyList: UserInfo[] }[]; groupBuddyList: { group: GroupDetailData; buddyList: UserInfo[] }[];
@Input() @Input()
favoritBuddyList: UserInfo[]; favoritBuddyList: UserInfo[];
@Input() @Input()
checkable = false; checkable = false;
@Input()
/** 선택된 사용자의 리스트 */
selectedUserList?: (UserInfo | UserInfoSS | UserInfoF | UserInfoDN)[] = [];
@Output() @Output()
more = new EventEmitter<{ more = new EventEmitter<{
@ -67,6 +73,7 @@ export class ExpansionPanelComponent implements OnInit {
this.more.emit({ event, group }); this.more.emit({ event, group });
} }
/** 그룹리스트가 checkable 할 경우 checkbox 의 change 이벤트를 상위 컴포넌트로 전달한다. */
onChangeCheck( onChangeCheck(
value: boolean, value: boolean,
groupBuddyList: { group: GroupDetailData; buddyList: UserInfo[] } groupBuddyList: { group: GroupDetailData; buddyList: UserInfo[] }
@ -76,4 +83,28 @@ export class ExpansionPanelComponent implements OnInit {
groupBuddyList groupBuddyList
}); });
} }
/** 그룹리스트가 checkable 할 경우 checkbox 의 isChecked 를 관장하며, 하위 부서원들의 전체선택여부를 판단한다. */
getCheckedGroup(groupBuddy: {
group: GroupDetailData;
buddyList: UserInfo[];
}) {
if (groupBuddy.buddyList.length === 0) {
return false;
}
if (!!this.selectedUserList && this.selectedUserList.length > 0) {
let allExist = true;
groupBuddy.buddyList.some(groupUser => {
if (
this.selectedUserList.filter(item => item.seq === groupUser.seq)
.length === 0
) {
allExist = false;
return true;
}
});
return allExist;
}
return false;
}
} }

View File

@ -48,6 +48,9 @@ export class UserListItemComponent implements OnInit, OnDestroy {
compactable = false; compactable = false;
@Input() @Input()
sessionVerinfo: VersionInfo2Response; sessionVerinfo: VersionInfo2Response;
@Input()
/** 선택된 사용자의 리스트 */
selectedUserList?: (UserInfo | UserInfoSS | UserInfoF | UserInfoDN)[] = [];
@Output() @Output()
checkUser = new EventEmitter<{ checkUser = new EventEmitter<{
@ -115,6 +118,7 @@ export class UserListItemComponent implements OnInit, OnDestroy {
return rtnClass; return rtnClass;
} }
/** 리스트가 checkable 할 경우 checkbox 의 change 이벤트를 상위 컴포넌트로 전달한다. */
onChangeCheck( onChangeCheck(
value: boolean, value: boolean,
userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN