From bdae23a40c461c2c6b6ee614f661eac731c949c8 Mon Sep 17 00:00:00 2001 From: Mila <Mila@pollex.com.tw> Date: 星期三, 22 十二月 2021 14:12:05 +0800 Subject: [PATCH] Merge branch 'master' of https://192.168.0.10:8443/r/pcalife/PAM --- PAMapp/pages/myAppointmentList/contactedList.vue | 42 +++++++++++++++++++++++++++++++----------- 1 files changed, 31 insertions(+), 11 deletions(-) diff --git a/PAMapp/pages/myAppointmentList/contactedList.vue b/PAMapp/pages/myAppointmentList/contactedList.vue index de75b31..92ecd84 100644 --- a/PAMapp/pages/myAppointmentList/contactedList.vue +++ b/PAMapp/pages/myAppointmentList/contactedList.vue @@ -5,6 +5,7 @@ placeholder="隢撓���摮�" class="mb-30 pam-clientReserved-input" v-model="keyWord" + @keyup.enter.native="search" > <i slot="suffix" @@ -26,28 +27,47 @@ </template> <script lang="ts"> -import { Vue, Component, Prop } from 'nuxt-property-decorator'; -import { ClientInfo } from '~/assets/ts/api/appointment'; +import { Vue, Component, Watch, State } from 'nuxt-property-decorator'; + +import { ClientInfo } from '~/shared/models/client.model'; @Component export default class ClientContactedList extends Vue { - @Prop({default: []}) contactedList!: ClientInfo[]; + + @State('myAppointmentList') + myAppointmentList!: ClientInfo[]; + + @Watch('myAppointmentList') + onMyAppointmentListChange() { + this.contactedList = (this.myAppointmentList || []) + .filter(item => item.communicateStatus === 'contacted') + .map((item) => ({...item, sortTime: new Date(item.contactTime)})) + .sort((prevItem, nextItem) => +nextItem - +prevItem); + this.filterList = this.contactedList; + } + + contactedList: ClientInfo[] = []; pageList: ClientInfo[] = []; keyWord: string = ''; filterList: ClientInfo[] = []; + ////////////////////////////////////////////////////////////////////// + mounted() { - this.filterList = JSON.parse(JSON.stringify(this.contactedList)); + this.onMyAppointmentListChange(); } - changePage(pageList: ClientInfo[]) { + ////////////////////////////////////////////////////////////////////// + + search(): void { + this.filterList = this.contactedList.filter(item => { + return item?.name?.match(this.keyWord) || item?.requirement?.match(this.keyWord) + }) + } + + changePage(pageList: ClientInfo[]): void { this.pageList = pageList; } - search() { - this.filterList = this.contactedList.filter(item => { - return item.name.match(this.keyWord) || item.requirement.match(this.keyWord) - }) - } } -</script> \ No newline at end of file +</script> -- Gitblit v1.8.0