forked from verdnatura/salix-front
Se asigno directamente la data fetcheada desde los componentes FetchData y se borró las funciones que se usaban para esto
This commit is contained in:
parent
c4af2e3cf7
commit
5a1d4e90c9
|
@ -57,18 +57,6 @@ const getStatus = computed({
|
|||
},
|
||||
});
|
||||
|
||||
const onFetchCompanies = (companies) => {
|
||||
companiesOptions.value = [...companies];
|
||||
};
|
||||
|
||||
const onFetchPrinters = (printers) => {
|
||||
printersOptions.value = [...printers];
|
||||
};
|
||||
|
||||
const onFetchClients = (clients) => {
|
||||
clientsOptions.value = [...clients];
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
await invoiceOutGlobalStore.init();
|
||||
formData.value = { ...formInitialData.value };
|
||||
|
@ -76,9 +64,13 @@ onMounted(async () => {
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData url="Companies" @on-fetch="(data) => onFetchCompanies(data)" auto-load />
|
||||
<FetchData url="Printers" @on-fetch="(data) => onFetchPrinters(data)" auto-load />
|
||||
<FetchData url="Clients" @on-fetch="(data) => onFetchClients(data)" auto-load />
|
||||
<FetchData
|
||||
url="Companies"
|
||||
@on-fetch="(data) => (companiesOptions = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData url="Printers" @on-fetch="(data) => (printersOptions = data)" auto-load />
|
||||
<FetchData url="Clients" @on-fetch="(data) => (clientsOptions = data)" auto-load />
|
||||
|
||||
<QForm
|
||||
v-if="!initialDataLoading && optionsInitialData"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<script setup>
|
||||
import { reactive } from 'vue';
|
||||
import { reactive, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import FetchData from 'components/FetchData.vue';
|
||||
|
@ -16,16 +16,10 @@ const props = defineProps({
|
|||
},
|
||||
});
|
||||
|
||||
const filtersOptions = reactive({
|
||||
warehouses: [],
|
||||
continents: [],
|
||||
agencies: [],
|
||||
suppliers: [],
|
||||
});
|
||||
|
||||
const updateFilterOptions = (data, optionKey) => {
|
||||
filtersOptions[optionKey] = [...data];
|
||||
};
|
||||
const warehousesOptions = ref([]);
|
||||
const continentsOptions = ref([]);
|
||||
const agenciesOptions = ref([]);
|
||||
const suppliersOptions = ref([]);
|
||||
|
||||
const add = (paramsObj, key) => {
|
||||
if (paramsObj[key] === undefined) {
|
||||
|
@ -45,22 +39,22 @@ const decrement = (paramsObj, key) => {
|
|||
<template>
|
||||
<FetchData
|
||||
url="Warehouses"
|
||||
@on-fetch="(data) => updateFilterOptions(data, 'warehouses')"
|
||||
@on-fetch="(data) => (warehousesOptions = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
url="Continents"
|
||||
@on-fetch="(data) => updateFilterOptions(data, 'continents')"
|
||||
@on-fetch="(data) => (continentsOptions = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
url="AgencyModes"
|
||||
@on-fetch="(data) => updateFilterOptions(data, 'agencies')"
|
||||
@on-fetch="(data) => (agenciesOptions = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
url="Suppliers"
|
||||
@on-fetch="(data) => updateFilterOptions(data, 'suppliers')"
|
||||
@on-fetch="(data) => (suppliersOptions = data)"
|
||||
auto-load
|
||||
/>
|
||||
|
||||
|
@ -123,7 +117,7 @@ const decrement = (paramsObj, key) => {
|
|||
<VnSelectFilter
|
||||
:label="t('params.agencyModeFk')"
|
||||
v-model="params.agencyModeFk"
|
||||
:options="filtersOptions.agencies"
|
||||
:options="agenciesOptions"
|
||||
option-value="agencyFk"
|
||||
option-label="name"
|
||||
hide-selected
|
||||
|
@ -156,7 +150,7 @@ const decrement = (paramsObj, key) => {
|
|||
<VnSelectFilter
|
||||
:label="t('params.warehouseOutFk')"
|
||||
v-model="params.warehouseOutFk"
|
||||
:options="filtersOptions.warehouses"
|
||||
:options="warehousesOptions"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
hide-selected
|
||||
|
@ -171,7 +165,7 @@ const decrement = (paramsObj, key) => {
|
|||
<VnSelectFilter
|
||||
:label="t('params.warehouseInFk')"
|
||||
v-model="params.warehouseInFk"
|
||||
:options="filtersOptions.warehouses"
|
||||
:options="warehousesOptions"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
hide-selected
|
||||
|
@ -186,7 +180,7 @@ const decrement = (paramsObj, key) => {
|
|||
<VnSelectFilter
|
||||
:label="t('supplier.pageTitles.supplier')"
|
||||
v-model="params.cargoSupplierFk"
|
||||
:options="filtersOptions.suppliers"
|
||||
:options="suppliersOptions"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
hide-selected
|
||||
|
@ -201,7 +195,7 @@ const decrement = (paramsObj, key) => {
|
|||
<VnSelectFilter
|
||||
:label="t('params.continent')"
|
||||
v-model="params.continent"
|
||||
:options="filtersOptions.continents"
|
||||
:options="continentsOptions"
|
||||
option-value="code"
|
||||
option-label="name"
|
||||
hide-selected
|
||||
|
|
|
@ -24,8 +24,8 @@ const newTravelForm = reactive({
|
|||
});
|
||||
|
||||
const agenciesOptions = ref([]);
|
||||
const viewAction = ref();
|
||||
const warehousesOptions = ref([]);
|
||||
const viewAction = ref();
|
||||
|
||||
onBeforeMount(() => {
|
||||
// Esto nos permite decirle a FormModel si queremos observar los cambios o no
|
||||
|
@ -43,19 +43,19 @@ onBeforeMount(() => {
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
const onFetchAgencies = (agencies) => {
|
||||
agenciesOptions.value = [...agencies];
|
||||
};
|
||||
|
||||
const onFetchWarehouses = (warehouses) => {
|
||||
warehousesOptions.value = [...warehouses];
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FetchData url="AgencyModes" @on-fetch="(data) => onFetchAgencies(data)" auto-load />
|
||||
<FetchData url="Warehouses" @on-fetch="(data) => onFetchWarehouses(data)" auto-load />
|
||||
<FetchData
|
||||
url="AgencyModes"
|
||||
@on-fetch="(data) => (agenciesOptions = data)"
|
||||
auto-load
|
||||
/>
|
||||
<FetchData
|
||||
url="Warehouses"
|
||||
@on-fetch="(data) => (warehousesOptions = data)"
|
||||
auto-load
|
||||
/>
|
||||
<QPage>
|
||||
<QToolbar class="bg-vn-dark">
|
||||
<div id="st-data"></div>
|
||||
|
|
Loading…
Reference in New Issue