forked from verdnatura/salix-front
Merge branch 'dev' into 6826-RolSummary
This commit is contained in:
commit
9664978733
|
@ -7,6 +7,7 @@ import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue';
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
import VnInputDate from 'components/common/VnInputDate.vue';
|
import VnInputDate from 'components/common/VnInputDate.vue';
|
||||||
|
import axios from 'axios';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
|
@ -20,6 +21,7 @@ const warehousesOptions = ref([]);
|
||||||
const continentsOptions = ref([]);
|
const continentsOptions = ref([]);
|
||||||
const agenciesOptions = ref([]);
|
const agenciesOptions = ref([]);
|
||||||
const suppliersOptions = ref([]);
|
const suppliersOptions = ref([]);
|
||||||
|
const warehousesByContinent = ref({});
|
||||||
|
|
||||||
const add = (paramsObj, key) => {
|
const add = (paramsObj, key) => {
|
||||||
if (paramsObj[key] === undefined) {
|
if (paramsObj[key] === undefined) {
|
||||||
|
@ -34,6 +36,28 @@ const decrement = (paramsObj, key) => {
|
||||||
|
|
||||||
paramsObj[key]--;
|
paramsObj[key]--;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const warehouses = async () => {
|
||||||
|
const warehousesResponse = await axios.get('Warehouses');
|
||||||
|
const countriesResponse = await axios.get('Countries');
|
||||||
|
const continentsResponse = await axios.get('Continents');
|
||||||
|
|
||||||
|
const countryContinentMap = countriesResponse.data.reduce((acc, country) => {
|
||||||
|
acc[country.id] = country.continentFk;
|
||||||
|
return acc;
|
||||||
|
}, {});
|
||||||
|
|
||||||
|
continentsResponse.data.forEach((continent) => {
|
||||||
|
const countriesInContinent = Object.keys(countryContinentMap).filter(
|
||||||
|
(countryId) => countryContinentMap[countryId] === continent.id.toString()
|
||||||
|
);
|
||||||
|
|
||||||
|
warehousesByContinent.value[continent.code] = warehousesResponse.data.filter(
|
||||||
|
(warehouse) => countriesInContinent.includes(warehouse.countryFk.toString())
|
||||||
|
);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
warehouses();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -116,7 +140,6 @@ const decrement = (paramsObj, key) => {
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('params.agencyModeFk')"
|
:label="t('params.agencyModeFk')"
|
||||||
v-model="params.agencyModeFk"
|
v-model="params.agencyModeFk"
|
||||||
@update:model-value="searchFn()"
|
|
||||||
:options="agenciesOptions"
|
:options="agenciesOptions"
|
||||||
option-value="agencyFk"
|
option-value="agencyFk"
|
||||||
option-label="name"
|
option-label="name"
|
||||||
|
@ -147,12 +170,26 @@ const decrement = (paramsObj, key) => {
|
||||||
/>
|
/>
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem>
|
<QItem v-if="warehousesByContinent[params.continent]">
|
||||||
|
<QItemSection>
|
||||||
|
<VnSelect
|
||||||
|
:label="t('params.warehouseOutFk')"
|
||||||
|
v-model="params.warehouseOutFk"
|
||||||
|
:options="warehousesByContinent[params.continent]"
|
||||||
|
option-value="id"
|
||||||
|
option-label="name"
|
||||||
|
hide-selected
|
||||||
|
dense
|
||||||
|
outlined
|
||||||
|
rounded
|
||||||
|
/>
|
||||||
|
</QItemSection>
|
||||||
|
</QItem>
|
||||||
|
<QItem v-else>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('params.warehouseOutFk')"
|
:label="t('params.warehouseOutFk')"
|
||||||
v-model="params.warehouseOutFk"
|
v-model="params.warehouseOutFk"
|
||||||
@update:model-value="searchFn()"
|
|
||||||
:options="warehousesOptions"
|
:options="warehousesOptions"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
option-label="name"
|
option-label="name"
|
||||||
|
@ -168,7 +205,6 @@ const decrement = (paramsObj, key) => {
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('params.warehouseInFk')"
|
:label="t('params.warehouseInFk')"
|
||||||
v-model="params.warehouseInFk"
|
v-model="params.warehouseInFk"
|
||||||
@update:model-value="searchFn()"
|
|
||||||
:options="warehousesOptions"
|
:options="warehousesOptions"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
option-label="name"
|
option-label="name"
|
||||||
|
@ -184,7 +220,6 @@ const decrement = (paramsObj, key) => {
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('supplier.pageTitles.supplier')"
|
:label="t('supplier.pageTitles.supplier')"
|
||||||
v-model="params.cargoSupplierFk"
|
v-model="params.cargoSupplierFk"
|
||||||
@update:model-value="searchFn()"
|
|
||||||
:options="suppliersOptions"
|
:options="suppliersOptions"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
option-label="name"
|
option-label="name"
|
||||||
|
@ -200,7 +235,6 @@ const decrement = (paramsObj, key) => {
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('params.continent')"
|
:label="t('params.continent')"
|
||||||
v-model="params.continent"
|
v-model="params.continent"
|
||||||
@update:model-value="searchFn()"
|
|
||||||
:options="continentsOptions"
|
:options="continentsOptions"
|
||||||
option-value="code"
|
option-value="code"
|
||||||
option-label="name"
|
option-label="name"
|
||||||
|
|
Loading…
Reference in New Issue