แก้ parent

This commit is contained in:
mamoss 2025-12-07 16:36:18 +07:00
parent f814454003
commit a8bb884564
4 changed files with 89 additions and 89 deletions

View file

@ -1154,7 +1154,7 @@ export class EmployeePositionController extends Controller {
_data.child1 != undefined && _data.child1 != null
? _data.child1[0] != null
? `posMaster.orgChild1Id IN (:...child1)`
: `posMaster.orgChild1Id is null`
: `posMaster.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
: "1=1",
{
child1: _data.child1,
@ -1381,24 +1381,22 @@ export class EmployeePositionController extends Controller {
};
}),
);
if(_data.privilege === 'NORMAL'|| _data.privilege === 'PARENT'|| _data.privilege === 'CHILD'){ //PARENT จะไม่มีทางเห็น ROOT , CHILD ยึดจาก CHILD ที่อยู่ลงไปข้างล่างและจะไม่เห็น CHILD ที่อยู่เหนือกว่า
const nextChildMap:any = { //เอาไวเช็ค CHILD ถัดไป
if (_data.privilege === "NORMAL" || _data.privilege === "CHILD") {
//PARENT จะไม่มีทางเห็น ROOT , CHILD ยึดจาก CHILD ที่อยู่ลงไปข้างล่างและจะไม่เห็น CHILD ที่อยู่เหนือกว่า
const nextChildMap: any = {
//เอาไวเช็ค CHILD ถัดไป
0: _data.child1,
1: _data.child2,
2: _data.child3,
3: _data.child4,
};
const childValue = nextChildMap[body.type];
if(_data.privilege === 'NORMAL'){
if (Array.isArray(childValue) && childValue.some(item => item != null)) {
if (_data.privilege === "NORMAL") {
if (Array.isArray(childValue) && childValue.some((item) => item != null)) {
return new HttpSuccess({ data: [], total: 0 });
}
}else if(_data.privilege === 'PARENT'){
if (body.type == 0){
return new HttpSuccess({ data: [], total: 0 });
}
} else if (_data.privilege === 'CHILD') {
} else if (_data.privilege === "CHILD") {
const higherChildChecks = [
{ type: [0], child: _data.child1, next: _data.child2 },
{ type: [0, 1], child: _data.child2, next: _data.child3 },