ปรับแก้ไข เปลี่ยนแปลงรอบ
This commit is contained in:
parent
9100062af6
commit
ea614b07c2
3 changed files with 106 additions and 39 deletions
|
|
@ -150,7 +150,7 @@ export const useChangeRoundDataStore = defineStore(
|
|||
roundStart: e.startTimeMorning,
|
||||
roundEnd: e.leaveTimeAfterNoon,
|
||||
currentRound: `${e.startTimeMorning}-${e.leaveTimeAfterNoon}`,
|
||||
effectiveDate: date2Thai(e.effectiveDate),
|
||||
effectiveDate: date2Thai(e.effectiveDate) ?? "-",
|
||||
}));
|
||||
console.log(profileId.value);
|
||||
console.log(apiData.length);
|
||||
|
|
@ -171,7 +171,9 @@ export const useChangeRoundDataStore = defineStore(
|
|||
const rowsHistory = ref<historyShow[]>([]);
|
||||
// paging
|
||||
const page = ref<number>(1);
|
||||
const total = ref<number>(0);
|
||||
const pageSize = ref<number>(10);
|
||||
const maxPage = ref<number>(0);
|
||||
const filter = ref<string>(""); //search data table
|
||||
/**
|
||||
* ฟังก์ชั่น api เปลี่ยนหน้า
|
||||
|
|
@ -183,19 +185,19 @@ export const useChangeRoundDataStore = defineStore(
|
|||
pageSize.value = await pageSizeVal;
|
||||
fetchDatainHistory();
|
||||
}
|
||||
|
||||
/**ฟังก์ชั่นดึงดาต้าประวัติ */
|
||||
async function fetchDatainHistory() {
|
||||
console.log(profileId.value);
|
||||
showLoader();
|
||||
await http
|
||||
.post(
|
||||
config.API.leaveRoundById(profileId.value),
|
||||
{
|
||||
page: page.value,
|
||||
pageSize: pageSize.value,
|
||||
keyword: filter.value,
|
||||
}
|
||||
// `?page=${page.value}&pageSize=${pageSize.value}&keyword=${filter.value}`
|
||||
.get(
|
||||
config.API.leaveRoundById(profileId.value) +
|
||||
// {
|
||||
// page: page.value,
|
||||
// pageSize: pageSize.value,
|
||||
// keyword: filter.value,
|
||||
// }
|
||||
`?page=${page.value}&pageSize=${pageSize.value}&keyword=${filter.value}`
|
||||
)
|
||||
.then((res) => {
|
||||
const dataHistory = res.data.result.data;
|
||||
|
|
@ -209,7 +211,9 @@ export const useChangeRoundDataStore = defineStore(
|
|||
effectiveDate: date2Thai(e.effectiveDate),
|
||||
reson: e.remark ?? "-",
|
||||
});
|
||||
console.log(rowsHistory.value);
|
||||
total.value = res.data.result.total;
|
||||
maxPage.value = Math.ceil(total.value / pageSize.value);
|
||||
maxPage.value = maxPage.value < 1 ? 1 : maxPage.value;
|
||||
});
|
||||
})
|
||||
.catch((err) => {
|
||||
|
|
@ -232,6 +236,8 @@ export const useChangeRoundDataStore = defineStore(
|
|||
checkCilck,
|
||||
setProfileId,
|
||||
changePage,
|
||||
total,
|
||||
maxPage,
|
||||
};
|
||||
}
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue