From 477b8e999cee9937f2d0263dc7fb96caeb20e118 Mon Sep 17 00:00:00 2001 From: setthawutttty Date: Wed, 13 Sep 2023 17:03:17 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=80=E0=B9=80=E0=B8=81=E0=B9=89=20validate?= =?UTF-8?q?=20=E0=B9=80=E0=B9=80=E0=B8=A5=E0=B9=89=E0=B8=A7=20input=20?= =?UTF-8?q?=E0=B8=A5=E0=B8=AD=E0=B8=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/1_Proposals/addProposals.vue | 24 +++++++++++-------- .../components/3_result/DialogForm.vue | 2 +- .../components/4_Allocate/DialogForm.vue | 23 ++++++++++++++---- .../08_registryEmployee/views/Assessment.vue | 2 +- .../08_registryEmployee/views/Discipline.vue | 2 +- .../08_registryEmployee/views/Education.vue | 2 +- .../views/Information/Address.vue | 2 +- .../views/Information/Certicate.vue | 2 +- .../views/Information/Family.vue | 2 +- .../views/Information/Information.vue | 2 +- .../views/Information/Tempinformation.vue | 2 +- .../08_registryEmployee/views/Leave.vue | 2 +- .../08_registryEmployee/views/Other.vue | 2 +- .../08_registryEmployee/views/Talent.vue | 2 +- .../08_registryEmployee/views/Train.vue | 2 +- .../08_registryEmployee/views/Work.vue | 2 +- .../10_order/components/step/step02.vue | 2 +- 17 files changed, 47 insertions(+), 30 deletions(-) diff --git a/src/modules/07_insignia/components/1_Proposals/addProposals.vue b/src/modules/07_insignia/components/1_Proposals/addProposals.vue index 0375d325a..23ebbdd74 100644 --- a/src/modules/07_insignia/components/1_Proposals/addProposals.vue +++ b/src/modules/07_insignia/components/1_Proposals/addProposals.vue @@ -15,6 +15,7 @@ const { hideLoader, dialogConfirm, success, + dialogMessageNotify } = mixin; const router = useRouter(); const route = useRoute(); @@ -106,22 +107,25 @@ const editData = async (id: string) => { console.log(formData); }; const checkSave = () => { - dialogConfirm($q, () => SaveData()); -}; -const SaveData = async () => { if (myForm.value !== null) { myForm.value.validate().then(async (success) => { if (success) { - if (edit.value) { - await editData(id.value); - } else { - await addData(); - clickBack(); - } + dialogConfirm($q, () => SaveData()); + }else { + dialogMessageNotify($q,"กรุณาเลือกรอบการเสนอขอพระราชทานเครื่องราชฯ") } - }); + }) } }; +const SaveData = async () => { + if (edit.value) { + await editData(id.value); + } else { + await addData(); + clickBack(); + } +}; + const updateDateRange = () => { if (roundInsig.value.value == 1) { dateStart.value = new Date(new Date().getFullYear(), 9, 1); diff --git a/src/modules/07_insignia/components/3_result/DialogForm.vue b/src/modules/07_insignia/components/3_result/DialogForm.vue index e5b50659c..2b847d30c 100644 --- a/src/modules/07_insignia/components/3_result/DialogForm.vue +++ b/src/modules/07_insignia/components/3_result/DialogForm.vue @@ -278,7 +278,7 @@ const searchcardid = () => {
(); +const myForm = ref(null); //form data input const mixin = useCounterMixin(); -const { dialogConfirm } = mixin; +const { dialogConfirm,dialogMessageNotify } = mixin; const router = useRouter(); const routeName = router.currentRoute.value.name; const amount = ref(); @@ -42,8 +42,18 @@ watch(props, () => { }); const clickSave = () => { - dialogConfirm($q, () => props.save(grandCross.value, amount.value)); + if (myForm.value !== null) { + myForm.value.validate().then(async (success) => { + if (success) { + dialogConfirm($q, () => props.save(grandCross.value, amount.value)); + }else { + dialogMessageNotify($q,"กรุณาข้อมูลให้ครบ") + } + }) + } }; + +