From ca4c3565bd2a570f497ad5ae111c347a305078ae Mon Sep 17 00:00:00 2001 From: waruneeta Date: Thu, 9 Nov 2023 16:00:55 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B8=9B=E0=B8=A3=E0=B8=B1=E0=B8=9A=E0=B8=9F?= =?UTF-8?q?=E0=B8=AD=E0=B8=A3=E0=B9=8C=E0=B8=A1=E0=B8=81=E0=B8=B2=E0=B8=A3?= =?UTF-8?q?=E0=B8=A5=E0=B8=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../05_leave/componenst/Forms/01_SickForm.vue | 587 ++++++++++-------- .../componenst/Forms/09_StudyForm.vue | 20 +- .../componenst/Forms/10_TrainForm.vue | 20 +- .../Forms/13_RehabilitationForm.vue | 108 ++-- .../05_leave/componenst/Forms/Form.vue | 6 +- src/modules/05_leave/views/AddPage.vue | 62 +- src/stores/mixin.ts | 19 + 7 files changed, 431 insertions(+), 391 deletions(-) diff --git a/src/modules/05_leave/componenst/Forms/01_SickForm.vue b/src/modules/05_leave/componenst/Forms/01_SickForm.vue index eade6b9..b446ab5 100644 --- a/src/modules/05_leave/componenst/Forms/01_SickForm.vue +++ b/src/modules/05_leave/componenst/Forms/01_SickForm.vue @@ -1,294 +1,347 @@ + - - - - กรอกข้อมูล - + + + + กรอกข้อมูล + + + + + - - - - - + + + + + - - - - - + + + {{ year + 543 }} + + + {{ parseInt(value + 543) }} + + + + + + + + + + - - - {{ year + 543 }} - - - {{ parseInt(value + 543) }} - - - - - - - - - + + + {{ year + 543 }} + + + {{ parseInt(value + 543) }} + + + + + + + + + + + - - - {{ year + 543 }} - - - {{ parseInt(value + 543) }} - - - - - - - - - - + - + - + - + + + + + - - - - - + + + + เอกสารเพิ่มเติม + + + + + + + + {{ file.name }} + + + + + + + + + + + + - - - เอกสารเพิ่มเติม - - - - - - - {{ file.name }} - - - - - - - - - - - - - - - - - - + + + + + + + diff --git a/src/modules/05_leave/componenst/Forms/09_StudyForm.vue b/src/modules/05_leave/componenst/Forms/09_StudyForm.vue index 4a2123a..2822191 100644 --- a/src/modules/05_leave/componenst/Forms/09_StudyForm.vue +++ b/src/modules/05_leave/componenst/Forms/09_StudyForm.vue @@ -5,7 +5,7 @@ import type { FormRef09 } from "@/modules/05_leave/interface/request/AddAbsence" import { useQuasar } from "quasar"; const $q = useQuasar(); const mixin = useCounterMixin(); -const { date2Thai, dialogConfirm ,arabicNumberToText} = mixin; +const { date2Thai, dialogConfirm ,arabicNumberToText, calculateDurationYmd} = mixin; const edit = ref(true); const props = defineProps({ data: { @@ -96,23 +96,7 @@ function onSubmit() { "ต้องการยืนยันการบันทึกข้อมูลนี้หรือไม่ ?" ); } -function calculateDuration(startDate: string | null, endDate: string | null) { - if (startDate && endDate) { - const start = new Date(startDate); - const end = new Date(endDate); - const duration = end.getTime() - start.getTime(); // ระยะเวลาในมิลลิวินาที - - const days = Math.floor(duration / (1000 * 60 * 60 * 24)); - const months = Math.floor(duration / (1000 * 60 * 60 * 24 * 30.44)); - const years = Math.floor(duration / (1000 * 60 * 60 * 24 * 30.44 * 12)); - - // return `${days} วัน, ${months} เดือน, ${years} ปี`; - return `${years} ปี, ${months} เดือน, ${days} วัน`; - } - - return ""; -} const formattedSalary = computed(() => { return formData.salary !== null ? formData.salary.toLocaleString("th-TH") @@ -334,7 +318,7 @@ const formattedSalary = computed(() => { > ระยะเวลา {{ - calculateDuration(formData.dateLeaveStart, formData.dateLeaveEnd) + calculateDurationYmd(formData.dateLeaveStart, formData.dateLeaveEnd) }}