수정 :: 새로운 대화 개설용 유저 선택 팝업 > 유저선택 항목 탭간 서로 공유

This commit is contained in:
leejh 2019-10-17 17:02:20 +09:00
parent d29ca388bf
commit 687b49816a
5 changed files with 61 additions and 22 deletions

View File

@ -1,25 +1,16 @@
<div
class="oraganization-tab"
fxLayout="column"
*ngIf="departmentInfoList$ | async"
>
<div class="oraganization-tab" fxLayout="column" *ngIf="departmentInfoList$ | async">
<div class="oraganization-tab-tree" fxFlex="50" style="overflow: scroll">
<ucap-organization-tree
[oraganizationList]="departmentInfoList$ | async"
(selected)="onSelectedOrganization($event)"
></ucap-organization-tree>
<ucap-organization-tree [oraganizationList]="departmentInfoList$ | async"
(selected)="onSelectedOrganization($event)"></ucap-organization-tree>
</div>
<div fxFlex="50" style="overflow: scroll">
<div>
(선택된부서명)
</div>
<div>
<ucap-profile-user-list-item
*ngFor="let userInfo of selectedDepartmentUserInfoList$ | async"
[userInfo]="userInfo"
[checkable]="true"
[sessionVerinfo]="sessionVerinfo"
>
<ucap-profile-user-list-item *ngFor="let userInfo of selectedDepartmentUserInfoList$ | async"
[userInfo]="userInfo" [checkable]="true" [sessionVerinfo]="sessionVerinfo" [selectedUserList]="selectedUserList"
[isChecked]="getCheckedUser(userInfo)" (checkUser)="onCheckUser($event)">
</ucap-profile-user-list-item>
</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 { Observable } from 'rxjs';
import {
@ -6,8 +6,11 @@ import {
QueryProtocolService,
DeptSearchType,
UserInfoSS,
DeptUserResponse
DeptUserResponse,
UserInfoF,
UserInfoDN
} from '@ucap-webmessenger/protocol-query';
import { UserInfo } from '@ucap-webmessenger/protocol-sync';
import { Store, select } from '@ngrx/store';
import { NGXLogger } from 'ngx-logger';
@ -26,6 +29,16 @@ import { KEY_VER_INFO } from '@app/types/ver-info.type';
animations: ucapAnimations
})
export class OrganizationComponent implements OnInit {
@Input()
/** 선택된 사용자의 리스트 */
selectedUserList?: (UserInfo | UserInfoSS | UserInfoF | UserInfoDN)[] = [];
@Output()
checkUser = new EventEmitter<{
isChecked: boolean;
userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN;
}>();
departmentInfoList$: Observable<DeptInfo[]>;
selectedDepartmentUserInfoList$: Observable<UserInfoSS[]>;
selectedDepartmentStatus$: Observable<DeptUserResponse>;
@ -76,6 +89,16 @@ export class OrganizationComponent implements OnInit {
.subscribe();
}
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;
}
onSelectedOrganization(deptInfo: DeptInfo) {
this.store
.pipe(
@ -97,4 +120,12 @@ export class OrganizationComponent implements OnInit {
)
.subscribe();
}
onCheckUser(params: {
isChecked: boolean;
userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN;
}) {
console.log(this.selectedUserList);
this.checkUser.emit(params);
}
}

View File

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

View File

@ -207,7 +207,7 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy {
this.selectedUserList.filter(user => user.seq === item.seq).length ===
0
) {
this.selectedUserList.push(item);
this.selectedUserList = [...this.selectedUserList, item];
}
});
} else {
@ -226,9 +226,10 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy {
if (params.isChecked) {
if (
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 {
this.selectedUserList = this.selectedUserList.filter(
@ -242,4 +243,14 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy {
// choice
// });
}
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;
}
}

View File

@ -48,6 +48,9 @@ export class UserListItemComponent implements OnInit, OnDestroy {
compactable = false;
@Input()
sessionVerinfo: VersionInfo2Response;
@Input()
/** 선택된 사용자의 리스트 */
selectedUserList?: (UserInfo | UserInfoSS | UserInfoF | UserInfoDN)[] = [];
@Output()
checkUser = new EventEmitter<{