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/myConsultantList.vue |   36 +++++++++++++++++-------------------
 1 files changed, 17 insertions(+), 19 deletions(-)

diff --git a/PAMapp/pages/myConsultantList.vue b/PAMapp/pages/myConsultantList.vue
index 7aa2014..687547c 100644
--- a/PAMapp/pages/myConsultantList.vue
+++ b/PAMapp/pages/myConsultantList.vue
@@ -26,7 +26,7 @@
 
 <script lang='ts'>
 import { Vue, Component, Watch, State, Action } from 'nuxt-property-decorator';
-import { Consultant, ConsultantWithAppointmentId } from '~/assets/ts/models/consultant.model';
+import { Consultant, ConsultantWithAppointmentId } from '~/shared/models/consultant.model';
 
 @Component
 export default class myConsultantList extends Vue {
@@ -40,11 +40,6 @@
 
     @Action
     storeConsultantList!: any;
-
-    @Watch('myConsultantList')
-    onMyConsultantListChange() {
-        this.setList();
-    }
 
     //////////////////////////////////////////////////////////////////////
 
@@ -67,6 +62,11 @@
 
     //////////////////////////////////////////////////////////////////////
 
+    @Watch('myConsultantList')
+    onMyConsultantListChange() {
+        this.setList();
+    }
+
     clickTab(path: string) {
         this.activeTabName = path;
         this.$router.push('/myConsultantList/' + this.activeTabName)
@@ -87,22 +87,20 @@
       // format contacted list
         this.myConsultantList.filter((consultant) => consultant.appointments!.length)
           .forEach((consultant) => {
-            const hasAppointment = consultant.appointments?.length;
-            if (hasAppointment) {
-              consultant.appointments!.forEach((appointment) => {
-                const consultantWithAppointmentId: ConsultantWithAppointmentId = {
-                  ...consultant,
-                  appointmentId: appointment.id,
-                  appointmentDate: appointment.appointmentDate,
-                  appointmentScore: appointment.satisfactionScore
-                };
-                this.contactedList.push(consultantWithAppointmentId);
-              })
-            }
+            consultant.appointments!.forEach((appointment) => {
+              const consultantWithAppointmentId: ConsultantWithAppointmentId = {
+                ...consultant,
+                appointmentId: appointment.id,
+                appointmentDate: appointment.appointmentDate,
+                appointmentScore: appointment.satisfactionScore,
+                appointmentStatus: appointment.communicateStatus,
+              };
+              this.contactedList.push(consultantWithAppointmentId);
+            })
           });
 
         this.contactedList = this.contactedList
-          .filter((appointment) => appointment['contactStatus'] === 'contacted')
+          .filter((appointment) => appointment['appointmentStatus'] === 'contacted')
           .map((appointment) => ({ ...appointment, sortTime: new Date(appointment.appointmentDate)}))
           .sort((preAppointment, nextAppointment) => +nextAppointment.sortTime - +preAppointment.sortTime);
     }

--
Gitblit v1.9.3