รายการลา => ปรับ paging

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-04-26 17:50:42 +07:00
parent acd1c97d77
commit 5d05c19c50
3 changed files with 11 additions and 0 deletions

View file

@ -33,6 +33,7 @@ const querySting = reactive<QuerySting>({
keyword: leaveStore.filter.keyword, //keyword
});
const maxPage = ref<number>(1);
const totalList = ref<number>(0);
//** API*/
async function fecthLeaveList() {
@ -50,6 +51,7 @@ async function fecthLeaveList() {
.then((res) => {
const data = res.data.result;
maxPage.value = Math.ceil(data.total / querySting.pageSize);
totalList.value = data.total;
leaveStore.fetchListLeave(data.data); /** ส่งข้อมูลไป stores*/
})
.catch((err) => {
@ -143,6 +145,7 @@ watch(
:page="querySting.page"
:rowsPerPage="querySting.pageSize"
:maxPage="maxPage"
:totalList="totalList"
@update:querySting="updatePaging"
/>
</div>

View file

@ -33,6 +33,7 @@ const querySting = reactive<QuerySting>({
keyword: leaveStore.filter.keyword, //keyword
});
const maxPage = ref<number>(1);
const totalList = ref<number>(0);
//** API*/
async function fecthLeaveList() {
@ -50,6 +51,7 @@ async function fecthLeaveList() {
.then((res) => {
const data = res.data.result;
maxPage.value = Math.ceil(data.total / querySting.pageSize);
totalList.value = data.tatol;
fetchListLeaveReject(data.data); /** ส่งข้อมูลไป stores*/
})
.catch((err) => {
@ -96,6 +98,7 @@ onMounted(async () => {
:page="querySting.page"
:rowsPerPage="querySting.pageSize"
:maxPage="maxPage"
:totalList="totalList"
@update:querySting="updatePaging"
/>
</template>

View file

@ -202,6 +202,10 @@ const props = defineProps({
type: Number,
require: true,
},
totalList: {
type: Number,
require: true,
},
});
const emit = defineEmits(["update:querySting"]);
@ -291,6 +295,7 @@ onMounted(() => {
</q-tr>
</template>
<template v-slot:pagination="scope">
งหมด {{ totalList }} รายการ
<q-pagination
v-model="currentPage"
active-color="primary"