ดูแบบร่าง owner

This commit is contained in:
kittapath 2024-09-13 10:29:08 +07:00
parent 6f11eecb8f
commit 4641362b95
5 changed files with 72 additions and 53 deletions

View file

@ -253,7 +253,7 @@ export class EmployeePositionController extends Controller {
posMasterNo: posMaster.posMasterNo,
posMasterNoSuffix: posMaster.posMasterNoSuffix,
reason: posMaster.reason,
isOfficer: posMaster.isOfficer,
// isOfficer: posMaster.isOfficer,
isStaff: posMaster.isStaff,
isDirector: posMaster.isDirector,
positionSign: posMaster.positionSign,
@ -630,12 +630,12 @@ export class EmployeePositionController extends Controller {
if (!posMaster) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลอัตรากำลัง");
}
let _null:any = null;
let _null: any = null;
posMaster.posMasterNo = requestBody.posMasterNo;
posMaster.isDirector = requestBody.isDirector;
posMaster.isStaff = requestBody.isStaff;
posMaster.positionSign = requestBody.positionSign == null ? _null : requestBody.positionSign;
posMaster.isOfficer = requestBody.isOfficer;
// posMaster.isOfficer = requestBody.isOfficer;
posMaster.posMasterNoPrefix = requestBody.posMasterNoPrefix;
posMaster.posMasterNoSuffix = requestBody.posMasterNoSuffix;
posMaster.reason = requestBody.reason == null ? "" : requestBody.reason;

View file

@ -626,21 +626,23 @@ export class OrganizationController extends Controller {
_data = await new permission().PermissionOrgList(request, "SYS_ORG");
}
if (orgRevision.orgRevisionIsDraft == true && orgRevision.orgRevisionIsCurrent == false) {
const profile = await this.profileRepo.findOne({
where: { keycloak: request.user.sub },
relations: ["permissionProfiles"],
});
if (!profile) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผู้ใช้งานในทะเบียนประวัติ");
if (_data.root != null) {
if (orgRevision.orgRevisionIsDraft == true && orgRevision.orgRevisionIsCurrent == false) {
const profile = await this.profileRepo.findOne({
where: { keycloak: request.user.sub },
relations: ["permissionProfiles"],
});
if (!profile) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผู้ใช้งานในทะเบียนประวัติ");
}
_data = {
root: [profile.permissionProfiles.map((x) => x.orgRootId)],
child1: null,
child2: null,
child3: null,
child4: null,
};
}
_data = {
root: profile.permissionProfiles.map((x) => x.orgRootId),
child1: null,
child2: null,
child3: null,
child4: null,
};
}
const orgRootData = await AppDataSource.getRepository(OrgRoot)

View file

@ -451,23 +451,40 @@ export class PositionController extends Controller {
order: { posDictName: "ASC" },
});
break;
case "ALL":
findPosDict = await this.posDictRepository.find({
where: [
{ posDictName: Like(`%${keyword}%`) },
{ posDictField: Like(`%${keyword}%`) },
{ posTypeId: In(await this.posTypeRepository.find({ where: { posTypeName: Like(`%${keyword}%`) }, select: ["id"] }).then(types => types.map(type => type.id))) },
{ posLevelId: In(await this.posLevelRepository.find({ where: { posLevelName: Like(`%${keyword}%`) }, select: ["id"] }).then(levels => levels.map(level => level.id))) },
{ posExecutiveId: In(await this.posExecutiveRepository.find({ where: { posExecutiveName: Like(`%${keyword}%`) }, select: ["id"] }).then(executives => executives.map(exec => exec.id))) },
{ posDictExecutiveField: Like(`%${keyword}%`) },
{ posDictArea: Like(`%${keyword}%`) }
],
relations: ["posType", "posLevel", "posExecutive"],
order: { posDictName: "ASC" },
});
break;
case "ALL":
findPosDict = await this.posDictRepository.find({
where: [
{ posDictName: Like(`%${keyword}%`) },
{ posDictField: Like(`%${keyword}%`) },
{
posTypeId: In(
await this.posTypeRepository
.find({ where: { posTypeName: Like(`%${keyword}%`) }, select: ["id"] })
.then((types) => types.map((type) => type.id)),
),
},
{
posLevelId: In(
await this.posLevelRepository
.find({ where: { posLevelName: Like(`%${keyword}%`) }, select: ["id"] })
.then((levels) => levels.map((level) => level.id)),
),
},
{
posExecutiveId: In(
await this.posExecutiveRepository
.find({ where: { posExecutiveName: Like(`%${keyword}%`) }, select: ["id"] })
.then((executives) => executives.map((exec) => exec.id)),
),
},
{ posDictExecutiveField: Like(`%${keyword}%`) },
{ posDictArea: Like(`%${keyword}%`) },
],
relations: ["posType", "posLevel", "posExecutive"],
order: { posDictName: "ASC" },
});
break;
default:
findPosDict = await this.posDictRepository.find({
@ -821,10 +838,10 @@ export class PositionController extends Controller {
if (!posMaster) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลอัตรากำลัง");
}
let _null:any = null;
let _null: any = null;
posMaster.isDirector = requestBody.isDirector;
posMaster.isStaff = requestBody.isStaff;
posMaster.isOfficer = requestBody.isOfficer;
// posMaster.isOfficer = requestBody.isOfficer;
posMaster.positionSign = requestBody.positionSign == null ? _null : requestBody.positionSign;
posMaster.posMasterNo = requestBody.posMasterNo;
posMaster.posMasterNoPrefix = requestBody.posMasterNoPrefix;
@ -1023,7 +1040,7 @@ export class PositionController extends Controller {
posMasterNo: posMaster.posMasterNo,
posMasterNoSuffix: posMaster.posMasterNoSuffix,
reason: posMaster.reason,
isOfficer: posMaster.isOfficer,
// isOfficer: posMaster.isOfficer,
isStaff: posMaster.isStaff,
isDirector: posMaster.isDirector,
positionSign: posMaster.positionSign,
@ -1591,8 +1608,8 @@ export class PositionController extends Controller {
* @param {string} id Id
*/
@Get("history/{id}")
async getHistoryPosMater(@Path() id: string , @Request() request: RequestWithUser) {
await new permission().PermissionGet(request , "SYS_ORG");
async getHistoryPosMater(@Path() id: string, @Request() request: RequestWithUser) {
await new permission().PermissionGet(request, "SYS_ORG");
const posMaster = await this.posMasterRepository.findOne({
where: { id },
});
@ -3328,7 +3345,7 @@ export class PositionController extends Controller {
isAll: boolean;
},
) {
await new permission().PermissionGet(request,"SYS_ACTING");
await new permission().PermissionGet(request, "SYS_ACTING");
const posMasterMain = await this.posMasterRepository.findOne({
where: { id: body.posmasterId },
relations: ["posMasterActs"],

View file

@ -99,11 +99,11 @@ export class EmployeePosMaster extends EntityBase {
})
isStaff: boolean;
@Column({
comment: "เป็นสกจ",
default: false,
})
isOfficer: boolean;
// @Column({
// comment: "เป็นสกจ",
// default: false,
// })
// isOfficer: boolean;
@Column({
nullable: true,
@ -270,8 +270,8 @@ export class CreateEmployeePosMaster {
@Column()
isStaff: boolean;
@Column()
isOfficer: boolean;
// @Column()
// isOfficer: boolean;
@Column()
positionSign: string | null;

View file

@ -100,11 +100,11 @@ export class PosMaster extends EntityBase {
})
isStaff: boolean;
@Column({
comment: "เป็นสกจ",
default: false,
})
isOfficer: boolean;
// @Column({
// comment: "เป็นสกจ",
// default: false,
// })
// isOfficer: boolean;
@Column({
nullable: true,
@ -277,8 +277,8 @@ export class CreatePosMaster {
@Column()
isStaff: boolean;
@Column()
isOfficer: boolean;
// @Column()
// isOfficer: boolean;
@Column()
positionSign: string | null;