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 <VnFilterPanel
:data-key="props.dataKey" :data-key="props.dataKey"
:expr-builder="exprBuilder" :expr-builder="props.exprBuilder"
:custom-tags="customTags" :custom-tags="props.customTags"
> >
<template #tags="{ tag, formatFn }"> <template #tags="{ tag, formatFn }">
<strong v-if="tag.label === 'categoryFk'"> <strong v-if="tag.label === 'categoryFk'">

View File

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