add role parent
This commit is contained in:
parent
072d9a6880
commit
bd9c270cd7
9 changed files with 231 additions and 241 deletions
|
|
@ -2034,12 +2034,15 @@ export class ProfileEmployeeController extends Controller {
|
|||
if (!result) {
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
}
|
||||
try{
|
||||
try {
|
||||
await new permission().PermissionOrgUserDelete(request, "SYS_REGISTRY_EMP", result.id);
|
||||
await this.informationHistoryRepository.delete({ profileEmployeeId: id });
|
||||
await this.profileRepo.remove(result);
|
||||
} catch {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่สามารถลบข้อมูลได้ เนื่องจากข้อมูลนี้ถูกใช้งานในระบบอื่น");
|
||||
throw new HttpError(
|
||||
HttpStatusCode.NOT_FOUND,
|
||||
"ไม่สามารถลบข้อมูลได้ เนื่องจากข้อมูลนี้ถูกใช้งานในระบบอื่น",
|
||||
);
|
||||
}
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
|
@ -2837,7 +2840,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
_data.child1 != undefined && _data.child1 != null
|
||||
? _data.child1[0] != null
|
||||
? `current_holders.orgChild1Id IN (:...child1)`
|
||||
: `current_holders.orgChild1Id is null`
|
||||
: `current_holders.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
|
||||
: "1=1",
|
||||
{
|
||||
child1: _data.child1,
|
||||
|
|
@ -3582,10 +3585,10 @@ export class ProfileEmployeeController extends Controller {
|
|||
nodeDnaId: null,
|
||||
salary: profile ? profile.amount : null,
|
||||
amountSpecial: profile ? profile.amountSpecial : null,
|
||||
posNo: null
|
||||
// root?.orgRootShortName && posMaster?.posMasterNo
|
||||
// ? `${root?.orgRootShortName} ${posMaster?.posMasterNo}`
|
||||
// : "",
|
||||
posNo: null,
|
||||
// root?.orgRootShortName && posMaster?.posMasterNo
|
||||
// ? `${root?.orgRootShortName} ${posMaster?.posMasterNo}`
|
||||
// : "",
|
||||
};
|
||||
if (_profile.child4Id != null) {
|
||||
_profile.node = 4;
|
||||
|
|
@ -3716,7 +3719,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
_data.child1 != undefined && _data.child1 != null
|
||||
? _data.child1[0] != null
|
||||
? `current_holders.orgChild1Id IN (:...child1)`
|
||||
: `current_holders.orgChild1Id is null`
|
||||
: `current_holders.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
|
||||
: "1=1",
|
||||
{ child1: _data.child1 },
|
||||
)
|
||||
|
|
@ -4274,7 +4277,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
_data.child1 != undefined && _data.child1 != null
|
||||
? _data.child1[0] != null
|
||||
? `current_holders.orgChild1Id IN (:...child1)`
|
||||
: `current_holders.orgChild1Id is null`
|
||||
: `current_holders.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
|
||||
: "1=1",
|
||||
{
|
||||
child1: _data.child1,
|
||||
|
|
@ -4435,22 +4438,26 @@ export class ProfileEmployeeController extends Controller {
|
|||
.leftJoinAndSelect("current_holders.orgChild4", "orgChild4")
|
||||
.leftJoinAndSelect("current_holders.positions", "positions")
|
||||
.andWhere(
|
||||
new Brackets(qb => {
|
||||
new Brackets((qb) => {
|
||||
qb.where("profileEmployee.position LIKE :keyword", { keyword: `%${body.keyword}%` })
|
||||
.orWhere("posLevel.posLevelName LIKE :keyword", { keyword: `%${body.keyword}%` })
|
||||
.orWhere("posType.posTypeName LIKE :keyword", { keyword: `%${body.keyword}%` })
|
||||
.orWhere("CONCAT(profileEmployee.prefix, profileEmployee.firstName, ' ', profileEmployee.lastName) LIKE :keyword", { keyword: `%${body.keyword}%` });
|
||||
})
|
||||
.orWhere(
|
||||
"CONCAT(profileEmployee.prefix, profileEmployee.firstName, ' ', profileEmployee.lastName) LIKE :keyword",
|
||||
{ keyword: `%${body.keyword}%` },
|
||||
);
|
||||
}),
|
||||
)
|
||||
.andWhere("profileEmployee.isLeave = false")
|
||||
.andWhere("current_holders.orgRevisionId = :orgRevisionId", { orgRevisionId: orgRevisionActive.id });
|
||||
.andWhere("current_holders.orgRevisionId = :orgRevisionId", {
|
||||
orgRevisionId: orgRevisionActive.id,
|
||||
});
|
||||
|
||||
if (body.type) {
|
||||
const typeUpper = body.type.trim().toUpperCase();
|
||||
if (typeUpper === "EMPLOYEE") {
|
||||
query = query.andWhere("profileEmployee.employeeClass = 'PERM'");
|
||||
}
|
||||
else if (typeUpper === "TEMP"){
|
||||
} else if (typeUpper === "TEMP") {
|
||||
query = query.andWhere("profileEmployee.employeeClass = 'TEMP'");
|
||||
}
|
||||
}
|
||||
|
|
@ -4471,9 +4478,10 @@ export class ProfileEmployeeController extends Controller {
|
|||
: item.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id);
|
||||
const position =
|
||||
posMaster == null ||
|
||||
item.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id)?.positions == null ||
|
||||
item.current_holders?.find((x) => x.orgRevisionId == orgRevisionActive.id)?.positions.length ==
|
||||
0 ||
|
||||
item.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id)?.positions ==
|
||||
null ||
|
||||
item.current_holders?.find((x) => x.orgRevisionId == orgRevisionActive.id)?.positions
|
||||
.length == 0 ||
|
||||
item.current_holders
|
||||
.find((x) => x.orgRevisionId == orgRevisionActive.id)
|
||||
?.positions?.find((position) => position.positionIsSelected == true) == null
|
||||
|
|
@ -4486,18 +4494,20 @@ export class ProfileEmployeeController extends Controller {
|
|||
item.current_holders.length == 0
|
||||
? null
|
||||
: item.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id) != null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id)?.orgChild4 !=
|
||||
null
|
||||
item.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id)
|
||||
?.orgChild4 != null
|
||||
? `${item.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id)?.orgChild4.orgChild4ShortName} ${item.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id)?.posMasterNo}`
|
||||
: item.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id) != null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id)?.orgChild3 !=
|
||||
null
|
||||
item.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id)
|
||||
?.orgChild3 != null
|
||||
? `${item.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id)?.orgChild3.orgChild3ShortName} ${item.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id)?.posMasterNo}`
|
||||
: item.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id) != null &&
|
||||
: item.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id) !=
|
||||
null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id)
|
||||
?.orgChild2 != null
|
||||
? `${item.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id)?.orgChild2.orgChild2ShortName} ${item.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id)?.posMasterNo}`
|
||||
: item.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id) != null &&
|
||||
: item.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id) !=
|
||||
null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id)
|
||||
?.orgChild1 != null
|
||||
? `${item.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id)?.orgChild1.orgChild1ShortName} ${item.current_holders.find((x) => x.orgRevisionId == orgRevisionActive.id)?.posMasterNo}`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue