# 이슈처리

102 발신 쪽지 읽음 확인 카운트 오류 :: 프로그램 수정 후 정상동작
This commit is contained in:
leejinho 2020-01-09 12:45:17 +09:00
parent ec7fbdbecc
commit 0f72beeca9
5 changed files with 76 additions and 27 deletions

View File

@ -184,25 +184,33 @@
<mat-tab> <mat-tab>
<ng-template mat-tab-label> <ng-template mat-tab-label>
{{ 'message.countOfUnreadUser' | translate }} {{ 'message.countOfUnreadUser' | translate }}
{{ getReadUserCount(true) }} {{ getReadUserCount(false) }}
</ng-template> </ng-template>
<ul> <ul>
<div> <div>
{{ 'common.messages.selectAll' | translate }} {{ 'common.messages.selectAll' | translate }}
<mat-checkbox <mat-checkbox
#checkbox #checkbox
(change)=" (change)="onUnreadUserCheckAll(checkbox.checked)"
checkbox.checked
? unReadUsers.selectAll()
: unReadUsers.deselectAll()
"
(click)="$event.stopPropagation()" (click)="$event.stopPropagation()"
> >
</mat-checkbox> </mat-checkbox>
</div> </div>
<mat-selection-list #unReadUsers> <mat-selection-list
#unReadUsers
(selectionChange)="
onUnreadUserSelectionChange(
unReadUsers.selectedOptions.selected
)
"
>
<ng-container *ngFor="let user of receivers"> <ng-container *ngFor="let user of receivers">
<mat-list-option *ngIf="!user.readYn" [value]="user.userSeq"> <mat-list-option
*ngIf="!user.readYn"
[value]="user.userSeq"
[disabled]="user.cancelYn"
[selected]="isSelectedUnreadUser(user)"
>
<span>{{ user.userName }}</span> <span>{{ user.userName }}</span>
</mat-list-option> </mat-list-option>
</ng-container> </ng-container>
@ -211,14 +219,10 @@
<button <button
mat-stroked-button mat-stroked-button
[disabled]="unReadUsers.selectedOptions.selected.length === 0" [disabled]="unReadUsers.selectedOptions.selected.length === 0"
(click)=" (click)="cancelSendMessageForUsers()"
cancelSendMessageForUsers(
unReadUsers.selectedOptions.selected
)
"
class="mat-primary" class="mat-primary"
> >
{{ 'message.cancelReservation' | translate }} {{ 'message.cancelSending' | translate }}
</button> </button>
</div> </div>
</ul> </ul>

View File

@ -3,7 +3,8 @@ import {
MatDialogRef, MatDialogRef,
MAT_DIALOG_DATA, MAT_DIALOG_DATA,
MatSelectionList, MatSelectionList,
MatDrawer MatDrawer,
MatListOption
} from '@angular/material'; } from '@angular/material';
import { map, catchError, take } from 'rxjs/operators'; import { map, catchError, take } from 'rxjs/operators';
@ -79,6 +80,8 @@ export class MessageDetailDialogComponent implements OnInit {
downloadQueue: DownloadQueueForMessage[] = []; downloadQueue: DownloadQueueForMessage[] = [];
downloadFail: DownloadQueueForMessage[] = []; downloadFail: DownloadQueueForMessage[] = [];
selectedUnreadUserSeqs: number[] = [];
@ViewChild('rightDrawer', { static: true }) rightDrawer: MatDrawer; @ViewChild('rightDrawer', { static: true }) rightDrawer: MatDrawer;
@ViewChild('unReadUsers', { static: false }) unReadUsers: MatSelectionList; @ViewChild('unReadUsers', { static: false }) unReadUsers: MatSelectionList;
@ -139,7 +142,13 @@ export class MessageDetailDialogComponent implements OnInit {
} }
getReadUserCount(readYn: boolean): number { getReadUserCount(readYn: boolean): number {
return this.receivers.filter(user => user.readYn === readYn).length; return this.receivers.filter(user => {
if (!!readYn) {
return user.readYn === readYn;
} else {
return user.readYn === readYn && !user.cancelYn;
}
}).length;
} }
getFileStatusIcon(file: DetailContent) { getFileStatusIcon(file: DetailContent) {
@ -534,8 +543,8 @@ export class MessageDetailDialogComponent implements OnInit {
async cancelSendMessageForUsers() { async cancelSendMessageForUsers() {
if ( if (
!!this.unReadUsers && !!this.selectedUnreadUserSeqs &&
this.unReadUsers.selectedOptions.selected.length > 0 this.selectedUnreadUserSeqs.length > 0
) { ) {
const result = await this.dialogService.open< const result = await this.dialogService.open<
ConfirmDialogComponent, ConfirmDialogComponent,
@ -549,11 +558,11 @@ export class MessageDetailDialogComponent implements OnInit {
}); });
if (!!result && !!result.choice && result.choice) { if (!!result && !!result.choice && result.choice) {
const cancelUserSeqs: number[] = []; const cancelUserSeqs: number[] = this.selectedUnreadUserSeqs;
const recvUserList: { userSeq: number }[] = []; const recvUserList: {
this.unReadUsers.selectedOptions.selected.forEach(selected => { userSeq: number;
cancelUserSeqs.push(selected.value); }[] = this.selectedUnreadUserSeqs.map(userSeq => {
recvUserList.push({ userSeq: selected.value }); return { userSeq };
}); });
this.messageApiService this.messageApiService
@ -569,9 +578,13 @@ export class MessageDetailDialogComponent implements OnInit {
take(1), take(1),
map(async res => { map(async res => {
if (res.responseCode === MessageStatusCode.Success) { if (res.responseCode === MessageStatusCode.Success) {
this.receivers = this.receivers.filter( this.receivers.forEach(user => {
user => cancelUserSeqs.indexOf(user.userSeq) < 0 if (cancelUserSeqs.indexOf(user.userSeq) >= 0) {
); user.cancelYn = true;
user.readYn = false;
}
});
this.selectedUnreadUserSeqs = [];
this.rightDrawer.close(); this.rightDrawer.close();
} else { } else {
this.logger.error('message cancel user Error!'); this.logger.error('message cancel user Error!');
@ -584,6 +597,28 @@ export class MessageDetailDialogComponent implements OnInit {
} }
} }
onUnreadUserCheckAll(checked: boolean) {
if (!!checked) {
this.selectedUnreadUserSeqs = this.receivers
.filter(user => !user.readYn && !user.cancelYn)
.map(user => user.userSeq);
} else {
this.selectedUnreadUserSeqs = [];
}
}
onUnreadUserSelectionChange(selectedList: MatListOption[]) {
this.selectedUnreadUserSeqs = selectedList.map(list => list.value);
}
isSelectedUnreadUser(user: DetailReceiver) {
if (this.selectedUnreadUserSeqs.indexOf(user.userSeq) < 0) {
return false;
} else {
return true;
}
}
onClickConfirm(): void { onClickConfirm(): void {
this.dialogRef.close({ this.dialogRef.close({
returnType: 'CLOSE' returnType: 'CLOSE'

View File

@ -262,6 +262,7 @@
"confirmRemove": "Do you want to delete selected message(s)?", "confirmRemove": "Do you want to delete selected message(s)?",
"detailOfViewers": "Detail of viewers", "detailOfViewers": "Detail of viewers",
"selectRecipient": "Select recipient", "selectRecipient": "Select recipient",
"andOthers": "and {{count}}others",
"results": { "results": {
"successForSending": "Your message has been sent.", "successForSending": "Your message has been sent.",
"successForReservation": "You have scheduled a message transfer.", "successForReservation": "You have scheduled a message transfer.",

View File

@ -262,6 +262,7 @@
"confirmRemove": "선택한 쪽지를 삭제하시겠습니까?", "confirmRemove": "선택한 쪽지를 삭제하시겠습니까?",
"detailOfViewers": "읽음 확인", "detailOfViewers": "읽음 확인",
"selectRecipient": "수신자 선택", "selectRecipient": "수신자 선택",
"andOthers": "외 {{count}}명",
"results": { "results": {
"successForSending": "쪽지를 전송하였습니다.", "successForSending": "쪽지를 전송하였습니다.",
"successForReservation": "쪽지 전송을 예약 하였습니다.", "successForReservation": "쪽지 전송을 예약 하였습니다.",

View File

@ -14,7 +14,15 @@
<dd class="info"> <dd class="info">
<div class="detail"> <div class="detail">
<span class="name"> <span class="name">
<b>{{ message.userName }}</b> <b>
{{ message.userName
}}<span *ngIf="message.userCount > 0">
{{
'message.andOthers'
| translate: { count: message.userCount - 1 }
}}
</span>
</b>
{{ message.title }} {{ message.title }}
</span> </span>
<span class="dept"> <span class="dept">