no message
This commit is contained in:
parent
d33569005a
commit
8fd2131b4c
3 changed files with 87 additions and 41 deletions
|
|
@ -89,6 +89,7 @@ export class ReportController extends Controller {
|
||||||
"posMasters.positions",
|
"posMasters.positions",
|
||||||
"posMasters.positions.posLevel",
|
"posMasters.positions.posLevel",
|
||||||
"posMasters.positions.posType",
|
"posMasters.positions.posType",
|
||||||
|
"posMasters.positions.posExecutive",
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -181,6 +182,7 @@ export class ReportController extends Controller {
|
||||||
"posMasters.positions",
|
"posMasters.positions",
|
||||||
"posMasters.positions.posLevel",
|
"posMasters.positions.posLevel",
|
||||||
"posMasters.positions.posType",
|
"posMasters.positions.posType",
|
||||||
|
"posMasters.positions.posExecutive",
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
if (orgRevisionActive == null) {
|
if (orgRevisionActive == null) {
|
||||||
|
|
@ -192,6 +194,7 @@ export class ReportController extends Controller {
|
||||||
"posMasters.positions",
|
"posMasters.positions",
|
||||||
"posMasters.positions.posLevel",
|
"posMasters.positions.posLevel",
|
||||||
"posMasters.positions.posType",
|
"posMasters.positions.posType",
|
||||||
|
"posMasters.positions.posExecutive",
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
if (_orgRevisionActive.length > 0) orgRevisionActive = _orgRevisionActive[0];
|
if (_orgRevisionActive.length > 0) orgRevisionActive = _orgRevisionActive[0];
|
||||||
|
|
@ -225,6 +228,9 @@ export class ReportController extends Controller {
|
||||||
const posLevel = [
|
const posLevel = [
|
||||||
...new Set(posMaster.positions.map((x) => x.posLevel.posLevelName)),
|
...new Set(posMaster.positions.map((x) => x.posLevel.posLevelName)),
|
||||||
];
|
];
|
||||||
|
const posExecutive = [
|
||||||
|
...new Set(posMaster.positions.map((x) => x.posExecutive.posExecutiveName)),
|
||||||
|
];
|
||||||
const positionField = [...new Set(posMaster.positions.map((x) => x.positionField))];
|
const positionField = [...new Set(posMaster.positions.map((x) => x.positionField))];
|
||||||
let positionMasterProfileOld: any = null;
|
let positionMasterProfileOld: any = null;
|
||||||
if (posMaster.next_holder != null) {
|
if (posMaster.next_holder != null) {
|
||||||
|
|
@ -237,6 +243,7 @@ export class ReportController extends Controller {
|
||||||
let profilePositionName: any = [];
|
let profilePositionName: any = [];
|
||||||
let profilePosType: any = [];
|
let profilePosType: any = [];
|
||||||
let profilePosLevel: any = [];
|
let profilePosLevel: any = [];
|
||||||
|
let profilePosExecutive: any = [];
|
||||||
let profilePositionField: any = [];
|
let profilePositionField: any = [];
|
||||||
if (posMaster.ancestorDNA != null) {
|
if (posMaster.ancestorDNA != null) {
|
||||||
positionMasterOld = orgRevisionActive.posMasters.find(
|
positionMasterOld = orgRevisionActive.posMasters.find(
|
||||||
|
|
@ -255,6 +262,11 @@ export class ReportController extends Controller {
|
||||||
positionMasterOld.positions.map((x: any) => x.posLevel.posLevelName),
|
positionMasterOld.positions.map((x: any) => x.posLevel.posLevelName),
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
|
profilePosExecutive = [
|
||||||
|
...new Set(
|
||||||
|
positionMasterOld.positions.map((x: any) => x.posExecutive.posExecutiveName),
|
||||||
|
),
|
||||||
|
];
|
||||||
profilePositionField = [
|
profilePositionField = [
|
||||||
...new Set(positionMasterOld.positions.map((x: any) => x.positionField)),
|
...new Set(positionMasterOld.positions.map((x: any) => x.positionField)),
|
||||||
];
|
];
|
||||||
|
|
@ -265,74 +277,88 @@ export class ReportController extends Controller {
|
||||||
posMasterNoPrefix: posMaster.posMasterNoPrefix,
|
posMasterNoPrefix: posMaster.posMasterNoPrefix,
|
||||||
posMasterNo: posMaster.posMasterNo,
|
posMasterNo: posMaster.posMasterNo,
|
||||||
posMasterNoSuffix: posMaster.posMasterNoSuffix,
|
posMasterNoSuffix: posMaster.posMasterNoSuffix,
|
||||||
|
// positionName:
|
||||||
|
// posMaster.next_holder == null
|
||||||
|
// ? positionName.join(" หรือ ")
|
||||||
|
// : posMaster.positionIsSelected == false
|
||||||
|
// ? posMaster.positions.find((x: any) => (x.positionIsSelected = true))
|
||||||
|
// ?.positionName
|
||||||
|
// : posMaster.next_holder.position,
|
||||||
|
// posType:
|
||||||
|
// posMaster.next_holder == null
|
||||||
|
// ? posType.join(" หรือ ")
|
||||||
|
// : posMaster.positionIsSelected == false
|
||||||
|
// ? posMaster.positions.find((x: any) => (x.positionIsSelected = true))
|
||||||
|
// ?.posType?.posTypeName
|
||||||
|
// : posMaster.next_holder.posType == null
|
||||||
|
// ? "-"
|
||||||
|
// : posMaster.next_holder.posType.posTypeName,
|
||||||
|
// posLevel:
|
||||||
|
// posMaster.next_holder == null
|
||||||
|
// ? posLevel.join(" หรือ ")
|
||||||
|
// : posMaster.positionIsSelected == false
|
||||||
|
// ? posMaster.positions.find((x: any) => (x.positionIsSelected = true))
|
||||||
|
// ?.posLevel?.posLevelName
|
||||||
|
// : posMaster.next_holder.posLevel == null
|
||||||
|
// ? "-"
|
||||||
|
// : posMaster.next_holder.posLevel.posLevelName,
|
||||||
|
// posExecutive:
|
||||||
|
// posMaster.next_holder == null
|
||||||
|
// ? posExecutive.join(" หรือ ")
|
||||||
|
// : posMaster.positionIsSelected == false
|
||||||
|
// ? posMaster.positions.find((x: any) => (x.positionIsSelected = true))
|
||||||
|
// ?.posExecutive?.posExecutiveName
|
||||||
|
// : positionMasterProfileOld == null
|
||||||
|
// ? "-"
|
||||||
|
// : positionMasterProfileOld.positions.find(
|
||||||
|
// (x: any) => (x.positionIsSelected = true),
|
||||||
|
// )?.posExecutive?.posExecutiveName,
|
||||||
|
|
||||||
profileFullname:
|
profileFullname:
|
||||||
posMaster.next_holder == null
|
posMaster.next_holder == null
|
||||||
? "- ว่าง -"
|
? "- ว่าง -"
|
||||||
: `${posMaster.next_holder.prefix}${posMaster.next_holder.firstName} ${posMaster.next_holder.lastName}`,
|
: `${posMaster.next_holder.prefix}${posMaster.next_holder.firstName} ${posMaster.next_holder.lastName}`,
|
||||||
profilePosMasterNo:
|
profilePosMasterNo:
|
||||||
positionMasterProfileOld == null
|
posMaster.next_holder == null
|
||||||
? positionMasterOld == null
|
? positionMasterOld == null
|
||||||
? "-"
|
? "-"
|
||||||
: positionMasterOld.posMasterNo
|
: positionMasterOld.posMasterNo
|
||||||
: positionMasterProfileOld.posMasterNo,
|
: positionMasterProfileOld == null
|
||||||
|
? "-"
|
||||||
|
: positionMasterProfileOld.posMasterNo,
|
||||||
profilePositionName:
|
profilePositionName:
|
||||||
posMaster.next_holder == null
|
posMaster.next_holder == null
|
||||||
? profilePositionName.length > 0
|
? positionMasterOld == null
|
||||||
? profilePositionName.join(" หรือ ")
|
? positionName.join(" หรือ ")
|
||||||
: positionName.join(" หรือ ")
|
: profilePositionName.join(" หรือ ")
|
||||||
: posMaster.next_holder.position,
|
: posMaster.next_holder.position,
|
||||||
profilePosType:
|
profilePosType:
|
||||||
posMaster.next_holder == null
|
posMaster.next_holder == null
|
||||||
? profilePosType.length > 0
|
? positionMasterOld == null
|
||||||
? profilePosType.join(" หรือ ")
|
? posType.join(" หรือ ")
|
||||||
: posType.join(" หรือ ")
|
: profilePosType.join(" หรือ ")
|
||||||
: posMaster.next_holder.posType == null
|
: posMaster.next_holder.posType == null
|
||||||
? "-"
|
? "-"
|
||||||
: posMaster.next_holder.posType.posTypeName,
|
: posMaster.next_holder.posType.posTypeName,
|
||||||
profilePosLevel:
|
profilePosLevel:
|
||||||
posMaster.next_holder == null
|
posMaster.next_holder == null
|
||||||
? profilePosLevel.length > 0
|
? positionMasterOld == null
|
||||||
? profilePosLevel.join(" หรือ ")
|
? posLevel.join(" หรือ ")
|
||||||
: posLevel.join(" หรือ ")
|
: profilePosLevel.join(" หรือ ")
|
||||||
: posMaster.next_holder.posLevel == null
|
: posMaster.next_holder.posLevel == null
|
||||||
? "-"
|
? "-"
|
||||||
: posMaster.next_holder.posLevel.posLevelName,
|
: posMaster.next_holder.posLevel.posLevelName,
|
||||||
profilePositionField:
|
profilePosExecutive:
|
||||||
posMaster.next_holder == null
|
posMaster.next_holder == null
|
||||||
? profilePositionField.length > 0
|
? positionMasterOld == null
|
||||||
? profilePositionField.join(" หรือ ")
|
? posExecutive.join(" หรือ ")
|
||||||
: positionField.join(" หรือ ")
|
: profilePosExecutive.join(" หรือ ")
|
||||||
: positionMasterProfileOld == null
|
: positionMasterProfileOld == null
|
||||||
? "-"
|
? "-"
|
||||||
: positionMasterProfileOld.positions.find(
|
: positionMasterProfileOld.positions.find(
|
||||||
(x: any) => (x.positionIsSelected = true),
|
(x: any) => (x.positionIsSelected = true),
|
||||||
)?.positionField,
|
)?.posExecutive?.posExecutiveName,
|
||||||
|
|
||||||
positionName:
|
|
||||||
posMaster.next_holder == null
|
|
||||||
? positionName.join(" หรือ ")
|
|
||||||
: posMaster.next_holder.position,
|
|
||||||
posType:
|
|
||||||
posMaster.next_holder == null
|
|
||||||
? posType.join(" หรือ ")
|
|
||||||
: posMaster.next_holder.posType == null
|
|
||||||
? "-"
|
|
||||||
: posMaster.next_holder.posType.posTypeName,
|
|
||||||
posLevel:
|
|
||||||
posMaster.next_holder == null
|
|
||||||
? posLevel.join(" หรือ ")
|
|
||||||
: posMaster.next_holder.posLevel == null
|
|
||||||
? "-"
|
|
||||||
: posMaster.next_holder.posLevel.posLevelName,
|
|
||||||
positionField:
|
|
||||||
posMaster.next_holder == null
|
|
||||||
? positionField.join(" หรือ ")
|
|
||||||
: positionMasterProfileOld == null
|
|
||||||
? "-"
|
|
||||||
: positionMasterProfileOld.positions.find(
|
|
||||||
(x: any) => (x.positionIsSelected = true),
|
|
||||||
)?.positionField,
|
|
||||||
// positions: await Promise.all(
|
// positions: await Promise.all(
|
||||||
// positions
|
// positions
|
||||||
// .filter((position) => position.posMasterId === posMaster.id)
|
// .filter((position) => position.posMasterId === posMaster.id)
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,12 @@ export class PosMaster extends EntityBase {
|
||||||
})
|
})
|
||||||
posMasterLine: PosMasterLine;
|
posMasterLine: PosMasterLine;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
comment: "นั่งทับตำแหน่งไหม",
|
||||||
|
default: false,
|
||||||
|
})
|
||||||
|
isSit: boolean;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
nullable: true,
|
nullable: true,
|
||||||
length: 40,
|
length: 40,
|
||||||
|
|
|
||||||
14
src/migration/1707306721668-update_table_posMaster_isSit.ts
Normal file
14
src/migration/1707306721668-update_table_posMaster_isSit.ts
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||||
|
|
||||||
|
export class UpdateTablePosMasterIsSit1707306721668 implements MigrationInterface {
|
||||||
|
name = 'UpdateTablePosMasterIsSit1707306721668'
|
||||||
|
|
||||||
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`ALTER TABLE \`posMaster\` ADD \`isSit\` tinyint NOT NULL COMMENT 'นั่งทับตำแหน่งไหม' DEFAULT 0`);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`ALTER TABLE \`posMaster\` DROP COLUMN \`isSit\``);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue