Merge branch 'develop' of github.com:Frappet/bma-ehr-kpi into develop

This commit is contained in:
Kittapath 2024-04-19 14:37:38 +07:00
commit 2f50a1983b
3 changed files with 14 additions and 9 deletions

View file

@ -48,17 +48,17 @@ export class kpiCapacityController extends Controller {
name: "ชื่อสมรรถนะ", name: "ชื่อสมรรถนะ",
description: "คำจำกัดความ", description: "คำจำกัดความ",
kpiCapacityDetails: [{ kpiCapacityDetails: [{
level: "ระดับ",
description: "คำอธิบายระดับ" description: "คำอธิบายระดับ"
}] }]
}) })
async createKpiCapacity( async createKpiCapacity(
// @Body() requestBody: createKpiCapacity,
@Body() requestBody: { @Body() requestBody: {
type: string type: string
name: string name: string
description: string description: string
capacityDetails: { capacityDetails: {
// level: number; level: string;
description: string; description: string;
}[]; }[];
}, },
@ -78,8 +78,9 @@ export class kpiCapacityController extends Controller {
let idx: number = 0; let idx: number = 0;
for (const data of requestBody.capacityDetails) { for (const data of requestBody.capacityDetails) {
idx += 1 idx += 1
let _level = (kpiCapacity.type === "HEAD" || kpiCapacity.type === "GROUP") ? idx.toString() : data.level;
const kpiCapacityDetail = Object.assign(new KpiCapacityDetail(), { const kpiCapacityDetail = Object.assign(new KpiCapacityDetail(), {
level: idx, level: _level,
description: data.description, description: data.description,
kpiCapacityId: kpiCapacity.id kpiCapacityId: kpiCapacity.id
}); });
@ -106,6 +107,7 @@ export class kpiCapacityController extends Controller {
name: "ชื่อสมรรถนะ", name: "ชื่อสมรรถนะ",
description: "คำจำกัดความ", description: "คำจำกัดความ",
kpiCapacityDetails: [{ kpiCapacityDetails: [{
level: "ระดับ",
description: "คำอธิบายระดับ" description: "คำอธิบายระดับ"
}] }]
}) })
@ -116,6 +118,7 @@ export class kpiCapacityController extends Controller {
name: string name: string
description: string description: string
capacityDetails: { capacityDetails: {
level: string
description: string; description: string;
}[]; }[];
}, },
@ -148,8 +151,9 @@ export class kpiCapacityController extends Controller {
let idx: number = 0; let idx: number = 0;
for (const data of requestBody.capacityDetails) { for (const data of requestBody.capacityDetails) {
idx += 1 idx += 1
let _level = (kpiCapacity.type === "HEAD" || kpiCapacity.type === "GROUP") ? idx.toString() : data.level;
const kpiCapacityDetail = Object.assign(new KpiCapacityDetail(), { const kpiCapacityDetail = Object.assign(new KpiCapacityDetail(), {
level: idx, level: _level,
description: data.description, description: data.description,
kpiCapacityId: kpiCapacity.id kpiCapacityId: kpiCapacity.id
}); });
@ -226,11 +230,11 @@ export class kpiCapacityController extends Controller {
keyword == undefined keyword == undefined
? "1=1" ? "1=1"
: [ : [
{ "kpiCapacity.name": Like(`%${keyword}%`) }, { name: Like(`%${keyword}%`) },
{ "kpiCapacity.description": Like(`%${keyword}%`) }, { description: Like(`%${keyword}%`) },
], ],
) )
.andWhere(type == undefined ? "1=1" : { "kpiCapacity.type": type }) .andWhere(type == undefined ? "1=1" : { type: type })
.orderBy("kpiCapacityDetail.level", "ASC") .orderBy("kpiCapacityDetail.level", "ASC")
.skip((page - 1) * pageSize) .skip((page - 1) * pageSize)
.take(pageSize) .take(pageSize)

View file

@ -176,6 +176,7 @@ export class kpiRoleController extends Controller {
node: node, node: node,
nodeId: nodeId, nodeId: nodeId,
orgRevisionId: kpiRole.orgRevisionId, orgRevisionId: kpiRole.orgRevisionId,
position: kpiRole.position
}; };
return new HttpSuccess(formattedData); return new HttpSuccess(formattedData);
} }

View file

@ -36,7 +36,7 @@ export class createKpiCapacityDetail {
description: string; description: string;
@Column() @Column()
level: Number; level: string;
} }
export class updateKpiCapacityDetail { export class updateKpiCapacityDetail {
@ -44,5 +44,5 @@ export class updateKpiCapacityDetail {
description: string; description: string;
@Column() @Column()
level: Number; level: string;
} }