forked from verdnatura/salix-front
refactor: refs #5447 fix request
This commit is contained in:
parent
f41f312294
commit
45a6c49907
|
@ -36,24 +36,26 @@ const decrement = (paramsObj, key) => {
|
|||
paramsObj[key]--;
|
||||
};
|
||||
|
||||
const warehouseAm = ref([]);
|
||||
const warehousesAm = ref([]);
|
||||
const warehouses = async () => {
|
||||
const warehouses = await axios.get('Warehouses');
|
||||
const countries = await axios.get('Countries');
|
||||
const continents = await axios.get('Continents');
|
||||
const continents = await axios.get('Continents', {
|
||||
params: {
|
||||
filter: { where: { code: 'AM' } },
|
||||
},
|
||||
});
|
||||
|
||||
const countryContinent = countries.data.reduce((acc, c) => {
|
||||
acc[c.id] = c.continentFk;
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
const continentAMId = continents.data.find((continent) => continent.code === 'AM').id;
|
||||
|
||||
const countriesInAM = Object.keys(countryContinent).filter(
|
||||
(countryId) => countryContinent[countryId] === continentAMId.toString()
|
||||
(countryId) => countryContinent[countryId] === continents.data[0].id.toString()
|
||||
);
|
||||
|
||||
warehouseAm.value = warehouses.data.filter((w) =>
|
||||
warehousesAm.value = warehouses.data.filter((w) =>
|
||||
countriesInAM.includes(w.countryFk.toString())
|
||||
);
|
||||
};
|
||||
|
@ -178,7 +180,7 @@ warehouses();
|
|||
:label="t('params.warehouseOutFk')"
|
||||
v-model="params.warehouseOutFk"
|
||||
@update:model-value="searchFn()"
|
||||
:options="warehouseAm"
|
||||
:options="warehousesAm"
|
||||
option-value="id"
|
||||
option-label="name"
|
||||
hide-selected
|
||||
|
|
Loading…
Reference in New Issue