From 17c4bad56fd902184f7c037dbdb22fd63289d1e7 Mon Sep 17 00:00:00 2001
From: Mila <Mila@pollex.com.tw>
Date: 星期二, 25 一月 2022 16:21:42 +0800
Subject: [PATCH] fixed: TODO#134613 [顧問管理流程] 搜尋欄位清空 , 未顯示原本的約訪中列表

---
 PAMapp/pages/myAppointmentList/appointmentList.vue |   19 ++++++++++++-------
 PAMapp/pages/myAppointmentList/closedList.vue      |   13 ++++++++-----
 PAMapp/pages/myAppointmentList/contactedList.vue   |   13 ++++++++-----
 PAMapp/components/AddressPicker.vue                |    2 +-
 4 files changed, 29 insertions(+), 18 deletions(-)

diff --git a/PAMapp/components/AddressPicker.vue b/PAMapp/components/AddressPicker.vue
index a5749c5..95314fa 100644
--- a/PAMapp/components/AddressPicker.vue
+++ b/PAMapp/components/AddressPicker.vue
@@ -6,7 +6,7 @@
           class="p mt-10 cursor--pointer input-radius"
           tabindex="-1"
           v-model="keyWord"
-          @change="searchDistrict"
+          @input="searchDistrict"
           placeholder="隢撓���摮�"
       ></el-input>
       <Ui-ScrollPicker
diff --git a/PAMapp/pages/myAppointmentList/appointmentList.vue b/PAMapp/pages/myAppointmentList/appointmentList.vue
index a2a19cc..e623916 100644
--- a/PAMapp/pages/myAppointmentList/appointmentList.vue
+++ b/PAMapp/pages/myAppointmentList/appointmentList.vue
@@ -5,9 +5,9 @@
             placeholder="隢撓���摮�"
             class="mb-30 pam-clientReserved-input"
             v-model="keyWord"
-            @keyup.enter.native="search"
+            @input="search"
         >
-            <i slot="suffix" class="icon-search search cursor--pointer" @click="search"></i>
+            <i slot="suffix" class="icon-search search cursor--pointer"></i>
         </el-input>
 
         <ClientList
@@ -62,12 +62,12 @@
 
     @Watch('myAppointmentList')
     onMyAppointmentListChange(): void {
-      const tempViewList = this.myAppointmentList
+      this.appointmentList = this.myAppointmentList
           .filter(item => item.communicateStatus === this.contactStatus.RESERVED)
           .map((item) => ({ ...item, sortTime: new Date(item.lastModifiedDate)}))
           .sort((preItem, nextItem) => +nextItem.sortTime - +preItem.sortTime);
 
-      this.filterList = tempViewList;
+      this.filterList = this.appointmentList;
 
       this.getCurrentPage();
     }
@@ -84,9 +84,14 @@
     //////////////////////////////////////////////////////////////////////
 
     search(): void {
-        this.filterList = this.appointmentList.filter(item => {
-            return item.name.match(this.keyWord) || item.requirement.match(this.keyWord)
-        })
+        if (this.keyWord) {
+            this.filterList = this.appointmentList.filter(item => {
+                return item.name.match(this.keyWord) || item.requirement.match(this.keyWord);
+            })
+        } else {
+            this.filterList = this.appointmentList;
+        }
+
     }
 
     changePage(pageList: Appointment[]): void {
diff --git a/PAMapp/pages/myAppointmentList/closedList.vue b/PAMapp/pages/myAppointmentList/closedList.vue
index 4e6d18f..42a54e1 100644
--- a/PAMapp/pages/myAppointmentList/closedList.vue
+++ b/PAMapp/pages/myAppointmentList/closedList.vue
@@ -5,12 +5,11 @@
             placeholder="隢撓���摮�"
             class="mb-10 pam-clientReserved-input"
             v-model="keyWord"
-            @keyup.enter.native="search"
+            @input="search"
         >
             <i
                 slot="suffix"
                 class="icon-search search cursor--pointer"
-                @click="search"
             ></i>
         </el-input>
 
@@ -109,9 +108,13 @@
       } else {
         this.filterList = this.closedList;
       }
-      this.filterList = this.filterList.filter(item => {
-          return item?.name?.match(this.keyWord) || item?.requirement?.match(this.keyWord)
-      })
+
+      if (this.keyWord) {
+        this.filterList = this.filterList.filter(item => {
+            return item?.name?.match(this.keyWord) || item?.requirement?.match(this.keyWord)
+        })
+      }
+
     }
 
     changePage(pageList: Appointment[]): void {
diff --git a/PAMapp/pages/myAppointmentList/contactedList.vue b/PAMapp/pages/myAppointmentList/contactedList.vue
index 805b000..5be7e6f 100644
--- a/PAMapp/pages/myAppointmentList/contactedList.vue
+++ b/PAMapp/pages/myAppointmentList/contactedList.vue
@@ -5,12 +5,11 @@
             placeholder="隢撓���摮�"
             class="mb-30 pam-clientReserved-input"
             v-model="keyWord"
-            @keyup.enter.native="search"
+            @input="search"
         >
             <i
                 slot="suffix"
                 class="icon-search search cursor--pointer"
-                @click="search"
             ></i>
         </el-input>
 
@@ -109,9 +108,13 @@
     //////////////////////////////////////////////////////////////////////
 
     search(): void {
-        this.filterList = this.contactedList.filter(item => {
-            return item?.name?.match(this.keyWord) || item?.requirement?.match(this.keyWord)
-        })
+        if (this.keyWord) {
+          this.filterList = this.contactedList.filter(item => {
+              return item?.name?.match(this.keyWord) || item?.requirement?.match(this.keyWord)
+          })
+        } else {
+          this.filterList = this.contactedList;
+        }
     }
 
     changePage(pageList: Appointment[]): void {

--
Gitblit v1.8.0