This commit is contained in:
AdisakKanthawilang 2025-08-15 12:04:45 +07:00
parent 59a0d01f98
commit 8992698651

View file

@ -1466,6 +1466,7 @@ export class PositionController extends Controller {
break; break;
} }
let shortName = ""; let shortName = "";
let orgId: any;
if ( if (
posMaster.orgRootId !== null && posMaster.orgRootId !== null &&
posMaster.orgChild1Id == null && posMaster.orgChild1Id == null &&
@ -1473,6 +1474,7 @@ export class PositionController extends Controller {
posMaster.orgChild3Id == null posMaster.orgChild3Id == null
) { ) {
shortName = posMaster.orgRoot.orgRootShortName; shortName = posMaster.orgRoot.orgRootShortName;
orgId = posMaster.orgRootId;
} else if ( } else if (
posMaster.orgRootId !== null && posMaster.orgRootId !== null &&
posMaster.orgChild1Id !== null && posMaster.orgChild1Id !== null &&
@ -1480,6 +1482,7 @@ export class PositionController extends Controller {
posMaster.orgChild3Id == null posMaster.orgChild3Id == null
) { ) {
shortName = posMaster.orgChild1.orgChild1ShortName; shortName = posMaster.orgChild1.orgChild1ShortName;
orgId = posMaster.orgChild1Id;
} else if ( } else if (
posMaster.orgRootId !== null && posMaster.orgRootId !== null &&
posMaster.orgChild1Id !== null && posMaster.orgChild1Id !== null &&
@ -1487,6 +1490,7 @@ export class PositionController extends Controller {
posMaster.orgChild3Id == null posMaster.orgChild3Id == null
) { ) {
shortName = posMaster.orgChild2.orgChild2ShortName; shortName = posMaster.orgChild2.orgChild2ShortName;
orgId = posMaster.orgChild2Id;
} else if ( } else if (
posMaster.orgRootId !== null && posMaster.orgRootId !== null &&
posMaster.orgChild1Id !== null && posMaster.orgChild1Id !== null &&
@ -1494,6 +1498,7 @@ export class PositionController extends Controller {
posMaster.orgChild3Id !== null posMaster.orgChild3Id !== null
) { ) {
shortName = posMaster.orgChild3.orgChild3ShortName; shortName = posMaster.orgChild3.orgChild3ShortName;
orgId = posMaster.orgChild3Id;
} else if ( } else if (
posMaster.orgRootId !== null && posMaster.orgRootId !== null &&
posMaster.orgChild1Id !== null && posMaster.orgChild1Id !== null &&
@ -1501,6 +1506,7 @@ export class PositionController extends Controller {
posMaster.orgChild3Id !== null posMaster.orgChild3Id !== null
) { ) {
shortName = posMaster.orgChild4.orgChild4ShortName; shortName = posMaster.orgChild4.orgChild4ShortName;
orgId = posMaster.orgChild4Id;
} }
const positions = await this.positionRepository.find({ const positions = await this.positionRepository.find({
where: { posMasterId: posMaster.id }, where: { posMasterId: posMaster.id },
@ -1525,6 +1531,7 @@ export class PositionController extends Controller {
isStaff: posMaster.isStaff, isStaff: posMaster.isStaff,
orgLevel: orgLevel, orgLevel: orgLevel,
orgShortname: shortName, orgShortname: shortName,
orgId: orgId,
isDirector: posMaster.isDirector, isDirector: posMaster.isDirector,
positionSign: posMaster.positionSign, positionSign: posMaster.positionSign,
positions: positions.map((position) => ({ positions: positions.map((position) => ({