This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2025-08-05 17:46:43 +07:00
parent 41c453cd23
commit 9b03f29353
4 changed files with 175 additions and 28 deletions

View file

@ -24,6 +24,7 @@ const pageSize = ref<number>(10) // จำนวนแถวต่อหน้
const total = ref<number>(0) //
const maxPage = ref<number>(1) //
const filter = ref<string>('') //search data table
const isLoading = ref<boolean>(false) //
/**
* งก api เปลยนหน
@ -38,19 +39,15 @@ async function changePage(pageVal: number, pageSizeVal: number, key: string) {
await functionFetch()
}
/**
* งกนสำหรบดงขอมลตามประเภทแทบทเลอก
*/
/** ฟังก์ชันสำหรับดึงข้อมูลตามประเภทแท็บที่เลือก*/
async function functionFetch() {
stores.rows = []
stores.tab === 'history' ? await fetchlistHistory() : await fetchlistTime()
}
/***
* งกนดงขอมลรายการประวการลงเวลา
*/
/** ฟังก์ชั่นดึงข้อมูลรายการประวัติการลงเวลา*/
async function fetchlistHistory() {
showLoader()
isLoading.value = true
await http
.get(
config.API.history() +
@ -72,7 +69,7 @@ async function fetchlistHistory() {
messageError($q, err)
})
.finally(() => {
hideLoader()
isLoading.value = false
})
}
@ -80,7 +77,7 @@ async function fetchlistHistory() {
* งกนดงรายการลงเวลากรณเศษ
*/
async function fetchlistTime() {
showLoader()
isLoading.value = true
await http
.get(
config.API.historyTime() +
@ -104,7 +101,7 @@ async function fetchlistTime() {
messageError($q, err)
})
.finally(() => {
hideLoader()
isLoading.value = false
})
}
@ -193,6 +190,7 @@ onMounted(() => {
@update:change-page="changePage"
:max-page="maxPage"
:tab="stores.tab"
:is-loading="isLoading"
/>
</q-tab-panel>
@ -211,6 +209,7 @@ onMounted(() => {
@update:change-page="changePage"
:max-page="maxPage"
:tab="stores.tab"
:is-loading="isLoading"
/>
</q-tab-panel>
</q-tab-panels>