Merge branch 'dev' into feature/ItemDiary
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Javier Segarra 2024-05-02 08:28:00 +00:00
commit e4f787f2fa
2 changed files with 9 additions and 31 deletions

View File

@ -169,6 +169,7 @@ watch(modelValue, (newValue) => {
ref="vnSelectRef" ref="vnSelectRef"
:class="{ required: $attrs.required }" :class="{ required: $attrs.required }"
:rules="$attrs.required ? [requiredFieldRule] : null" :rules="$attrs.required ? [requiredFieldRule] : null"
virtual-scroll-slice-size="options.length"
> >
<template v-if="isClearable" #append> <template v-if="isClearable" #append>
<QIcon <QIcon

View File

@ -2,7 +2,7 @@
import { ref } from 'vue'; import { ref } from 'vue';
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import VnSelect from 'src/components/common/VnSelect.vue';
import FetchData from 'components/FetchData.vue'; import FetchData from 'components/FetchData.vue';
import FormModel from 'components/FormModel.vue'; import FormModel from 'components/FormModel.vue';
import VnRow from 'components/ui/VnRow.vue'; import VnRow from 'components/ui/VnRow.vue';
@ -37,8 +37,6 @@ const claimFilter = {
], ],
}; };
const workers = ref([]);
const workersCopy = ref([]);
const claimStates = ref([]); const claimStates = ref([]);
const claimStatesCopy = ref([]); const claimStatesCopy = ref([]);
const optionsList = ref([]); const optionsList = ref([]);
@ -47,6 +45,7 @@ function setWorkers(data) {
workers.value = data; workers.value = data;
workersCopy.value = data; workersCopy.value = data;
} }
const workersOptions = ref([]);
function setClaimStates(data) { function setClaimStates(data) {
claimStates.value = data; claimStates.value = data;
@ -68,25 +67,6 @@ async function getEnumValues() {
getEnumValues(); getEnumValues();
const workerFilter = {
options: workers,
filterFn: (options, value) => {
const search = value.toLowerCase();
if (value === '') return workersCopy.value;
return options.value.filter((row) => {
const id = row.id;
const name = row.name.toLowerCase();
const idMatches = id == search;
const nameMatches = name.indexOf(search) > -1;
return idMatches || nameMatches;
});
},
};
const statesFilter = { const statesFilter = {
options: claimStates, options: claimStates,
filterFn: (options, value) => { filterFn: (options, value) => {
@ -106,7 +86,7 @@ const statesFilter = {
<FetchData <FetchData
url="Workers/activeWithInheritedRole" url="Workers/activeWithInheritedRole"
:filter="{ where: { role: 'salesPerson' } }" :filter="{ where: { role: 'salesPerson' } }"
@on-fetch="setWorkers" @on-fetch="(data) => (workersOptions = data)"
auto-load auto-load
/> />
<FetchData url="ClaimStates" @on-fetch="setClaimStates" auto-load /> <FetchData url="ClaimStates" @on-fetch="setClaimStates" auto-load />
@ -135,18 +115,15 @@ const statesFilter = {
</VnRow> </VnRow>
<VnRow class="row q-gutter-md q-mb-md"> <VnRow class="row q-gutter-md q-mb-md">
<div class="col"> <div class="col">
<QSelect <VnSelect
:label="t('claim.basicData.assignedTo')"
v-model="data.workerFk" v-model="data.workerFk"
:options="workers" :options="workersOptions"
option-value="id" option-value="id"
option-label="name" option-label="name"
emit-value emit-value
:label="t('claim.basicData.assignedTo')" auto-load
map-options
use-input
@filter="(value, update) => filter(value, update, workerFilter)"
:rules="validate('claim.claimStateFk')" :rules="validate('claim.claimStateFk')"
:input-debounce="0"
> >
<template #before> <template #before>
<QAvatar color="orange"> <QAvatar color="orange">
@ -157,7 +134,7 @@ const statesFilter = {
/> />
</QAvatar> </QAvatar>
</template> </template>
</QSelect> </VnSelect>
</div> </div>
<div class="col"> <div class="col">
<QSelect <QSelect