feat: add pagination

This commit is contained in:
Methapon Metanipat 2024-10-01 09:48:03 +07:00
parent 32b51ff84b
commit fde6335706

View file

@ -225,10 +225,6 @@ const pageState = reactive({
quotationModal: false, quotationModal: false,
employeeModal: false, employeeModal: false,
productServiceModal: false, productServiceModal: false,
currentMaxPage: 1,
currentPage: 1,
pageSize: 30,
}); });
const statData = ref< const statData = ref<
@ -445,9 +441,7 @@ onMounted(async () => {
flowStore.rotate(); flowStore.rotate();
}); });
watch( async function fetchQuotationList() {
() => pageState.currentTab,
async () => {
const ret = await quotationStore.getQuotationList({ const ret = await quotationStore.getQuotationList({
page: quotationPage.value, page: quotationPage.value,
pageSize: quotationPageSize.value, pageSize: quotationPageSize.value,
@ -470,8 +464,9 @@ watch(
} }
flowStore.rotate(); flowStore.rotate();
}, }
);
watch(() => pageState.currentTab, fetchQuotationList);
</script> </script>
<template> <template>
@ -804,10 +799,10 @@ watch(
</div> </div>
<nav class="col-4 row justify-end"> <nav class="col-4 row justify-end">
<PaginationComponent <PaginationComponent
v-model:current-page="pageState.currentPage" v-model:current-page="quotationPage"
v-model:max-page="pageState.currentMaxPage" v-model:max-page="quotationPageMax"
:fetch-data="fetchQuotationList"
/> />
<!-- :fetch-data="async () => await fetchUserList()" -->
</nav> </nav>
</footer> </footer>
</div> </div>