diff --git a/src/modules/05_leave/componenst/Forms/01_SickForm.vue b/src/modules/05_leave/componenst/Forms/01_SickForm.vue index c3d1f27..37a530d 100644 --- a/src/modules/05_leave/componenst/Forms/01_SickForm.vue +++ b/src/modules/05_leave/componenst/Forms/01_SickForm.vue @@ -36,13 +36,16 @@ const formDataSick = reactive({ leaveEndDate: null, halfDay: "day", leaveTotal: "", - leaveLast: "", + leaveLast: null, leaveNumber: "", leaveAddress: "", leaveDetail: "", leaveDocument: [], }) +//แปลง leaveLast ด้วย Date2thai +const leave2Thai = dataStore.leaveLast != null ? date2Thai(dataStore.leaveLast) : null + /** ตัวแปร ref สำหรับแสดง validate */ const leaveWroteRef = ref(null) const leaveStartDateRef = ref(null) @@ -320,7 +323,7 @@ const isReadOnly = computed(() => { outlined ref="leaveLastRef" for="leaveLastRef" - v-model="dataStore.leaveLast" + v-model="leave2Thai" label="ลาครั้งสุดท้ายเมื่อวันที่" readonly hide-bottom-space diff --git a/src/modules/05_leave/componenst/Forms/03_Birth.vue b/src/modules/05_leave/componenst/Forms/03_Birth.vue index 6618216..1d5d330 100644 --- a/src/modules/05_leave/componenst/Forms/03_Birth.vue +++ b/src/modules/05_leave/componenst/Forms/03_Birth.vue @@ -42,6 +42,9 @@ const formDataBirth = reactive({ leaveDocument: [], }) +//แปลง leaveLast ด้วย Date2thai +const leave2Thai = dataStore.leaveLast != null ? date2Thai(dataStore.leaveLast) : null + /** ตัวแปร ref สำหรับแสดง validate */ const leaveWroteRef = ref(null) const leaveStartDateRef = ref(null) @@ -287,7 +290,7 @@ async function saveFormData() { outlined ref="leaveLastRef" for="leaveLastRef" - v-model="dataStore.leaveLast" + v-model="leave2Thai" label="ลาครั้งสุดท้ายเมื่อวันที่" readonly hide-bottom-space diff --git a/src/modules/05_leave/componenst/Forms/Form.vue b/src/modules/05_leave/componenst/Forms/Form.vue index 8d7935b..e1825a4 100644 --- a/src/modules/05_leave/componenst/Forms/Form.vue +++ b/src/modules/05_leave/componenst/Forms/Form.vue @@ -70,9 +70,9 @@ onMounted(async () => { - + - + diff --git a/src/modules/05_leave/store.ts b/src/modules/05_leave/store.ts index 9341b67..fd250e2 100644 --- a/src/modules/05_leave/store.ts +++ b/src/modules/05_leave/store.ts @@ -229,7 +229,7 @@ export const useLeaveStore = defineStore("Leave", () => { const dateSendLeave = ref() //วันที่ยื่นใบลา const leaveTypeName = ref("") //Name ประเภทการลา const dear = ref("") //เรียน - const fullname = ref("") //คำนำหน้า ชื่อ นามสกุล ผู้ยื่นขอ + const fullName = ref("") //คำนำหน้า ชื่อ นามสกุล ผู้ยื่นขอ const positionName = ref("") //ตำแหน่งผู้ยื่นขอ const positionLevelName = ref("") //ระดับผู้ยื่นขอ const organizationName = ref("") //สังกัดผู้ยื่นขอ @@ -241,7 +241,7 @@ export const useLeaveStore = defineStore("Leave", () => { const dateAppoint = ref() //วันที่เข้ารับราชการ const salary = ref(0) //เงินเดือนปัจจุบัน const salaryText = ref("") //เงินเดือนปัจจุบัน(ภาษาไทย) - const leaveLast = ref("") + const leaveLast = ref() const restDayCurrentTotal = ref("") //ดึงข้อมูล profile จาก API @@ -254,7 +254,7 @@ export const useLeaveStore = defineStore("Leave", () => { dateSendLeave.value = data.dateSendLeave leaveTypeName.value = data.leaveTypeName dear.value = data.dear - fullname.value = data.fullname + fullName.value = data.fullName positionName.value = data.positionName positionLevelName.value = data.positionLevelName organizationName.value = data.organizationName @@ -266,7 +266,7 @@ export const useLeaveStore = defineStore("Leave", () => { dateAppoint.value = data.dateAppoint salary.value = data.salary salaryText.value = data.salaryText - leaveLast.value = data.leaveLast + leaveLast.value = data.leaveLast && date2Thai(data.leaveLast) restDayCurrentTotal.value = data.restDayCurrentTotal console.log(data) }) @@ -303,7 +303,7 @@ export const useLeaveStore = defineStore("Leave", () => { dateSendLeave, leaveTypeName, dear, - fullname, + fullName, positionName, positionLevelName, organizationName,