fix: select customer

This commit is contained in:
Thanaphon Saengchan 2025-09-11 13:36:09 +07:00 committed by Methapon2001
parent d89925dee9
commit c29e1d4ec5
3 changed files with 31 additions and 11 deletions

View file

@ -30,6 +30,7 @@ defineEmits<{
type ExclusiveProps = {
simple?: boolean;
simpleBranchNo?: boolean;
selectFirstValue?: boolean;
};
const props = defineProps<SelectProps<typeof getList> & ExclusiveProps>();
@ -64,10 +65,14 @@ onMounted(async () => {
setFirstValue();
}
await getSelectedOption();
valueOption.value = selectOptions.value.find((v) => v.id === value.value);
if (props.selectFirstValue) {
setDefaultValue();
} else await getSelectedOption();
});
function setDefaultValue() {
setFirstValue();
}
</script>
<template>
<SelectInput
@ -160,11 +165,9 @@ onMounted(async () => {
</template>
<template #option="{ opt, scope }">
<q-item @click="valueOption = opt" v-bind="scope.itemProps">
<q-item v-bind="scope.itemProps" class="q-mx-sm bodrder">
<SelectCustomerItem :data="opt" :simple :simple-branch-no />
</q-item>
<q-separator class="q-mx-sm" />
</template>
<template #append v-if="clearable">
@ -177,3 +180,11 @@ onMounted(async () => {
</template>
</SelectInput>
</template>
<style scoped>
.bodrder {
border-bottom: solid;
border-bottom-width: 1px;
border-color: var(--border-color);
}
</style>