保誠-保戶業務員媒合平台
Tomas
2021-12-22 abfd26bb700d93a92da6a04703b0187d4acaaeb5
PAMapp/pages/myAppointmentList/contactedList.vue
@@ -28,37 +28,46 @@
<script lang="ts">
import { Vue, Component, Watch, State } from 'nuxt-property-decorator';
import { ClientInfo } from '~/assets/ts/api/appointment';
import { ClientInfo } from '~/shared/models/client.model';
@Component
export default class ClientContactedList extends Vue {
    @State('myAppointmentList') myAppointmentList!: 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[] = [];
    @Watch('myAppointmentList')
    onMyAppointmentListChange() {
        this.contactedList = (this.myAppointmentList || [])
            .filter(item => item.communicateStatus === 'contacted')
            .sort((a, b) => a.contactTime > b.contactTime ? -1 : 1);
        this.filterList = this.contactedList;
    }
    //////////////////////////////////////////////////////////////////////
    mounted() {
        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>
</script>