no message

This commit is contained in:
setthawutttty 2024-10-31 14:59:41 +07:00
parent 49d54b38eb
commit 8be5a28594

View file

@ -25,6 +25,7 @@ const mixin = useCounterMixin();
const { messageError, success, dialogConfirm, showLoader, hideLoader } = mixin;
const route = useRoute();
const assignId = ref<string>("baa3d9f6-9d21-4c58-85f2-114abf8de25c");
const status = ref<boolean>(true);
const answer1 = ref<string>("");
@ -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();
});
</script>
<template>