รายการโครงการ => เพิ่ม Dialogconfrim

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-07-03 16:28:40 +07:00
parent ca213d6c76
commit efc6b4db98

View file

@ -28,8 +28,13 @@ import { useCounterMixin } from "@/stores/mixin";
/** use*/
const $q = useQuasar();
const router = useRouter();
const { showLoader, hideLoader, messageError, dialogMessageNotify } =
useCounterMixin();
const {
showLoader,
hideLoader,
messageError,
dialogMessageNotify,
dialogConfirm,
} = useCounterMixin();
const node = ref<any>([]);
const expanded = ref<string[]>([]);
@ -177,19 +182,21 @@ function closeDialog() {
/** dialog submit */
async function onSubmit() {
if (formProject.nodeId) {
await showLoader();
await http
.post(config.API.developmentMain, formProject)
.then((res) => {
router.push(`/development/${res.data.result}`);
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
await closeDialog();
await hideLoader();
});
dialogConfirm($q, async () => {
await showLoader();
await http
.post(config.API.developmentMain, formProject)
.then(async (res) => {
await closeDialog();
await router.push(`/development/${res.data.result}`);
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
});
} else {
dialogMessageNotify($q, "กรุณาเลือกหน่วยงานที่รับผิดชอบ");
}
@ -513,7 +520,7 @@ onMounted(() => {
<q-dialog persistent v-model="modal">
<q-card flat bordered style="min-width: 60vw">
<q-form greedy @submit.prevent @validation-success="onSubmit">
<q-form greedy @submit.prevent @validation-success="onSubmit()">
<DialogHeader
tittle="เพิ่มโครงการ/หลักสูตรการฝึกอบรม"
:close="closeDialog"