เพิ่มตัวชี้วัดตามแผนฯ noti

This commit is contained in:
STW_TTTY\stwtt 2024-04-26 11:32:58 +07:00
parent b9b89e99e7
commit 3266ef9a57

View file

@ -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<string>(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();
}
},
"ยืนยันการบันทึกข้อมูล",
"ต้องการยืนยันการบันทึกข้อมูลนี้หรือไม่ ?"
);
}
}
/**