ปรับค้นงานปีงบประมาณ ประวัติการลงเวลา

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2023-11-29 17:46:19 +07:00
parent a51042d48a
commit 9aef54609d
5 changed files with 134 additions and 10 deletions

View file

@ -7,6 +7,7 @@ const { date2Thai } = mixin
/** store for checkin history*/
export const useChekIn = defineStore('checkin', () => {
const year = ref<number>(new Date().getFullYear())
const rows = ref<Datalist[]>()
/**
@ -90,6 +91,7 @@ export const useChekIn = defineStore('checkin', () => {
return {
rows,
year,
fetchHistoryList,
classColorStatus,
}

View file

@ -267,8 +267,54 @@ export const useCounterMixin = defineStore('mixin', () => {
})
}
function monthYear2Thai(month: number, year: number, isFullMonth = false) {
const date = new Date(`${year}-${month + 1}-1`)
const fullMonthThai = [
'มกราคม',
'กุมภาพันธ์',
'มีนาคม',
'เมษายน',
'พฤษภาคม',
'มิถุนายน',
'กรกฎาคม',
'สิงหาคม',
'กันยายน',
'ตุลาคม',
'พฤศจิกายน',
'ธันวาคม',
]
const abbrMonthThai = [
'ม.ค.',
'ก.พ.',
'มี.ค.',
'เม.ย.',
'พ.ค.',
'มิ.ย.',
'ก.ค.',
'ส.ค.',
'ก.ย.',
'ต.ค.',
'พ.ย.',
'ธ.ค.',
]
let dstYear = 0
if (date.getFullYear() > 2500) {
dstYear = date.getFullYear()
} else {
dstYear = date.getFullYear() + 543
}
let dstMonth = ''
if (isFullMonth) {
dstMonth = fullMonthThai[date.getMonth()]
} else {
dstMonth = abbrMonthThai[date.getMonth()]
}
return dstMonth + ' ' + dstYear
}
return {
date2Thai,
monthYear2Thai,
showLoader,
hideLoader,
covertDateObject,