แก้ stroe ลา

This commit is contained in:
Warunee Tamkoo 2024-01-16 11:28:22 +07:00
parent 0b2bb5f252
commit 97976d193d

View file

@ -263,7 +263,7 @@ export const useLeaveStore = defineStore("Leave", () => {
const salary = ref<number>(0) //เงินเดือนปัจจุบัน
const salaryText = ref<string>("") //เงินเดือนปัจจุบัน(ภาษาไทย)
const leaveLast = ref<any>()
const restDayCurrentTotal = ref<string>("")
const restDayCurrentTotal = ref<number>(0)
//ดึงข้อมูล profile จาก API
async function fetchProfile() {
@ -287,7 +287,7 @@ export const useLeaveStore = defineStore("Leave", () => {
salary.value = data.salary ? data.salary.toLocaleString("th-TH") : ""
salaryText.value = data.salaryText
leaveLast.value = data.leaveLast != "0001-01-01T00:00:00" ? date2Thai(data.leaveLast) : "-"
restDayCurrentTotal.value = data.restDayCurrentTotal
restDayCurrentTotal.value = Number(data.leaveLimit) - Number(data.restDayTotalOld)
})
.catch((e: any) => {
messageError($q, e)
@ -307,6 +307,7 @@ export const useLeaveStore = defineStore("Leave", () => {
dateAppoint.value = data.dateAppoint // วันที่รับราชการ
salary.value = data.salary ? data.salary.toLocaleString("th-TH") : ""
salaryText.value = data.salaryText
restDayCurrentTotal.value = Number(data.leaveLimit) - Number(data.restDayTotalOld)
})
.catch((e: any) => {
messageError($q, e)
@ -340,7 +341,7 @@ export const useLeaveStore = defineStore("Leave", () => {
salary.value = 0
salaryText.value = ""
leaveLast.value = undefined
restDayCurrentTotal.value = ""
restDayCurrentTotal.value = 0
}
return {