diff --git a/src/views/HistoryView.vue b/src/views/HistoryView.vue
index aa19cea..a2f007f 100644
--- a/src/views/HistoryView.vue
+++ b/src/views/HistoryView.vue
@@ -7,6 +7,7 @@ import http from '@/plugins/http'
import config from '@/app.config'
import { useChekIn } from '@/stores/chekin'
import { useCounterMixin } from '@/stores/mixin'
+import { calculateFiscalYear } from '@/utils/function'
import TableHistory from '@/components/TableHistory.vue' //ตารางประวัติการลงเวลา
import ToolBar from '@/components/ToolBar.vue' // เมนู Herder
@@ -17,8 +18,9 @@ const stores = useChekIn()
const { showLoader, hideLoader, messageError } = useCounterMixin()
const { fetchHistoryList } = stores
-const year = ref(new Date().getFullYear()) // ปีงบปรมาณ
+const year = ref(calculateFiscalYear(new Date())) // ปีงบปรมาณ
const month = ref(new Date().getMonth()) // เดือน
+const year2 = ref(new Date().getFullYear()) // ปีงบปรมาณ
const page = ref(1) // หน้าปัจจุบัน
const pageSize = ref(10) // จำนวนแถวต่อหน้า
const total = ref(0) // จำนวนทั้งหมด
@@ -81,7 +83,7 @@ async function fetchlistTime() {
await http
.get(
config.API.historyTime() +
- `?year=${year.value}&month=${month.value + 1}&page=${
+ `?year=${year2.value}&month=${month.value + 1}&page=${
page.value
}&pageSize=${pageSize.value}&keyword=${
filter.value ? filter.value : ''
@@ -111,9 +113,8 @@ async function fetchlistTime() {
* @param m เดือนที่ต้องการอัปเดต
*/
async function updateYear(y: number, m: number) {
- year.value = y
+ stores.tab === 'history' ? (year.value = y) : (year2.value = y)
month.value = m
- stores.year = y
await functionFetch() // เรียกใช้งานฟังก์ชัน functionFetch เพื่อดึงข้อมูลใหม่
}
@@ -127,15 +128,8 @@ watch(
() => {
page.value = 1
filter.value = ''
- functionFetch()
}
)
-/**
- * Hook
- */
-onMounted(() => {
- functionFetch()
-})