diff --git a/src/modules/05_placement/components/AppointEmployee/AppointEmployeeDetail.vue b/src/modules/05_placement/components/AppointEmployee/AppointEmployeeDetail.vue index dbc03398e..452d173d3 100644 --- a/src/modules/05_placement/components/AppointEmployee/AppointEmployeeDetail.vue +++ b/src/modules/05_placement/components/AppointEmployee/AppointEmployeeDetail.vue @@ -8,19 +8,15 @@ import { useCounterMixin } from "@/stores/mixin"; import http from "@/plugins/http"; import config from "@/app.config"; -/** - * importType - */ +/** importType */ import type { QForm } from "quasar"; +import type { MainData } from "@/modules/05_placement/interface/index/Main"; import type { appointmentData, - ResponseData, DataProfile, } from "@/modules/05_placement/interface/response/AppointMent"; -/** - * importComponents - */ +/** importComponents*/ import CardProfile from "@/components/CardProfile.vue"; // card ข้อมูลส่วนตัว const $q = useQuasar(); @@ -38,7 +34,6 @@ const { } = mixin; const dataProfile = ref(); //ข้อมุลส่วนตัว - const appointment = ref({ citizenId: "", prefixId: "", @@ -58,17 +53,17 @@ const date = ref(null); //ดำรงตำแหน่งใน const reason = ref(""); //หมายเหตุ const status = ref(""); const fullName = ref(""); +const mianData = ref(); -/** - * fetch รายละเอียดการปรับระดับชั้นงานลูกจ้าง - */ +/** fetch รายละเอียดการปรับระดับชั้นงานลูกจ้าง*/ async function fecthappointmentByid() { showLoader(); await http .get(config.API.appointEmployeeByid(paramsId.toString())) - .then((res: ResponseData) => { + .then((res) => { dataProfile.value = res.data.result as unknown as DataProfile; const data = res.data.result; + mianData.value = res.data.result; appointment.value = data; profileId.value = data.profileId; fullName.value = `${data.prefix === null ? "" : data.prefix}${ @@ -93,9 +88,7 @@ async function fecthappointmentByid() { }); } -/** - * ยืนยันการบันทึกข้อมูลเพื่อลงบัญชีแนบท้าย - */ +/** ยืนยันการบันทึกข้อมูลเพื่อลงบัญชีแนบท้าย*/ function clickSave() { if (myForm.value !== null) { myForm.value.validate().then((result: any) => { @@ -140,27 +133,33 @@ function clickSave() { } } -/** - * ยกเลิกการบันทึกข้อมูลเพื่อลงบัญชีแนบท้าย - */ -function cancel() { +/** ยกเลิกการบันทึกข้อมูลเพื่อลงบัญชีแนบท้าย*/ +async function cancel() { edit.value = false; - fecthappointmentByid(); + const data = mianData.value; + if (data) { + educationOld.value = data.educationOld ?? "-"; + organizationPositionOld.value = data.organizationPositionOld; + positionTypeOld.value = data.positionTypeOld; + positionLevelOld.value = data.positionLevelOld; + posNo.value = data.positionNumberOld; + salary.value = data.salary ?? 0; + reason.value = data.reason; + date.value = data.positionDate; + } myForm.value?.resetValidation(); } -/** - * Class input - */ -const getClass = (val: boolean) => { +/** Class inpu*/ +function getClass(val: boolean) { return { "full-width inputgreen cursor-pointer": val, "full-width cursor-pointer": !val, }; -}; +} -onMounted(() => { - fecthappointmentByid(); +onMounted(async () => { + await fecthappointmentByid(); });