From e0a16671ddfc675f804c77ab044af634a38c7d7d Mon Sep 17 00:00:00 2001 From: AnandaTon Date: Wed, 13 Dec 2023 10:05:17 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=81=E0=B8=81=E0=B9=89=E0=B9=84=E0=B8=82?= =?UTF-8?q?=E0=B8=95=E0=B8=B1=E0=B8=A7=E0=B9=81=E0=B8=9B=E0=B8=A3=E0=B8=A5?= =?UTF-8?q?=E0=B8=B2=E0=B8=84=E0=B8=A3=E0=B8=B1=E0=B9=89=E0=B8=87=E0=B8=AA?= =?UTF-8?q?=E0=B8=B8=E0=B8=94=E0=B8=97=E0=B9=89=E0=B8=B2=E0=B8=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/05_leave/componenst/Forms/01_SickForm.vue | 7 +++++-- src/modules/05_leave/componenst/Forms/03_Birth.vue | 5 ++++- src/modules/05_leave/componenst/Forms/Form.vue | 4 ++-- src/modules/05_leave/store.ts | 10 +++++----- 4 files changed, 16 insertions(+), 10 deletions(-) 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,