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

View File

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