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