保誠-保戶業務員媒合平台
Mila
2022-01-22 c047a3336ff1efc7d21edee6f0c8811264eebae7
PAMapp/store/index.ts
@@ -5,8 +5,9 @@
import reviewsService from '~/shared/services/reviews.service';
import { Consultant } from '~/shared/models/consultant.model';
import { getFavoriteFromStorage, setFavoriteToStorage } from '~/shared/storageConsultant';
import { AppointmentLog, InterviewRecord } from '~/shared/models/appointment.model';
import { AppointmentLog } from '~/shared/models/appointment.model';
import { AgentOfStrictQuery, StrictQueryParams } from '~/shared/models/strict-query.model';
import { NotificationList } from '~/shared/models/reviews.model';
@Module
export default class Store extends VuexModule {
@@ -14,17 +15,9 @@
    strictQueryList: AgentOfStrictQuery[] = [];
    myConsultantList: Consultant[] = [];
    myAppointmentReviewLogList: AppointmentLog[] = [];
    interviewRecord: InterviewRecord = {
        appointmentId   : 0,
        content         : '',
        createdBy       : '',
        createdDate     : '',
        id              : 0,
        interviewDate   : '',
        lastModifiedBy  : '',
        lastModifiedDate: ''
    }
    reviewLogList: AppointmentLog[] = [];
    unReviewLogList: AppointmentLog[] = [];
    notificationList: NotificationList[] = [];
    get isUserLogin() {
        return this.context.getters['localStorage/isUserLogin'];
@@ -46,27 +39,18 @@
    }
    @Mutation
    updateMyAppointmentReviewLog(data: AppointmentLog[]) {
        this.myAppointmentReviewLogList = data;
    updateReviewLog(data: AppointmentLog[]) {
        this.reviewLogList = data;
    }
    @Mutation
    updateInterviewRecord(data: InterviewRecord) {
        this.interviewRecord = data;
    updateUnReviewLog(data: AppointmentLog[]) {
        this.unReviewLogList = data;
    }
    @Mutation
    clearInterviewRecord() {
        this.interviewRecord = {
            appointmentId   : 0,
            content         : '',
            createdBy       : '',
            createdDate     : '',
            id              : 0,
            interviewDate   : '',
            lastModifiedBy  : '',
            lastModifiedDate: ''
        }
    updateNotification(data: NotificationList[]) {
        this.notificationList = data;
    }
    @Action
@@ -147,7 +131,10 @@
                }
            });
            const sortedData = dataWithLatestDate.sort((a, b) => +b.compareDate - +a.compareDate);
            this.context.commit('updateMyAppointmentReviewLog', sortedData);
            const reviewLog = sortedData.filter(item => item.score);
            const unReviewLog = sortedData.filter(item => !item.score);
            this.context.commit('updateReviewLog', reviewLog);
            this.context.commit('updateUnReviewLog', unReviewLog);
        });
    }
@@ -160,4 +147,11 @@
        });
    }
    @Action
    storeMyPersonalNotification() {
        reviewsService.getMyPersonalNotification().then(data => {
            this.context.commit('updateNotification', data);
        })
    }
}