fix
This commit is contained in:
parent
1e64f973f1
commit
ac263f25eb
1 changed files with 40 additions and 26 deletions
|
|
@ -98,12 +98,12 @@ export class ReportController extends Controller {
|
|||
const latestEducation = x.current_holder.profileEducations.sort((a:any, b:any) => b.endDate - a.startDate)[0];
|
||||
return {
|
||||
name: x.current_holder.firstName + " " + x.current_holder.lastName,
|
||||
affiliation: x.orgRoot.orgRootName,
|
||||
gender: x.current_holder.gender,
|
||||
affiliation: x.orgRoot.orgRootName??"-",
|
||||
gender: x.current_holder.gender??"-",
|
||||
positionName: x.positions[0]?x.positions[0].positionName:"-",
|
||||
status: x.current_holder.relationship,
|
||||
posType: x.current_holder.posType.posTypeName,
|
||||
posLevel: x.current_holder.posLevel.posLevelName,
|
||||
status: x.current_holder.relationship??"-",
|
||||
posType: x.current_holder.posType.posTypeName??"-",
|
||||
posLevel: x.current_holder.posLevel.posLevelName??"-",
|
||||
degree: latestEducation ? latestEducation.educationLevel : "-",
|
||||
posExecutive: x.positions[0].posExecutive?x.positions[0].posExecutive.posExecutiveName:"-",
|
||||
currentPreiodPos: "-",
|
||||
|
|
@ -115,14 +115,14 @@ export class ReportController extends Controller {
|
|||
const key = `${item.posType} - ${item.affiliation} - ${item.gender} - ${item.degree || 'ไม่พบข้อมูล'} - ${item.status || 'ไม่พบข้อมูล'} - ${item.positionName} - ${item.posLevel} - ${item.posExecutive || 'ไม่พบข้อมูล'} `;
|
||||
if (!acc[key]) {
|
||||
acc[key] = {
|
||||
posType: item.posType,
|
||||
affiliation: item.affiliation,
|
||||
gender: item.gender,
|
||||
degree: item.degree,
|
||||
status: item.status,
|
||||
positionName: item.positionName,
|
||||
posLevel: item.posLevel,
|
||||
posExecutive: item.posExecutive,
|
||||
posType: item.posType && item.posType != "" ? item.posType: "-",
|
||||
affiliation: item.affiliation && item.affiliation != "" ? item.affiliation: "-",
|
||||
gender: item.gender && item.gender != "" ? item.gender: "-",
|
||||
degree: item.degree && item.degree != "" ? item.degree: "-",
|
||||
status: item.status && item.status != "" ? item.status: "-",
|
||||
positionName: item.positionName && item.positionName != "" ? item.positionName: "-",
|
||||
posLevel: item.posLevel && item.posLevel != "" ? item.posLevel: "-",
|
||||
posExecutive: item.posExecutive && item.posExecutive != "" ? item.posExecutive: "-",
|
||||
currentPreiodPos: "-",
|
||||
levelPeriodPos: "-",
|
||||
count: 0,
|
||||
|
|
@ -133,10 +133,17 @@ export class ReportController extends Controller {
|
|||
return acc;
|
||||
}, {});
|
||||
|
||||
const result = Object.values(groupedData).map((item: any) => ({
|
||||
...item ,
|
||||
count: item.count
|
||||
}));
|
||||
|
||||
return new HttpSuccess({
|
||||
template: "registry-officer",
|
||||
reportName: "xlsx-report",
|
||||
data: groupedData,
|
||||
data: {
|
||||
list: result
|
||||
},
|
||||
});
|
||||
}
|
||||
/**
|
||||
|
|
@ -198,12 +205,12 @@ export class ReportController extends Controller {
|
|||
const latestEducation = x.current_holder.profileEducations.sort((a:any, b:any) => b.endDate - a.startDate)[0];
|
||||
return {
|
||||
name: x.current_holder.firstName + " " + x.current_holder.lastName,
|
||||
affiliation: x.orgRoot.orgRootName,
|
||||
gender: x.current_holder.gender,
|
||||
affiliation: x.orgRoot.orgRootName??"-",
|
||||
gender: x.current_holder.gender??"-",
|
||||
positionName: x.positions[0]?x.positions[0].positionName: "-",
|
||||
status: x.current_holder.relationship,
|
||||
posType: x.current_holder.posType.posTypeName,
|
||||
posLevel: x.current_holder.posLevel.posLevelName,
|
||||
status: x.current_holder.relationship??"-",
|
||||
posType: x.current_holder.posType.posTypeName??"-",
|
||||
posLevel: x.current_holder.posLevel.posLevelName??"-",
|
||||
degree: latestEducation ? latestEducation.educationLevel : "-",
|
||||
period: "-",
|
||||
};
|
||||
|
|
@ -214,12 +221,12 @@ export class ReportController extends Controller {
|
|||
`;
|
||||
if (!acc[key]) {
|
||||
acc[key] = {
|
||||
affiliation: item.affiliation,
|
||||
gender: item.gender,
|
||||
degree: item.degree,
|
||||
status: item.status,
|
||||
posType: item.posType,
|
||||
positionName: item.positionName,
|
||||
affiliation: item.affiliation && item.affiliation != ""?item.affiliation:"-",
|
||||
gender: item.gender && item.gender != ""?item.gender:"-",
|
||||
degree: item.degree && item.degree != ""?item.degree:"-",
|
||||
status: item.status && item.status != ""?item.status:"-",
|
||||
posType: item.posType && item.posType != ""?item.posType:"-",
|
||||
positionName: item.positionName && item.positionName != ""?item.positionName:"-",
|
||||
posLevel: item.posLevel,
|
||||
period: "-",
|
||||
count: 0,
|
||||
|
|
@ -229,11 +236,18 @@ export class ReportController extends Controller {
|
|||
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
const result = Object.values(groupedData).map((item: any) => ({
|
||||
...item ,
|
||||
count: item.count
|
||||
}));
|
||||
|
||||
return new HttpSuccess({
|
||||
template: "registry-emp",
|
||||
reportName: "xlsx-report",
|
||||
data: groupedData,
|
||||
data: {
|
||||
list: result
|
||||
},
|
||||
});
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue