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