forked from verdnatura/salix-front
fix: filterPanelbug
This commit is contained in:
parent
a03049a721
commit
955e196882
|
@ -78,23 +78,10 @@ watch(
|
|||
);
|
||||
|
||||
const isLoading = ref(false);
|
||||
function eliminarPropiedadesNull(objeto) {
|
||||
for (let clave in objeto) {
|
||||
if (objeto[clave] === null) {
|
||||
delete objeto[clave];
|
||||
}
|
||||
}
|
||||
return objeto;
|
||||
}
|
||||
|
||||
async function search() {
|
||||
store.filter.where = {};
|
||||
isLoading.value = true;
|
||||
const objetoSinNull = eliminarPropiedadesNull(userParams.value);
|
||||
userParams.value = objetoSinNull;
|
||||
const params = { ...userParams.value };
|
||||
if (Object.entries(params).length > 0) store.exprBuilder = props.exprBuilder;
|
||||
else delete store.filter.where;
|
||||
store.userParams = userParams.value;
|
||||
store.userParamsChanged = true;
|
||||
store.filter.skip = 0;
|
||||
store.skip = 0;
|
||||
|
@ -158,26 +145,8 @@ 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];
|
||||
// if (Object.entries(userParams.value).length === 0) {
|
||||
// store.exprBuilder = null;
|
||||
// delete store.filter.where;
|
||||
// }
|
||||
// else {
|
||||
// store.exprBuilder = props.exprBuilder;
|
||||
// }
|
||||
userParams.value[key] = null;
|
||||
await search();
|
||||
emit('remove', key);
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ const exprBuilder = (param, value) => ({
|
|||
</template>
|
||||
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
|
||||
<QScrollArea class="fit text-grey-8">
|
||||
<ItemTypeFilter data-key="ItemTypeList" :expr-builder="exprBuilder" />
|
||||
<ItemTypeFilter data-key="ItemTypeList" />
|
||||
</QScrollArea>
|
||||
</QDrawer>
|
||||
<QPage class="column items-center q-pa-md">
|
||||
|
@ -70,6 +70,7 @@ const exprBuilder = (param, value) => ({
|
|||
url="ItemTypes"
|
||||
:order="['name']"
|
||||
auto-load
|
||||
:expr-builder="exprBuilder"
|
||||
>
|
||||
<template #body="{ rows }">
|
||||
<CardList
|
||||
|
|
Loading…
Reference in New Issue