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