0
0
Fork 0

perf: improve ItemFixedPricefilterPanel

This commit is contained in:
Javier Segarra 2024-09-06 14:41:38 +02:00
parent a8057b47dc
commit 31b8088b5f
2 changed files with 12 additions and 23 deletions

View File

@ -159,8 +159,8 @@ const removeTag = (index, params, search) => {
/>
<VnFilterPanel
:data-key="props.dataKey"
:expr-builder="exprBuilder"
:custom-tags="customTags"
:expr-builder="props.exprBuilder"
:custom-tags="props.customTags"
>
<template #tags="{ tag, formatFn }">
<strong v-if="tag.label === 'categoryFk'">

View File

@ -17,10 +17,6 @@ const props = defineProps({
});
const itemTypeWorkersOptions = ref([]);
const $params = ref({});
const pushParam = (param) => ({
param: { [param]: $params.value[param] },
});
const exprBuilder = (param, value) => {
switch (param) {
case 'name':
@ -46,11 +42,7 @@ const exprBuilder = (param, value) => {
:filter="{ fields: ['id', 'nickname'], order: 'nickname ASC', limit: 30 }"
@on-fetch="(data) => (itemTypeWorkersOptions = data)"
/>
<ItemsFilterPanel
:data-key="props.dataKey"
:custom-tags="['tags']"
search-url="table"
>
<ItemsFilterPanel :data-key="props.dataKey" :custom-tags="['tags']">
<template #body="{ params, searchFn }">
<QItem class="q-my-md">
<QItemSection>
@ -110,27 +102,24 @@ const exprBuilder = (param, value) => {
<QItemSection>
<QCheckbox
:label="t('components.itemsFilterPanel.mine')"
v-model="$params.mine"
:true-value="'true'"
:false-value="'false'"
@update:model-value="searchFn(pushParam('mine'))"
v-model="params.mine"
toggle-indeterminate
@update:model-value="searchFn()"
/>
<QCheckbox
v-model="$params.showBadDates"
v-model="params.showBadDates"
:label="t(`components.itemsFilterPanel.showBadDates`)"
:true-value="'true'"
:false-value="'false'"
@update:model-value="searchFn(pushParam('showBadDates'))"
toggle-indeterminate
@update:model-value="searchFn()"
>
</QCheckbox>
<QCheckbox
:label="t('components.itemsFilterPanel.hasMinPrice')"
v-model="$params.hasMinPrice"
:true-value="'true'"
:false-value="'false'"
@update:model-value="searchFn(pushParam('hasMinPrice'))"
v-model="params.hasMinPrice"
toggle-indeterminate
@update:model-value="searchFn()"
/>
</QItemSection>
</QItem>