From 98d305ee48e08a0949c8d5040e4a23a1e3ea6727 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Tue, 5 Sep 2023 10:34:30 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=80=E0=B8=9E=E0=B8=B4=E0=B9=88=E0=B8=A1?= =?UTF-8?q?=E0=B9=81=E0=B8=81=E0=B9=89=E0=B9=84=E0=B8=82=20=E0=B9=81?= =?UTF-8?q?=E0=B8=9A=E0=B8=9A=E0=B8=A3=E0=B8=B2=E0=B8=A2=E0=B8=87=E0=B8=B2?= =?UTF-8?q?=E0=B8=99=E0=B8=81=E0=B8=B2=E0=B8=A3=E0=B8=9B=E0=B8=A3=E0=B8=B0?= =?UTF-8?q?=E0=B9=80=E0=B8=A1=E0=B8=B4=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 | 45 +++++++++++++------ 1 file changed, 32 insertions(+), 13 deletions(-) diff --git a/src/modules/05_placement/components/probation/FormEvaluation/FormReport.vue b/src/modules/05_placement/components/probation/FormEvaluation/FormReport.vue index 063251e89..33a29dda5 100644 --- a/src/modules/05_placement/components/probation/FormEvaluation/FormReport.vue +++ b/src/modules/05_placement/components/probation/FormEvaluation/FormReport.vue @@ -29,7 +29,9 @@ const commander = ref([]); const status = ref(true); const saveEdit = (id: string) => { - dialogConfirm($q, () => console.log("save")); + dialogConfirm($q, async () => { + await postData("put"); + }); }; const edit = () => { status.value = true; @@ -55,7 +57,7 @@ const fecthAssign = async (id: string) => { director_id.value = res.data.data.chairman.name; director_id2.value = res.data.data.commander.name; - if(mentors.value.length != 0){ + if (mentors.value.length != 0) { director_id3.value = mentors.value[0].name; } commander.value = res.data.data.commander; @@ -127,7 +129,7 @@ const optionDirector = ref([]); const savaForm = async () => { await myForm.value!.validate().then((result: boolean) => { if (result) { - dialogConfirm($q, async () => await postData()); + dialogConfirm($q, async () => await postData("post")); } }); }; @@ -157,7 +159,7 @@ const clickdownloadFile = async (type: string) => { hideLoader(); }); }; -const postData = async () => { +const postData = async (action: string) => { const data = await { start_date: date_start.value, date_finish: date_finish.value, @@ -169,15 +171,32 @@ const postData = async () => { director2_dated: director2_dated.value, expand_month: expand_month.value, }; - await http - .post(config.API.createformReport(assignId.value), data) - .then(() => { - success($q, "บันทึกสำเร็จ"); - router.push(`/probation/detail/${personalId.value}/${assignId.value}`); - }) - .catch((e: any) => { - messageError($q, e); - }); + if (action === "post") { + await http + .post(config.API.createformReport(assignId.value), data) + .then(() => { + success($q, "บันทึกสำเร็จ"); + router.push(`/probation/detail/${personalId.value}/${assignId.value}`); + }) + .catch((e: any) => { + messageError($q, e); + }); + } else if (action === "put") { + await http + .put(config.API.createformReport(assignId.value), data) + .then(() => { + success($q, "บันทึกสำเร็จ"); + router.push(`/probation/detail/${personalId.value}/${assignId.value}`); + }) + .catch((e: any) => { + messageError($q, e); + }) + .finally(() => { + status.value = false; + // fecthAssign(assignId.value); + fecthResult(assignId.value); + }); + } }; const selectRuslt = () => { if (result.value !== 3) {