fix: refs #7323 load all opts
This commit is contained in:
parent
c6db81ddb5
commit
e780dcda05
src/pages/Worker/Card
|
@ -12,9 +12,12 @@ import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
const workersOptions = ref([]);
|
const educationLevels = ref([]);
|
||||||
const countriesOptions = ref([]);
|
const countries = ref([]);
|
||||||
const educationLevelsOptions = ref([]);
|
const maritalStatus = [
|
||||||
|
{ code: 'M', name: t('Married') },
|
||||||
|
{ code: 'S', name: t('Single') },
|
||||||
|
];
|
||||||
|
|
||||||
const workerFilter = {
|
const workerFilter = {
|
||||||
include: [
|
include: [
|
||||||
|
@ -29,44 +32,21 @@ const workerFilter = {
|
||||||
{ relation: 'department', scope: { include: { relation: 'department' } } },
|
{ 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>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
<FetchData
|
||||||
:filter="workersFilter"
|
:filter="{ fields: ['id', 'name'], order: 'name ASC' }"
|
||||||
@on-fetch="(data) => (workersOptions = data)"
|
@on-fetch="(data) => (educationLevels = 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)"
|
|
||||||
auto-load
|
auto-load
|
||||||
url="EducationLevels"
|
url="EducationLevels"
|
||||||
/>
|
/>
|
||||||
|
<FetchData
|
||||||
|
url="Countries"
|
||||||
|
:filter="{ fields: ['id', 'name'], order: 'name ASC' }"
|
||||||
|
@on-fetch="(data) => (countries = data)"
|
||||||
|
auto-load
|
||||||
|
/>
|
||||||
<FormModel
|
<FormModel
|
||||||
:filter="workerFilter"
|
:filter="workerFilter"
|
||||||
:url="`Workers/${route.params.id}`"
|
:url="`Workers/${route.params.id}`"
|
||||||
|
@ -90,7 +70,7 @@ const maritalStatus = [
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('Boss')"
|
:label="t('Boss')"
|
||||||
:options="workersOptions"
|
url="Workers/search"
|
||||||
hide-selected
|
hide-selected
|
||||||
option-label="nickname"
|
option-label="nickname"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
|
@ -121,7 +101,7 @@ const maritalStatus = [
|
||||||
<VnRow>
|
<VnRow>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('Origin country')"
|
:label="t('Origin country')"
|
||||||
:options="countriesOptions"
|
:options="countries"
|
||||||
hide-selected
|
hide-selected
|
||||||
option-label="name"
|
option-label="name"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
|
@ -129,7 +109,7 @@ const maritalStatus = [
|
||||||
/>
|
/>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
:label="t('Education level')"
|
:label="t('Education level')"
|
||||||
:options="educationLevelsOptions"
|
:options="educationLevels"
|
||||||
hide-selected
|
hide-selected
|
||||||
option-label="name"
|
option-label="name"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
|
|
Loading…
Reference in New Issue