add field assignedPosLevel

This commit is contained in:
Bright 2025-06-13 18:05:30 +07:00
parent 9e69bf3a46
commit 264fafdcbf
4 changed files with 32 additions and 1 deletions

View file

@ -550,6 +550,7 @@ export class EvaluationController {
select: ["detailBody", "detailFooter"],
});
const before = null;
let typeTh = evaluation.type == "EXPERT" ? "ชำนาญการ" : evaluation.type == "EXPERTISE" ? "เชียวชาญ" : evaluation.type == "SPECIAL_EXPERT" ? "ชำนาญการพิเศษ":"";
await new CallAPI()
.GetData(request, `/org/profile/keycloak/commander/${request.user.sub}`)
.then(async (x) => {
@ -560,6 +561,8 @@ export class EvaluationController {
evaluation.child4DnaId = x.child4DnaId;
})
.catch();
evaluation.assignedPosition = requestBody.position ? requestBody.position : _null;
evaluation.assignedPosLevel = typeTh;
evaluation.step = "PREPARE_DOC_V1";
evaluation.type = requestBody.type == "EXPERT" ? "EXPERT" : "SPECIAL_EXPERT";
evaluation.fullName = requestBody.fullName;
@ -837,6 +840,7 @@ export class EvaluationController {
const evaluation = Object.assign(new Evaluation(), requestBody);
const before = null;
let org: any;
const __null: any = null;
await new CallAPI()
.GetData(request, `/org/profile/keycloak/commander/${request.user.sub}`)
.then(async (x) => {
@ -849,6 +853,8 @@ export class EvaluationController {
})
.catch();
//Evaluation
evaluation.assignedPosition = requestBody.position ? requestBody.position : __null;
evaluation.assignedPosLevel = "เชียวชาญ";
evaluation.oc = org;
evaluation.step = "DONE";
evaluation.type = "EXPERTISE";
@ -2226,6 +2232,7 @@ export class EvaluationController {
evaluation.subjectDoc2 = evaluation.subject;
evaluation.authorDoc2 = evaluation.author;
evaluation.assignedPosition = evaluation.position; //xxxxxxxxxx
evaluation.assignedPosLevel = "xxxxxxxx"; //xxxxxxxxxx
evaluation.commanderFullnameDoc2 = evaluation.commanderFullname;
evaluation.commanderPositionDoc2 = evaluation.commanderPosition;
evaluation.commanderAboveFullnameDoc2 = evaluation.commanderAboveFullname;
@ -2895,6 +2902,7 @@ export class EvaluationController {
"authorDoc2",
"subjectDoc2",
"assignedPosition",
"assignedPosLevel",
"commanderFullnameDoc2",
"commanderOrgDoc2",
"commanderOrgOldDoc2",
@ -2939,6 +2947,7 @@ export class EvaluationController {
"authorDoc2",
"subjectDoc2",
"assignedPosition",
"assignedPosLevel",
"commanderFullnameDoc2",
"commanderOrgDoc2",
"commanderOrgOldDoc2",
@ -3048,6 +3057,7 @@ export class EvaluationController {
authorDoc2: "string",
subjectDoc2: "string",
assignedPosition: "string",
assignedPosLevel: "string",
commanderFullnameDoc2: "string",
commanderPositionDoc2: "string",
commanderAboveFullnameDoc2: "string",
@ -3061,6 +3071,7 @@ export class EvaluationController {
authorDoc2: string;
subjectDoc2: string[];
assignedPosition: string;
assignedPosLevel?: string;
commanderFullnameDoc2: string;
commanderPositionDoc2: string;
commanderAboveFullnameDoc2: string;
@ -3084,6 +3095,7 @@ export class EvaluationController {
evaluation.authorDoc2 = body.authorDoc2;
evaluation.subjectDoc2 = body.subjectDoc2;
evaluation.assignedPosition = body.assignedPosition;
evaluation.assignedPosLevel = body.assignedPosLevel ? body.assignedPosLevel : _null;
evaluation.commanderFullnameDoc2 = body.commanderFullnameDoc2;
evaluation.commanderOrgDoc2 = body.commanderOrgDoc2 ?? _null;
evaluation.commanderOrgOldDoc2 = body.commanderOrgOldDoc2 ?? _null;

View file

@ -335,8 +335,10 @@ export class ReoportController {
prefix: evaluation.prefix,
fullName: evaluation.fullName ? `${evaluation.fullName}` : "",
position: evaluation.position ? evaluation.position : "",
// ตำแหน่งเดิม,
posAndPosLevel: (evaluation.position ? `${evaluation.position}` : "") + (evaluation.positionLevel ? `${evaluation.positionLevel}` : ""),
posAndTypeTh: (evaluation.position ? `${evaluation.position}` : "" ) + (typeTh ? `${typeTh}` : ""),
// ตำแหน่งใหม่
posAndTypeTh: (evaluation.assignedPosition ? `${evaluation.assignedPosition}` : "" ) + (evaluation.assignedPosLevel ? `${evaluation.assignedPosLevel}` : ""),
posNo: evaluation.posNo ? Extension.ToThaiNumber(evaluation.posNo) : "",
posNoWithSym: evaluation.posNo ? `(${Extension.ToThaiNumber(evaluation.posNo)})` : "",
oc: evaluation.oc ? evaluation.oc.replace(/\n/g, " ") : "-",

View file

@ -268,6 +268,9 @@ export class Evaluation extends EntityBase {
@Column({ nullable: true, comment: "ตำแหน่งที่ได้รับมอบหมาย" })
assignedPosition: string;
@Column({ nullable: true, comment: "ระดับที่ได้รับมอบหมาย" })
assignedPosLevel: string;
@Column({ nullable: true, comment: "ผลการประเมิน", default: "PENDING" }) //PENDING,PASS,NOTPASS
evaluationResult: string;

View file

@ -0,0 +1,14 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddFieldAssignedPosLevel1749811430532 implements MigrationInterface {
name = 'AddFieldAssignedPosLevel1749811430532'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`evaluation\` ADD \`assignedPosLevel\` varchar(255) NULL COMMENT 'ระดับที่ได้รับมอบหมาย'`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`evaluation\` DROP COLUMN \`assignedPosLevel\``);
}
}