Ver código fonte

Added keyword search

master
Kobus 5 anos atrás
pai
commit
3ad722391a

+ 5
- 5
src/components/shared/searchTab.vue Ver arquivo

15
                 type="text"
15
                 type="text"
16
                 class="form-control form-control-a"
16
                 class="form-control form-control-a"
17
                 placeholder="Keyword"
17
                 placeholder="Keyword"
18
-                v-model="keyword"
18
+                v-model="filter.keyword"
19
               />
19
               />
20
             </div>
20
             </div>
21
           </div>
21
           </div>
107
   data() {
107
   data() {
108
     return {
108
     return {
109
       selectedPropertyType: 'timeshare',
109
       selectedPropertyType: 'timeshare',
110
-      keyword: '',
111
       propertySearch: {
110
       propertySearch: {
112
         userID: 0,
111
         userID: 0,
113
-        keyword: '',
114
         salesType: 'Sale',
112
         salesType: 'Sale',
115
         propertyUsageType: 'All',
113
         propertyUsageType: 'All',
116
         propertyType: 'All',
114
         propertyType: 'All',
120
       },
118
       },
121
     };
119
     };
122
   },
120
   },
123
-  computed: {},
121
+  computed: {
122
+    ...mapState('weekList', ['filter']),
123
+  },
124
   methods: {
124
   methods: {
125
     updateType(item) {
125
     updateType(item) {
126
       this.selectedPropertyType = item;
126
       this.selectedPropertyType = item;
128
     updateSearch(item) {
128
     updateSearch(item) {
129
       this.propertySearch = item;
129
       this.propertySearch = item;
130
       this.propertySearch.propertyUsageType = this.selectedPropertyType;
130
       this.propertySearch.propertyUsageType = this.selectedPropertyType;
131
-      this.propertySearch.keyword = this.keyword;
131
+      this.propertySearch.keyword = this.filter.keyword;
132
     },
132
     },
133
     Search() {
133
     Search() {
134
       if (this.selectedPropertyType === 'timeshare') {
134
       if (this.selectedPropertyType === 'timeshare') {

+ 1
- 0
src/main.js Ver arquivo

38
   return `R ${formatter.format(value)}`;
38
   return `R ${formatter.format(value)}`;
39
 });
39
 });
40
 
40
 
41
+
41
 Vue.filter('toDate', value => value.substring(0, value.length > 9 ? 10 : value.length));
42
 Vue.filter('toDate', value => value.substring(0, value.length > 9 ? 10 : value.length));
42
 
43
 
43
 new Vue({
44
 new Vue({

+ 16
- 0
src/store/modules/timeshare/weekList.js Ver arquivo

15
       date: undefined,
15
       date: undefined,
16
       minPrice: undefined,
16
       minPrice: undefined,
17
       maxPrice: undefined,
17
       maxPrice: undefined,
18
+      keyword: null,
18
     },
19
     },
19
   },
20
   },
20
   mutations: {
21
   mutations: {
39
       } = state;
40
       } = state;
40
       // console.log(JSON.stringify(weekList));
41
       // console.log(JSON.stringify(weekList));
41
       if (filter) {
42
       if (filter) {
43
+        if (filter.keyword) {
44
+          const list = [];
45
+          for (const i in weekList) {
46
+            const item = weekList[i];
47
+            for (const r in item) {
48
+              const innerItem = item[r];
49
+              if (innerItem && JSON.stringify(innerItem).toLowerCase().includes(filter.keyword
50
+                .toLowerCase())) {
51
+                list.push(item);
52
+                break;
53
+              }
54
+            }
55
+          }
56
+          weekList = list;
57
+        }
42
         if (filter.region) {
58
         if (filter.region) {
43
           weekList = _.filter(weekList, x => x.region && x.region.regionCode === filter.region
59
           weekList = _.filter(weekList, x => x.region && x.region.regionCode === filter.region
44
             .regionCode);
60
             .regionCode);

Carregando…
Cancelar
Salvar