保誠-保戶業務員媒合平台
wayne
2022-01-26 6fa4bba623713c396432ba8b863846883d6a1906
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
 
 
<template>
    <InterviewRecordCard :noticeLogsList="displayLogs"></InterviewRecordCard>
</template>
 
<script lang="ts">
import { Component, namespace, Vue, Watch } from "nuxt-property-decorator";
import { Appointment, NoticeLogs } from "~/shared/models/appointment.model";
 
const appointmentStore = namespace('appointment.store');
 
@Component
export default class RecordList extends Vue {
    @appointmentStore.State
    appointmentDetail!: Appointment;
 
    displayLogs: NoticeLogs[] = [];
 
    ////////////////////////////////////////////////////////
 
    @Watch('appointmentDetail', {immediate: true})
    onAppointmentDetailChange() {
      if (this.appointmentDetail?.appointmentNoticeLogs.length) {
        this.displayLogs = this.appointmentDetail?.appointmentNoticeLogs
                            .map((i) => ({ ...i, sortDate: new Date(i.createdDate)}))
                            .sort((preItem, nextItem) => +nextItem.sortDate - +preItem.sortDate);
      }
    }
 
}
</script>