|
5 | 5 | label-class="text-primary" |
6 | 6 | class="m-0" |
7 | 7 | > |
8 | | - <b-row v-if="textInput"> |
9 | | - <b-col> |
10 | | - <b-form-group label-class="text-primary"> |
11 | | - <c-input-expression |
12 | | - v-model="options.prefilter" |
13 | | - height="3.688rem" |
14 | | - lang="javascript" |
15 | | - :suggestion-params="recordAutoCompleteParams" |
16 | | - /> |
17 | | - |
18 | | - <i18next |
19 | | - path="recordList.record.prefilterFootnote" |
20 | | - tag="small" |
21 | | - class="text-muted" |
22 | | - > |
23 | | - <code>${record.values.fieldName}</code> |
24 | | - <code>${recordID}</code> |
25 | | - <code>${ownerID}</code> |
26 | | - <span><code>${userID}</code>, <code>${user.name}</code></span> |
27 | | - </i18next> |
28 | | - </b-form-group> |
29 | | - </b-col> |
30 | | - </b-row> |
31 | | - |
32 | | - <filter-toolbox |
33 | | - v-else |
34 | | - v-model="filterGroup" |
35 | | - :module="module" |
36 | | - :mock.sync="mock" |
37 | | - reset-filter-on-created |
38 | | - start-empty |
39 | | - /> |
40 | | - |
41 | | - <div class="mt-1 d-flex align-items-center"> |
42 | | - <b-button |
43 | | - variant="link" |
44 | | - size="sm" |
45 | | - class="ml-auto text-decoration-none" |
46 | | - @click="toggleFilterView" |
| 8 | + <template v-if="textInput"> |
| 9 | + <c-input-expression |
| 10 | + v-model="options.prefilter" |
| 11 | + height="3.688rem" |
| 12 | + lang="javascript" |
| 13 | + :suggestion-params="recordAutoCompleteParams" |
| 14 | + /> |
| 15 | + |
| 16 | + <i18next |
| 17 | + path="recordList.record.prefilterFootnote" |
| 18 | + tag="small" |
| 19 | + class="text-muted" |
47 | 20 | > |
48 | | - {{ $t('recordList.prefilter.toggleInputType') }} |
49 | | - </b-button> |
50 | | - </div> |
| 21 | + <code>${record.values.fieldName}</code> |
| 22 | + <code>${recordID}</code> |
| 23 | + <code>${ownerID}</code> |
| 24 | + <span><code>${userID}</code>, <code>${user.name}</code></span> |
| 25 | + </i18next> |
| 26 | + |
| 27 | + <div class="d-flex align-items-center justify-content-end mt-1"> |
| 28 | + <b-button |
| 29 | + variant="link" |
| 30 | + size="sm" |
| 31 | + class="text-decoration-none" |
| 32 | + @click="toggleFilterInputType" |
| 33 | + > |
| 34 | + {{ $t('recordList.prefilter.toggleInputType') }} |
| 35 | + </b-button> |
| 36 | + </div> |
| 37 | + </template> |
| 38 | + |
| 39 | + <template v-else> |
| 40 | + <filter-toolbox |
| 41 | + v-model="filterGroup" |
| 42 | + :module="module" |
| 43 | + :mock.sync="mock" |
| 44 | + reset-filter-on-created |
| 45 | + start-empty |
| 46 | + /> |
| 47 | + |
| 48 | + <div class="d-flex align-items-center justify-content-end mt-1 gap-1"> |
| 49 | + <b-button |
| 50 | + variant="light" |
| 51 | + size="sm" |
| 52 | + @click="toggleFilterInputType" |
| 53 | + > |
| 54 | + {{ $t('general:label.cancel') }} |
| 55 | + </b-button> |
| 56 | + |
| 57 | + <b-button |
| 58 | + variant="primary" |
| 59 | + size="sm" |
| 60 | + class="ml-1" |
| 61 | + @click="saveFilter" |
| 62 | + > |
| 63 | + {{ $t('general:label.save') }} |
| 64 | + </b-button> |
| 65 | + </div> |
| 66 | + </template> |
51 | 67 | </b-form-group> |
52 | 68 | </c-form-table-wrapper> |
53 | 69 | </template> |
@@ -144,11 +160,16 @@ export default { |
144 | 160 | }, |
145 | 161 |
|
146 | 162 | methods: { |
147 | | - toggleFilterView () { |
148 | | - if (!this.textInput) { |
149 | | - this.options.prefilter = this.parseFilter() || this.options.prefilter |
| 163 | + saveFilter (filter) { |
| 164 | + if (filter && filter[0] && !filter[0].filter[0].name) { |
| 165 | + return |
150 | 166 | } |
151 | 167 |
|
| 168 | + this.options.prefilter = this.parseFilter() |
| 169 | + this.toggleFilterInputType() |
| 170 | + }, |
| 171 | +
|
| 172 | + toggleFilterInputType () { |
152 | 173 | this.textInput = !this.textInput |
153 | 174 | }, |
154 | 175 |
|
|
0 commit comments