This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2026-01-16 16:00:24 +07:00
parent 6aa8a61b40
commit 99cba9f3bd
5 changed files with 37 additions and 9 deletions

View file

@ -1,5 +1,5 @@
<script setup lang="ts">
import { ref, reactive } from "vue";
import { ref, reactive, computed } from "vue";
import { useQuasar } from "quasar";
import { useRouter, useRoute } from "vue-router";
@ -16,11 +16,22 @@ import type { DataOption } from "@/modules/04_registryPerson/interface/index/Mai
const $q = useQuasar();
const router = useRouter();
const route = useRoute();
const { showLoader, hideLoader, messageError, date2Thai, dateToISO } =
useCounterMixin();
const {
showLoader,
hideLoader,
messageError,
date2Thai,
dateToISO,
pathRegistryEmp,
success,
} = useCounterMixin();
//props
const modal = defineModel<boolean>("modal", { required: true });
const profileId = ref<string>(route.params.id?.toString() ?? ""); //ProfileId
const empType = ref<string>(pathRegistryEmp(route.name?.toString() ?? "")); //
const isEmployee = computed(() => empType.value !== "");
const form = reactive({
location: "",
@ -57,6 +68,7 @@ async function onSubmit() {
try {
showLoader();
const formData = new FormData();
formData.append("ProfileId", profileId.value);
formData.append("Location", form.location);
formData.append(
"ActiveDate",
@ -70,8 +82,9 @@ async function onSubmit() {
formData.append("remark", form.remark);
}
// await http.post(config.API.listtransfer(), formData);
// success($q, "");
await http.post(config.API.resignAdmin(empType.value), formData);
router.push({ name: isEmployee.value ? "resignEmployee" : "resign" });
success($q, "บันทึกข้อมูลสำเร็จ");
} catch (error) {
messageError($q, error);
} finally {
@ -82,6 +95,11 @@ async function onSubmit() {
/** function ปิด popup*/
function closeDialog() {
modal.value = false;
form.location = "";
form.activeDate = null;
form.reason = "";
form.files = null;
form.remark = "";
}
</script>

View file

@ -20,6 +20,8 @@ const { showLoader, hideLoader, messageError, success } = useCounterMixin();
//props
const modal = defineModel<boolean>("modal", { required: true });
const profileId = ref<string>(route.params.id?.toString() ?? ""); //ProfileId
const form = reactive({
tranferOrg: "",
noteReason: "",
@ -30,14 +32,16 @@ async function onSubmit() {
try {
showLoader();
const formData = new FormData();
formData.append("ProfileId", profileId.value);
formData.append("Organization", form.tranferOrg);
formData.append("Reason", form.noteReason);
if (form.files) {
formData.append("file", form.files);
}
// await http.post(config.API.listtransfer(), formData);
// success($q, "");
await http.post(config.API.transferAdmin, formData);
router.push({ name: "transfer" });
success($q, "บันทึกข้อมูลสำเร็จ");
} catch (error) {
messageError($q, error);
} finally {