รายการลา => ปรับ paging
This commit is contained in:
parent
acd1c97d77
commit
5d05c19c50
3 changed files with 11 additions and 0 deletions
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue