From 8be5a28594ea58ee3cc41e18cb0597480f0fd992 Mon Sep 17 00:00:00 2001 From: setthawutttty Date: Thu, 31 Oct 2024 14:59:41 +0700 Subject: [PATCH] no message --- src/modules/15_probationReport/views/main.vue | 55 ++++++++++--------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/src/modules/15_probationReport/views/main.vue b/src/modules/15_probationReport/views/main.vue index 44b90b6..5b2d002 100644 --- a/src/modules/15_probationReport/views/main.vue +++ b/src/modules/15_probationReport/views/main.vue @@ -25,6 +25,7 @@ const mixin = useCounterMixin(); const { messageError, success, dialogConfirm, showLoader, hideLoader } = mixin; const route = useRoute(); +const assignId = ref("baa3d9f6-9d21-4c58-85f2-114abf8de25c"); const status = ref(true); const answer1 = ref(""); @@ -55,32 +56,32 @@ async function getSurveyData() { /** save ข้อมูล */ async function save() { -// await myForm.value!.validate().then((result: boolean) => { -// if (result && answer3.value !== 0) { -// const data = { -// answer1: answer1.value, -// answer2: answer2.value, -// answer3: answer3.value, -// }; -// dialogConfirm($q, async () => { -// showLoader(); -// await http -// .post(config.API.summarySurveyDetail(assignId.value), data) -// .then((res: any) => { -// success($q, "บันทึกสำเร็จ"); -// getSurveyData(); -// }) -// .catch((e: any) => { -// messageError($q, e); -// }) -// .finally(() => { -// hideLoader(); -// }); -// }); -// } else if (answer3.value == 0) { -// classBordered.value = "border_custom"; -// } -// }); + await myForm.value!.validate().then((result: boolean) => { + if (result && answer3.value !== 0) { + const data = { + answer1: answer1.value, + answer2: answer2.value, + answer3: answer3.value, + }; + dialogConfirm($q, async () => { + showLoader(); + await http + .post(config.API.summarySurveyDetail(assignId.value), data) + .then((res: any) => { + success($q, "บันทึกสำเร็จ"); + getSurveyData(); + }) + .catch((e: any) => { + messageError($q, e); + }) + .finally(() => { + hideLoader(); + }); + }); + } else if (answer3.value == 0) { + classBordered.value = "border_custom"; + } + }); } /** ถ้าเป็น 0 ใส่ class */ watch(answer3, () => { @@ -91,7 +92,7 @@ watch(answer3, () => { /** get ค่า เมื่อโหลดหน้า */ onMounted(() => { - // getSurveyData(); + getSurveyData(); });