face เลือกหัวหน้าทั้งหน่วยงาน #1597
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m11s

This commit is contained in:
harid 2026-06-16 15:50:15 +07:00
parent ca5b11e36b
commit db36b250e3

View file

@ -865,6 +865,7 @@ export class WorkflowController extends Controller {
type?: string | null; type?: string | null;
sortBy?: string | null; sortBy?: string | null;
descending?: boolean; descending?: boolean;
isAllDirector?: boolean;
}, },
) { ) {
const userKeycloak = body.keycloakId ?? request.user.sub; const userKeycloak = body.keycloakId ?? request.user.sub;
@ -953,38 +954,46 @@ export class WorkflowController extends Controller {
let mainConditions: any[] = []; let mainConditions: any[] = [];
if (type.trim().toUpperCase() === "OPERATE" || body.type === "employee") { if (type.trim().toUpperCase() === "OPERATE" || body.type === "employee") {
mainConditions = [
{ ...baseCondition, orgRootId: In(roodIds), orgChild1Id: IsNull() }, if (body.isAllDirector === true) {
{ mainConditions = [
...baseCondition, { ...baseCondition, orgRootId: In(roodIds) }
orgRootId: In(roodIds), ];
orgChild1Id: posMasterUser.orgChild1Id, }
orgChild2Id: IsNull(), else {
}, mainConditions = [
{ { ...baseCondition, orgRootId: In(roodIds), orgChild1Id: IsNull() },
...baseCondition, {
orgRootId: In(roodIds), ...baseCondition,
orgChild1Id: posMasterUser.orgChild1Id, orgRootId: In(roodIds),
orgChild2Id: posMasterUser.orgChild2Id, orgChild1Id: posMasterUser.orgChild1Id,
orgChild3Id: IsNull(), orgChild2Id: IsNull(),
}, },
{ {
...baseCondition, ...baseCondition,
orgRootId: In(roodIds), orgRootId: In(roodIds),
orgChild1Id: posMasterUser.orgChild1Id, orgChild1Id: posMasterUser.orgChild1Id,
orgChild2Id: posMasterUser.orgChild2Id, orgChild2Id: posMasterUser.orgChild2Id,
orgChild3Id: posMasterUser.orgChild3Id, orgChild3Id: IsNull(),
orgChild4Id: IsNull(), },
}, {
{ ...baseCondition,
...baseCondition, orgRootId: In(roodIds),
orgRootId: In(roodIds), orgChild1Id: posMasterUser.orgChild1Id,
orgChild1Id: posMasterUser.orgChild1Id, orgChild2Id: posMasterUser.orgChild2Id,
orgChild2Id: posMasterUser.orgChild2Id, orgChild3Id: posMasterUser.orgChild3Id,
orgChild3Id: posMasterUser.orgChild3Id, orgChild4Id: IsNull(),
orgChild4Id: posMasterUser.orgChild4Id, },
}, {
]; ...baseCondition,
orgRootId: In(roodIds),
orgChild1Id: posMasterUser.orgChild1Id,
orgChild2Id: posMasterUser.orgChild2Id,
orgChild3Id: posMasterUser.orgChild3Id,
orgChild4Id: posMasterUser.orgChild4Id,
},
];
}
} else if (isLowLevel) { } else if (isLowLevel) {
mainConditions = [ mainConditions = [
{ {