保誠-保戶業務員媒合平台
wayne
2022-02-17 a3716f72066d25d745f4d5103ff23a553c3e102b
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<template>
    <div class="record-log-component">
        <div class="mdTxt mt-30 mb-10">系統通知紀錄</div>
 
            <InterviewRecordCard :noticeLogsList="displayLogs.slice(0, 3)"></InterviewRecordCard>
 
            <section class="text--center mt-30" v-if="displayLogs.length > 3">
                <div class="pam-link-button"
                    @click="readMoreBtn"
                >展開看更多
                <i class="icon-expand"></i></div>
            </section>
    </div>
</template>
 
<script lang="ts">
import { Vue, Component, Prop, Watch } from 'nuxt-property-decorator';
import { NoticeLogs } from '~/shared/models/appointment.model';
 
@Component
export default class AppointmentRecordList extends Vue {
 
    @Prop()
    noticeLogs!: NoticeLogs[];
 
    appointmentId: string       = '';
    displayLogs  : NoticeLogs[] = [];
 
    //////////////////////////////////////////////////////////////////////
 
    mounted() {
        this.appointmentId = this.$route.params.appointmentId;
    }
 
    //////////////////////////////////////////////////////////////////////
 
    @Watch('noticeLogs', {immediate: true})
    onNoticeLogsChange() {
      if (this.noticeLogs.length) {
        this.displayLogs = this.noticeLogs
                            .map((i) => ({ ...i, sortDate: new Date(i.createdDate)}))
                            .sort((preItem, nextItem) => +nextItem.sortDate - +preItem.sortDate);
      }
    }
 
    //////////////////////////////////////////////////////////////////////
 
    readMoreBtn() {
        this.$router.push(`/appointment/${this.appointmentId}/recordList`);
    }
 
}
</script>