เพิ่ม return ฟิลด์ระดับตำแหน่ง, สังกัด

This commit is contained in:
Bright 2025-03-31 11:25:25 +07:00
parent 968d5a2be4
commit 8cf13b8690

View file

@ -500,7 +500,26 @@ export class OrganizationDotnetController extends Controller {
}
}
}
let positionLeaveName = profile.posLevel?.posLevelName ?? null
const _profileCurrent = profile?.current_holders?.find(
(x) =>
x.orgRevision?.orgRevisionIsDraft === false &&
x.orgRevision?.orgRevisionIsCurrent === true
);
let oc = "";
if (_profileCurrent != null) {
if (_profileCurrent.orgChild1Id === null) {
oc = _profileCurrent.orgRoot?.orgRootName;
} else if (_profileCurrent.orgChild2Id === null) {
oc = `${_profileCurrent.orgChild1?.orgChild1Name} ${_profileCurrent.orgRoot?.orgRootName}`;
} else if (_profileCurrent.orgChild3Id === null) {
oc = `${_profileCurrent.orgChild2?.orgChild2Name} ${_profileCurrent.orgChild1?.orgChild1Name} ${_profileCurrent.orgRoot?.orgRootName}`;
} else if (_profileCurrent.orgChild4Id === null) {
oc = `${_profileCurrent.orgChild3?.orgChild3Name} ${_profileCurrent.orgChild2?.orgChild2Name} ${_profileCurrent.orgChild1?.orgChild1Name} ${_profileCurrent.orgRoot?.orgRootName}`;;
} else {
oc = `${_profileCurrent.orgChild4?.orgChild4Name}`
}
}
const mapProfile = {
id: profile.id,
avatar: profile.avatar,
@ -621,6 +640,8 @@ export class OrganizationDotnetController extends Controller {
profileSalary: profile.profileSalary.length > 0 ? profile.profileSalary[0] : null,
profileInsignia: profile.profileInsignias.length > 0 ? profile.profileInsignias[0] : null,
profileType: "EMPLOYEE",
positionLeaveName: positionLeaveName,
oc: oc,
};
return new HttpSuccess(mapProfile);
@ -794,6 +815,29 @@ export class OrganizationDotnetController extends Controller {
}
}
let positionLeaveName = profile.posType != null && profile.posLevel != null
&& (profile.posType.posTypeName == "บริหาร" || profile.posType.posTypeName == "อำนวยการ")
? `${profile.posType?.posTypeName ?? ""}${profile.posLevel?.posLevelName ?? ""}`
: profile.posLevel?.posLevelName ?? null
const _profileCurrent = profile?.current_holders?.find(
(x) =>
x.orgRevision?.orgRevisionIsDraft === false &&
x.orgRevision?.orgRevisionIsCurrent === true
);
let oc = "";
if (_profileCurrent != null) {
if (_profileCurrent.orgChild1Id === null) {
oc = _profileCurrent.orgRoot?.orgRootName;
} else if (_profileCurrent.orgChild2Id === null) {
oc = `${_profileCurrent.orgChild1?.orgChild1Name} ${_profileCurrent.orgRoot?.orgRootName}`;
} else if (_profileCurrent.orgChild3Id === null) {
oc = `${_profileCurrent.orgChild2?.orgChild2Name} ${_profileCurrent.orgChild1?.orgChild1Name} ${_profileCurrent.orgRoot?.orgRootName}`;
} else if (_profileCurrent.orgChild4Id === null) {
oc = `${_profileCurrent.orgChild3?.orgChild3Name} ${_profileCurrent.orgChild2?.orgChild2Name} ${_profileCurrent.orgChild1?.orgChild1Name} ${_profileCurrent.orgRoot?.orgRootName}`;;
} else {
oc = `${_profileCurrent.orgChild4?.orgChild4Name}`
}
}
const mapProfile = {
id: profile.id,
avatar: profile.avatar,
@ -914,6 +958,8 @@ export class OrganizationDotnetController extends Controller {
profileSalary: profile.profileSalary.length > 0 ? profile.profileSalary[0] : null,
profileInsignia: profile.profileInsignias.length > 0 ? profile.profileInsignias[0] : null,
profileType: "OFFICER",
positionLeaveName: positionLeaveName,
oc: oc,
};
return new HttpSuccess(mapProfile);