diff --git a/src/components/common/VnLocation.vue b/src/components/common/VnLocation.vue index e91c78430..db6f49469 100644 --- a/src/components/common/VnLocation.vue +++ b/src/components/common/VnLocation.vue @@ -7,11 +7,12 @@ 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 citiesLocationOptions = ref([]); +// const provincesLocationOptions = ref([]); +// const countriesOptions = ref([]); +// const townsRef = ref([]); const postcodesOptions = ref([]); -const postcodeFetchDataRef = ref(null); +const postcodesRef = ref(null); const $props = defineProps({ modelValue: { @@ -66,25 +67,61 @@ watch(options, (newValue) => { setOptions(newValue); }); -function showLabel(data){ - return `${data.code} - ${data.town.name}(${data.town.province.name}), ${data.town.province.country.country}`; +function showLabel(data) { + return `${data.code} - ${data.town}(${data.province}), ${data.country}`; } - +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}%` } }; -