forked from verdnatura/salix-front
refs #7172 fix vnSelectFilter
This commit is contained in:
parent
f60670cb87
commit
904f647a5b
|
@ -36,8 +36,6 @@ const claimFilter = {
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
const workers = ref([]);
|
|
||||||
const workersCopy = ref([]);
|
|
||||||
const claimStates = ref([]);
|
const claimStates = ref([]);
|
||||||
const claimStatesCopy = ref([]);
|
const claimStatesCopy = ref([]);
|
||||||
const workersOptions = ref([]);
|
const workersOptions = ref([]);
|
||||||
|
@ -47,25 +45,6 @@ function setClaimStates(data) {
|
||||||
claimStatesCopy.value = data;
|
claimStatesCopy.value = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
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) => {
|
||||||
|
@ -87,7 +66,6 @@ const statesFilter = {
|
||||||
:filter="{ where: { role: 'salesPerson' } }"
|
:filter="{ where: { role: 'salesPerson' } }"
|
||||||
@on-fetch="(data) => (workersOptions = data)"
|
@on-fetch="(data) => (workersOptions = data)"
|
||||||
auto-load
|
auto-load
|
||||||
limit="30"
|
|
||||||
/>
|
/>
|
||||||
<FetchData url="ClaimStates" @on-fetch="setClaimStates" auto-load />
|
<FetchData url="ClaimStates" @on-fetch="setClaimStates" auto-load />
|
||||||
<FormModel
|
<FormModel
|
||||||
|
@ -115,29 +93,6 @@ 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
|
|
||||||
v-model="data.workerFk"
|
|
||||||
:options="workers"
|
|
||||||
option-value="id"
|
|
||||||
option-label="name"
|
|
||||||
emit-value
|
|
||||||
:label="t('claim.basicData.assignedTo')"
|
|
||||||
map-options
|
|
||||||
use-input
|
|
||||||
@filter="(value, update) => filter(value, update, workerFilter)"
|
|
||||||
:rules="validate('claim.claimStateFk')"
|
|
||||||
:input-debounce="0"
|
|
||||||
>
|
|
||||||
<template #before>
|
|
||||||
<QAvatar color="orange">
|
|
||||||
<QImg
|
|
||||||
v-if="data.workerFk"
|
|
||||||
:src="`/api/Images/user/160x160/${data.workerFk}/download?access_token=${token}`"
|
|
||||||
spinner-color="white"
|
|
||||||
/>
|
|
||||||
</QAvatar>
|
|
||||||
</template>
|
|
||||||
</QSelect> -->
|
|
||||||
<VnSelectFilter
|
<VnSelectFilter
|
||||||
:label="t('claim.basicData.assignedTo')"
|
:label="t('claim.basicData.assignedTo')"
|
||||||
v-model="data.workerFk"
|
v-model="data.workerFk"
|
||||||
|
@ -146,7 +101,7 @@ const statesFilter = {
|
||||||
option-label="name"
|
option-label="name"
|
||||||
emit-value
|
emit-value
|
||||||
auto-load
|
auto-load
|
||||||
@filter="(value, update) => filter(value, update, workerFilter)"
|
:virtual-scroll-slice-size="workersOptions.length"
|
||||||
:rules="validate('claim.claimStateFk')"
|
:rules="validate('claim.claimStateFk')"
|
||||||
>
|
>
|
||||||
<template #before>
|
<template #before>
|
||||||
|
|
Loading…
Reference in New Issue