From 35ac3afe819c4773365f10ee7ca57f646693da90 Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 4 Aug 2023 08:57:11 +0200 Subject: [PATCH] refs #5673 fix(vnSelectFilter): update options --- src/components/common/VnSelectFilter.vue | 16 +++++++++------- src/pages/Claim/Card/ClaimDevelopment.vue | 12 ++++++++++++ 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/src/components/common/VnSelectFilter.vue b/src/components/common/VnSelectFilter.vue index 61566f777..74aa43082 100644 --- a/src/components/common/VnSelectFilter.vue +++ b/src/components/common/VnSelectFilter.vue @@ -18,22 +18,24 @@ const $props = defineProps({ }); const updateValue = (newValue) => emit('update:modelValue', newValue); -const updateOptions = (newValue) => emit('update:options', newValue); -const { modelValue } = toRefs($props); +const { modelValue, options, optionLabel } = toRefs($props); function filterFn(val, update) { update( () => { const needle = val.toLowerCase(); - console.log($props.options); // $props.options.value = options.value.filter( // (v) => v[$props.optionLabel.value].toLowerCase().indexOf(needle) > -1 // ); - updateOptions( - $props.options.filter( - (v) => v[$props.optionLabel].toLowerCase().indexOf(needle) > -1 - ) + // updateOptions( + // $props.options.filter( + // (v) => v[$props.optionLabel].toLowerCase().indexOf(needle) > -1 + // ) + // ); + const filteredOptions = options.value.filter( + (v) => v[optionLabel.value].toLowerCase().indexOf(needle) > -1 ); + emit('update:options', filteredOptions); }, (ref) => { ref.setOptionIndex(-1); diff --git a/src/pages/Claim/Card/ClaimDevelopment.vue b/src/pages/Claim/Card/ClaimDevelopment.vue index ace7b3e4d..09a655d3c 100644 --- a/src/pages/Claim/Card/ClaimDevelopment.vue +++ b/src/pages/Claim/Card/ClaimDevelopment.vue @@ -147,6 +147,12 @@ const columns = computed(() => [ :label="col.label" v-model="row[col.model]" :options="col.options" + @update:options=" + (newOptions) => { + console.log(newOptions); + col.options = newOptions; + } + " :option-value="col.optionValue" :option-label="col.optionLabel" /> @@ -166,6 +172,12 @@ const columns = computed(() => [ :label="col.label" v-model="props.row[col.model]" :options="col.options" + @update:options=" + (newOptions) => { + console.log(newOptions); + col.options = newOptions; + } + " :option-value="col.optionValue" :option-label="col.optionLabel" dense