no message
This commit is contained in:
parent
ca82158a20
commit
148fa2c81c
6 changed files with 65 additions and 30 deletions
|
|
@ -99,7 +99,10 @@ export class PositionController extends Controller {
|
|||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล PosLevelId");
|
||||
}
|
||||
|
||||
if (requestBody.posExecutiveId != "") requestBody.posExecutiveId = null;
|
||||
if (requestBody.posExecutiveId == "") {
|
||||
requestBody.posExecutiveId = null;
|
||||
posDict.posExecutiveId = null;
|
||||
}
|
||||
|
||||
if (requestBody.posExecutiveId != null) {
|
||||
const checkPosExecutiveId = await this.posExecutiveRepository.findOne({
|
||||
|
|
|
|||
|
|
@ -82,6 +82,10 @@ export class ReportController extends Controller {
|
|||
relations: [
|
||||
"posMasters",
|
||||
"posMasters.next_holder",
|
||||
"posMasters.next_holder.posLevel",
|
||||
"posMasters.next_holder.posType",
|
||||
"posMasters.next_holder.current_holders",
|
||||
"posMasters.next_holder.current_holders.positions",
|
||||
"posMasters.positions",
|
||||
"posMasters.positions.posLevel",
|
||||
"posMasters.positions.posType",
|
||||
|
|
@ -181,18 +185,18 @@ export class ReportController extends Controller {
|
|||
if (_orgRevisionActive.length > 0) orgRevisionActive = _orgRevisionActive[0];
|
||||
}
|
||||
|
||||
const posMasterOlds = await this.posMasterRepository.find({
|
||||
where: {
|
||||
orgRevisionId: orgRevisionActive.id,
|
||||
},
|
||||
relations: ["next_holder", "current_holder"],
|
||||
});
|
||||
const positionOlds = await this.positionRepository.find({
|
||||
where: {
|
||||
posMasterId: In(posMasterOlds.map((posMaster: any) => posMaster.id)),
|
||||
},
|
||||
relations: ["posLevel", "posType", "posExecutive"],
|
||||
});
|
||||
// const posMasterOlds = await this.posMasterRepository.find({
|
||||
// where: {
|
||||
// orgRevisionId: orgRevisionActive.id,
|
||||
// },
|
||||
// relations: ["next_holder", "current_holder"],
|
||||
// });
|
||||
// const positionOlds = await this.positionRepository.find({
|
||||
// where: {
|
||||
// posMasterId: In(posMasterOlds.map((posMaster: any) => posMaster.id)),
|
||||
// },
|
||||
// relations: ["posLevel", "posType", "posExecutive"],
|
||||
// });
|
||||
|
||||
let data = new Array();
|
||||
for (let orgRoot of orgRootData) {
|
||||
|
|
@ -237,6 +241,11 @@ export class ReportController extends Controller {
|
|||
...new Set(posMaster.positions.map((x) => x.posLevel.posLevelName)),
|
||||
];
|
||||
const positionField = [...new Set(posMaster.positions.map((x) => x.positionField))];
|
||||
const positionMasterOld = posMaster.next_holder.current_holders.find(
|
||||
(x) => x == orgRevisionActive,
|
||||
);
|
||||
console.log(orgRevisionActive);
|
||||
console.log("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
|
||||
return {
|
||||
posMasterNoPrefix: posMaster.posMasterNoPrefix,
|
||||
posMasterNo: posMaster.posMasterNo,
|
||||
|
|
@ -245,13 +254,37 @@ export class ReportController extends Controller {
|
|||
posMaster.next_holder == null
|
||||
? "- ว่าง -"
|
||||
: `${posMaster.next_holder.prefix}${posMaster.next_holder.firstName} ${posMaster.next_holder.lastName}`,
|
||||
profilePosMasterNo: posMaster.next_holder == null ? null : "xxx",
|
||||
|
||||
// profilePosMasterNo:
|
||||
// posMaster.next_holder == null
|
||||
// ? posMaster.posMasterNo
|
||||
// : positionMasterOld == null
|
||||
// ? null
|
||||
// : positionMasterOld.posMasterNo,
|
||||
profilePositionName:
|
||||
posMaster.next_holder == null ? positionName.join(" หรือ ") : "xxx",
|
||||
profilePosType: posMaster.next_holder == null ? posType.join(" หรือ ") : "xxx",
|
||||
profilePosLevel: posMaster.next_holder == null ? posLevel.join(" หรือ ") : "xxx",
|
||||
profilePositionField:
|
||||
posMaster.next_holder == null ? positionField.join(" หรือ ") : "xxx",
|
||||
posMaster.next_holder == null
|
||||
? positionName.join(" หรือ ")
|
||||
: posMaster.next_holder.position,
|
||||
profilePosType:
|
||||
posMaster.next_holder == null
|
||||
? posType.join(" หรือ ")
|
||||
: posMaster.next_holder.posType == null
|
||||
? null
|
||||
: posMaster.next_holder.posType.posTypeName,
|
||||
profilePosLevel:
|
||||
posMaster.next_holder == null
|
||||
? posLevel.join(" หรือ ")
|
||||
: posMaster.next_holder.posLevel == null
|
||||
? null
|
||||
: posMaster.next_holder.posLevel.posLevelName,
|
||||
// profilePositionField:
|
||||
// posMaster.next_holder == null
|
||||
// ? positionField.join(" หรือ ")
|
||||
// : positionMasterOld == null
|
||||
// ? null
|
||||
// : positionMasterOld.positions.find((x) => (x.positionIsSelected = true))
|
||||
// ?.positionField,
|
||||
|
||||
// profilePosMasterNo: (posMasterOld == null ? null : posMasterOld.posMasterNo),
|
||||
// profilePositionName: (positionOld == null ? null : positionOld.positionName),
|
||||
// profilePosType: (positionOld == null ? null : positionOld.posType.posTypeName),
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ export class PosDict extends EntityBase {
|
|||
comment: "ตำแหน่งทางการบริหาร",
|
||||
default: null,
|
||||
})
|
||||
posExecutiveId: string;
|
||||
posExecutiveId: string | null;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
|
|
@ -85,7 +85,7 @@ export class CreatePosDict {
|
|||
posLevelId: string;
|
||||
|
||||
@Column()
|
||||
posExecutiveId?: string | null;
|
||||
posExecutiveId: string | null;
|
||||
|
||||
@Column()
|
||||
posDictExecutiveField: string;
|
||||
|
|
|
|||
|
|
@ -54,8 +54,8 @@ export class PosLevel extends EntityBase {
|
|||
@OneToMany(() => PosDict, (posDict) => posDict.posLevel)
|
||||
posDicts: PosDict[];
|
||||
|
||||
@OneToMany(() => Profile, (profile) => profile.posLevelsId)
|
||||
posLevelId: Profile;
|
||||
@OneToMany(() => Profile, (profile) => profile.posLevel)
|
||||
posLevels: Profile[];
|
||||
}
|
||||
|
||||
export class CreatePosLevel {
|
||||
|
|
@ -73,4 +73,3 @@ export class CreatePosLevel {
|
|||
}
|
||||
|
||||
export type UpdatePosLevel = Partial<CreatePosLevel> & { posLevelAuthority?: PosLevelAuthority };
|
||||
|
||||
|
|
|
|||
|
|
@ -32,8 +32,8 @@ export class PosType extends EntityBase {
|
|||
@OneToMany(() => PosDict, (posDict) => posDict.posType)
|
||||
posDicts: PosDict[];
|
||||
|
||||
@OneToMany(() => Profile, (profile) => profile.posTypesId)
|
||||
posTypeId: Profile;
|
||||
@OneToMany(() => Profile, (profile) => profile.posType)
|
||||
posTypes: Profile[];
|
||||
}
|
||||
|
||||
export class CreatePosType {
|
||||
|
|
|
|||
|
|
@ -86,13 +86,13 @@ export class Profile extends EntityBase {
|
|||
@OneToMany(() => PosMaster, (posMaster) => posMaster.next_holder)
|
||||
next_holders: PosMaster[];
|
||||
|
||||
@ManyToOne(() => PosLevel, (posLevel) => posLevel.posLevelId)
|
||||
@ManyToOne(() => PosLevel, (posLevel) => posLevel.posLevels)
|
||||
@JoinColumn({ name: "posLevelId" })
|
||||
posLevelsId: PosLevel;
|
||||
posLevel: PosLevel;
|
||||
|
||||
@ManyToOne(() => PosType, (posType) => posType.posTypeId)
|
||||
@ManyToOne(() => PosType, (posType) => posType.posTypes)
|
||||
@JoinColumn({ name: "posTypeId" })
|
||||
posTypesId: PosType;
|
||||
posType: PosType;
|
||||
}
|
||||
|
||||
export class CreateProfile {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue