From 23ab289951f35bba9f0270f406ea7077ef467824 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Thu, 2 May 2024 17:05:19 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B8=9A=E0=B8=A3=E0=B8=A3=E0=B8=88=E0=B8=B8?= =?UTF-8?q?=20=3D>=20=E0=B8=A3=E0=B8=B2=E0=B8=A2=E0=B8=81=E0=B8=B2?= =?UTF-8?q?=E0=B8=A3=20=E0=B8=AD=E0=B8=B7=E0=B9=88=E0=B8=99=E0=B9=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../05_placement/components/Other/Detail.vue | 377 +++++------------- .../components/Other/Dialogbody.vue | 94 +++-- .../05_placement/components/Other/Main.vue | 167 ++++---- .../components/Repatriate/RepatriateMain.vue | 10 +- .../components/Repatriate/RepatriatebyId.vue | 5 +- .../helpgovernment/governmentDetail.vue | 5 +- .../components/helpgovernment/mainHelp.vue | 10 +- .../interface/response/OhterMain.ts | 4 +- 8 files changed, 276 insertions(+), 396 deletions(-) diff --git a/src/modules/05_placement/components/Other/Detail.vue b/src/modules/05_placement/components/Other/Detail.vue index 95fde264e..5a44705ae 100644 --- a/src/modules/05_placement/components/Other/Detail.vue +++ b/src/modules/05_placement/components/Other/Detail.vue @@ -3,24 +3,23 @@ import { onMounted, ref } from "vue"; import { useQuasar } from "quasar"; import { useRoute, useRouter } from "vue-router"; import { useCounterMixin } from "@/stores/mixin"; +import http from "@/plugins/http"; +import config from "@/app.config"; +import keycloak from "@/plugins/keycloak"; -import type { ResponseTitle } from "@/modules/05_placement/interface/response/Receive"; import type { ResponseDataDetail } from "@/modules/05_placement/interface/response/Transfer"; import type { OtherdataInterface, resApiData, } from "@/modules/05_placement/interface/response/OhterMain"; import type { QForm } from "quasar"; +import type { DataProfile } from "@/modules/05_placement/interface/index/Main"; -import http from "@/plugins/http"; -import config from "@/app.config"; -import keycloak from "@/plugins/keycloak"; - +/** importComponents*/ +import CardProfile from "@/components/CardProfile.vue"; import CurruncyInput from "@/components/CurruncyInput.vue"; -import PopupPersonal from "@/components/Dialogs/PopupPersonal.vue"; -const modalPersonal = ref(false); -const personId = ref(""); +/** use*/ const $q = useQuasar(); const route = useRoute(); const router = useRouter(); @@ -32,51 +31,26 @@ const { hideLoader, date2Thai, dialogConfirm, + findOrgName, success, } = mixin; +const myForm = ref(null); const roleAdmin = ref(false); -const title = ref({ - fullname: "", - organizationPositionOld: "", - positionLevelOld: "", - positionTypeOld: "", -}); -const responseData = ref({ - profileId: "", - avataPath: "", - createdAt: new Date(), - date: new Date(), - id: "", - organization: "", - organizationPositionOld: "", - positionLevelOld: "", - positionNumberOld: "", - positionTypeOld: "", - reason: "", - salary: 0, - status: "", - fullname: "", -}); +const dataProfile = ref(); +const fullName = ref(""); const edit = ref(false); +const status = ref(""); + +const educationOld = ref(""); const organizationPositionOld = ref(""); const positionTypeOld = ref(""); -const myForm = ref(null); const positionLevelOld = ref(""); const posNo = ref(""); const salary = ref(0); const date = ref(null); -const reason = ref(""); -const Otherdata = ref({ - citizenId: "", - prefixId: "", - firstname: "", - lastname: "", -}); -const avatar = ref(""); -const educationOld = ref(""); const militaryDate = ref(null); -const leaveDate = ref(null); +const reason = ref(""); //-----(fetch data by id)-----// const fecthOther = async () => { @@ -85,36 +59,24 @@ const fecthOther = async () => { .get(config.API.otherByid(paramsId.toString())) .then((res: resApiData) => { const data = res.data.result; - Otherdata.value = data; - avatar.value = data.avatar ?? ""; - title.value.fullname = `${data.firstname ?? "-"} ${data.lastname ?? "-"}`; - title.value.organizationPositionOld = data.organizationPositionOld ?? "-"; - title.value.positionLevelOld = data.positionLevelOld ?? "-"; - title.value.positionTypeOld = data.positionTypeOld ?? "-"; - responseData.value.profileId = data.profileId; - responseData.value.createdAt = data.createdAt; - responseData.value.id = data.id ?? ""; - responseData.value.organizationPositionOld = - data.organizationPositionOld ?? ""; - responseData.value.positionLevelOld = data.positionLevelOld ?? ""; - responseData.value.positionNumberOld = data.positionNumberOld ?? ""; - responseData.value.positionTypeOld = data.positionTypeOld ?? ""; - responseData.value.reason = data.reason ?? ""; - responseData.value.status = data.status ?? ""; - responseData.value.fullname = `${data.prefix ?? "-"}${ - data.firstname ?? "-" - } ${data.lastname ?? "-"}`; - organizationPositionOld.value = data.organizationPositionOld ?? ""; + dataProfile.value = res.data.result as unknown as DataProfile; + + fullName.value = `${data.prefix ?? "-"}${data.firstName ?? "-"} ${ + data.lastName ?? "-" + }`; + status.value = data.status; + + educationOld.value = data.educationOld ?? ""; + organizationPositionOld.value = data.organizationPositionOld + ? data.organizationPositionOld + : findOrgName(data); positionTypeOld.value = data.positionTypeOld ?? ""; positionLevelOld.value = data.positionLevelOld ?? ""; posNo.value = data.positionNumberOld ?? ""; salary.value = data.amountOld ?? ""; - date.value = - data.positionDate !== null ? new Date(data.positionDate) : null; - reason.value = data.reason ?? ""; - educationOld.value = data.educationOld ?? "-"; + date.value = data.positionDate ?? null; militaryDate.value = data.militaryDate ?? null; - leaveDate.value = data.leaveDate ?? null; + reason.value = data.reason ?? ""; }) .catch((e) => { messageError($q, e); @@ -125,57 +87,45 @@ const fecthOther = async () => { }); }; -//-----(edit)-----// -const clickEdit = async () => { - if (myForm.value !== null) { - myForm.value.validate().then((success: any) => { - if (success) { - dialogConfirm( - $q, - async () => await saveOther(), - "ต้องการแก้ไขข้อมูลหรือไม่?", - "แก้ไขข้อมูลเพื่อลงบัญชีแนบท้าย" - ); - } - }); - } +//-----(update)-----// +const onSubmit = async () => { + dialogConfirm( + $q, + async () => { + let data = { + educationOld: educationOld.value, + organizationPositionOld: organizationPositionOld.value, + positionTypeOld: positionTypeOld.value, + positionLevelOld: positionLevelOld.value, + positionNumberOld: posNo.value, + amountOld: Number(salary.value), + positionDate: date.value, + militaryDate: militaryDate.value, + reason: reason.value, + }; + await http + .put(config.API.otherByid(paramsId.toString()), data) + .then(() => { + success($q, "แก้ไข้ข้อมูลสำเร็จ"); + }) + .catch((e) => { + messageError($q, e); + }) + .finally(async () => { + await fecthOther(); + }); + }, + "ต้องการแก้ไขข้อมูลหรือไม่?", + "แก้ไขข้อมูลเพื่อลงบัญชีแนบท้าย" + ); }; -//-----(update)-----// -const saveOther = async () => { - let data = { - citizenId: Otherdata.value.citizenId, - prefixId: Otherdata.value.prefixId, - firstname: Otherdata.value.firstname, - lastname: Otherdata.value.lastname, - reason: reason.value, - organizationPositionOld: organizationPositionOld.value, - positionDate: date.value, - positionTypeOld: positionTypeOld.value, - positionLevelOld: positionLevelOld.value, - positionNumberOld: posNo.value, - amountOld: Number(salary.value), - educationOld: educationOld.value, - militaryDate: militaryDate.value, - leaveDate: leaveDate.value, - }; - await http - .put(config.API.otherByid(paramsId.toString()), data) - .then(() => { - success($q, "แก้ไข้ข้อมูลสำเร็จ"); - }) - .catch((e) => { - messageError($q, e); - }) - .finally(async () => { - await fecthOther(); - }); -}; const cancel = () => { edit.value = false; fecthOther(); myForm.value?.resetValidation(); }; + const getClass = (val: boolean) => { return { "full-width inputgreen cursor-pointer": val, @@ -183,15 +133,6 @@ const getClass = (val: boolean) => { }; }; -function onclickViewinfo(id: string) { - modalPersonal.value = true; - personId.value = id; -} - -function updatemodalPersonal(modal: boolean) { - modalPersonal.value = modal; -} - onMounted(async () => { if (keycloak.tokenParsed != null) { roleAdmin.value = await keycloak.tokenParsed.role.includes("placement1"); @@ -211,106 +152,60 @@ onMounted(async () => { class="q-mr-sm" @click="router.push(`/other`)" /> - รายละเอียดรายการอื่นๆ {{ responseData.fullname }} + รายละเอียดรายการอื่นๆ {{ fullName }} - -
-
- {{ responseData.fullname }} -
- - -
-
-
-
-
- - -
-
-
-
ตำแหน่งในสายงาน
-
- {{ title.positionTypeOld }} -
-
-
-
-
-
ระดับ
-
- {{ title.positionLevelOld }} -
-
-
-
-
-
สังกัด
-
- {{ title.organizationPositionOld }} -
-
-
-
-
-
+ -
-
- แก้ไขข้อมูลเพื่อลงบัญชีแนบท้าย -
- -
-
- + +
+
+ แก้ไขข้อมูลเพื่อลงบัญชีแนบท้าย
-
- - + +
+
+ +
+
+ + +
-
-
- +
+
@@ -458,55 +353,7 @@ onMounted(async () => {
- +
{
- -