This commit is contained in:
parent
94ea64247f
commit
a6822b1b33
1 changed files with 20 additions and 3 deletions
|
|
@ -11151,17 +11151,24 @@ export class ReportController extends Controller {
|
|||
.orderBy("posType.posTypeRank", "ASC")
|
||||
.addOrderBy("posLevel.posLevelRank", "ASC")
|
||||
.getMany();
|
||||
|
||||
|
||||
const _posMaster = posMaster.map((x) => ({
|
||||
type: [...new Set(x.positions.flatMap((y) => y.posType.posTypeName))].join(","),
|
||||
typeRank: [...new Set(x.positions.flatMap((y) => y.posType.posTypeRank))].join(""),
|
||||
typeShortNameAndRank: [
|
||||
...new Set(
|
||||
x.positions.map(
|
||||
(y) => `${y.posType.posTypeShortName} ${y.posLevel.posLevelRank}`
|
||||
)
|
||||
),
|
||||
].join(", "),
|
||||
level: [...new Set(x.positions.flatMap((y) => y.posLevel.posLevelName))].join(","),
|
||||
levelRank: [
|
||||
...new Set(
|
||||
x.positions.flatMap((y) => `${y.posType.posTypeRank}${y.posLevel.posLevelRank}`),
|
||||
),
|
||||
].join(""),
|
||||
positions: [...new Set(x.positions.flatMap((y) => y.positionName))].join(""),
|
||||
positions: [...new Set(x.positions.map((y) => y.positionName))].join(", "),
|
||||
}));
|
||||
|
||||
const groupedData = _posMaster.reduce((acc: any, curr: any) => {
|
||||
|
|
@ -11170,14 +11177,21 @@ export class ReportController extends Controller {
|
|||
acc[key] = { ...curr, total: 1 };
|
||||
} else {
|
||||
acc[key].total += 1;
|
||||
const combinedPositions = new Set([
|
||||
...acc[key].positions.split(", "),
|
||||
...curr.positions.split(", "),
|
||||
]);
|
||||
acc[key].positions = Array.from(combinedPositions).join(", ");
|
||||
}
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
// console.log("groupedData>>>",groupedData);
|
||||
|
||||
let result = Object.values(groupedData)
|
||||
.map((x: any) => ({
|
||||
type: x.type,
|
||||
typeRank: parseInt(x.typeRank),
|
||||
typeShortNameAndRank: x.typeShortNameAndRank,
|
||||
level: x.level,
|
||||
levelRank: parseInt(x.levelRank),
|
||||
|
||||
|
|
@ -11210,6 +11224,7 @@ export class ReportController extends Controller {
|
|||
_reslut.push({
|
||||
type: "",
|
||||
typeRank: "",
|
||||
typeShortNameAndRank: "",
|
||||
level: "รวม",
|
||||
levelRank: "",
|
||||
total: _total,
|
||||
|
|
@ -11228,6 +11243,7 @@ export class ReportController extends Controller {
|
|||
_reslut.push({
|
||||
type: "",
|
||||
typeRank: "",
|
||||
typeShortNameAndRank: "",
|
||||
level: "รวม",
|
||||
levelRank: "",
|
||||
total: total,
|
||||
|
|
@ -11236,6 +11252,7 @@ export class ReportController extends Controller {
|
|||
_reslut.push({
|
||||
type: "",
|
||||
typeRank: "",
|
||||
typeShortNameAndRank: "",
|
||||
level: "รวมทั้งสิ้น",
|
||||
levelRank: "",
|
||||
total: allTotal,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue