fix: wrong id

This commit is contained in:
Net 2024-08-14 16:02:30 +07:00
parent b2617a924f
commit bd676cc711
2 changed files with 19 additions and 5 deletions

View file

@ -62,7 +62,6 @@ const prop = withDefaults(
defineProps<{ defineProps<{
color?: 'purple' | 'green'; color?: 'purple' | 'green';
customerId: string;
customerType: CustomerType; customerType: CustomerType;
}>(), }>(),
{ {
@ -70,6 +69,8 @@ const prop = withDefaults(
}, },
); );
const customerId = defineModel<string>('customerId', { required: true });
defineEmits<{ defineEmits<{
(e: 'back'): void; (e: 'back'): void;
(e: 'viewDetail', branch: CustomerBranch, index: number): void; (e: 'viewDetail', branch: CustomerBranch, index: number): void;
@ -136,8 +137,10 @@ const branchFieldSelected = ref<
>(fieldDisplay.value); >(fieldDisplay.value);
async function fetchList() { async function fetchList() {
if (!customerId.value) return;
const result = await fetchListCustomeBranch({ const result = await fetchListCustomeBranch({
customerId: prop.customerId, customerId: customerId.value,
query: !!inputSearch.value ? inputSearch.value : undefined, query: !!inputSearch.value ? inputSearch.value : undefined,
page: currentPageBranch.value, page: currentPageBranch.value,
pageSize: pageSizeBranch.value, pageSize: pageSizeBranch.value,
@ -165,7 +168,7 @@ onMounted(async () => {
await fetchList(); await fetchList();
}); });
watch([inputSearch, currentStatus], async () => { watch([customerId, inputSearch, currentStatus], async () => {
await fetchList(); await fetchList();
}); });
</script> </script>
@ -227,7 +230,7 @@ watch([inputSearch, currentStatus], async () => {
</div> </div>
</div> </div>
<div class="row items-center justify-end col-12 col-sm q-py-sm no-wrap"> <div class="row items-center justify-end col-12 col-md q-py-sm no-wrap">
<q-input <q-input
lazy-rules="ondemand" lazy-rules="ondemand"
outlined outlined
@ -441,8 +444,19 @@ watch([inputSearch, currentStatus], async () => {
} }
" "
/> />
<q-btn
label="test"
size="sm"
dense
round
flat
@click="() => {}"
/>
</q-td> </q-td>
</q-tr> </q-tr>
<q-tr>asdadadasd</q-tr>
</template> </template>
<template #item="props"> <template #item="props">
<div class="col-12 col-md-6"> <div class="col-12 col-md-6">

View file

@ -1853,7 +1853,7 @@ const emptyCreateDialog = ref(false);
> >
<BranchPage <BranchPage
v-if="currentCustomer" v-if="currentCustomer"
:customer-id="currentCustomer.id" v-model:customer-id="currentCustomer.id"
:customer-type="currentCustomer.customerType" :customer-type="currentCustomer.customerType"
v-model:mode-view="gridView" v-model:mode-view="gridView"
@back="$router.push('/customer-management')" @back="$router.push('/customer-management')"