diff --git a/src/api/evaluate/api.evaluate.ts b/src/api/evaluate/api.evaluate.ts index c79b9fb..0d2d304 100644 --- a/src/api/evaluate/api.evaluate.ts +++ b/src/api/evaluate/api.evaluate.ts @@ -10,6 +10,7 @@ export default { evaluationCheckById: (id: string) => `${evaluation}/check/${id}`, evaluationCheckspec: () => `${evaluation}/check-spec`, evaluationCheckspecByid: (id: string) => `${evaluation}/check-spec/${id}`, + evaluationReportCheckspecByid: (id: string) => `${evaluation}/report/check-spec-report/${id}`, evaluationPreparedoc: (id: string, type: string) => `${evaluation}/prepare-doc-v1/${type}/${id}`, evaluationCheckdoc: (id: string, type: string) => diff --git a/src/modules/06_evaluate/components/step/step2.vue b/src/modules/06_evaluate/components/step/step2.vue index 77d89f3..9ba9503 100644 --- a/src/modules/06_evaluate/components/step/step2.vue +++ b/src/modules/06_evaluate/components/step/step2.vue @@ -123,82 +123,11 @@ async function onClickDowloadFile( fileName: string ) { showLoader(); - let educations: any = []; - if (profile.value != null) { - profile.value.educations.map((e: any) => { - educations.push({ - educationLevel: e.educationLevel ?? "", - finishYear: - e.finishDate == null - ? "" - : new Date(e.finishDate).getFullYear() + 543, - institute: e.institute ?? "", - }); - }); - } - let certificates: any = []; - if (profile.value != null) { - profile.value.certificates.map((e: any) => { - certificates.push({ - certificateNo: e.certificateNo ?? "", - certificateType: e.certificateType ?? "", - issuer: e.issuer ?? "", - }); - }); - } - let salaries: any = []; - if (profile.value != null) { - profile.value.salaries.map((e: any) => { - salaries.push({ - date: e.date == null ? "" : date2Thai(new Date(e.date)), - position: e.position ?? "", - amount: e.amount ?? "", - }); - }); - } - let trainings: any = []; - if (profile.value != null) { - profile.value.trainings.map((e: any) => { - trainings.push({ - yearly: e.yearly ?? "", - startDate: e.startDate == null ? "" : date2Thai(new Date(e.startDate)), - endDate: e.endDate == null ? "" : date2Thai(new Date(e.endDate)), - name: e.name ?? "", - topic: e.topic ?? "", - }); - }); - } - const data = Object.assign( - { educations: educations }, - { certificates: certificates }, - { salaries: salaries }, - { trainings: trainings }, - { fullName: profile.value == null ? "" : profile.value.fullName }, - { position: profile.value == null ? "" : profile.value.position }, - { positionLevel: profile.value == null ? "" : profile.value.positionLevel }, - { posNo: profile.value == null ? "" : profile.value.posNo }, - { oc: profile.value == null ? "" : profile.value.oc }, - { - birthDate: - profile.value == null ? "" : date2Thai(profile.value.birthDate), - }, - { govAge: profile.value == null ? "" : profile.value.govAge }, - { - positionLevelNew: - profile.value == null - ? "" - : profile.value.type == "EXPERT" - ? "ชำนาญการ" - : "ชำนาญการพิเศษ", - }, - tp === "EV1_005" || tp === "EV1_007" ? { organizationName: "-" } : null, - tp === "EV1_007" ? { positionName: "-" } : null, - tp === "EV1_007" ? { positionLeaveName: "-" } : null - ); + const body = { template: tp, reportName: templateName, - data: data, + data: profile.value, }; await genReport(body, fileName); //สร้างไฟล์ต้นแบบ } @@ -308,7 +237,7 @@ function fetcheSigner(id: string) { async function fetchCheckSpec(id: string) { showLoader(); await http - .get(config.API.evaluationCheckspecByid(id)) + .get(config.API.evaluationReportCheckspecByid(id)) .then((res) => { const data = res.data.result; profile.value = data;