From 4959e0847eb7cea7993c9909d2df5cf0fc75f2ef Mon Sep 17 00:00:00 2001 From: setthawutttty Date: Tue, 26 Sep 2023 16:08:56 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=81=E0=B8=81=E0=B9=89=E0=B9=84=E0=B8=82?= =?UTF-8?q?=20=E0=B8=81=E0=B8=A3=E0=B8=93=E0=B8=B5=20=E0=B9=81=E0=B8=81?= =?UTF-8?q?=E0=B9=89=E0=B9=84=E0=B8=82=20+=20=E0=B8=A2=E0=B8=81=E0=B9=80?= =?UTF-8?q?=E0=B8=A5=E0=B8=B4=E0=B8=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/AppointMent/Detail.vue | 26 +++++++++------- .../05_placement/components/Other/Detail.vue | 30 +++++++++++++------ .../components/Receive/receiveDetail2.vue | 2 +- .../components/Repatriate/RepatriatebyId.vue | 1 + .../components/Transfer/transferRegistry.vue | 1 + .../helpgovernment/governmentDetail.vue | 21 ++++++++----- 6 files changed, 54 insertions(+), 27 deletions(-) diff --git a/src/modules/05_placement/components/AppointMent/Detail.vue b/src/modules/05_placement/components/AppointMent/Detail.vue index bbfc18a7f..d17576708 100644 --- a/src/modules/05_placement/components/AppointMent/Detail.vue +++ b/src/modules/05_placement/components/AppointMent/Detail.vue @@ -6,7 +6,7 @@ import { useCounterMixin } from "@/stores/mixin"; import CurrencyInput from "@/components/CurruncyInput.vue"; import type { ResponseTitle } from "@/modules/05_placement/interface/response/Receive"; import type { appointmentData,ResponseData } from "@/modules/05_placement/interface/response/AppointMent"; - +import type { QForm } from "quasar"; import http from "@/plugins/http"; import config from "@/app.config"; @@ -21,7 +21,7 @@ prefixId:"", firstname:"", lastname:"" }); -const myform = ref(); +const myForm = ref(null); const edit = ref(false); const profileId = ref(""); const organizationPositionOld = ref(""); @@ -87,12 +87,18 @@ const fecthappointmentByid = async () => { //ยืนยันการเเก้ไข const clickSave = async () => { - await myform.value.validate().then(async (success: boolean) => { - if (success) { - dialogConfirm($q, () => putAppointment()); - } else { - } - }); + if (myForm.value !== null) { + myForm.value.validate().then((success: any) => { + if (success) { + dialogConfirm( + $q, + async () => await putAppointment(), + "ต้องการแก้ไขข้อมูลหรือไม่?", + "แก้ไขข้อมูลเพื่อลงบัญชีแนบท้าย" + ); + } + }); + } }; // เเก้ไขข้อมูล const putAppointment = async () => { @@ -127,7 +133,7 @@ const putAppointment = async () => { const cancel = () => { edit.value = false fecthappointmentByid() - + myForm.value?.resetValidation() } const getClass = (val: boolean) => { return { @@ -210,7 +216,7 @@ onMounted(async () => {
- +
วุฒิการศึกษา
diff --git a/src/modules/05_placement/components/Other/Detail.vue b/src/modules/05_placement/components/Other/Detail.vue index e6c1a0d78..9a01409d2 100644 --- a/src/modules/05_placement/components/Other/Detail.vue +++ b/src/modules/05_placement/components/Other/Detail.vue @@ -55,7 +55,7 @@ const responseData = ref({ const edit = ref(false); const organizationPositionOld = ref(""); const positionTypeOld = ref(""); -const myform = ref(); +const myForm = ref(null); const positionLevelOld = ref(""); const posNo = ref(""); const salary = ref(0); @@ -111,13 +111,20 @@ const fecthOther = async () => { //-----(edit)-----// const clickEdit = async () => { - await myform.value.validate().then(async (success: boolean) => { - if (success) { - dialogConfirm($q, () => saveOther()); - } else { - } - }); + if (myForm.value !== null) { + myForm.value.validate().then((success: any) => { + if (success) { + dialogConfirm( + $q, + async () => await saveOther(), + "ต้องการแก้ไขข้อมูลหรือไม่?", + "แก้ไขข้อมูลเพื่อลงบัญชีแนบท้าย" + ); + } + }); + } }; + //-----(update)-----// const saveOther = async () => { let data = { @@ -145,6 +152,11 @@ const saveOther = async () => { await fecthOther(); }); }; +const cancel = () => { + edit.value = false; + fecthOther(); + myForm.value?.resetValidation() +}; const getClass = (val: boolean) => { return { "full-width inputgreen cursor-pointer": val, @@ -227,12 +239,12 @@ onMounted(async () => { + style="width: 80px" @click="cancel()" />
- +
diff --git a/src/modules/05_placement/components/Receive/receiveDetail2.vue b/src/modules/05_placement/components/Receive/receiveDetail2.vue index 781d36267..5e1fed1b8 100644 --- a/src/modules/05_placement/components/Receive/receiveDetail2.vue +++ b/src/modules/05_placement/components/Receive/receiveDetail2.vue @@ -272,7 +272,7 @@ const cancel = async () => { edit.value = !edit.value; if (myForm.value !== null) { await getData(); - myForm.value.reset(); + myForm.value?.resetValidation() } }; diff --git a/src/modules/05_placement/components/Repatriate/RepatriatebyId.vue b/src/modules/05_placement/components/Repatriate/RepatriatebyId.vue index 078c0d091..0c4e99784 100644 --- a/src/modules/05_placement/components/Repatriate/RepatriatebyId.vue +++ b/src/modules/05_placement/components/Repatriate/RepatriatebyId.vue @@ -108,6 +108,7 @@ const conditionSave = async () => { const cancelBtn = () => { edit.value = !edit; getData(); + myForm.value?.resetValidation() }; const saveData = async () => { const body = { diff --git a/src/modules/05_placement/components/Transfer/transferRegistry.vue b/src/modules/05_placement/components/Transfer/transferRegistry.vue index 75ffd404d..d8a04f6f9 100644 --- a/src/modules/05_placement/components/Transfer/transferRegistry.vue +++ b/src/modules/05_placement/components/Transfer/transferRegistry.vue @@ -277,6 +277,7 @@ const saveData = async () => { const cancel = () => { edit.value = false getData() + myForm.value?.resetValidation() } const getClass = (val: boolean) => { return { diff --git a/src/modules/05_placement/components/helpgovernment/governmentDetail.vue b/src/modules/05_placement/components/helpgovernment/governmentDetail.vue index 5a465dc3e..22546fcf8 100644 --- a/src/modules/05_placement/components/helpgovernment/governmentDetail.vue +++ b/src/modules/05_placement/components/helpgovernment/governmentDetail.vue @@ -89,17 +89,24 @@ const getClass = (val: boolean) => { }; // const conditionSave = async () => { - dialogConfirm( - $q, - async () => await saveData(), - "ต้องการแก้ไขข้อมูลหรือไม่?", - "แก้ไขข้อมูลเพื่อลงบัญชีแนบท้าย" - ); + if (myForm.value !== null) { + myForm.value.validate().then((success: any) => { + if (success) { + dialogConfirm( + $q, + async () => await saveData(), + "ต้องการแก้ไขข้อมูลหรือไม่?", + "แก้ไขข้อมูลเพื่อลงบัญชีแนบท้าย" + ); + } + }); + } }; const cancelBtn = () => { edit.value = !edit; getData(); + myForm.value?.resetValidation() }; const saveData = async () => { const body = { @@ -201,7 +208,7 @@ onMounted(async () => {
- +