refs #6694 VnLocation #154
|
@ -7,10 +7,6 @@ const emit = defineEmits(['update:modelValue', 'update:options']);
|
|||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
const { t } = useI18n();
|
||||
// const citiesLocationOptions = ref([]);
|
||||
// const provincesLocationOptions = ref([]);
|
||||
// const countriesOptions = ref([]);
|
||||
// const townsRef = ref([]);
|
||||
const postcodesOptions = ref([]);
|
||||
const postcodesRef = ref(null);
|
||||
|
||||
|
@ -72,48 +68,14 @@ function showLabel(data) {
|
|||
}
|
||||
|
||||
function locationFilter(value) {
|
||||
// if(value==='') return [];
|
||||
let where = { limit: 30 };
|
||||
const params = { value };
|
||||
postcodesRef.value.fetch({ where: Object.assign(where, params) });
|
||||
// postcodesRef.value.fetch({
|
||||
// where: {
|
||||
// or: [
|
||||
// { code: { like: '%4660%' } },
|
||||
// { 'town.name': { like: '%Alz%' } }
|
||||
// ]
|
||||
// }});
|
||||
// const townParams = { name: { like: `%${val}%` } };
|
||||
|
||||
// townsRef.value.fetch({ where: Object.assign(where, townParams) });
|
||||
}
|
||||
function handleFetch( data) {
|
||||
jsegarra marked this conversation as resolved
Outdated
|
||||
// if (from === 'towns') {
|
||||
// data = data.reduce((acc, town) => {
|
||||
// for (const postcode of town.postcodes) {
|
||||
// console.log(postcode);
|
||||
// acc.push({ ...postcode, town:{name: town.name, province: town.province} });
|
||||
// }
|
||||
|
||||
// return acc;
|
||||
// }, []);
|
||||
// }
|
||||
// console.log(from, data);
|
||||
postcodesOptions.value = data;
|
||||
}
|
||||
</script>
|
||||
<!-- let where = { limit: 30 };
|
||||
|
||||
const params = { 'town': false, 'townsFk': {like: ``} };
|
||||
where = Object.assign(where, params);
|
||||
postcodesRef.value.fetch({ where});
|
||||
} -->
|
||||
<!-- <FetchData
|
||||
ref="townsRef"
|
||||
@on-fetch="(data) => handleFetch('towns', data)"
|
||||
auto-load
|
||||
url="Towns/location"
|
||||
/> -->
|
||||
<template>
|
||||
<FetchData
|
||||
ref="postcodesRef"
|
||||
|
@ -121,18 +83,6 @@ postcodesRef.value.fetch({ where});
|
|||
@on-fetch="(data) =>handleFetch(data)"
|
||||
auto-load
|
||||
jsegarra marked this conversation as resolved
Outdated
alexm
commented
Si solo se usa una vez, llamar directamente a locationFilter Si solo se usa una vez, llamar directamente a locationFilter
jsegarra
commented
Por mantener el formato en el uso de este componente. Por mantener el formato en el uso de este componente.
Pero se puede borrar.
|
||||
/>
|
||||
<!-- <FetchData
|
||||
@on-fetch="(data) => (provincesLocationOptions = data)"
|
||||
auto-load
|
||||
url="Provinces/location"
|
||||
/>
|
||||
<FetchData
|
||||
@on-fetch="(data) => (countriesOptions = data)"
|
||||
auto-load
|
||||
url="Countries"
|
||||
/> -->
|
||||
<!-- :filter-options="['code','town.name']"
|
||||
:filter-rules="['val.length>2']" -->
|
||||
<VnSelectCreate
|
||||
jsegarra marked this conversation as resolved
Outdated
jsegarra
commented
Opcion A=> limit="30" Opcion A=> limit="30"
|
||||
v-if="postcodesRef"
|
||||
jsegarra marked this conversation as resolved
Outdated
alexm
commented
Sin auto-load y hacer con codigo per con limit Sin auto-load y hacer con codigo per con **limit**
O con auto-load pero con limit
jsegarra
commented
El limit lo tienes definido en la línea 71, es correcto? El limit lo tienes definido en la línea 71, es correcto?
alexm
commented
Si y no. Eso sirve para las demás peticiones. Si y no. Eso sirve para las demás peticiones.
Pero no da más abrir la sección te carga toda la tabla (sin limit) al estar puesto el auto-load
(Lo he probado entrando en las ramas)
|
||||
v-model="value"
|
||||
|
|
Loading…
Reference in New Issue
No veo en que momento se hace el filtrado de datos a las tablas.