fix ไม่แสดงรอบ/ตารางไม่แสดงแถวแรก
This commit is contained in:
parent
b6fd61aad5
commit
fb41b66bf9
1 changed files with 66 additions and 66 deletions
|
|
@ -72,7 +72,7 @@ export class ReportController extends Controller {
|
||||||
})
|
})
|
||||||
dataKpiUserEvaluations = await this.kpiUserEvaluationRepository.find({
|
dataKpiUserEvaluations = await this.kpiUserEvaluationRepository.find({
|
||||||
where: {
|
where: {
|
||||||
kpiPeriodId: String(requestBody.periodId),
|
kpiPeriodId: requestBody.periodId,
|
||||||
orgId: requestBody.root
|
orgId: requestBody.root
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
@ -89,11 +89,10 @@ export class ReportController extends Controller {
|
||||||
period1 = `${Extension.ToThaiFullDate2(data.startDate)} ถึง ${Extension.ToThaiFullDate2(data.endDate)}`
|
period1 = `${Extension.ToThaiFullDate2(data.startDate)} ถึง ${Extension.ToThaiFullDate2(data.endDate)}`
|
||||||
let _period2 = await this.kpiPeriodRepository.findOne({
|
let _period2 = await this.kpiPeriodRepository.findOne({
|
||||||
where: {
|
where: {
|
||||||
year: data.year, durationKPI: "OCR", isActive: true
|
year: data.year, durationKPI: "OCT", isActive: true
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
period2 = _period2 ? `${Extension.ToThaiFullDate2(_period2?.startDate)} ถึง ${Extension.ToThaiFullDate2(_period2?.endDate)}` : ""
|
period2 = _period2 ? `${Extension.ToThaiFullDate2(_period2?.startDate)} ถึง ${Extension.ToThaiFullDate2(_period2?.endDate)}` : ""
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(data.durationKPI == "OCT"){
|
else if(data.durationKPI == "OCT"){
|
||||||
period2 = `${Extension.ToThaiFullDate2(data.startDate)} ถึง ${Extension.ToThaiFullDate2(data.endDate)}`
|
period2 = `${Extension.ToThaiFullDate2(data.startDate)} ถึง ${Extension.ToThaiFullDate2(data.endDate)}`
|
||||||
|
|
@ -142,26 +141,26 @@ export class ReportController extends Controller {
|
||||||
: "๐"
|
: "๐"
|
||||||
/*END ROOT*/
|
/*END ROOT*/
|
||||||
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,
|
durationKPI: data?.durationKPI,
|
||||||
root: data?.kpiUserEvaluations != null && data?.kpiUserEvaluations.length > 0
|
root: data?.kpiUserEvaluations != null && data?.kpiUserEvaluations.length > 0
|
||||||
? data?.kpiUserEvaluations[0].orgEvaluator
|
? data?.kpiUserEvaluations[0].orgEvaluator
|
||||||
: "",
|
: "-",
|
||||||
userEvaluations: [
|
userEvaluations: [
|
||||||
{
|
{
|
||||||
no: "๑",
|
no: userEvaluationOrg.length > 0 ? "๑" : "",
|
||||||
root: userEvaluationOrg.length > 0
|
root: userEvaluationOrg.length > 0
|
||||||
? userEvaluationOrg[0].orgEvaluator ?? ""
|
? userEvaluationOrg[0].orgEvaluator ?? ""
|
||||||
: "",
|
: "-",
|
||||||
resultAll: resultAll,
|
resultAll: userEvaluationOrg.length > 0 ? resultAll : "",
|
||||||
result: result,
|
result: userEvaluationOrg.length > 0 ? result : "",
|
||||||
excellent: excellent,
|
excellent: userEvaluationOrg.length > 0 ? excellent : "",
|
||||||
verygood: verygood,
|
verygood: userEvaluationOrg.length > 0 ? verygood : "",
|
||||||
good: good,
|
good: userEvaluationOrg.length > 0 ? good : "",
|
||||||
fair: fair,
|
fair: userEvaluationOrg.length > 0 ? fair : "",
|
||||||
improvment: improvment,
|
improvment: userEvaluationOrg.length > 0 ? improvment : "",
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
@ -169,77 +168,77 @@ export class ReportController extends Controller {
|
||||||
if (requestBody.type == "KPI2") {
|
if (requestBody.type == "KPI2") {
|
||||||
templateName = "KPI2";
|
templateName = "KPI2";
|
||||||
reportName = "KPI2";
|
reportName = "KPI2";
|
||||||
const excellent = data.length > 0
|
const excellent = data.kpiUserEvaluations.length > 0
|
||||||
? data.fla((x:any, idx:number) => ({
|
? data.kpiUserEvaluations.map((x:any, idx:number) => ({
|
||||||
no: Extension.ToThaiNumber((idx+1).toString()),
|
no: Extension.ToThaiNumber((idx+1).toString()),
|
||||||
fullName: `${x.prefix}${x.firstName} ${x.lastName}`,
|
fullName: `${x.prefix}${x.firstName} ${x.lastName}`,
|
||||||
position: x.position ? x.position : "",
|
position: x.position ? x.position : "",
|
||||||
posLevelName: x.posLevelName ? x.posLevelName : "",
|
posLevelName: x.posLevelName ? x.posLevelName : "",
|
||||||
org: x.org ? x.org : "",
|
org: x.org ? x.org : "",
|
||||||
})).filter((x:any) => x.evaluationResults == "EXCELLENT")
|
})).filter((x:any) => x.evaluationResults == "EXCELLENT")
|
||||||
: []
|
: [{}]
|
||||||
const verygood = data.length > 0
|
const verygood = data.kpiUserEvaluations.length > 0
|
||||||
? data.map((x:any, idx:number) => ({
|
? data.kpiUserEvaluations.map((x:any, idx:number) => ({
|
||||||
no: Extension.ToThaiNumber((idx+1).toString()),
|
no: Extension.ToThaiNumber((idx+1).toString()),
|
||||||
fullName: `${x.prefix}${x.firstName} ${x.lastName}`,
|
fullName: `${x.prefix}${x.firstName} ${x.lastName}`,
|
||||||
position: x.position ? x.position : "",
|
position: x.position ? x.position : "",
|
||||||
posLevelName: x.posLevelName ? x.posLevelName : "",
|
posLevelName: x.posLevelName ? x.posLevelName : "",
|
||||||
org: x.org ? x.org : "",
|
org: x.org ? x.org : "",
|
||||||
})).filter((x:any) => x.evaluationResults == "VERY_GOOD")
|
})).filter((x:any) => x.evaluationResults == "VERY_GOOD")
|
||||||
: []
|
: [{}]
|
||||||
const good = data.length > 0
|
const good = data.kpiUserEvaluations.length > 0
|
||||||
? data.map((x:any, idx:number) => ({
|
? data.kpiUserEvaluations.map((x:any, idx:number) => ({
|
||||||
no: Extension.ToThaiNumber((idx+1).toString()),
|
no: Extension.ToThaiNumber((idx+1).toString()),
|
||||||
fullName: `${x.prefix}${x.firstName} ${x.lastName}`,
|
fullName: `${x.prefix}${x.firstName} ${x.lastName}`,
|
||||||
position: x.position ? x.position : "",
|
position: x.position ? x.position : "",
|
||||||
posLevelName: x.posLevelName ? x.posLevelName : "",
|
posLevelName: x.posLevelName ? x.posLevelName : "",
|
||||||
org: x.org ? x.org : "",
|
org: x.org ? x.org : "",
|
||||||
})).filter((x:any) => x.evaluationResults == "GOOD")
|
})).filter((x:any) => x.evaluationResults == "GOOD")
|
||||||
: []
|
: [{}]
|
||||||
const fair = data.length > 0
|
const fair = data.kpiUserEvaluations.length > 0
|
||||||
? data.map((x:any, idx:number) => ({
|
? data.kpiUserEvaluations.map((x:any, idx:number) => ({
|
||||||
no: Extension.ToThaiNumber((idx+1).toString()),
|
no: Extension.ToThaiNumber((idx+1).toString()),
|
||||||
fullName: `${x.prefix}${x.firstName} ${x.lastName}`,
|
fullName: `${x.prefix}${x.firstName} ${x.lastName}`,
|
||||||
position: x.position ? x.position : "",
|
position: x.position ? x.position : "",
|
||||||
posLevelName: x.posLevelName ? x.posLevelName : "",
|
posLevelName: x.posLevelName ? x.posLevelName : "",
|
||||||
org: x.org ? x.org : "",
|
org: x.org ? x.org : "",
|
||||||
})).filter((x:any) => x.evaluationResults == "FAIR")
|
})).filter((x:any) => x.evaluationResults == "FAIR")
|
||||||
: []
|
: [{}]
|
||||||
const improvment = data.length > 0
|
const improvment = data.kpiUserEvaluations.length > 0
|
||||||
? data.map((x:any, idx:number) => ({
|
? data.kpiUserEvaluations.map((x:any, idx:number) => ({
|
||||||
no: Extension.ToThaiNumber((idx+1).toString()),
|
no: Extension.ToThaiNumber((idx+1).toString()),
|
||||||
fullName: `${x.prefix}${x.firstName} ${x.lastName}`,
|
fullName: `${x.prefix}${x.firstName} ${x.lastName}`,
|
||||||
position: x.position ? x.position : "",
|
position: x.position ? x.position : "",
|
||||||
posLevelName: x.posLevelName ? x.posLevelName : "",
|
posLevelName: x.posLevelName ? x.posLevelName : "",
|
||||||
org: x.org ? x.org : "",
|
org: x.org ? x.org : "",
|
||||||
})).filter((x:any) => x.evaluationResults == "IMPROVEMENT")
|
})).filter((x:any) => x.evaluationResults == "IMPROVEMENT")
|
||||||
: []
|
: [{}]
|
||||||
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,
|
durationKPI: data?.durationKPI,
|
||||||
root: data?.kpiUserEvaluations != null && data?.kpiUserEvaluations.length > 0
|
root: data?.kpiUserEvaluations != null && data?.kpiUserEvaluations.length > 0
|
||||||
? data?.kpiUserEvaluations[0].orgEvaluator
|
? data?.kpiUserEvaluations[0].orgEvaluator
|
||||||
: "",
|
: "-",
|
||||||
excellents: {
|
excellents: {
|
||||||
count: Extension.ToThaiNumber(excellent.length.toString()),
|
count: data.kpiUserEvaluations.length > 0 ? Extension.ToThaiNumber(excellent.length.toString()) : "",
|
||||||
data: excellent
|
data: excellent
|
||||||
},
|
},
|
||||||
verygoods: {
|
verygoods: {
|
||||||
count: Extension.ToThaiNumber(verygood.length.toString()),
|
count: data.kpiUserEvaluations.length > 0 ? Extension.ToThaiNumber(verygood.length.toString()) : "",
|
||||||
data: verygood
|
data: verygood
|
||||||
},
|
},
|
||||||
goods: {
|
goods: {
|
||||||
count: Extension.ToThaiNumber(good.length.toString()),
|
count: data.kpiUserEvaluations.length > 0 ? Extension.ToThaiNumber(good.length.toString()) : "",
|
||||||
data: good
|
data: good
|
||||||
},
|
},
|
||||||
fairs: {
|
fairs: {
|
||||||
count: Extension.ToThaiNumber(fair.length.toString()),
|
count: data.kpiUserEvaluations.length > 0 ? Extension.ToThaiNumber(fair.length.toString()) : "",
|
||||||
data: fair
|
data: fair
|
||||||
},
|
},
|
||||||
improvments: {
|
improvments: {
|
||||||
count: Extension.ToThaiNumber(improvment.length.toString()),
|
count: data.kpiUserEvaluations.length > 0 ? Extension.ToThaiNumber(improvment.length.toString()) : "",
|
||||||
data: improvment
|
data: improvment
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
@ -259,18 +258,18 @@ export class ReportController extends Controller {
|
||||||
point5: x.summaryPoint < 60.00 ? Extension.ToThaiNumber(x.summaryPoint.toString()) : "",
|
point5: x.summaryPoint < 60.00 ? Extension.ToThaiNumber(x.summaryPoint.toString()) : "",
|
||||||
remark: ""
|
remark: ""
|
||||||
}))
|
}))
|
||||||
: []
|
: [{}]
|
||||||
// const prefixEvaluator_ = data.kpiUserEvaluations.find((x:any) => x.prefixEvaluator);
|
// const prefixEvaluator_ = data.kpiUserEvaluations.find((x:any) => x.prefixEvaluator);
|
||||||
// const firstNameEvaluator_ = data.kpiUserEvaluations.firstNameEvaluator ? data.kpiUserEvaluations.firstNameEvaluator : "";
|
// const firstNameEvaluator_ = data.kpiUserEvaluations.firstNameEvaluator ? data.kpiUserEvaluations.firstNameEvaluator : "";
|
||||||
// const lastNameEvaluator_ = data.kpiUserEvaluations.lastNameEvaluator ? data.kpiUserEvaluations.lastNameEvaluator : "";
|
// const lastNameEvaluator_ = data.kpiUserEvaluations.lastNameEvaluator ? data.kpiUserEvaluations.lastNameEvaluator : "";
|
||||||
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,
|
durationKPI: data?.durationKPI,
|
||||||
root: data?.kpiUserEvaluations != null && data?.kpiUserEvaluations.length > 0
|
root: data?.kpiUserEvaluations != null && data?.kpiUserEvaluations.length > 0
|
||||||
? data?.kpiUserEvaluations[0].orgEvaluator
|
? data?.kpiUserEvaluations[0].orgEvaluator
|
||||||
: "",
|
: "-",
|
||||||
fullNameEvaluator: "-",
|
fullNameEvaluator: "-",
|
||||||
positionEvaluator: "-",
|
positionEvaluator: "-",
|
||||||
posTypeNameEvaluator: "-",
|
posTypeNameEvaluator: "-",
|
||||||
|
|
@ -310,27 +309,27 @@ export class ReportController extends Controller {
|
||||||
templateName = "KPI7";
|
templateName = "KPI7";
|
||||||
reportName = "KPI7";
|
reportName = "KPI7";
|
||||||
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,
|
durationKPI: data?.durationKPI,
|
||||||
root: data?.kpiUserEvaluations != null && data?.kpiUserEvaluations.length > 0
|
root: data?.kpiUserEvaluations != null && data?.kpiUserEvaluations.length > 0
|
||||||
? data?.kpiUserEvaluations[0].orgEvaluator
|
? data?.kpiUserEvaluations[0].orgEvaluator
|
||||||
: "",
|
: "-",
|
||||||
userEvaluations: data.kpiUserEvaluations.map((x: any, idx: number) => ({
|
userEvaluations: data.kpiUserEvaluations.length > 0
|
||||||
no: Extension.ToThaiNumber((idx + 1).toString()),
|
? data.kpiUserEvaluations.map((x: any, idx: number) => ({
|
||||||
fullName: `${x.prefix}${x.firstName} ${x.lastName}`,
|
no: Extension.ToThaiNumber((idx + 1).toString()),
|
||||||
position: x.position ? x.position : "",
|
fullName: `${x.prefix}${x.firstName} ${x.lastName}`,
|
||||||
posLevelName: x.posLevelName ? x.posLevelName : "",
|
position: x.position ? x.position : "",
|
||||||
developName: x.topicEvaluator ? x.topicEvaluator : "",
|
posLevelName: x.posLevelName ? x.posLevelName : "",
|
||||||
developEvaluator: x.developEvaluator ? x.developEvaluator : "",
|
developName: x.topicEvaluator ? x.topicEvaluator : "",
|
||||||
target: "", //เป้าหมาย
|
developEvaluator: x.developEvaluator ? x.developEvaluator : "",
|
||||||
timeEvaluator: x.timeEvaluator ? x.timeEvaluator : "",
|
target: "", //เป้าหมาย
|
||||||
developResults: "", //วิธีการวัดผลการพัฒนา
|
timeEvaluator: x.timeEvaluator ? x.timeEvaluator : "",
|
||||||
evaluationResults: x.evaluationResults
|
developResults: "", //วิธีการวัดผลการพัฒนา
|
||||||
? Extension.EvaluationResult(x.evaluationResults)
|
evaluationResults: x.evaluationResults ? Extension.EvaluationResult(x.evaluationResults) : "",
|
||||||
: "",
|
}))
|
||||||
})),
|
: [{}],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (requestBody.type == "KPI8") {
|
if (requestBody.type == "KPI8") {
|
||||||
|
|
@ -344,18 +343,19 @@ export class ReportController extends Controller {
|
||||||
formattedData = {
|
formattedData = {
|
||||||
root: data?.kpiUserEvaluations != null && data?.kpiUserEvaluations.length > 0
|
root: data?.kpiUserEvaluations != null && data?.kpiUserEvaluations.length > 0
|
||||||
? data?.kpiUserEvaluations[0].orgEvaluator
|
? data?.kpiUserEvaluations[0].orgEvaluator
|
||||||
: "",
|
: "-",
|
||||||
period: data?.durationKPI == "APR" ? "๑": data?.durationKPI == "OCT" ? "๒" : "-",
|
period: data?.durationKPI == "APR" ? "๑": data?.durationKPI == "OCT" ? "๒" : "-",
|
||||||
year: Extension.ToThaiNumber((data.year+543).toString()),
|
year: data.year ? Extension.ToThaiNumber((data.year+543).toString()) : "-",
|
||||||
userEvaluations: data.kpiUserEvaluations.map((x: any, idx: number) => ({
|
userEvaluations: data.kpiUserEvaluations.length > 0
|
||||||
no: Extension.ToThaiNumber((idx + 1).toString()),
|
? data.kpiUserEvaluations.map((x: any, idx: number) => ({
|
||||||
fullName: `${x.prefix}${x.firstName} ${x.lastName}`,
|
no: Extension.ToThaiNumber((idx + 1).toString()),
|
||||||
position: x.position ? x.position : "",
|
fullName: `${x.prefix}${x.firstName} ${x.lastName}`,
|
||||||
posLevelName: x.posLevelName ? x.posLevelName : "",
|
position: x.position ? x.position : "",
|
||||||
evaluationResults: x.evaluationResults
|
posLevelName: x.posLevelName ? x.posLevelName : "",
|
||||||
? Extension.EvaluationResult(x.evaluationResults)
|
evaluationResults: x.evaluationResults ? Extension.EvaluationResult(x.evaluationResults) : "",
|
||||||
: "",
|
}))
|
||||||
})),
|
: [{}]
|
||||||
|
,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue