diff --git a/src/modules/12_evaluatePersonal/components/Detail/step/step4.vue b/src/modules/12_evaluatePersonal/components/Detail/step/step4.vue index 4bde68153..635287d0b 100644 --- a/src/modules/12_evaluatePersonal/components/Detail/step/step4.vue +++ b/src/modules/12_evaluatePersonal/components/Detail/step/step4.vue @@ -29,6 +29,7 @@ const id = ref(route.params.id as string); const fullName = ref( keycloak.tokenParsed ? keycloak.tokenParsed.name!.toString() : "" ); +const profile = ref(); const messenger = ref(""); const title = ref(""); const modalEvaluation = ref(false); @@ -76,7 +77,14 @@ async function onClickDowloadFile( ) { showLoader(); const data = Object.assign( - { fullName: fullName.value }, + { 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, @@ -278,6 +286,23 @@ function checkDoc10() { .finally(() => { hideLoader(); }); + fetchProfile() +} + +async function fetchProfile() { + showLoader(); + await http + .get(config.API.evaluateGetDetail(id.value)) + .then((res) => { + const data = res.data.result; + profile.value =data + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); } onMounted(() => { @@ -342,7 +367,7 @@ onMounted(() => { color="primary" @click=" onClickDowloadFile( - 'EV1_008', + 'เอกสารหมายเลข 10', 'template-4', 'แบบประเมินคุณลักษณะบุคคล' ) @@ -396,7 +421,8 @@ onMounted(() => { -
+ +
(); const fileEvaluation84 = ref(); const fileEvaluation85 = ref(); const fileEvaluation86 = ref(); +const profile = ref(); async function onClickDowloadFile( tp: string, @@ -43,11 +44,21 @@ async function onClickDowloadFile( fileName: string ) { showLoader(); + const data = Object.assign( + { 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"? "ชำนาญการ":"ชำนาญการพิเศษ")} + ); const body = { template: tp, reportName: templateName, - data:{} + data: data, }; await genReport(body, fileName); } @@ -185,8 +196,24 @@ function nextStep(){ }); } +async function fetchProfile() { + showLoader(); + await http + .get(config.API.evaluateGetDetail(id.value)) + .then((res) => { + const data = res.data.result; + profile.value =data + }) + .catch((err) => { + messageError($q, err); + }) + .finally(() => { + hideLoader(); + }); +} + onMounted(()=>{ - + fetchProfile() })