From acee32e3cfd09b86a96ff820eec833a634858352 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1R2VSQH\\Lenovo ThinkPad E490" Date: Wed, 15 May 2024 16:11:43 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B8=97=E0=B8=B0=E0=B9=80=E0=B8=9A=E0=B8=B5?= =?UTF-8?q?=E0=B8=A2=E0=B8=99=E0=B8=9B=E0=B8=A3=E0=B8=B0=E0=B8=A7=E0=B8=B1?= =?UTF-8?q?=E0=B8=95=E0=B8=B4=20=3D>=20=E0=B8=82=E0=B9=89=E0=B8=AD?= =?UTF-8?q?=E0=B8=A1=E0=B8=B9=E0=B8=A5=E0=B8=84=E0=B8=A3=E0=B8=AD=E0=B8=9A?= =?UTF-8?q?=E0=B8=84=E0=B8=A3=E0=B8=B1=E0=B8=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/registry/api.registry.ts | 87 ++++++++-------- .../Achievement/01_ProfessionalLicense.vue | 13 ++- .../detail/Achievement/02_Train.vue | 15 ++- .../detail/Achievement/03_Insignia.vue | 28 ++++-- .../Achievement/04_DeclarationHonor.vue | 50 ++++++---- .../Achievement/05_ResultsPerformance.vue | 29 ++++-- .../detail/Other/01_OtherInformation.vue | 14 ++- .../Other/01_OtherInformationHistory.vue | 13 ++- .../PersonalInformation/04_FamilyNew.vue | 98 +++++++++++++++---- .../interface/request/DeclarationHonor.ts | 1 + .../interface/request/Insignia.ts | 1 + .../interface/request/ResultsPerformance.ts | 1 + 12 files changed, 240 insertions(+), 110 deletions(-) diff --git a/src/api/registry/api.registry.ts b/src/api/registry/api.registry.ts index a2c7078ca..3edee7305 100644 --- a/src/api/registry/api.registry.ts +++ b/src/api/registry/api.registry.ts @@ -39,38 +39,40 @@ export default { `${registryNew}${type}/nopaid/history/${dataId}`, // เครื่องราชฯ - profileNewInsign: `${registryNew}/insignia`, - profileNewInsignByProfileId: (profileId: string) => - `${registryNew}/insignia/${profileId}`, - profileNewInsignById: (dataId: string) => `${registryNew}/insignia/${dataId}`, - profileNewInsignHisById: (dataId: string) => - `${registryNew}/insignia/history/${dataId}`, + profileNewInsign: (type: string) => `${registryNew}${type}/insignia`, + profileNewInsignByProfileId: (profileId: string, type: string) => + `${registryNew}${type}/insignia/${profileId}`, + profileNewInsignById: (dataId: string, type: string) => + `${registryNew}${type}/insignia/${dataId}`, + profileNewInsignHisById: (dataId: string, type: string) => + `${registryNew}${type}/insignia/history/${dataId}`, // ประกาศเกียรติคุณ - profileNewHonor: `${registryNew}/honor`, - profileNewHonorByProfileId: (profileId: string) => - `${registryNew}/honor/${profileId}`, - profileNewHonorById: (dataId: string) => `${registryNew}/honor/${dataId}`, - profileNewHonorHisById: (dataId: string) => - `${registryNew}/honor/history/${dataId}`, + profileNewHonor: (type: string) => `${registryNew}${type}/honor`, + profileNewHonorByProfileId: (profileId: string, type: string) => + `${registryNew}${type}/honor/${profileId}`, + profileNewHonorById: (dataId: string, type: string) => + `${registryNew}${type}/honor/${dataId}`, + profileNewHonorHisById: (dataId: string, type: string) => + `${registryNew}${type}/honor/history/${dataId}`, // ผลการประเมินการปฏิบัติราชการ - profileNewAssessments: `${registryNew}/assessments`, - profileNewAssessmentsByProfileId: (profileId: string) => - `${registryNew}/assessments/${profileId}`, - profileNewAssessmentsById: (dataId: string) => - `${registryNew}/assessments/${dataId}`, - profileNewAssessmentsHisById: (dataId: string) => - `${registryNew}/assessments/history/${dataId}`, + profileNewAssessments: (type: string) => `${registryNew}${type}/assessments`, + profileNewAssessmentsByProfileId: (profileId: string, type: string) => + `${registryNew}${type}/assessments/${profileId}`, + profileNewAssessmentsById: (dataId: string, type: string) => + `${registryNew}${type}/assessments/${dataId}`, + profileNewAssessmentsHisById: (dataId: string, type: string) => + `${registryNew}${type}/assessments/history/${dataId}`, // การฝึกอบรม - profileNewTraining: `${registryNew}/training`, - profileNewTrainingByProfileId: (profileId: string) => - `${registryNew}/training/${profileId}`, - profileNewTrainingByTrainingId: (trainingId: string) => - `${registryNew}/training/${trainingId}`, - profileNewTrainingHisByTrainingId: (trainingId: string) => - `${registryNew}/training/history/${trainingId}`, + profileNewTraining: (type: string) => `${registryNew}${type}/training`, + profileNewTrainingByProfileId: (profileId: string, type: string) => + `${registryNew}${type}/training/${profileId}`, + profileNewTrainingByTrainingId: (trainingId: string, type: string) => + `${registryNew}${type}/training/${trainingId}`, + profileNewTrainingHisByTrainingId: (trainingId: string, type: string) => + `${registryNew}${type}/training/history/${trainingId}`, // ประวัติการศึกษา profileNewEducation: (type: string) => `${registryNew}${type}/educations`, @@ -91,21 +93,24 @@ export default { `${registryNew}${type}/ability/history/${abilityId}`, // ใบอนุญาตประกอบวิชาชีพ - profileNewCertificate: `${registryNew}/certificate`, - profileNewCertificateByProfileId: (profileId: string) => - `${registryNew}/certificate/${profileId}`, - profileNewCertificateByCertificateId: (certificateId: string) => - `${registryNew}/certificate/${certificateId}`, - profileNewCertificateHisByCertificateId: (certificateId: string) => - `${registryNew}/certificate/history/${certificateId}`, + profileNewCertificate: (type: string) => `${registryNew}${type}/certificate`, + profileNewCertificateByProfileId: (profileId: string, type: string) => + `${registryNew}${type}/certificate/${profileId}`, + profileNewCertificateByCertificateId: (certificateId: string, type: string) => + `${registryNew}${type}/certificate/${certificateId}`, + profileNewCertificateHisByCertificateId: ( + certificateId: string, + type: string + ) => `${registryNew}${type}/certificate/history/${certificateId}`, // ข้อมูลอื่นๆ - profileNewOther: `${registryNew}/other`, - profileNewOtherByProfileId: (profileId: string) => - `${registryNew}/other/${profileId}`, - profileNewOtherById: (dataId: string) => `${registryNew}/other/${dataId}`, - profileNewOtherHisById: (dataId: string) => - `${registryNew}/other/history/${dataId}`, + profileNewOther: (type: string) => `${registryNew}${type}/other`, + profileNewOtherByProfileId: (profileId: string, type: string) => + `${registryNew}${type}/other/${profileId}`, + profileNewOtherById: (dataId: string, type: string) => + `${registryNew}${type}/other/${dataId}`, + profileNewOtherHisById: (dataId: string, type: string) => + `${registryNew}${type}/other/history/${dataId}`, // ข้อมูลครอบครัว profileNewFamily: (type: string) => `${registryNew}${type}/family`, @@ -167,4 +172,8 @@ export default { `${registryNew}${type}/changeName/${changeNameId}`, profileNewChangeNameHisByChangeNameId: (changeNameId: string, type: string) => `${registryNew}${type}/changeName/history/${changeNameId}`, + + //ข้อมูลครอบครับ + profileFamily: (empType: string, type: string) => + `${registryNew}${empType}/${type}`, }; diff --git a/src/modules/04_registryNew/components/detail/Achievement/01_ProfessionalLicense.vue b/src/modules/04_registryNew/components/detail/Achievement/01_ProfessionalLicense.vue index 1499646c9..58ff6abb4 100644 --- a/src/modules/04_registryNew/components/detail/Achievement/01_ProfessionalLicense.vue +++ b/src/modules/04_registryNew/components/detail/Achievement/01_ProfessionalLicense.vue @@ -25,6 +25,9 @@ const mode = ref("table"); const dialog = ref(false); const route = useRoute(); const id = ref(route.params.id.toString()); +const empType = ref( + route.name === "registryNewByid" ? "" : "-employee" +); const dialogStatus = ref("create"); const editId = ref(""); const keyword = ref(""); @@ -235,7 +238,7 @@ function closeHistoryDialog() { async function fetchData(id: string) { showLoader(); await http - .get(config.API.profileNewCertificateByProfileId(id)) + .get(config.API.profileNewCertificateByProfileId(id,empType.value)) .then(async (res) => { rows.value = res.data.result; }) @@ -268,8 +271,10 @@ function editForm(row: any) { async function addData() { await http - .post(config.API.profileNewCertificate, { + .post(config.API.profileNewCertificate(empType.value), { ...profesLicenseData, + profileId: empType.value === "" ? id.value : undefined, + profileEmployeeId: empType.value !== "" ? id.value : undefined, }) .then(() => { fetchData(id.value); @@ -285,7 +290,7 @@ async function addData() { async function editData(idData: string) { await http - .patch(config.API.profileNewCertificateByCertificateId(idData), { + .patch(config.API.profileNewCertificateByCertificateId(idData,empType.value), { ...profesLicenseData, profileId: undefined, }) @@ -320,7 +325,7 @@ async function editData(idData: string) { async function fetchHistoryData(id: string) { showLoader(); await http - .get(config.API.profileNewCertificateHisByCertificateId(id)) + .get(config.API.profileNewCertificateHisByCertificateId(id,empType.value)) .then(async (res) => { historyRows.value = res.data.result; }) diff --git a/src/modules/04_registryNew/components/detail/Achievement/02_Train.vue b/src/modules/04_registryNew/components/detail/Achievement/02_Train.vue index 99e3e9b20..61a955d03 100644 --- a/src/modules/04_registryNew/components/detail/Achievement/02_Train.vue +++ b/src/modules/04_registryNew/components/detail/Achievement/02_Train.vue @@ -24,6 +24,9 @@ const { const route = useRoute(); const id = ref(route.params.id.toString()); +const empType = ref( + route.name === "registryNewByid" ? "" : "-employee" +); const dialog = ref(false); const mode = ref("table"); const columns = ref([ @@ -396,11 +399,13 @@ function editForm(row: any) { async function addData() { await http - .post(config.API.profileNewTraining, { + .post(config.API.profileNewTraining(empType.value), { ...trainData, startYear: undefined, finishYear: undefined, isDate: isDate.value === "false" ? false : true, + profileId: empType.value === "" ? id.value : undefined, + profileEmployeeId: empType.value !== "" ? id.value : undefined, }) .then(() => { fetchData(id.value); @@ -416,7 +421,7 @@ async function addData() { async function editData(idData: string) { await http - .patch(config.API.profileNewTrainingByTrainingId(idData), { + .patch(config.API.profileNewTrainingByTrainingId(idData, empType.value), { ...trainData, profileId: undefined, startYear: undefined, @@ -438,7 +443,7 @@ async function editData(idData: string) { function deleteData(idData: string) { dialogRemove($q, () => http - .delete(config.API.profileNewTrainingByTrainingId(idData)) + .delete(config.API.profileNewTrainingByTrainingId(idData, empType.value)) .then(() => { fetchData(id.value); success($q, "ลบข้อมูลสำเร็จ"); @@ -463,7 +468,7 @@ function closeHistoryDialog() { async function fetchData(id: string) { showLoader(); await http - .get(config.API.profileNewTrainingByProfileId(id)) + .get(config.API.profileNewTrainingByProfileId(id, empType.value)) .then(async (res) => { rows.value = res.data.result; }) @@ -478,7 +483,7 @@ async function fetchData(id: string) { async function fetchHistoryData(id: string) { showLoader(); await http - .get(config.API.profileNewTrainingHisByTrainingId(id)) + .get(config.API.profileNewTrainingHisByTrainingId(id, empType.value)) .then(async (res) => { historyRows.value = res.data.result; }) diff --git a/src/modules/04_registryNew/components/detail/Achievement/03_Insignia.vue b/src/modules/04_registryNew/components/detail/Achievement/03_Insignia.vue index fbb0f8044..5012e6989 100644 --- a/src/modules/04_registryNew/components/detail/Achievement/03_Insignia.vue +++ b/src/modules/04_registryNew/components/detail/Achievement/03_Insignia.vue @@ -33,6 +33,9 @@ const { const profileId = ref( route.params.id ? route.params.id.toString() : "" ); +const empType = ref( + route.name === "registryNewByid" ? "" : "-employee" +); const id = ref(""); const insigniaType = ref(""); @@ -447,7 +450,7 @@ async function fetchData() { showLoader(); try { const res = await http.get( - config.API.profileNewInsignByProfileId(profileId.value) + config.API.profileNewInsignByProfileId(profileId.value, empType.value) ); rows.value = res.data.result; } catch (error) { @@ -474,12 +477,15 @@ async function addEditData(editStatus: boolean = false) { if (!profileId.value) return; const url = editStatus - ? config.API.profileNewInsignById(id.value) - : config.API.profileNewInsign; + ? config.API.profileNewInsignById(id.value, empType.value) + : config.API.profileNewInsign(empType.value); const method = editStatus ? "patch" : "post"; const reqBody: RequestItemsObject = { ...insigniaForm, - profileId: editStatus ? undefined : profileId.value, + profileEmployeeId: + !editStatus && empType.value !== "" ? profileId.value : undefined, + profileId: + !editStatus && empType.value === "" ? profileId.value : undefined, }; try { await http[method](url, reqBody); @@ -528,7 +534,9 @@ async function clickHistory(row: ResponseObject) { showLoader(); try { - const res = await http.get(config.API.profileNewInsignHisById(row.id)); + const res = await http.get( + config.API.profileNewInsignHisById(row.id, empType.value) + ); rowsHistory.value = res.data.result; } catch (e) { messageError($q, e); @@ -599,7 +607,13 @@ onMounted(async () => {