| | |
| | | placeholder="請輸入關鍵字" |
| | | class="mb-30 pam-clientReserved-input" |
| | | v-model="keyWord" |
| | | @keyup.enter.native="search" |
| | | > |
| | | <i |
| | | slot="suffix" |
| | |
| | | </template> |
| | | |
| | | <script lang="ts"> |
| | | import { Vue, Component, Prop } from 'nuxt-property-decorator'; |
| | | import { ClientInfo } from '~/assets/ts/api/appointment'; |
| | | import { Vue, Component, Watch, State } from 'nuxt-property-decorator'; |
| | | |
| | | import { ClientInfo } from '~/shared/models/client.model'; |
| | | |
| | | @Component |
| | | export default class ClientContactedList extends Vue { |
| | | @Prop({default: []}) contactedList!: 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[] = []; |
| | | |
| | | ////////////////////////////////////////////////////////////////////// |
| | | |
| | | mounted() { |
| | | this.filterList = JSON.parse(JSON.stringify(this.contactedList)); |
| | | 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> |