fix bug pagintion ==> ระบบเปลี่ยนแปลงรอบการปฏิบัติงานของผู้ใช้งาน

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-11-26 11:10:23 +07:00
parent 0c91be9173
commit b28f759ac7
3 changed files with 43 additions and 29 deletions

View file

@ -122,17 +122,16 @@ export const useChangeRoundDataStore = defineStore(
const maxPageMain = ref<number>(0);
const totalListMain = ref<number>(0);
function fetchDataForCardId(dataDetail: any) {
async function fetchDataForCardId(dataDetail: any) {
if (dataDetail) {
rows.value = [];
showLoader();
http
await http
.post(config.API.leaveSearch(), {
citizenId: dataDetail.cardId || "", //เลขประจำตัวประชาชน
firstname: dataDetail.firstName || "", //ชื่อจริง
lastname: dataDetail.lastName || "", //นามสกุล
page: dataDetail.page || 1, //*หน้า
pageSize: dataDetail.pageSize || 10, //*จำนวนแถวต่อหน้า
page: dataDetail.page, //หน้า
pageSize: dataDetail.pageSize || 10, //จำนวนแถวต่อหน้า
keyword: dataDetail.keyword || "", //keyword ค้นหา
})
.then((res) => {
@ -160,7 +159,7 @@ export const useChangeRoundDataStore = defineStore(
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
.finally(() => {
hideLoader();
});
}
@ -179,13 +178,13 @@ export const useChangeRoundDataStore = defineStore(
* @param pageSizeVal pagesize
*/
async function changePage(pageVal: number, pageSizeVal: number) {
page.value = await pageVal;
pageSize.value = await pageSizeVal;
page.value = pageVal;
pageSize.value = pageSizeVal;
fetchDatainHistory();
}
/**ฟังก์ชั่นดึงดาต้าประวัติ */
async function fetchDatainHistory() {
console.log(profileId.value);
rowsHistory.value = [];
showLoader();
await http
.get(
@ -194,7 +193,6 @@ export const useChangeRoundDataStore = defineStore(
)
.then((res) => {
const dataHistory = res.data.result.data;
rowsHistory.value = [];
dataHistory.map((e: DataInterface) => {
rowsHistory.value.push({
round: e.round,
@ -206,9 +204,7 @@ export const useChangeRoundDataStore = defineStore(
});
total.value = res.data.result.total;
maxPage.value = Math.ceil(total.value / pageSize.value);
maxPage.value = maxPage.value < 1 ? 1 : maxPage.value;
});
console.log(rowsHistory.value);
})
.catch((err) => {
messageError($q, err);
@ -232,6 +228,8 @@ export const useChangeRoundDataStore = defineStore(
changePage,
total,
maxPage,
page,
pageSize,
totalListMain,
maxPageMain,