From 3266ef9a579783ec1998bb48ad028ecd097c231c Mon Sep 17 00:00:00 2001 From: "STW_TTTY\\stwtt" Date: Fri, 26 Apr 2024 11:32:58 +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=B8=95=E0=B8=B1=E0=B8=A7=E0=B8=8A=E0=B8=B5=E0=B9=89=E0=B8=A7?= =?UTF-8?q?=E0=B8=B1=E0=B8=94=E0=B8=95=E0=B8=B2=E0=B8=A1=E0=B9=81=E0=B8=9C?= =?UTF-8?q?=E0=B8=99=E0=B8=AF=20noti?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../indicatorByPlan/IndicatorByPlan.vue | 64 +++++++++++-------- 1 file changed, 39 insertions(+), 25 deletions(-) diff --git a/src/modules/14_KPI/components/indicatorByPlan/IndicatorByPlan.vue b/src/modules/14_KPI/components/indicatorByPlan/IndicatorByPlan.vue index 590dbfdd6..c90313790 100644 --- a/src/modules/14_KPI/components/indicatorByPlan/IndicatorByPlan.vue +++ b/src/modules/14_KPI/components/indicatorByPlan/IndicatorByPlan.vue @@ -18,7 +18,14 @@ const route = useRoute(); const router = useRouter(); const store = usePositionEmp(); const mixin = useCounterMixin(); -const { dialogConfirm, showLoader, hideLoader, messageError, success } = mixin; +const { + dialogConfirm, + showLoader, + hideLoader, + messageError, + success, + dialogMessageNotify, +} = mixin; const id = ref(route.params.id ? route.params.id.toLocaleString() : ""); @@ -211,30 +218,37 @@ function updateSelectedAgency(data: any, isUpdate: boolean = false) { /**function ยืนยันการบันทึกข้อมูล */ function onSubmit() { - dialogConfirm( - $q, - async () => { - showLoader(); - // editStatus.value ? editData(id.value) : addData(); - try { - const url = editStatus.value - ? config.API.kpiPlanById(id.value) - : config.API.kpiPlan; - const method = editStatus.value ? "put" : "post"; - const res = await http[method](url, planData); - success($q, "บันทึกข้อมูลสำเร็จ"); - editStatus.value - ? fetchDataById(id.value) - : router.push(`/KPI-indicator-plan/${res.data.result}`); - } catch (e) { - messageError($q, e); - } finally { - hideLoader(); - } - }, - "ยืนยันการบันทึกข้อมูล", - "ต้องการยืนยันการบันทึกข้อมูลนี้หรือไม่ ?" - ); + if (planData.nodeId == null || planData.strategyId == "") { + dialogMessageNotify( + $q, + `กรุณาเลือกหน่วยงาน/ส่วนราชการ หรือ ยุทธศาสตร์ / แผน` + ); + } else { + dialogConfirm( + $q, + async () => { + showLoader(); + // editStatus.value ? editData(id.value) : addData(); + try { + const url = editStatus.value + ? config.API.kpiPlanById(id.value) + : config.API.kpiPlan; + const method = editStatus.value ? "put" : "post"; + const res = await http[method](url, planData); + success($q, "บันทึกข้อมูลสำเร็จ"); + editStatus.value + ? fetchDataById(id.value) + : router.push(`/KPI-indicator-plan/${res.data.result}`); + } catch (e) { + messageError($q, e); + } finally { + hideLoader(); + } + }, + "ยืนยันการบันทึกข้อมูล", + "ต้องการยืนยันการบันทึกข้อมูลนี้หรือไม่ ?" + ); + } } /**