ผูกสิท
This commit is contained in:
parent
92b2291c4b
commit
5b63aa9fad
7 changed files with 181 additions and 22 deletions
|
|
@ -198,9 +198,9 @@ export class KpiUserEvaluationController extends Controller {
|
|||
* @summary รายการประเมินผลการปฏิบัติราชการระดับบุคคลทั้งหมด
|
||||
*
|
||||
*/
|
||||
@Post("list")
|
||||
async listKpiListEvaluation(
|
||||
@Request() request: { user: Record<string, any> },
|
||||
@Post("list-announce")
|
||||
async listKpiListEvaluationAnnounce(
|
||||
@Request() request: RequestWithUser,
|
||||
@Body()
|
||||
requestBody: {
|
||||
page: number;
|
||||
|
|
@ -213,6 +213,124 @@ export class KpiUserEvaluationController extends Controller {
|
|||
evaluating?: boolean | null;
|
||||
},
|
||||
) {
|
||||
await new permission().PermissionDelete(request, "SYS_RESULT");
|
||||
let conditionFullName =
|
||||
"CONCAT(kpiUserEvaluation.prefix, kpiUserEvaluation.firstName, ' ', kpiUserEvaluation.lastName) LIKE :keyword";
|
||||
const [kpiUserEvaluation, total] = await AppDataSource.getRepository(KpiUserEvaluation)
|
||||
.createQueryBuilder("kpiUserEvaluation")
|
||||
.andWhere(requestBody.kpiPeriodId ? "kpiPeriodId LIKE :kpiPeriodId" : "1=1", {
|
||||
kpiPeriodId: requestBody.kpiPeriodId,
|
||||
})
|
||||
.andWhere(
|
||||
requestBody.status != null && requestBody.status != undefined
|
||||
? "evaluationstatus LIKE :status"
|
||||
: "1=1",
|
||||
{
|
||||
status:
|
||||
requestBody.status == null || requestBody.status == undefined
|
||||
? null
|
||||
: requestBody.status.trim().toUpperCase(),
|
||||
},
|
||||
)
|
||||
.andWhere(
|
||||
requestBody.results != null && requestBody.results != undefined
|
||||
? "evaluationResults LIKE :results"
|
||||
: "1=1",
|
||||
{
|
||||
results:
|
||||
requestBody.results == null || requestBody.results == undefined
|
||||
? null
|
||||
: requestBody.results.trim().toUpperCase(),
|
||||
},
|
||||
)
|
||||
.andWhere(
|
||||
new Brackets((qb) => {
|
||||
qb.orWhere("kpiUserEvaluation.prefix LIKE :keyword", {
|
||||
keyword: `%${requestBody.keyword}%`,
|
||||
})
|
||||
.orWhere("kpiUserEvaluation.firstName LIKE :keyword", {
|
||||
keyword: `%${requestBody.keyword}%`,
|
||||
})
|
||||
.orWhere("kpiUserEvaluation.lastName LIKE :keyword", {
|
||||
keyword: `%${requestBody.keyword}%`,
|
||||
})
|
||||
.orWhere("kpiUserEvaluation.org LIKE :keyword", {
|
||||
keyword: `%${requestBody.keyword}%`,
|
||||
})
|
||||
.orWhere("kpiUserEvaluation.position LIKE :keyword", {
|
||||
keyword: `%${requestBody.keyword}%`,
|
||||
})
|
||||
.orWhere("kpiUserEvaluation.posTypeName LIKE :keyword", {
|
||||
keyword: `%${requestBody.keyword}%`,
|
||||
})
|
||||
.orWhere("kpiUserEvaluation.posLevelName LIKE :keyword", {
|
||||
keyword: `%${requestBody.keyword}%`,
|
||||
})
|
||||
.orWhere(conditionFullName, {
|
||||
keyword: `%${requestBody.keyword}%`,
|
||||
});
|
||||
}),
|
||||
)
|
||||
.orderBy("kpiUserEvaluation.createdAt", "ASC")
|
||||
.skip((requestBody.page - 1) * requestBody.pageSize)
|
||||
.take(requestBody.pageSize)
|
||||
.getManyAndCount();
|
||||
|
||||
const mapData = kpiUserEvaluation.map((item) => {
|
||||
const fullNameParts = [item.child4, item.child3, item.child2, item.child1, item.org];
|
||||
|
||||
const organization = fullNameParts
|
||||
.filter((part) => part !== undefined && part !== null)
|
||||
.join("/");
|
||||
|
||||
return {
|
||||
id: item.id,
|
||||
profileId: item.profileId,
|
||||
prefix: item.prefix,
|
||||
firstname: item.firstName,
|
||||
lastname: item.lastName,
|
||||
kpiPeriodId: item.kpiPeriodId,
|
||||
evaluationStatus: item.evaluationStatus,
|
||||
evaluationResults: item.evaluationResults,
|
||||
createdAt: item.createdAt,
|
||||
evaluatorId: item.evaluatorId,
|
||||
commanderId: item.commanderId,
|
||||
commanderHighId: item.commanderHighId,
|
||||
root: item.org ? item.org : null,
|
||||
rootId: item.orgId ? item.orgId : null,
|
||||
position: item.position ? item.position : null,
|
||||
// posTypeId: item.posTypeId,
|
||||
posTypeName: item.posTypeName ? item.posTypeName : null,
|
||||
// posLevelId: item.posLevelId,
|
||||
posLevelName: item.posLevelName ? item.posLevelName : null,
|
||||
organization: organization ? organization : null,
|
||||
};
|
||||
});
|
||||
return new HttpSuccess({ data: mapData, total });
|
||||
}
|
||||
|
||||
/**
|
||||
* API
|
||||
*
|
||||
* @summary รายการประเมินผลการปฏิบัติราชการระดับบุคคลทั้งหมด
|
||||
*
|
||||
*/
|
||||
@Post("list")
|
||||
async listKpiListEvaluation(
|
||||
@Request() request: RequestWithUser,
|
||||
@Body()
|
||||
requestBody: {
|
||||
page: number;
|
||||
pageSize: number;
|
||||
kpiPeriodId?: string;
|
||||
keyword?: string;
|
||||
status?: string | null;
|
||||
results?: string | null;
|
||||
reqedit?: string | null;
|
||||
evaluating?: boolean | null;
|
||||
},
|
||||
) {
|
||||
await new permission().PermissionDelete(request, "SYS_KPI_LIST");
|
||||
let conditionFullName =
|
||||
"CONCAT(kpiUserEvaluation.prefix, kpiUserEvaluation.firstName, ' ', kpiUserEvaluation.lastName) LIKE :keyword";
|
||||
const [kpiUserEvaluation, total] = await AppDataSource.getRepository(KpiUserEvaluation)
|
||||
|
|
@ -1440,10 +1558,8 @@ export class KpiUserEvaluationController extends Controller {
|
|||
* @param {string} id Guid, *Id คนประเมิน (USER)
|
||||
*/
|
||||
@Get("reason/{id}")
|
||||
async getReasonKpiEvaluation(
|
||||
@Path() id: string,
|
||||
@Request() request: { user: Record<string, any> },
|
||||
) {
|
||||
async getReasonKpiEvaluation(@Path() id: string, @Request() request: RequestWithUser) {
|
||||
await new permission().PermissionGet(request, "SYS_KPI_LIST");
|
||||
const kpiUserEvaluation = await this.kpiUserEvalutionRepository.findOne({
|
||||
where: { id: id },
|
||||
select: [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue