From f78a5c78df797205e94d336618c746099dfb70e2 Mon Sep 17 00:00:00 2001 From: setthawutttty Date: Fri, 8 Sep 2023 09:52:07 +0700 Subject: [PATCH] =?UTF-8?q?validate=20=E0=B9=81=E0=B8=9A=E0=B8=9A=E0=B8=A3?= =?UTF-8?q?=E0=B8=B2=E0=B8=A2=E0=B8=87=E0=B8=B2=E0=B8=99=E0=B8=81=E0=B8=B2?= =?UTF-8?q?=E0=B8=A3=E0=B8=9B=E0=B8=A3=E0=B8=B0=E0=B9=80=E0=B8=A1=E0=B8=B4?= =?UTF-8?q?=E0=B8=99=E0=B8=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../probation/FormEvaluation/FormReport.vue | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/modules/05_placement/components/probation/FormEvaluation/FormReport.vue b/src/modules/05_placement/components/probation/FormEvaluation/FormReport.vue index 33a29dda5..b5be6affb 100644 --- a/src/modules/05_placement/components/probation/FormEvaluation/FormReport.vue +++ b/src/modules/05_placement/components/probation/FormEvaluation/FormReport.vue @@ -7,7 +7,7 @@ import http from "@/plugins/http"; import config from "@/app.config"; const $q = useQuasar(); -const myForm = ref(); +const myForm = ref(null); const mixin = useCounterMixin(); const router = useRouter(); const { @@ -18,6 +18,7 @@ const { showLoader, hideLoader, dialogConfirm, + dialogMessageNotify } = mixin; const route = useRoute(); const assignId = ref(route.params.form.toString()); @@ -28,9 +29,13 @@ const mentors = ref([]); const commander = ref([]); const status = ref(true); -const saveEdit = (id: string) => { - dialogConfirm($q, async () => { - await postData("put"); +const saveEdit = async (id: string) => { + await myForm.value.validate().then((result: boolean) => { + if (result) { + dialogConfirm($q, async () => await postData("put")); + }else { + dialogMessageNotify($q, "กรุณากรอกข้อมูลให้ครบ"); + } }); }; const edit = () => { @@ -49,7 +54,6 @@ const fecthAssign = async (id: string) => { await http .get(config.API.evaluateReportcreate(id)) .then((res) => { - console.log(res); // assign.value = res.data.data.assign; mentors.value = res.data.data.mentors; // date_start.value = assign.value.date_start; @@ -87,7 +91,6 @@ const fecthResult = async (id: string) => { .then(async (res: any) => { if (res.data.data != null) { const data = await res.data.data.evaluate; - console.log("data ===>", data); // fullname.value = res.data.data.profile.name; date_start.value = data.date_start; @@ -127,9 +130,11 @@ const director_id3 = ref(null); const optionDirector = ref([]); const savaForm = async () => { - await myForm.value!.validate().then((result: boolean) => { + await myForm.value.validate().then((result: boolean) => { if (result) { dialogConfirm($q, async () => await postData("post")); + }else { + dialogMessageNotify($q, "กรุณากรอกข้อมูลให้ครบ"); } }); }; @@ -419,6 +424,7 @@ const selectRuslt = () => {
+ { class="bg-white" type="textarea" v-model="reson" + lazy-rules label="เหตุผล" - :rules="[(val) => !!val || 'กรุณาระบุเหตุผล']" + :rules="[(val) => !!val && val.length > 0 || 'กรุณาระบุเหตุผล']" />