From 3b94b4083bcac1db00f3df756517105edc469d33 Mon Sep 17 00:00:00 2001 From: leejinho Date: Mon, 20 Jan 2020 09:00:15 +0900 Subject: [PATCH] =?UTF-8?q?#=20=EC=9D=B4=EC=8A=88=EC=B2=98=EB=A6=AC=20156?= =?UTF-8?q?=20=EC=AA=BD=EC=A7=80=20=EC=88=98=EC=8B=A0=EC=9E=90=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=20=ED=9B=84=20=ED=95=9C=EB=B2=88=20=EB=8D=94=20?= =?UTF-8?q?=EC=84=A0=ED=83=9D=20=EC=8B=9C=20=EC=B6=94=EA=B0=80=EB=90=9C=20?= =?UTF-8?q?=EC=88=98=EC=8B=A0=EC=9E=90=20=EC=82=AC=EB=9D=BC=EC=A7=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../message-write.dialog.component.html | 2 +- .../message/message-write.dialog.component.ts | 62 +++++++++++++++++-- .../src/lib/components/write.component.html | 2 +- .../src/lib/components/write.component.ts | 50 ++------------- 4 files changed, 63 insertions(+), 53 deletions(-) diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/message/message-write.dialog.component.html b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/message/message-write.dialog.component.html index 4c7f704a..d3a26a22 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/message/message-write.dialog.component.html +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/message/message-write.dialog.component.html @@ -10,7 +10,7 @@ [isModify]="isModify" [detail]="data.detail" [detailContents]="data.detailContents" - [curReceiverList]="data.receiverList" + [curReceiverList]="curReceiverList" [fileAllowSize]="fileAllowSize" (send)="onSend($event)" (selectReceiver)="onSelectReceiver($event)" diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/message/message-write.dialog.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/message/message-write.dialog.component.ts index 14acd2ef..c388fa50 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/message/message-write.dialog.component.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/message/message-write.dialog.component.ts @@ -7,10 +7,14 @@ import { DetailResponse, DetailContent, MessageApiService, - MessageType + MessageType, + DetailReceiver } from '@ucap-webmessenger/api-message'; -import { LoginResponse } from '@ucap-webmessenger/protocol-authentication'; +import { + LoginResponse, + RoleCode +} from '@ucap-webmessenger/protocol-authentication'; import { NGXLogger } from 'ngx-logger'; import { WriteComponent as UCapMessageWriteComponent, @@ -34,6 +38,7 @@ import { TranslateService } from '@ngx-translate/core'; import { VersionInfo2Response } from '@ucap-webmessenger/api-public'; import { SessionStorageService } from '@ucap-webmessenger/web-storage'; import { environment } from '../../../../../environments/environment'; +import { EmployeeType } from '@ucap-webmessenger/protocol-room'; export interface MessageWriteDialogData { loginRes: LoginResponse; @@ -62,6 +67,8 @@ export class MessageWriteDialogComponent implements OnInit { @ViewChild('messageWrite', { static: true }) messageWrite: UCapMessageWriteComponent; + curReceiverList: (UserInfo | UserInfoSS)[]; + sessionVerInfo: VersionInfo2Response; fileAllowSize: number; @@ -94,6 +101,11 @@ export class MessageWriteDialogComponent implements OnInit { if (!!this.data.detail && !!this.data.detail.msgInfo) { this.isModify = true; + this.curReceiverList = this.data.detail.recvList.map(recvInfo => + this.convertDetailReceivertoUserInfo(recvInfo) + ); + } else { + this.curReceiverList = this.data.receiverList; } } @@ -112,12 +124,14 @@ export class MessageWriteDialogComponent implements OnInit { }); if (!!result && !!result.choice && result.choice) { - while (receiverList.length) { - receiverList.pop(); - } + // while (receiverList.length) { + // receiverList.pop(); + // } + const selectedUserList: UserInfo[] = []; result.selectedUserList.forEach(v => { - receiverList.push(v as UserInfo); + selectedUserList.push(v as UserInfo); }); + this.curReceiverList = selectedUserList; } } @@ -220,4 +234,40 @@ export class MessageWriteDialogComponent implements OnInit { getBtnValid() { return true; } + + private convertDetailReceivertoUserInfo(base: DetailReceiver): UserInfo { + return { + seq: base.userSeq, + name: base.userName, + profileImageFile: '', + grade: '', + intro: '', + companyCode: '', + hpNumber: '', + lineNumber: '', + email: '', + isMobile: false, + deptName: '', + isFavorit: false, + isBuddy: false, + isActive: false, + roleCd: RoleCode.Self, + employeeNum: '', + madn: '', + hardSadn: '', + fmcSadn: '', + nameEn: '', + nameCn: '', + gradeEn: '', + gradeCn: '', + deptNameEn: '', + deptNameCn: '', + isPrivacyAgree: false, + isValidLogin: false, + employeeType: EmployeeType.Regular, + nickName: '', + + order: '' + }; + } } diff --git a/projects/ucap-webmessenger-ui-message/src/lib/components/write.component.html b/projects/ucap-webmessenger-ui-message/src/lib/components/write.component.html index 7f5fcd93..88c1259b 100644 --- a/projects/ucap-webmessenger-ui-message/src/lib/components/write.component.html +++ b/projects/ucap-webmessenger-ui-message/src/lib/components/write.component.html @@ -13,7 +13,7 @@ }} {{ diff --git a/projects/ucap-webmessenger-ui-message/src/lib/components/write.component.ts b/projects/ucap-webmessenger-ui-message/src/lib/components/write.component.ts index 06836207..a5eeabe3 100644 --- a/projects/ucap-webmessenger-ui-message/src/lib/components/write.component.ts +++ b/projects/ucap-webmessenger-ui-message/src/lib/components/write.component.ts @@ -79,7 +79,11 @@ export interface MessageModify extends Message { }) export class WriteComponent implements OnInit, OnDestroy, AfterViewInit { @Input() - curReceiverList: UserInfo[] = []; + set curReceiverList(userInfoList: UserInfo[]) { + if (!!userInfoList && userInfoList.length > 0) { + this.receiverList = userInfoList; + } + } @Input() detail?: DetailResponse; @Input() @@ -122,14 +126,6 @@ export class WriteComponent implements OnInit, OnDestroy, AfterViewInit { title: ['', []] }); - if (!!this.curReceiverList && this.curReceiverList.length > 0) { - this.receiverList = this.curReceiverList; - } else if (!!this.detail && this.detail.recvList.length > 0) { - this.receiverList = this.detail.recvList.map(recvInfo => - this.convertDetailReceivertoUserInfo(recvInfo) - ); - } - if (this.isModify) { if (!!this.detail.msgInfo.title) { this.messageWriteForm.setValue({ title: this.detail.msgInfo.title }); @@ -563,40 +559,4 @@ export class WriteComponent implements OnInit, OnDestroy, AfterViewInit { range.insertNode(node); } - - private convertDetailReceivertoUserInfo(base: DetailReceiver): UserInfo { - return { - seq: base.userSeq, - name: base.userName, - profileImageFile: '', - grade: '', - intro: '', - companyCode: '', - hpNumber: '', - lineNumber: '', - email: '', - isMobile: false, - deptName: '', - isFavorit: false, - isBuddy: false, - isActive: false, - roleCd: RoleCode.Self, - employeeNum: '', - madn: '', - hardSadn: '', - fmcSadn: '', - nameEn: '', - nameCn: '', - gradeEn: '', - gradeCn: '', - deptNameEn: '', - deptNameCn: '', - isPrivacyAgree: false, - isValidLogin: false, - employeeType: EmployeeType.Regular, - nickName: '', - - order: '' - }; - } }