diff --git a/src/components/shared/select/select.ts b/src/components/shared/select/select.ts index cf1555cb..08fd88b2 100644 --- a/src/components/shared/select/select.ts +++ b/src/components/shared/select/select.ts @@ -35,13 +35,7 @@ export const createSelect = >( let previousSearch = ''; watch(value, (v) => { - if (!v) return; - - if (cache && cache.find((opt) => opt[valueField] === v)) { - valueOption.value = cache.find((opt) => opt[valueField] === v); - return; - } - + if (!v || (cache && cache.find((opt) => opt[valueField] === v))) return; getSelectedOption(); }); @@ -69,15 +63,7 @@ export const createSelect = >( const currentValue = value.value; if (!currentValue) return; - - const option = selectOptions.value.find( - (v) => v[valueField] === currentValue, - ); - - if (option) { - valueOption.value = option; - return; - } + if (selectOptions.value.find((v) => v[valueField] === currentValue)) return; if (valueOption.value && valueOption.value[valueField] === currentValue) { return selectOptions.value.unshift(valueOption.value); } diff --git a/src/pages/05_quotation/QuotationFormProductSelect.vue b/src/pages/05_quotation/QuotationFormProductSelect.vue index b2e92761..39be19e7 100644 --- a/src/pages/05_quotation/QuotationFormProductSelect.vue +++ b/src/pages/05_quotation/QuotationFormProductSelect.vue @@ -51,8 +51,6 @@ const emit = defineEmits<{ const selectedProductGroup = defineModel('selectedProductGroup', { default: '', }); - -const selectedProductGroupOption = ref(); const model = defineModel(); const inputSearch = defineModel('inputSearch'); const productGroup = defineModel('productGroup', { @@ -571,18 +569,14 @@ watch( {{ productGroup.find( (g) => g.id === selectedProductGroup, - )?.name || - selectedProductGroupOption?.name || - '-' + )?.name || '-' }} {{ productGroup.find( (g) => g.id === selectedProductGroup, - )?.code || - selectedProductGroupOption?.code || - '-' + )?.code || '-' }} @@ -868,13 +862,13 @@ watch( {{ $t('productService.group.title') }} +