fix: add exprBuilder
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Javier Segarra 2024-04-26 15:24:44 +02:00
parent c1ed4ab032
commit 0d50944c2d
2 changed files with 31 additions and 3 deletions

View File

@ -81,6 +81,8 @@ const isLoading = ref(false);
async function search() {
isLoading.value = true;
const params = { ...userParams.value };
if (Object.entries(params).length > 0) store.exprBuilder = props.exprBuilder;
store.userParamsChanged = true;
store.filter.skip = 0;
store.skip = 0;
@ -144,9 +146,25 @@ const customTags = computed(() =>
tagsList.value.filter((tag) => (props.customTags || []).includes(tag.label))
);
watch(tags, (now, before) => {
if (now.length < before.length) {
const beforeMap = before.map(({ label }) => label);
const nowMap = now.map(({ label }) => label);
const key = beforeMap.filter((elemento) => !nowMap.includes(elemento))[0];
remove(key ?? beforeMap[0]);
}
console.error('');
});
async function remove(key) {
// userParams.value[key] = null;
if (userParams.value[key]) delete userParams.value[key];
delete userParams.value[key];
if (Object.entries(userParams.value).length === 0) {
store.exprBuilder = null;
delete store.filter.where;
} else {
store.exprBuilder = props.exprBuilder;
}
await search();
emit('remove', key);
}

View File

@ -29,12 +29,22 @@ const emit = defineEmits(['search']);
<template #body="{ params }">
<QItem>
<QItemSection>
<VnInput :label="t('Name')" v-model="params.name" is-outlined />
<VnInput
@update:model-value="emit('search')"
:label="t('Name')"
v-model="params.name"
is-outlined
/>
</QItemSection>
</QItem>
<QItem>
<QItemSection>
<VnInput v-model="params.code" :label="t('Code')" is-outlined />
<VnInput
@update:model-value="emit('search')"
v-model="params.code"
:label="t('Code')"
is-outlined
/>
</QItemSection>
</QItem>
</template>