fix issue #1099 รายงานนระบบ KPI >> (ข้อมูลจำนวนผู้ประเมินไม่บันทึกลงรายงาน)
This commit is contained in:
parent
324d911c83
commit
8678a4b62b
1 changed files with 131 additions and 150 deletions
|
|
@ -408,161 +408,142 @@ export class ReportController extends Controller {
|
||||||
if (requestBody.type == "KPI3") {
|
if (requestBody.type == "KPI3") {
|
||||||
templateName = "KPI3";
|
templateName = "KPI3";
|
||||||
reportName = "KPI3";
|
reportName = "KPI3";
|
||||||
const userEvaluations_ =
|
const groupedEvaluations: any[] = [];
|
||||||
data?.kpiUserEvaluations?.length > 0
|
let fullNameCommander: string = "-";
|
||||||
? data.kpiUserEvaluations.map((x: any, idx: number) => ({
|
let positionCommander: string = "-";
|
||||||
no: idx != null ? Extension.ToThaiNumber((idx + 1).toString()) : "-",
|
let posTypeNameCommander: string = "-";
|
||||||
fullName:
|
let posLevelNameCommander: string = "-";
|
||||||
x.prefix != null && x.firstName != null && x.lastName != null
|
let orgCommander: string = "-";
|
||||||
? `${x.prefix}${x.firstName} ${x.lastName}`
|
let fullNameCommanderHigh: string = "-";
|
||||||
: "-",
|
let positionCommanderHigh: string = "-";
|
||||||
position: x.position ? x.position : "-",
|
let posTypeNameCommanderHigh: string = "-";
|
||||||
point1:
|
let posLevelNameCommanderHigh: string = "-";
|
||||||
x.summaryPoint >= 90.0 ? Extension.ToThaiNumber(x.summaryPoint.toString()) : "-",
|
let orgCommanderHigh: string = "-";
|
||||||
point2:
|
let idx:number=0
|
||||||
x.summaryPoint >= 80.0 && x.summaryPoint <= 89.99
|
for (const x of data?.kpiUserEvaluations || []) {
|
||||||
? Extension.ToThaiNumber(x.summaryPoint.toString())
|
let group = groupedEvaluations.find(
|
||||||
: "-",
|
(g) =>
|
||||||
point3:
|
g.evaluatorId === x.evaluatorId &&
|
||||||
x.summaryPoint >= 70.0 && x.summaryPoint <= 79.99
|
g.commanderId === x.commanderId &&
|
||||||
? Extension.ToThaiNumber(x.summaryPoint.toString())
|
g.commanderHighId === x.commanderHighId
|
||||||
: "-",
|
);
|
||||||
point4:
|
if (x.commanderId != "" && x.commanderId != null) {
|
||||||
x.summaryPoint >= 60.0 && x.summaryPoint <= 69.99
|
await new CallAPI()
|
||||||
? Extension.ToThaiNumber(x.summaryPoint.toString())
|
.GetData(request, "/org/profile/profileid/position/" + x.commanderId)
|
||||||
: "-",
|
.then((res) => {
|
||||||
point5:
|
fullNameCommander = `${res.prefix}${res.firstName} ${res.lastName}`;
|
||||||
x.summaryPoint < 60.0 ? Extension.ToThaiNumber(x.summaryPoint.toString()) : "-",
|
positionCommander = res.position;
|
||||||
remark: x.reasonEvaluator,
|
posTypeNameCommander = res.posTypeName;
|
||||||
}))
|
posLevelNameCommander = res.posLevelName;
|
||||||
: [
|
orgCommander = res.root;
|
||||||
{
|
})
|
||||||
no: "-",
|
.catch(() => {});
|
||||||
fullName: "-",
|
}
|
||||||
position: "-",
|
if (x.commanderHighId != "" && x.commanderHighId != null) {
|
||||||
point1: "-",
|
await new CallAPI()
|
||||||
point2: "-",
|
.GetData(request, "/org/profile/profileid/position/" + x.commanderHighId)
|
||||||
point3: "-",
|
.then((res) => {
|
||||||
point4: "-",
|
fullNameCommanderHigh = `${res.prefix}${res.firstName} ${res.lastName}`;
|
||||||
point5: "-",
|
positionCommanderHigh = res.position;
|
||||||
remark: "-",
|
posTypeNameCommanderHigh = res.posTypeName;
|
||||||
},
|
posLevelNameCommanderHigh = res.posLevelName;
|
||||||
];
|
orgCommanderHigh = res.root;
|
||||||
const prefixEvaluator_ =
|
})
|
||||||
data.kpiUserEvaluations.length > 0 ? data.kpiUserEvaluations[0].prefixEvaluator : "";
|
.catch(() => {});
|
||||||
const firstNameEvaluator_ =
|
}
|
||||||
data.kpiUserEvaluations.length > 0 ? data.kpiUserEvaluations[0].firstNameEvaluator : "";
|
if (!group) {
|
||||||
const lastNameEvaluator_ =
|
group = {
|
||||||
data.kpiUserEvaluations.length > 0 ? data.kpiUserEvaluations[0].lastNameEvaluator : "";
|
evaluatorId: x.evaluatorId,
|
||||||
const fullNameEvaluator =
|
commanderId: x.commanderId,
|
||||||
prefixEvaluator_ != "" && firstNameEvaluator_ != "" && lastNameEvaluator_ != ""
|
commanderHighId: x.commanderHighId,
|
||||||
? `${prefixEvaluator_}${firstNameEvaluator_} ${lastNameEvaluator_}`
|
fullNameEvaluator: `${x.prefixEvaluator}${x.firstNameEvaluator} ${x.lastNameEvaluator}`,
|
||||||
: "-";
|
positionEvaluator: x.positionEvaluator,
|
||||||
const commanderId =
|
posTypeNameEvaluator: x.posTypeNameEvaluator,
|
||||||
data.kpiUserEvaluations.length > 0 ? data.kpiUserEvaluations[0].commanderId : "";
|
posLevelNameEvaluator: x.posLevelNameEvaluator,
|
||||||
let prefixCommander = "";
|
orgEvaluator: x.orgEvaluator,
|
||||||
let firstNameCommander = "";
|
fullNameCommander: fullNameCommander,
|
||||||
let lastNameCommander = "";
|
positionCommander: positionCommander,
|
||||||
let positionCommander = "";
|
posTypeNameCommander: posTypeNameCommander,
|
||||||
let posTypeNameCommander = "";
|
posLevelNameCommander: posLevelNameCommander,
|
||||||
let posLevelNameCommander = "";
|
orgCommander: orgCommander,
|
||||||
let orgCommander = "";
|
fullNameCommanderHigh: fullNameCommanderHigh,
|
||||||
if (commanderId != "" && commanderId != null) {
|
positionCommanderHigh: positionCommanderHigh,
|
||||||
await new CallAPI()
|
posTypeNameCommanderHigh: posTypeNameCommanderHigh,
|
||||||
.GetData(request, "org/profile/profileid/position/" + commanderId)
|
posLevelNameCommanderHigh: posLevelNameCommanderHigh,
|
||||||
.then((x) => {
|
orgCommanderHigh: orgCommanderHigh,
|
||||||
prefixCommander = x.prefix;
|
evaluationResults: [],
|
||||||
firstNameCommander = x.firstName;
|
};
|
||||||
lastNameCommander = x.lastName;
|
groupedEvaluations.push(group);
|
||||||
positionCommander = x.position;
|
}
|
||||||
orgCommander = x.root;
|
group.evaluationResults.push({
|
||||||
posTypeNameCommander = x.posTypeName;
|
no: idx != null ? Extension.ToThaiNumber((idx + 1).toString()) : "-",
|
||||||
posLevelNameCommander = x.posLevelName;
|
fullName:
|
||||||
})
|
x.prefix != null && x.firstName != null && x.lastName != null
|
||||||
.catch(() => {
|
? `${x.prefix}${x.firstName} ${x.lastName}`
|
||||||
// throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลในทะเบียนประวัติ");
|
: "-",
|
||||||
});
|
position: x.position ? x.position : "-",
|
||||||
|
point1:
|
||||||
|
x.summaryPoint >= 90.0 ? Extension.ToThaiNumber(x.summaryPoint.toString()) : "-",
|
||||||
|
point2:
|
||||||
|
x.summaryPoint >= 80.0 && x.summaryPoint <= 89.99
|
||||||
|
? Extension.ToThaiNumber(x.summaryPoint.toString())
|
||||||
|
: "-",
|
||||||
|
point3:
|
||||||
|
x.summaryPoint >= 70.0 && x.summaryPoint <= 79.99
|
||||||
|
? Extension.ToThaiNumber(x.summaryPoint.toString())
|
||||||
|
: "-",
|
||||||
|
point4:
|
||||||
|
x.summaryPoint >= 60.0 && x.summaryPoint <= 69.99
|
||||||
|
? Extension.ToThaiNumber(x.summaryPoint.toString())
|
||||||
|
: "-",
|
||||||
|
point5:
|
||||||
|
x.summaryPoint < 60.0 ? Extension.ToThaiNumber(x.summaryPoint.toString()) : "-",
|
||||||
|
remark: x.reasonEvaluator,
|
||||||
|
});
|
||||||
|
idx ++;
|
||||||
}
|
}
|
||||||
const fullNameCommander =
|
const _userEvaluations = groupedEvaluations.length > 0
|
||||||
prefixCommander != "" && firstNameCommander != "" && firstNameCommander != ""
|
? groupedEvaluations
|
||||||
? `${prefixCommander}${firstNameCommander} ${lastNameCommander}`
|
: [
|
||||||
: "-";
|
{
|
||||||
|
evaluatorId: "-",
|
||||||
const commanderHighId =
|
commanderId: "-",
|
||||||
data.kpiUserEvaluations.length > 0 ? data.kpiUserEvaluations[0].commanderHighId : "";
|
commanderHighId: "-",
|
||||||
let prefixCommanderHigh = "";
|
fullNameEvaluator: "-",
|
||||||
let firstNameCommanderHigh = "";
|
positionEvaluator: "-",
|
||||||
let lastNameCommanderHigh = "";
|
posTypeNameEvaluator: "-",
|
||||||
let positionCommanderHigh = "";
|
posLevelNameEvaluator: "-",
|
||||||
let posTypeNameCommanderHigh = "";
|
orgEvaluator: "-",
|
||||||
let posLevelNameCommanderHigh = "";
|
fullNameCommander: "-",
|
||||||
let orgCommanderHigh;
|
positionCommander: "-",
|
||||||
if (commanderHighId != "" && commanderHighId != null) {
|
posTypeNameCommander: "-",
|
||||||
await new CallAPI()
|
posLevelNameCommander: "-",
|
||||||
.GetData(request, "org/profile/profileid/position/" + commanderHighId)
|
orgCommander: "-",
|
||||||
.then((x) => {
|
fullNameCommanderHigh: "-",
|
||||||
prefixCommanderHigh = x.prefix;
|
positionCommanderHigh: "-",
|
||||||
firstNameCommanderHigh = x.firstName;
|
posTypeNameCommanderHigh: "-",
|
||||||
lastNameCommanderHigh = x.lastName;
|
posLevelNameCommanderHigh: "-",
|
||||||
positionCommanderHigh = x.position;
|
orgCommanderHigh: "-",
|
||||||
orgCommanderHigh = x.root;
|
evaluationResults: [
|
||||||
posTypeNameCommanderHigh = x.posTypeName;
|
{
|
||||||
posLevelNameCommanderHigh = x.posLevelName;
|
no: "-",
|
||||||
})
|
fullName: "-",
|
||||||
.catch(() => {
|
position: "-",
|
||||||
// throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลในทะเบียนประวัติ");
|
point1: "-",
|
||||||
});
|
point2: "-",
|
||||||
}
|
point3: "-",
|
||||||
const fullNameCommanderHigh =
|
point4: "-",
|
||||||
prefixCommanderHigh != "" && firstNameCommanderHigh != "" && lastNameCommanderHigh != ""
|
point5: "-",
|
||||||
? `${prefixCommanderHigh}${firstNameCommanderHigh} ${lastNameCommanderHigh}`
|
remark: "-",
|
||||||
: "-";
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
];
|
||||||
formattedData = {
|
formattedData = {
|
||||||
year: data?.year ? Extension.ToThaiNumber((data.year + 543).toString()) : "-",
|
year: data?.year ? Extension.ToThaiNumber((data.year + 543).toString()) : "-",
|
||||||
period1: Extension.ToThaiNumber(period1),
|
period1: Extension.ToThaiNumber(period1),
|
||||||
period2: Extension.ToThaiNumber(period2),
|
period2: Extension.ToThaiNumber(period2),
|
||||||
durationKPI: data?.durationKPI,
|
evaluations: _userEvaluations,
|
||||||
root: data && data.rootName != null ? data.rootName : "-",
|
|
||||||
fullNameEvaluator: fullNameEvaluator,
|
|
||||||
positionEvaluator:
|
|
||||||
data.kpiUserEvaluations.length > 0 ? data.kpiUserEvaluations[0].positionEvaluator : "-",
|
|
||||||
posTypeNameEvaluator:
|
|
||||||
data.kpiUserEvaluations.length > 0
|
|
||||||
? data.kpiUserEvaluations[0].posTypeNameEvaluator
|
|
||||||
: "-",
|
|
||||||
posLevelNameEvaluator:
|
|
||||||
data.kpiUserEvaluations.length > 0
|
|
||||||
? data.kpiUserEvaluations[0].posLevelNameEvaluator
|
|
||||||
: "-",
|
|
||||||
orgEvaluator:
|
|
||||||
data.kpiUserEvaluations.length > 0 ? data.kpiUserEvaluations[0].orgEvaluator : "-",
|
|
||||||
fullNameCommander: fullNameCommander,
|
|
||||||
positionCommander:
|
|
||||||
positionCommander != "" && positionCommander != null ? positionCommander : "-",
|
|
||||||
posTypeNameCommander:
|
|
||||||
posTypeNameCommander != "" && posTypeNameCommander != null ? posTypeNameCommander : "-",
|
|
||||||
posLevelNameCommander:
|
|
||||||
posLevelNameCommander != "" && posLevelNameCommander != null
|
|
||||||
? posLevelNameCommander
|
|
||||||
: "-",
|
|
||||||
orgCommander: orgCommander != "" && orgCommander != null ? orgCommander : "-",
|
|
||||||
fullNameCommanderHigh: fullNameCommanderHigh,
|
|
||||||
positionCommanderHigh:
|
|
||||||
positionCommanderHigh != "" && positionCommanderHigh != null
|
|
||||||
? positionCommanderHigh
|
|
||||||
: "-",
|
|
||||||
posTypeNameCommanderHigh:
|
|
||||||
posTypeNameCommanderHigh != "" && posTypeNameCommanderHigh != null
|
|
||||||
? posTypeNameCommanderHigh
|
|
||||||
: "-",
|
|
||||||
posLevelNameCommanderHigh:
|
|
||||||
posLevelNameCommanderHigh != "" && posLevelNameCommanderHigh != null
|
|
||||||
? posLevelNameCommanderHigh
|
|
||||||
: "-",
|
|
||||||
orgCommanderHigh:
|
|
||||||
orgCommanderHigh != "" && orgCommanderHigh != null ? orgCommanderHigh : "-",
|
|
||||||
userEvaluations: userEvaluations_,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (requestBody.type == "KPI4") {
|
if (requestBody.type == "KPI4") {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue