From 3c0471e267046ca1bf7860e333a591e514b01858 Mon Sep 17 00:00:00 2001 From: waruneeauy Date: Thu, 26 Sep 2024 10:03:22 +0700 Subject: [PATCH] updated redirect send command --- .../components/DialogCreateCommand.vue | 64 ++++++++++++------- 1 file changed, 40 insertions(+), 24 deletions(-) diff --git a/src/modules/18_command/components/DialogCreateCommand.vue b/src/modules/18_command/components/DialogCreateCommand.vue index 674d30582..4d30e2d67 100644 --- a/src/modules/18_command/components/DialogCreateCommand.vue +++ b/src/modules/18_command/components/DialogCreateCommand.vue @@ -133,7 +133,7 @@ const columns = ref([ /** * ฟังก์ชันสร้างคำสั่งใหม่ */ -function createCommand() { +function createCommand(isRedirect: boolean) { dialogConfirm($q, async () => { const data = props.personsId; const body = { @@ -147,9 +147,12 @@ function createCommand() { .post(config.API.command, body) .then(async (res) => { const id = await res.data.result; - modal.value = false; - clearValue(); - router.push(`/command/edit/${id}`); + if (isRedirect) { + router.push(`/command/edit/${id}`); + } else { + modal.value = false; + clearValue(); + } }) .catch((e) => { messageError($q, e); @@ -163,7 +166,7 @@ function createCommand() { /** * ฟังก์ชันเพิ่มคนเข้าไปในคำสั่งที่เป็นแบบร่าง */ -function addPersonalToCommand() { +function addPersonalToCommand(isRedirect: boolean) { dialogConfirm($q, async () => { const data = props.personsId; const body = { @@ -177,7 +180,12 @@ function addPersonalToCommand() { // .then((res) => { // const id = res.data.result modal.value = false; - router.push("/command/edit/18477dcd-2f14-4e49-8fca-a446164e8b59"); + if (isRedirect) { + router.push("/command/edit/18477dcd-2f14-4e49-8fca-a446164e8b59"); + } else { + modal.value = false; + clearValue(); + } // router.push("/command/edit/" + id); // }) // .catch((e) => { @@ -189,11 +197,11 @@ function addPersonalToCommand() { }); } -function onSubmit() { +function onSubmit(isRedirect: boolean) { if (selectCreate.value === "NEW") { - createCommand(); + createCommand(isRedirect); } else { - addPersonalToCommand(); + addPersonalToCommand(isRedirect); } } @@ -288,18 +296,17 @@ watch(modal, () => {
- - -
@@ -511,12 +518,21 @@ watch(modal, () => { + บันทึกและเลือกรายชื่อต่อ + + บันทึก + บันทึกและไปยังหน้าคำสั่ง +