fix: vnfilterPanel

This commit is contained in:
Javier Segarra 2024-05-13 13:51:15 +02:00
parent ebdc1e9906
commit e6b360ee4b
2 changed files with 15 additions and 27 deletions

View File

@ -32,9 +32,6 @@ const itemTypesFilter = {
order: 'name ASC', order: 'name ASC',
where: {}, where: {},
}; };
const defaultParams = {
warehouse: arrayData.store?.userParams?.warehouse,
};
const onCategoryChange = async (categoryFk, search) => { const onCategoryChange = async (categoryFk, search) => {
if (!categoryFk) { if (!categoryFk) {
itemTypesFilter.where.categoryFk = null; itemTypesFilter.where.categoryFk = null;
@ -56,11 +53,7 @@ const onCategoryChange = async (categoryFk, search) => {
auto-load auto-load
/> />
<VnFilterPanel <VnFilterPanel :data-key="props.dataKey" :search-button="true">
:params="defaultParams"
:data-key="props.dataKey"
:search-button="true"
>
<template #tags="{ tag, formatFn }"> <template #tags="{ tag, formatFn }">
<div class="q-gutter-x-xs"> <div class="q-gutter-x-xs">
<strong>{{ t(`negative.${tag.label}`) }}: </strong> <strong>{{ t(`negative.${tag.label}`) }}: </strong>

View File

@ -1,5 +1,5 @@
<script setup> <script setup>
import { computed, ref, onBeforeMount } from 'vue'; import { computed, ref, reactive } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { useStateStore } from 'stores/useStateStore'; import { useStateStore } from 'stores/useStateStore';
import VnPaginate from 'components/ui/VnPaginate.vue'; import VnPaginate from 'components/ui/VnPaginate.vue';
@ -14,7 +14,6 @@ import NegativeOriginDialog from 'pages/Ticket/Negative/NegativeOriginDialog.vue
import TotalNegativeOriginDialog from 'pages/Ticket/Negative/TotalNegativeOriginDialog.vue'; import TotalNegativeOriginDialog from 'pages/Ticket/Negative/TotalNegativeOriginDialog.vue';
import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue'; import ItemDescriptorProxy from 'src/pages/Item/Card/ItemDescriptorProxy.vue';
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue'; import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
import axios from 'axios';
const DEFAULT_WAREHOUSE = 'Algemesi'; const DEFAULT_WAREHOUSE = 'Algemesi';
const stateStore = useStateStore(); const stateStore = useStateStore();
@ -27,11 +26,11 @@ const showProposalDialog = ref(false);
const showChangeQuantityDialog = ref(false); const showChangeQuantityDialog = ref(false);
const showChangeStateDialog = ref(false); const showChangeStateDialog = ref(false);
const showFree = ref(true); const showFree = ref(true);
const showFilterPanel = ref(false);
const currentRow = ref(null); const currentRow = ref(null);
const negativeParams = computed(() => ({ const negativeParams = reactive({
days: 22, days: 2,
warehouse: null, });
}));
const viewSummary = (row) => { const viewSummary = (row) => {
currentRow.value = row; currentRow.value = row;
}; };
@ -100,18 +99,13 @@ const columns = computed(() => [
field: (row) => row, field: (row) => row,
}, },
]); ]);
const vnPaginateRef = ref();
onBeforeMount(async () => { const handleWarehouses = async (data) => {
stateStore.rightDrawer = false; negativeParams.warehouse = data.find((w) => w.name === DEFAULT_WAREHOUSE).id;
await vnPaginateRef.value.fetch();
const data = await axios.get('Warehouses'); showFilterPanel.value = true;
console.log(data); };
// .then((data) => {
// negativeParams.value.warehouse = data.find(
// (w) => w.name === DEFAULT_WAREHOUSE
// ).id;
// });
});
</script> </script>
<template> <template>
@ -134,6 +128,7 @@ onBeforeMount(async () => {
</template> </template>
<QPage class="column items-center"> <QPage class="column items-center">
<FetchData url="Warehouses" @on-fetch="handleWarehouses" auto-load />
<VnSubToolbar class="bg-vn-dark justify-end"> <VnSubToolbar class="bg-vn-dark justify-end">
<template #st-actions> <template #st-actions>
<QBtnGroup v-if="currentRow" push style="column-gap: 1px" <QBtnGroup v-if="currentRow" push style="column-gap: 1px"
@ -207,7 +202,7 @@ onBeforeMount(async () => {
</VnSubToolbar> </VnSubToolbar>
<div v-show="!currentRow" class="list"> <div v-show="!currentRow" class="list">
<VnPaginate <VnPaginate
auto-load ref="vnPaginateRef"
data-key="NegativeList" data-key="NegativeList"
:url="`Tickets/itemLack`" :url="`Tickets/itemLack`"
:order="['itemFk DESC']" :order="['itemFk DESC']"
@ -320,7 +315,7 @@ onBeforeMount(async () => {
</NegativeOriginDialog> </NegativeOriginDialog>
<QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above> <QDrawer v-model="stateStore.rightDrawer" side="right" :width="256" show-if-above>
<QScrollArea class="fit text-grey-8"> <QScrollArea class="fit text-grey-8">
<TicketLackFilter data-key="NegativeList" /> <TicketLackFilter v-if="showFilterPanel" data-key="NegativeList" />
</QScrollArea> </QScrollArea>
</QDrawer> </QDrawer>
</QPage> </QPage>