From 5450a034b71cfdee9eabb2b46d441d72c0bf8d1e Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Fri, 14 Mar 2025 09:33:36 +0700 Subject: [PATCH] =?UTF-8?q?fix=20ConverDate=20=E0=B9=80=E0=B8=87=E0=B8=B4?= =?UTF-8?q?=E0=B8=99=E0=B9=80=E0=B8=94=E0=B8=B7=E0=B8=AD=E0=B8=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/01_Salary/DialogFormMain.vue | 36 ++++++++----------- .../02_salaryEmployee/DialogEmployeeChart.vue | 8 ++++- .../02_salaryEmployee/DialogEmployeeRate.vue | 8 ++--- .../components/03_salaryRound/DialogForm.vue | 5 +-- .../DialogAddPerson.vue | 1 - .../13_salary/views/03_salaryRound.vue | 8 ++--- 6 files changed, 32 insertions(+), 34 deletions(-) diff --git a/src/modules/13_salary/components/01_Salary/DialogFormMain.vue b/src/modules/13_salary/components/01_Salary/DialogFormMain.vue index 0f065dad7..7482e93a1 100644 --- a/src/modules/13_salary/components/01_Salary/DialogFormMain.vue +++ b/src/modules/13_salary/components/01_Salary/DialogFormMain.vue @@ -26,6 +26,7 @@ const { hideLoader, messageError, success, + convertDateToAPI, } = useCounterMixin(); const modal = defineModel("modal", { required: true }); @@ -77,9 +78,7 @@ const title = computed(() => { return name; }); -/** - * fiunction fetch ข้อมูลประเภทตำแหน่ง - */ +/** fiunction fetch ข้อมูลประเภทตำแหน่ง*/ function fetchPosType() { http .get(config.API.salaryPosType) @@ -97,9 +96,7 @@ function fetchPosType() { }); } -/** - * fiunction fetch ข้อมูลระดับตำแหน่ง - */ +/** fiunction fetch ข้อมูลระดับตำแหน่ง*/ function fetchPosLevel(id: string) { const filterLevel = posType.value.find((e: SalaryPosType) => e.id === id); const listOption = @@ -144,9 +141,7 @@ function fetchSalaryDetail(id: string) { }); } -/** - * callbackFunction ทำการ fetch ข้อมูลไฟล์เมื่อเปิด Dialog - */ +/**callbackFunction ทำการ fetch ข้อมูลไฟล์เมื่อเปิด Dialog*/ watch( () => modal.value, async () => { @@ -167,17 +162,13 @@ watch( } ); -/** - * function ปืด Dialog - */ +/** function ปืด Dialog*/ function closeDialog() { modal.value = !modal.value; clearFormData(); } -/** - * function เคลียข้อมูล form - */ +/** function เคลียข้อมูล form*/ function clearFormData() { formData.name = ""; formData.posTypeId = ""; @@ -191,9 +182,7 @@ function clearFormData() { isReadonly.value = false; } -/** - * function บันทึกข้อมูลผังบัญชีเงินเดือน - */ +/** function บันทึกข้อมูลผังบัญชีเงินเดือน*/ function onSubmit() { dialogConfirm($q, async () => { showLoader(); @@ -202,7 +191,12 @@ function onSubmit() { props.typeAction === "add" ? config.API.salaryChart : config.API.salaryChartByid(salaryId.value); - await http[props.typeAction === "add" ? "post" : "put"](url, formData); + await http[props.typeAction === "add" ? "post" : "put"](url, { + ...formData, + date: convertDateToAPI(formData.date), + startDate: convertDateToAPI(formData.startDate), + endDate: convertDateToAPI(formData.endDate), + }); await props.fetchData?.(); await success($q, "บันทีกข้อมูลสำเร็จ"); closeDialog(); @@ -214,9 +208,7 @@ function onSubmit() { }); } -/** - * function checkEndDate - */ +/** function checkEndDate*/ function checkEndDate() { if (formData.endDate !== null && formData.startDate !== null) { if (formData.endDate < formData.startDate) { diff --git a/src/modules/13_salary/components/02_salaryEmployee/DialogEmployeeChart.vue b/src/modules/13_salary/components/02_salaryEmployee/DialogEmployeeChart.vue index 3a4863a0c..206d0e005 100644 --- a/src/modules/13_salary/components/02_salaryEmployee/DialogEmployeeChart.vue +++ b/src/modules/13_salary/components/02_salaryEmployee/DialogEmployeeChart.vue @@ -22,6 +22,7 @@ const { hideLoader, messageError, success, + convertDateToAPI, } = useCounterMixin(); /** props*/ @@ -85,7 +86,12 @@ function onSubmit() { const url = !props.isStatusEdit ? config.API.salaryEmployeeChart : config.API.salaryEmployeeChartByid(props.data.id); - await http[!props.isStatusEdit ? "post" : "put"](url, formData); + await http[!props.isStatusEdit ? "post" : "put"](url, { + ...formData, + date: convertDateToAPI(formData.date), + startDate: convertDateToAPI(formData.startDate), + endDate: convertDateToAPI(formData.endDate), + }); await props.fetchData?.(); success($q, "บันทีกข้อมูลสำเร็จ"); closeDialog(); diff --git a/src/modules/13_salary/components/02_salaryEmployee/DialogEmployeeRate.vue b/src/modules/13_salary/components/02_salaryEmployee/DialogEmployeeRate.vue index 9b900cb52..bc8774302 100644 --- a/src/modules/13_salary/components/02_salaryEmployee/DialogEmployeeRate.vue +++ b/src/modules/13_salary/components/02_salaryEmployee/DialogEmployeeRate.vue @@ -156,8 +156,8 @@ const getClass = (val: boolean) => { v-model="formData.salaryNo" label="ลำดับชั้น" :rules="[ - (val) => !!val || 'กรุณากรอกลำดับชั้น', - (val) => + (val:number) => !!val || 'กรุณากรอกลำดับชั้น', + (val:number) => Number(val) === Math.floor(val) || Number(val) === Math.floor(val) + 0.5 || `กรุณากรอกจำนวนเต็มเท่านั้ หรือ .5`, @@ -179,7 +179,7 @@ const getClass = (val: boolean) => { mask="###,###,###,###" reverse-fill-mask :rules="[ - (val) => + (val:string) => !!val || `${'กรุณากรอกอัตราค่าจ้าง/ขั้นวิ่ง (รายเดือน)'}`, ]" lazy-rules @@ -201,7 +201,7 @@ const getClass = (val: boolean) => { lazy-rules hide-bottom-space :rules="[ - (val) => + (val:string) => !!val || `${'กรุณากรอกอัตราค่าจ้าง/ขั้นวิ่ง (รายวัน)'}`, ]" /> diff --git a/src/modules/13_salary/components/03_salaryRound/DialogForm.vue b/src/modules/13_salary/components/03_salaryRound/DialogForm.vue index e2a3171dc..f1e7f10ce 100644 --- a/src/modules/13_salary/components/03_salaryRound/DialogForm.vue +++ b/src/modules/13_salary/components/03_salaryRound/DialogForm.vue @@ -22,11 +22,12 @@ const { success, showLoader, hideLoader, + convertDateToAPI, } = useCounterMixin(); /** props*/ const modal = defineModel("modal", { required: true }); -const effective = defineModel("effective", { +const effective = defineModel("effective", { required: true, }); const isRead = defineModel("isRead", { required: true }); @@ -79,7 +80,7 @@ function onSubmit() { const body = { period: period.value, isActive: isActive.value, - effectiveDate: effective.value, + effectiveDate: convertDateToAPI(effective.value), year: year.value, }; try { diff --git a/src/modules/13_salary/components/05_salaryListsEmployee/DialogAddPerson.vue b/src/modules/13_salary/components/05_salaryListsEmployee/DialogAddPerson.vue index ec61c618e..e292c7ec5 100644 --- a/src/modules/13_salary/components/05_salaryListsEmployee/DialogAddPerson.vue +++ b/src/modules/13_salary/components/05_salaryListsEmployee/DialogAddPerson.vue @@ -146,7 +146,6 @@ function onClickAddPerson(data: DataPerson) { const body: DataPersonReq = { id: store.groupId, type: store.tabType, - ...data, }; diff --git a/src/modules/13_salary/views/03_salaryRound.vue b/src/modules/13_salary/views/03_salaryRound.vue index 555e057bb..9d0df2222 100644 --- a/src/modules/13_salary/views/03_salaryRound.vue +++ b/src/modules/13_salary/views/03_salaryRound.vue @@ -211,12 +211,12 @@ function editPopup(data: RowList, status: string) { function dialogClose(id: string) { dialogConfirm( $q, - () => { + async () => { showLoader(); - http + await http .get(config.API.salaryPeriod() + `/close/${id}`) - .then(() => { - getData(); + .then(async () => { + await getData(); success($q, "ลบข้อมูลสำเร็จ"); }) .catch((e) => {