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 * as AppStore from '@app/store';
import * as ChatStore from '@app/store/messenger/chat';
@Component({
selector: 'app-layout-messenger-left-side',
@ -45,11 +46,14 @@ export class LeftSideComponent implements OnInit {
}
});
this.logger.debug(result.choice);
// if (result.choice) {
if (!!result && !!result.choice && 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
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>
<div *ngIf="!isUserSelect">
(하단버튼영역)
</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,19 @@ import { KEY_VER_INFO } from '@app/types/ver-info.type';
animations: ucapAnimations
})
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[]>;
selectedDepartmentUserInfoList$: Observable<UserInfoSS[]>;
selectedDepartmentStatus$: Observable<DeptUserResponse>;
@ -97,4 +113,24 @@ export class OrganizationComponent implements OnInit {
)
.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"
(keyDownEnter)="onKeyDownEnterOrganizationTenantSearch($event)"></ucap-organization-tenant-search>
<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"
[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-group-expansion-panel>
</mat-tab>
@ -23,7 +25,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" [isUserSelect]="true"
(checkUser)="onCheckUser($event)">
</app-layout-chat-left-sidenav-organization>
</mat-tab>
<mat-tab>
<ng-template mat-tab-label>

View File

@ -38,6 +38,7 @@ export interface CreateChatDialogData {
export interface CreateChatDialogResult {
choice: boolean;
selectedUserList?: (UserInfo | UserInfoSS | UserInfoF | UserInfoDN)[];
}
@Component({
@ -197,6 +198,7 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy {
);
}
/** 동료그룹 :: 그룹의 checkbox 의 이벤트를 받아 선택된 유저리스트를 수집. */
onCheckGroup(params: {
isChecked: boolean;
groupBuddyList: { group: GroupDetailData; buddyList: UserInfo[] };
@ -207,7 +209,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 {
@ -219,6 +221,7 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy {
}
}
/** 동료그룹>부서원, 조직도>부서원 :: 리스트의 checkbox 의 이벤트를 받아 선택된 유저리스트를 수집. */
onCheckUser(params: {
isChecked: boolean;
userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN;
@ -226,9 +229,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(
@ -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 {
// this.dialogRef.close({
// choice
// });
this.dialogRef.close({
choice,
selectedUserList: this.selectedUserList
});
}
}

View File

@ -28,8 +28,8 @@
(click)="onClickMore($event, groupBuddy.group)">
<mat-icon>more_vert</mat-icon>
</button>
<mat-checkbox *ngIf="checkable" #checkbox (change)="onChangeCheck(checkbox.checked, groupBuddy)"
(click)="$event.stopPropagation()"></mat-checkbox>
<mat-checkbox *ngIf="checkable" #checkbox [checked]="getCheckedGroup(groupBuddy)"
(change)="onChangeCheck(checkbox.checked, groupBuddy)" (click)="$event.stopPropagation()"></mat-checkbox>
</mat-panel-description>
</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 { MatAccordion } from '@angular/material';
import { ExpansionPanelItemDirective } from '../directives/expansion-panel-item.directive';
import {
UserInfoSS,
UserInfoF,
UserInfoDN
} from '@ucap-webmessenger/protocol-query';
@Component({
selector: 'ucap-group-expansion-panel',
@ -24,12 +29,13 @@ import { ExpansionPanelItemDirective } from '../directives/expansion-panel-item.
export class ExpansionPanelComponent implements OnInit {
@Input()
groupBuddyList: { group: GroupDetailData; buddyList: UserInfo[] }[];
@Input()
favoritBuddyList: UserInfo[];
@Input()
checkable = false;
@Input()
/** 선택된 사용자의 리스트 */
selectedUserList?: (UserInfo | UserInfoSS | UserInfoF | UserInfoDN)[] = [];
@Output()
more = new EventEmitter<{
@ -67,6 +73,7 @@ export class ExpansionPanelComponent implements OnInit {
this.more.emit({ event, group });
}
/** 그룹리스트가 checkable 할 경우 checkbox 의 change 이벤트를 상위 컴포넌트로 전달한다. */
onChangeCheck(
value: boolean,
groupBuddyList: { group: GroupDetailData; buddyList: UserInfo[] }
@ -76,4 +83,28 @@ export class ExpansionPanelComponent implements OnInit {
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;
@Input()
sessionVerinfo: VersionInfo2Response;
@Input()
/** 선택된 사용자의 리스트 */
selectedUserList?: (UserInfo | UserInfoSS | UserInfoF | UserInfoDN)[] = [];
@Output()
checkUser = new EventEmitter<{
@ -115,6 +118,7 @@ export class UserListItemComponent implements OnInit, OnDestroy {
return rtnClass;
}
/** 리스트가 checkable 할 경우 checkbox 의 change 이벤트를 상위 컴포넌트로 전달한다. */
onChangeCheck(
value: boolean,
userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN