#6943 - Customer module find salesPersons out of first get #711
|
@ -38,6 +38,10 @@ const $props = defineProps({
|
|||
type: [Array],
|
||||
default: () => [],
|
||||
},
|
||||
exprBuilder: {
|
||||
type: Function,
|
||||
default: null,
|
||||
},
|
||||
isClearable: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
|
@ -179,6 +183,8 @@ async function fetchFilter(val) {
|
|||
}, {});
|
||||
} else defaultWhere = { [key]: getVal(val) };
|
||||
const where = { ...(val ? defaultWhere : {}), ...$props.where };
|
||||
if (typeof $props.exprBuilder === 'function')
|
||||
|
||||
Object.assign(where, $props.exprBuilder(key, val));
|
||||
const fetchOptions = { where, include, limit };
|
||||
if (fields) fetchOptions.fields = fields;
|
||||
if (sortBy) fetchOptions.order = sortBy;
|
||||
|
|
|
@ -16,19 +16,19 @@ const { t } = useI18n();
|
|||
const businessTypes = ref([]);
|
||||
const contactChannels = ref([]);
|
||||
const title = ref();
|
||||
const handleSalesModelValue = (val) => {
|
||||
filter.value.and[1] = {
|
||||
or: [
|
||||
{ name: val },
|
||||
{ nickname: { like: '%' + val + '%' } },
|
||||
{ code: { like: `${val}%` } },
|
||||
],
|
||||
const handleSalesModelValue = (val) => ({
|
||||
or: [
|
||||
alexm
commented
No hay que dar por hecho una estructura del where, puede dar problemas No hay que dar por hecho una estructura del where, puede dar problemas
jsegarra
commented
Lo revisamos porque ni con mergeWhere, ni mergeFilter, ni mergeFields En otor momento revisamos la solución Lo revisamos porque ni con mergeWhere, ni mergeFilter, ni mergeFields
El problema es que o bien la variable val está vacia o no recoge el ultimo cambio del VnSelect filter
En otor momento revisamos la solución
|
||||
{ name: val },
|
||||
{ nickname: { like: '%' + val + '%' } },
|
||||
{ code: { like: `${val}%` } },
|
||||
],
|
||||
});
|
||||
|
||||
const exprBuilder = (param, value) => {
|
||||
return {
|
||||
and: [{ active: { neq: false } }, handleSalesModelValue(value)],
|
||||
};
|
||||
};
|
||||
|
||||
const filter = ref({
|
||||
and: [{ active: { neq: false } }],
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
<FetchData
|
||||
|
@ -109,11 +109,10 @@ const filter = ref({
|
|||
:params="{
|
||||
departmentCodes: ['VT', 'shopping'],
|
||||
}"
|
||||
:where="filter"
|
||||
:fields="['id', 'nickname']"
|
||||
sort-by="nickname ASC"
|
||||
:rules="validate('client.salesPersonFk')"
|
||||
@filter="handleSalesModelValue"
|
||||
:expr-builder="exprBuilder"
|
||||
emit-value
|
||||
auto-load
|
||||
>
|
||||
|
|
Loading…
Reference in New Issue
if (typeof $props.exprBuilder)
Mi no entender, y el editor tampoco