refs #6280 perf: call locationFilter
gitea/salix-front/pipeline/head This commit looks good Details

This commit is contained in:
Javier Segarra 2024-01-23 12:53:21 +01:00
parent 7f24b32336
commit 37859892fa
1 changed files with 8 additions and 6 deletions

View File

@ -1,5 +1,5 @@
<script setup>
import { ref, toRefs, computed, watch } from 'vue';
import { ref, toRefs, computed, watch, onMounted } from 'vue';
import CreateNewPostcode from 'src/components/CreateNewPostcodeForm.vue';
import VnSelectCreate from 'components/common/VnSelectCreate.vue';
import FetchData from 'components/FetchData.vue';
@ -67,16 +67,19 @@ function showLabel(data) {
return `${data.code} - ${data.town}(${data.province}), ${data.country}`;
}
onMounted(() => {
locationFilter()
})
function locationFilter(search) {
let where = { limit: 30 };
const params = { search };
postcodesRef.value.fetch({ where, args: params });
let where = { search };
postcodesRef.value.fetch({ where, limit: 30});
}
function handleFetch( data) {
postcodesOptions.value = data;
}
async function onPostcodeCreated(){
postcodesRef.value.fetch();
locationFilter()
};
</script>
<template>
@ -84,7 +87,6 @@ async function onPostcodeCreated(){
ref="postcodesRef"
url="Postcodes/filter"
@on-fetch="(data) =>handleFetch(data)"
auto-load
/>
<VnSelectCreate
v-if="postcodesRef"