fix: refs #7323 load all opts
gitea/salix-front/pipeline/pr-test This commit looks good Details

This commit is contained in:
Jorge Penadés 2024-08-13 16:45:30 +02:00
parent c6db81ddb5
commit e780dcda05
1 changed files with 17 additions and 37 deletions

View File

@ -12,9 +12,12 @@ import VnSelect from 'src/components/common/VnSelect.vue';
const route = useRoute();
const { t } = useI18n();
const workersOptions = ref([]);
const countriesOptions = ref([]);
const educationLevelsOptions = ref([]);
const educationLevels = ref([]);
const countries = ref([]);
const maritalStatus = [
{ code: 'M', name: t('Married') },
{ code: 'S', name: t('Single') },
];
const workerFilter = {
include: [
@ -29,44 +32,21 @@ const workerFilter = {
{ relation: 'department', scope: { include: { relation: 'department' } } },
],
};
const workersFilter = {
fields: ['id', 'nickname'],
order: 'nickname ASC',
limit: 30,
};
const countriesFilter = {
fields: ['id', 'name', 'code'],
order: 'name ASC',
limit: 30,
};
const educationLevelsFilter = { fields: ['id', 'name'], order: 'name ASC', limit: 30 };
const maritalStatus = [
{ code: 'M', name: t('Married') },
{ code: 'S', name: t('Single') },
];
</script>
<template>
<FetchData
:filter="workersFilter"
@on-fetch="(data) => (workersOptions = data)"
auto-load
url="Workers/search"
/>
<FetchData
:filter="countriesFilter"
@on-fetch="(data) => (countriesOptions = data)"
auto-load
url="Countries"
/>
<FetchData
:filter="educationLevelsFilter"
@on-fetch="(data) => (educationLevelsOptions = data)"
:filter="{ fields: ['id', 'name'], order: 'name ASC' }"
@on-fetch="(data) => (educationLevels = data)"
auto-load
url="EducationLevels"
/>
<FetchData
url="Countries"
:filter="{ fields: ['id', 'name'], order: 'name ASC' }"
@on-fetch="(data) => (countries = data)"
auto-load
/>
<FormModel
:filter="workerFilter"
:url="`Workers/${route.params.id}`"
@ -90,7 +70,7 @@ const maritalStatus = [
<VnRow>
<VnSelect
:label="t('Boss')"
:options="workersOptions"
url="Workers/search"
hide-selected
option-label="nickname"
option-value="id"
@ -121,7 +101,7 @@ const maritalStatus = [
<VnRow>
<VnSelect
:label="t('Origin country')"
:options="countriesOptions"
:options="countries"
hide-selected
option-label="name"
option-value="id"
@ -129,7 +109,7 @@ const maritalStatus = [
/>
<VnSelect
:label="t('Education level')"
:options="educationLevelsOptions"
:options="educationLevels"
hide-selected
option-label="name"
option-value="id"