保誠-保戶業務員媒合平台
Tomas
2022-01-13 46da7429ca192bf6a947d79437e8076b94676a05
PAMapp/pages/myAppointmentList/appointmentList.vue
@@ -17,26 +17,33 @@
        <UiPagination
            :totalList="filterList"
            :currentPage="currentPage"
            @changePage="changePage"
        ></UiPagination>
    </div>
</template>
<script lang="ts">
import { Vue, Component, State, Watch } from 'nuxt-property-decorator';
import { Vue, Component, State, Watch, namespace } from 'nuxt-property-decorator';
import { ClientInfo } from '~/shared/models/client.model';
import { Appointment } from '~/shared/models/appointment.model';
const localStorage = namespace('localStorage');
@Component
export default class ClientReservedList extends Vue {
    @State('myAppointmentList')
    myAppointmentList!: ClientInfo[];
    myAppointmentList!: Appointment[];
    appointmentList: ClientInfo[] = [];
    filterList     : ClientInfo[] = [];
    @localStorage.Getter
    currentAppointmentIdFromMsg!: string;
    appointmentList: Appointment[] = [];
    filterList     : Appointment[] = [];
    keyWord        : string       = '';
    pageList       : ClientInfo[] = [];
    pageList       : Appointment[] = [];
    currentPage    : number = 1;
    //////////////////////////////////////////////////////////////////////
@@ -66,15 +73,27 @@
      this.appointmentList = [...unViewList, ...unreadList, ...readList];
      this.filterList = this.appointmentList;
      this.getCurrentPage();
    }
    private getCurrentPage() {
        const currentIndex = this.filterList
            .findIndex(item => item.id === +this.currentAppointmentIdFromMsg);
        const pageSize = 5;
        if (currentIndex > -1) {
            this.currentPage = Math.ceil((currentIndex + 1) / pageSize);
        }
    }
    //////////////////////////////////////////////////////////////////////
    search(): void {
        this.filterList = this.appointmentList.filter(item => {
            return item.name.match(this.keyWord) || item.requirement.match(this.keyWord)
        })
    }
    changePage(pageList: ClientInfo[]): void {
    changePage(pageList: Appointment[]): void {
        this.pageList = pageList;
    }