Compare commits
No commits in common. "b21949712bac4b17c7f13bccd521bff905912a2a" and "968aa04aa99feb8637bb293a55a38fa06368a88e" have entirely different histories.
b21949712b
...
968aa04aa9
2 changed files with 5 additions and 25 deletions
|
|
@ -35,13 +35,7 @@ export const createSelect = <T extends Record<string, any>>(
|
|||
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 = <T extends Record<string, any>>(
|
|||
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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,8 +51,6 @@ const emit = defineEmits<{
|
|||
const selectedProductGroup = defineModel<string>('selectedProductGroup', {
|
||||
default: '',
|
||||
});
|
||||
|
||||
const selectedProductGroupOption = ref<ProductGroup | undefined>();
|
||||
const model = defineModel<boolean>();
|
||||
const inputSearch = defineModel<string>('inputSearch');
|
||||
const productGroup = defineModel<ProductGroup[]>('productGroup', {
|
||||
|
|
@ -571,18 +569,14 @@ watch(
|
|||
{{
|
||||
productGroup.find(
|
||||
(g) => g.id === selectedProductGroup,
|
||||
)?.name ||
|
||||
selectedProductGroupOption?.name ||
|
||||
'-'
|
||||
)?.name || '-'
|
||||
}}
|
||||
</span>
|
||||
<span class="text-caption app-text-muted">
|
||||
{{
|
||||
productGroup.find(
|
||||
(g) => g.id === selectedProductGroup,
|
||||
)?.code ||
|
||||
selectedProductGroupOption?.code ||
|
||||
'-'
|
||||
)?.code || '-'
|
||||
}}
|
||||
</span>
|
||||
</div>
|
||||
|
|
@ -868,13 +862,13 @@ watch(
|
|||
<span class="q-pr-sm">
|
||||
{{ $t('productService.group.title') }}
|
||||
</span>
|
||||
|
||||
<SelectProductGroup
|
||||
class="col-md-4 col-12"
|
||||
:class="{ 'q-mb-sm': $q.screen.lt.md }"
|
||||
id="product-group-select"
|
||||
clearable
|
||||
v-model:value="selectedProductGroup"
|
||||
v-model:value-option="selectedProductGroupOption"
|
||||
:placeholder="
|
||||
!selectedProductGroup
|
||||
? $t('general.select', {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue