refs #7136 use paginate when url exists
gitea/salix-front/pipeline/pr-dev Build queued... Details

This commit is contained in:
Javier Segarra 2024-04-05 13:59:23 +02:00
parent 3159c1c049
commit 243d66b592
2 changed files with 40 additions and 44 deletions

View File

@ -60,7 +60,7 @@ const $props = defineProps({
}, },
limit: { limit: {
type: [Number, String], type: [Number, String],
default: '30', default: '4',
}, },
fetchRef: { fetchRef: {
type: Object, type: Object,
@ -165,11 +165,12 @@ async function onScroll(scrollEv) {
const lastIndex = myOptions.value.length - 1; const lastIndex = myOptions.value.length - 1;
const optionIndex = ref.getOptionIndex(); const optionIndex = ref.getOptionIndex();
if (!$props.fetchRef) return; if (!$props.url && !$props.fetchRef) return;
if (direction === 'decrease') return; if (direction === 'decrease') return;
if (optionIndex > 0 && to === lastIndex && isLoading.value === false) { if (optionIndex > 0 && to === lastIndex && isLoading.value === false) {
isLoading.value = true; isLoading.value = true;
await $props.fetchRef.paginate(); !$props.url && (await $props.fetchRef.paginate());
$props.url && (await dataRef.value.paginate());
} }
} }
</script> </script>

View File

@ -30,7 +30,6 @@ const suppliersRef = ref();
limit="30" limit="30"
auto-load auto-load
@on-fetch="(data) => (suppliers = data)" @on-fetch="(data) => (suppliers = data)"
auto-load
/> />
<VnFilterPanel :data-key="props.dataKey" :search-button="true"> <VnFilterPanel :data-key="props.dataKey" :search-button="true">
<template #tags="{ tag, formatFn }"> <template #tags="{ tag, formatFn }">
@ -71,19 +70,15 @@ const suppliersRef = ref();
</QItemSection> </QItemSection>
</QItem> </QItem>
<QItem> <QItem>
<QItemSection> <QItemSection>
<VnInputDate <VnInputDate :label="t('From')" v-model="params.from" is-outlined />
:label="t('From')" </QItemSection>
v-model="params.from" </QItem>
is-outlined <QItem>
/> <QItemSection>
</QItemSection> <VnInputDate :label="t('To')" v-model="params.to" is-outlined />
</QItem> </QItemSection>
<QItem> </QItem>
<QItemSection>
<VnInputDate :label="t('To')" v-model="params.to" is-outlined />
</QItemSection>
</QItem>
<QItem> <QItem>
<QItemSection> <QItemSection>
<VnInput <VnInput
@ -115,33 +110,33 @@ const suppliersRef = ref();
</QItem> </QItem>
<QExpansionItem :label="t('More options')" expand-separator> <QExpansionItem :label="t('More options')" expand-separator>
<QItem> <QItem>
<QItemSection> <QItemSection>
<VnInput <VnInput
:label="t('params.fi')" :label="t('params.fi')"
v-model="params.fi" v-model="params.fi"
is-outlined is-outlined
lazy-rules lazy-rules
> >
<template #prepend> <template #prepend>
<QIcon name="badge" size="sm"></QIcon> <QIcon name="badge" size="sm"></QIcon>
</template> </template>
</VnInput> </VnInput>
</QItemSection> </QItemSection>
</QItem> </QItem>
<QItem> <QItem>
<QItemSection> <QItemSection>
<VnInput <VnInput
:label="t('params.serialNumber')" :label="t('params.serialNumber')"
v-model="params.serialNumber" v-model="params.serialNumber"
is-outlined is-outlined
lazy-rules lazy-rules
> >
<template #prepend> <template #prepend>
<QIcon name="badge" size="sm"></QIcon> <QIcon name="badge" size="sm"></QIcon>
</template> </template>
</VnInput> </VnInput>
</QItemSection> </QItemSection>
</QItem> </QItem>
<QItem> <QItem>
<QItemSection> <QItemSection>
<VnInput <VnInput