check space report

This commit is contained in:
setthawutttty 2025-05-30 14:21:29 +07:00
parent 5211555eae
commit 7e2132f45f

View file

@ -181,150 +181,150 @@ 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: dataPerson.formData.firstName
? `${dataPerson.formData.prefix}${dataPerson.formData.firstName} ${dataPerson.formData.lastName}`
: "",
},
{
position: dataPerson.formData.position
? dataPerson.formData.position
: "",
},
{
positionLevel: dataPerson.formData.posLevelName
? dataPerson.formData.posLevelName
: "",
},
{ posNo: dataPerson.formData.posNo ? dataPerson.formData.posNo : "" },
{ org: dataPerson.formData ? dataPerson.formData.org : "" },
{
birthDate: dataPerson.formData.birthDate
? date2Thai(new Date(dataPerson.formData.birthDate))
: "",
},
{
govAge: profile.value.government
? `${
profile.value.government.govAge.year !== 0
? `${profile.value.government.govAge.year} ปี`
: ""
} ${
profile.value.government.govAge.month !== 0
? `${profile.value.government.govAge.month} เดือน`
: ""
} ${
profile.value.government.govAge.day !== 0
? `${profile.value.government.govAge.day} วัน`
: ""
}`
: ``,
},
{
positionLevelNew:
profile.value == null
? ""
: profile.value.type == "EXPERT"
? "ชำนาญการ"
: "ชำนาญการพิเศษ",
},
// 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: dataPerson.formData.firstName
// ? `${dataPerson.formData.prefix}${dataPerson.formData.firstName} ${dataPerson.formData.lastName}`
// : "",
// },
// {
// position: dataPerson.formData.position
// ? dataPerson.formData.position
// : "",
// },
// {
// positionLevel: dataPerson.formData.posLevelName
// ? dataPerson.formData.posLevelName
// : "",
// },
// { posNo: dataPerson.formData.posNo ? dataPerson.formData.posNo : "" },
// { org: dataPerson.formData ? dataPerson.formData.org : "" },
// {
// birthDate: dataPerson.formData.birthDate
// ? date2Thai(new Date(dataPerson.formData.birthDate))
// : "",
// },
// {
// govAge: profile.value.government
// ? `${
// profile.value.government.govAge.year !== 0
// ? `${profile.value.government.govAge.year} `
// : ""
// } ${
// profile.value.government.govAge.month !== 0
// ? `${profile.value.government.govAge.month} `
// : ""
// } ${
// profile.value.government.govAge.day !== 0
// ? `${profile.value.government.govAge.day} `
// : ""
// }`
// : ``,
// },
// {
// positionLevelNew:
// profile.value == null
// ? ""
// : profile.value.type == "EXPERT"
// ? ""
// : "",
// },
tp === "EV1_005"
? { salary: dataPerson.formData.salary ? dataPerson.formData.salary : "" }
: null,
// tp === "EV1_005"
// ? { salary: dataPerson.formData.salary ? dataPerson.formData.salary : "" }
// : null,
tp === "EV1_006"
? {
years: {
lastTwoYear: toThaiNumber(currentYear - 2 + 543),
lastOneYear: toThaiNumber(currentYear - 1 + 543),
currentYear: toThaiNumber(currentYear + 543),
},
}
: null,
tp === "EV1_006" || tp === "EV1_008"
? { commanderFullname: formData.commanderFullname }
: null,
tp === "EV1_006" || tp === "EV1_008"
? { commanderPosition: formData.commanderPosition }
: null,
tp === "EV1_006" ? { commanderOrg: "" } : null,
tp === "EV1_006" || tp === "EV1_008"
? { commanderAboveFullname: formData.commanderAboveFullname }
: null,
tp === "EV1_006" || tp === "EV1_008"
? { commanderAbovePosition: formData.commanderAbovePosition }
: null,
tp === "EV1_006" ? { commanderAboveOrg: "" } : null,
// tp === "EV1_006"
// ? {
// years: {
// lastTwoYear: toThaiNumber(currentYear - 2 + 543),
// lastOneYear: toThaiNumber(currentYear - 1 + 543),
// currentYear: toThaiNumber(currentYear + 543),
// },
// }
// : null,
// tp === "EV1_006" || tp === "EV1_008"
// ? { commanderFullname: formData.commanderFullname }
// : null,
// tp === "EV1_006" || tp === "EV1_008"
// ? { commanderPosition: formData.commanderPosition }
// : null,
// tp === "EV1_006" ? { commanderOrg: "" } : null,
// tp === "EV1_006" || tp === "EV1_008"
// ? { commanderAboveFullname: formData.commanderAboveFullname }
// : null,
// tp === "EV1_006" || tp === "EV1_008"
// ? { commanderAbovePosition: formData.commanderAbovePosition }
// : null,
// tp === "EV1_006" ? { commanderAboveOrg: "" } : null,
tp === "EV1_007" ? { positionName: "-" } : null,
tp === "EV1_007" ? { positionLeaveName: "-" } : null,
// tp === "EV1_007" ? { positionName: "-" } : null,
// tp === "EV1_007" ? { positionLeaveName: "-" } : null,
tp === "EV1_009" ? { dateStart: dataPerson.formData.dateStart } : null,
tp === "EV1_009"
? { dateRetireLaw: dataPerson.formData.dateRetireLaw }
: null,
// tp === "EV1_009" ? { dateStart: dataPerson.formData.dateStart } : null,
// tp === "EV1_009"
// ? { dateRetireLaw: dataPerson.formData.dateRetireLaw }
// : null,
tp === "EV1_010" ? { subject: formData.subject } : null,
{ typeTh: "เชี่ยวชาญ" },
{ posNoWithSym: `(${dataPerson.formData.posNo})` },
{ orgNoNewLine: dataPerson.formData.org }
);
// tp === "EV1_010" ? { subject: formData.subject } : null,
// { typeTh: "" },
// { posNoWithSym: `(${dataPerson.formData.posNo})` },
// { orgNoNewLine: dataPerson.formData.org }
// );
const body = {
template: tp,
reportName: templateName,
data: data,
data: reportData.value,
};
await genReport(body, fileName); //
}
@ -402,7 +402,7 @@ async function uploadfile(uploadUrl: string, file: any) {
});
}
function getData() {
async function getData() {
showLoader();
http
.get(config.API.evaluationExpertise + `/${evaluateId.value}`)
@ -418,9 +418,10 @@ function getData() {
})
.catch((e) => {
messageError($q, e);
hideLoader();
})
.finally(() => {
hideLoader();
});
}
@ -447,9 +448,24 @@ const keyObject = ref<string[]>([
"assessments",
"government",
]);
const reportData = ref<any>()
async function getCheckSpace(){
http
.get(config.API.evaluationReportCheckspecByid(evaluateId.value))
.then((res)=>{
reportData.value = res.data.result
})
.catch((e)=>{
messageError($q,e)
hideLoader();
}).finally(()=>{
})
}
onMounted(() => {
showLoader();
Promise.all([getData(), ...keyObject.value.map(getDetail)])
Promise.all([getData(),getCheckSpace(), ...keyObject.value.map(getDetail)])
.then(() => {})
.catch((e) => {
hideLoader();