เพิ่ม API

This commit is contained in:
setthawutttty 2025-03-20 13:11:03 +07:00
parent 01f0087beb
commit 71771b4b51
2 changed files with 37 additions and 3 deletions

View file

@ -14,5 +14,7 @@ export default {
`${urlFile}/file/${name}/${group}/${id}/${fileName}`,
changePassword:`${orgKeycloak}/user/change-password`,
resetPassword:`${orgKeycloak}/user/reset-password`
resetPassword:`${orgKeycloak}/user/reset-password`,
checkoutCheck:`${leave}/user/checkout-check`
}

View file

@ -13,11 +13,12 @@ import type { FormRef } from '@/interface/response/checkin'
import MapCheck from '@/components/AscGISMap.vue'
const mixin = useCounterMixin()
const { date2Thai, showLoader, hideLoader, messageError } = mixin
const { date2Thai, showLoader, hideLoader, messageError, dialogConfirm } = mixin
const $q = useQuasar()
const modalTime = ref<boolean>(false) // Dailog
const stetusCheckin = ref<boolean>(true) // ,
const checkStatus = ref<string>('')
const msgCheckTime = ref<string>('') //
const isDisabledCheckTime = ref<boolean>(false) //
@ -188,7 +189,11 @@ function validateForm() {
}
}
if (hasError.every((result) => result === true)) {
confirm()
if (stetusCheckin.value == false) {
getCheck()
} else if (stetusCheckin.value) {
confirm()
}
}
}
@ -233,6 +238,33 @@ async function confirm() {
})
}
async function getCheck() {
showLoader()
await http
.get(config.API.checkoutCheck)
.then(async (res) => {
const data = await res.data.result.status
checkStatus.value = data.toLocaleUpperCase()
if (checkStatus.value == 'ABSENT') {
dialogConfirm(
$q,
() => {
confirm()
},
'หากลงเวลาออกเวลานี้สถานะการเข้างานของคุณจะเป็นขาดราชการ',
'ยืนยันการลงเวลาออก?'
)
} else if (checkStatus.value == 'NORMAL') {
confirm()
}
})
.catch((e) => {
messageError($q, e)
})
.finally(() => {
hideLoader()
})
}
/** ปิด popup แสดงการลงเวลา*/
async function onClickConfirm() {
showLoader()