From 9975c4176d375490e9cd68f1875ab6ad9a8063b9 Mon Sep 17 00:00:00 2001 From: Kittapath Date: Fri, 13 Oct 2023 07:57:40 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B8=AA=E0=B8=AD=E0=B8=9A=E0=B8=84=E0=B8=B1?= =?UTF-8?q?=E0=B8=94=E0=B9=80=E0=B8=A5=E0=B8=B7=E0=B8=AD=E0=B8=94validate?= =?UTF-8?q?=E0=B8=9B=E0=B8=A3=E0=B8=B0=E0=B8=A7=E0=B8=B1=E0=B8=95=E0=B8=B4?= =?UTF-8?q?=E0=B8=97=E0=B8=B3=E0=B8=87=E0=B8=B2=E0=B8=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../03_recruiting/components/Career.vue | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/modules/03_recruiting/components/Career.vue b/src/modules/03_recruiting/components/Career.vue index 20c9f86c3..ba1ae035b 100644 --- a/src/modules/03_recruiting/components/Career.vue +++ b/src/modules/03_recruiting/components/Career.vue @@ -181,7 +181,12 @@ lazy-rules :borderless="!edit" :model-value="date2Thai(startDate)" - :rules="[(val) => !!val || `${'กรุณาเลือกวันที่เริ่ม'}`]" + :rules="[ + (val) => !!val || `${'กรุณาเลือกวันที่เริ่ม'}`, + (val) => + startDate <= endDate || + `${'กรุณาเลือกวันที่เริ่มให้ถูกต้อง'}`, + ]" hide-bottom-space :label="`${'วันที่เริ่ม'}`" > @@ -228,7 +233,9 @@ :model-value="date2Thai(endDate)" :rules="[ (val) => !!val || `${'กรุณาเลือกวันที่สิ้นสุด'}`, - endDateValidation, + (val) => + startDate <= endDate || + `${'กรุณาเลือกวันที่สิ้นสุดให้ถูกต้อง'}`, ]" hide-bottom-space :label="`${'วันที่สิ้นสุด'}`" @@ -664,14 +671,6 @@ const checkDelete = (row: RequestItemsObject) => { ); }; -//validat enddate -const endDateValidation = (value: Date) => { - if (startDate.value < endDate.value) { - return true; - } - return false; -}; - /** * ลบข้อมูลใน table */ @@ -832,6 +831,7 @@ const addRow = () => { * เช็คว่ามีการแก้ไขข้อมูล */ const clickEditRow = () => { + myForm.value.validate(); editRow.value = true; };