แก้ bug list tree
This commit is contained in:
parent
e90e3a27c6
commit
97b85acbd0
1 changed files with 219 additions and 119 deletions
|
|
@ -704,7 +704,8 @@ export class OrganizationController extends Controller {
|
||||||
: [];
|
: [];
|
||||||
|
|
||||||
// const formattedData = orgRootData.map((orgRoot) => {
|
// const formattedData = orgRootData.map((orgRoot) => {
|
||||||
const formattedData = await Promise.all(orgRootData.map(async (orgRoot) => {
|
const formattedData = await Promise.all(
|
||||||
|
orgRootData.map(async (orgRoot) => {
|
||||||
return {
|
return {
|
||||||
orgTreeId: orgRoot.id,
|
orgTreeId: orgRoot.id,
|
||||||
orgLevel: 0,
|
orgLevel: 0,
|
||||||
|
|
@ -720,13 +721,24 @@ export class OrganizationController extends Controller {
|
||||||
orgTreeFax: orgRoot.orgRootFax,
|
orgTreeFax: orgRoot.orgRootFax,
|
||||||
orgRevisionId: orgRoot.orgRevisionId,
|
orgRevisionId: orgRoot.orgRevisionId,
|
||||||
orgRootName: orgRoot.orgRootName,
|
orgRootName: orgRoot.orgRootName,
|
||||||
totalPosition: await this.posMasterRepository.count({ where: { orgRootId: orgRoot.id }}),
|
totalPosition: await this.posMasterRepository.count({
|
||||||
totalPositionCurrentUse: await this.posMasterRepository.count({ where: { orgRootId: orgRoot.id, profileIdCurrentHolder: Not(IsNull()) && Not("") }}),
|
where: { orgRootId: orgRoot.id },
|
||||||
totalPositionCurrentVacant: await this.posMasterRepository.count({ where: { orgRootId: orgRoot.id, profileIdCurrentHolder: IsNull() && "" }}),
|
}),
|
||||||
totalPositionNextUse: await this.posMasterRepository.count({ where: { orgRootId: orgRoot.id, profileIdNextHolder: Not(IsNull()) && Not("") }}),
|
totalPositionCurrentUse: await this.posMasterRepository.count({
|
||||||
totalPositionNextVacant: await this.posMasterRepository.count({ where: { orgRootId: orgRoot.id, profileIdNextHolder: IsNull() && "" }}),
|
where: { orgRootId: orgRoot.id, profileIdCurrentHolder: Not(IsNull()) && Not("") },
|
||||||
|
}),
|
||||||
|
totalPositionCurrentVacant: await this.posMasterRepository.count({
|
||||||
|
where: { orgRootId: orgRoot.id, profileIdCurrentHolder: IsNull() && "" },
|
||||||
|
}),
|
||||||
|
totalPositionNextUse: await this.posMasterRepository.count({
|
||||||
|
where: { orgRootId: orgRoot.id, profileIdNextHolder: Not(IsNull()) && Not("") },
|
||||||
|
}),
|
||||||
|
totalPositionNextVacant: await this.posMasterRepository.count({
|
||||||
|
where: { orgRootId: orgRoot.id, profileIdNextHolder: IsNull() && "" },
|
||||||
|
}),
|
||||||
|
|
||||||
children: orgChild1Data
|
children: await Promise.all(
|
||||||
|
orgChild1Data
|
||||||
.filter((orgChild1) => orgChild1.orgRootId === orgRoot.id)
|
.filter((orgChild1) => orgChild1.orgRootId === orgRoot.id)
|
||||||
.map(async (orgChild1) => ({
|
.map(async (orgChild1) => ({
|
||||||
orgTreeId: orgChild1.id,
|
orgTreeId: orgChild1.id,
|
||||||
|
|
@ -745,12 +757,29 @@ export class OrganizationController extends Controller {
|
||||||
orgTreeFax: orgChild1.orgChild1Fax,
|
orgTreeFax: orgChild1.orgChild1Fax,
|
||||||
orgRevisionId: orgRoot.orgRevisionId,
|
orgRevisionId: orgRoot.orgRevisionId,
|
||||||
orgRootName: orgRoot.orgRootName,
|
orgRootName: orgRoot.orgRootName,
|
||||||
totalPosition: await this.posMasterRepository.count({ where: { orgChild1Id: orgChild1.id }}),
|
totalPosition: await this.posMasterRepository.count({
|
||||||
totalPositionCurrentUse: await this.posMasterRepository.count({ where: { orgChild1Id: orgChild1.id, profileIdCurrentHolder: Not(IsNull()) && Not("") }}),
|
where: { orgChild1Id: orgChild1.id },
|
||||||
totalPositionCurrentVacant: await this.posMasterRepository.count({ where: { orgChild1Id: orgChild1.id, profileIdCurrentHolder: IsNull() && "" }}),
|
}),
|
||||||
totalPositionNextUse: await this.posMasterRepository.count({ where: { orgChild1Id: orgChild1.id, profileIdNextHolder: Not(IsNull()) && Not("") }}),
|
totalPositionCurrentUse: await this.posMasterRepository.count({
|
||||||
totalPositionNextVacant: await this.posMasterRepository.count({ where: { orgChild1Id: orgChild1.id, profileIdNextHolder: IsNull() && "" }}),
|
where: {
|
||||||
children: orgChild2Data
|
orgChild1Id: orgChild1.id,
|
||||||
|
profileIdCurrentHolder: Not(IsNull()) && Not(""),
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
totalPositionCurrentVacant: await this.posMasterRepository.count({
|
||||||
|
where: { orgChild1Id: orgChild1.id, profileIdCurrentHolder: IsNull() && "" },
|
||||||
|
}),
|
||||||
|
totalPositionNextUse: await this.posMasterRepository.count({
|
||||||
|
where: {
|
||||||
|
orgChild1Id: orgChild1.id,
|
||||||
|
profileIdNextHolder: Not(IsNull()) && Not(""),
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
totalPositionNextVacant: await this.posMasterRepository.count({
|
||||||
|
where: { orgChild1Id: orgChild1.id, profileIdNextHolder: IsNull() && "" },
|
||||||
|
}),
|
||||||
|
children: await Promise.all(
|
||||||
|
orgChild2Data
|
||||||
.filter((orgChild2) => orgChild2.orgChild1Id === orgChild1.id)
|
.filter((orgChild2) => orgChild2.orgChild1Id === orgChild1.id)
|
||||||
.map(async (orgChild2) => ({
|
.map(async (orgChild2) => ({
|
||||||
orgTreeId: orgChild2.id,
|
orgTreeId: orgChild2.id,
|
||||||
|
|
@ -769,12 +798,32 @@ export class OrganizationController extends Controller {
|
||||||
orgTreeFax: orgChild2.orgChild2Fax,
|
orgTreeFax: orgChild2.orgChild2Fax,
|
||||||
orgRevisionId: orgRoot.orgRevisionId,
|
orgRevisionId: orgRoot.orgRevisionId,
|
||||||
orgRootName: orgRoot.orgRootName,
|
orgRootName: orgRoot.orgRootName,
|
||||||
totalPosition: await this.posMasterRepository.count({ where: { orgChild2Id: orgChild2.id }}),
|
totalPosition: await this.posMasterRepository.count({
|
||||||
totalPositionCurrentUse: await this.posMasterRepository.count({ where: { orgChild2Id: orgChild2.id, profileIdCurrentHolder: Not(IsNull()) && Not("") }}),
|
where: { orgChild2Id: orgChild2.id },
|
||||||
totalPositionCurrentVacant: await this.posMasterRepository.count({ where: { orgChild2Id: orgChild2.id, profileIdCurrentHolder: IsNull() && "" }}),
|
}),
|
||||||
totalPositionNextUse: await this.posMasterRepository.count({ where: { orgChild2Id: orgChild2.id, profileIdNextHolder: Not(IsNull()) && Not("") }}),
|
totalPositionCurrentUse: await this.posMasterRepository.count({
|
||||||
totalPositionNextVacant: await this.posMasterRepository.count({ where: { orgChild2Id: orgChild2.id, profileIdNextHolder: IsNull() && "" }}),
|
where: {
|
||||||
children: orgChild3Data
|
orgChild2Id: orgChild2.id,
|
||||||
|
profileIdCurrentHolder: Not(IsNull()) && Not(""),
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
totalPositionCurrentVacant: await this.posMasterRepository.count({
|
||||||
|
where: {
|
||||||
|
orgChild2Id: orgChild2.id,
|
||||||
|
profileIdCurrentHolder: IsNull() && "",
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
totalPositionNextUse: await this.posMasterRepository.count({
|
||||||
|
where: {
|
||||||
|
orgChild2Id: orgChild2.id,
|
||||||
|
profileIdNextHolder: Not(IsNull()) && Not(""),
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
totalPositionNextVacant: await this.posMasterRepository.count({
|
||||||
|
where: { orgChild2Id: orgChild2.id, profileIdNextHolder: IsNull() && "" },
|
||||||
|
}),
|
||||||
|
children: await Promise.all(
|
||||||
|
orgChild3Data
|
||||||
.filter((orgChild3) => orgChild3.orgChild2Id === orgChild2.id)
|
.filter((orgChild3) => orgChild3.orgChild2Id === orgChild2.id)
|
||||||
.map(async (orgChild3) => ({
|
.map(async (orgChild3) => ({
|
||||||
orgTreeId: orgChild3.id,
|
orgTreeId: orgChild3.id,
|
||||||
|
|
@ -793,12 +842,35 @@ export class OrganizationController extends Controller {
|
||||||
orgTreeFax: orgChild3.orgChild3Fax,
|
orgTreeFax: orgChild3.orgChild3Fax,
|
||||||
orgRevisionId: orgRoot.orgRevisionId,
|
orgRevisionId: orgRoot.orgRevisionId,
|
||||||
orgRootName: orgRoot.orgRootName,
|
orgRootName: orgRoot.orgRootName,
|
||||||
totalPosition: await this.posMasterRepository.count({ where: { orgChild3Id: orgChild3.id }}),
|
totalPosition: await this.posMasterRepository.count({
|
||||||
totalPositionCurrentUse: await this.posMasterRepository.count({ where: { orgChild3Id: orgChild3.id, profileIdCurrentHolder: Not(IsNull()) && Not("") }}),
|
where: { orgChild3Id: orgChild3.id },
|
||||||
totalPositionCurrentVacant: await this.posMasterRepository.count({ where: { orgChild3Id: orgChild3.id, profileIdCurrentHolder: IsNull() && "" }}),
|
}),
|
||||||
totalPositionNextUse: await this.posMasterRepository.count({ where: { orgChild3Id: orgChild3.id, profileIdNextHolder: Not(IsNull()) && Not("") }}),
|
totalPositionCurrentUse: await this.posMasterRepository.count({
|
||||||
totalPositionNextVacant: await this.posMasterRepository.count({ where: { orgChild3Id: orgChild3.id, profileIdNextHolder: IsNull() && "" }}),
|
where: {
|
||||||
children: orgChild4Data
|
orgChild3Id: orgChild3.id,
|
||||||
|
profileIdCurrentHolder: Not(IsNull()) && Not(""),
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
totalPositionCurrentVacant: await this.posMasterRepository.count({
|
||||||
|
where: {
|
||||||
|
orgChild3Id: orgChild3.id,
|
||||||
|
profileIdCurrentHolder: IsNull() && "",
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
totalPositionNextUse: await this.posMasterRepository.count({
|
||||||
|
where: {
|
||||||
|
orgChild3Id: orgChild3.id,
|
||||||
|
profileIdNextHolder: Not(IsNull()) && Not(""),
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
totalPositionNextVacant: await this.posMasterRepository.count({
|
||||||
|
where: {
|
||||||
|
orgChild3Id: orgChild3.id,
|
||||||
|
profileIdNextHolder: IsNull() && "",
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
children: await Promise.all(
|
||||||
|
orgChild4Data
|
||||||
.filter((orgChild4) => orgChild4.orgChild3Id === orgChild3.id)
|
.filter((orgChild4) => orgChild4.orgChild3Id === orgChild3.id)
|
||||||
.map(async (orgChild4) => ({
|
.map(async (orgChild4) => ({
|
||||||
orgTreeId: orgChild4.id,
|
orgTreeId: orgChild4.id,
|
||||||
|
|
@ -817,17 +889,45 @@ export class OrganizationController extends Controller {
|
||||||
orgTreeFax: orgChild4.orgChild4Fax,
|
orgTreeFax: orgChild4.orgChild4Fax,
|
||||||
orgRevisionId: orgRoot.orgRevisionId,
|
orgRevisionId: orgRoot.orgRevisionId,
|
||||||
orgRootName: orgRoot.orgRootName,
|
orgRootName: orgRoot.orgRootName,
|
||||||
totalPosition: await this.posMasterRepository.count({ where: { orgChild4Id: orgChild4.id }}),
|
totalPosition: await this.posMasterRepository.count({
|
||||||
totalPositionCurrentUse: await this.posMasterRepository.count({ where: { orgChild4Id: orgChild4.id, profileIdCurrentHolder: Not(IsNull()) && Not("") }}),
|
where: { orgChild4Id: orgChild4.id },
|
||||||
totalPositionCurrentVacant: await this.posMasterRepository.count({ where: { orgChild4Id: orgChild4.id, profileIdCurrentHolder: IsNull() && "" }}),
|
}),
|
||||||
totalPositionNextUse: await this.posMasterRepository.count({ where: { orgChild4Id: orgChild4.id, profileIdNextHolder: Not(IsNull()) && Not("") }}),
|
totalPositionCurrentUse: await this.posMasterRepository.count({
|
||||||
totalPositionNextVacant: await this.posMasterRepository.count({ where: { orgChild4Id: orgChild4.id, profileIdNextHolder: IsNull() && "" }}),
|
where: {
|
||||||
|
orgChild4Id: orgChild4.id,
|
||||||
|
profileIdCurrentHolder: Not(IsNull()) && Not(""),
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
totalPositionCurrentVacant:
|
||||||
|
await this.posMasterRepository.count({
|
||||||
|
where: {
|
||||||
|
orgChild4Id: orgChild4.id,
|
||||||
|
profileIdCurrentHolder: IsNull() && "",
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
totalPositionNextUse: await this.posMasterRepository.count({
|
||||||
|
where: {
|
||||||
|
orgChild4Id: orgChild4.id,
|
||||||
|
profileIdNextHolder: Not(IsNull()) && Not(""),
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
totalPositionNextVacant: await this.posMasterRepository.count({
|
||||||
|
where: {
|
||||||
|
orgChild4Id: orgChild4.id,
|
||||||
|
profileIdNextHolder: IsNull() && "",
|
||||||
|
},
|
||||||
|
}),
|
||||||
})),
|
})),
|
||||||
|
),
|
||||||
})),
|
})),
|
||||||
|
),
|
||||||
})),
|
})),
|
||||||
|
),
|
||||||
})),
|
})),
|
||||||
|
),
|
||||||
};
|
};
|
||||||
}));
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
return new HttpSuccess(formattedData);
|
return new HttpSuccess(formattedData);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue