From e4835425c02a0df2faf69ab487a2ae1fff8c0bf0 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Fri, 1 Mar 2024 13:12:21 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B8=9C=E0=B8=B1=E0=B8=87=E0=B8=9A=E0=B8=B1?= =?UTF-8?q?=E0=B8=8D=E0=B8=8A=E0=B8=B5=E0=B9=80=E0=B8=87=E0=B8=B4=E0=B8=99?= =?UTF-8?q?=E0=B9=80=E0=B8=94=E0=B8=B7=E0=B8=AD=E0=B8=99=20=3D>=20validate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/SalaryChart/DialogFormMain.vue | 45 +++++++++++++++---- 1 file changed, 36 insertions(+), 9 deletions(-) diff --git a/src/modules/13_salary/components/SalaryChart/DialogFormMain.vue b/src/modules/13_salary/components/SalaryChart/DialogFormMain.vue index 38ada04f5..f2855fac0 100644 --- a/src/modules/13_salary/components/SalaryChart/DialogFormMain.vue +++ b/src/modules/13_salary/components/SalaryChart/DialogFormMain.vue @@ -8,7 +8,7 @@ import config from "@/app.config"; import type { DataOption, ObjectSalaryRef, - FormData + FormData, } from "@/modules/13_salary/interface/index/Main"; import type { SalaryPosType, @@ -63,9 +63,9 @@ const formData = reactive({ const salaryTypeRef = ref(null); const posTypeRef = ref(null); const posLevelRef = ref(null); -const dateRef = ref(null); -const startDateRef = ref(null); -const endDateRef = ref(null); +const dateRef = ref(null); +const startDateRef = ref(); +const endDateRef = ref(); const ObjectRef: ObjectSalaryRef = { salaryType: salaryTypeRef, @@ -169,11 +169,11 @@ watch( if (salaryPosTypeOption.value.length === 0) { await fetchPosType(); } - if (props.typeAction === "add") { - formData.date = new Date() - formData.startDate = new Date() - formData.endDate = new Date() - } + // if (props.typeAction === "add") { + // formData.date = new Date(); + // formData.startDate = new Date(); + // formData.endDate = new Date(); + // } if (props.typeAction === "edit") { await showLoader(); if (props.data) { @@ -251,6 +251,33 @@ function checkEndDate() { } } +watch( + () => formData.date, + () => { + if (formData.date) { + dateRef.value.resetValidation(); + } + } +); + +watch( + () => formData.startDate, + () => { + if (formData.startDate) { + startDateRef.value.resetValidation(); + } + } +); + +watch( + () => formData.endDate, + () => { + if (formData.endDate) { + endDateRef.value.resetValidation(); + } + } +); + /** * function เรียกไฟล์ PDF * @param url link PDF