fix ==> การรันตำแหน่ง โครงสร้างอัตรากำลัง

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2025-08-25 15:16:48 +07:00
parent 3c114a6ac9
commit 2afdcc4f94
2 changed files with 16 additions and 10 deletions

View file

@ -118,18 +118,24 @@ async function fetchDataTable(id: string, level: number, action: boolean) {
.then(async (res) => {
const dataMain: PosMaster[] = [];
totalPage.value = Math.ceil(res.data.result.total / reqMaster.pageSize);
totalData.value = res.data.result.total;
res.data.result.data.forEach((e: PosMaster) => {
const p = e.positions;
if (p.length !== 0) {
const a = p.find((el: Position) => el.positionIsSelected === true);
const { id, ...rest } = a ? a : p[0];
const test = {
...e,
...rest,
};
dataMain.push(test);
let positionData = {};
if (p?.length > 0) {
const selectedPos = p.find(
(el: Position) => el.positionIsSelected === true
);
const targetPosition = selectedPos || p[0];
const { id, ...rest } = targetPosition;
positionData = rest;
}
const newDataMain = {
...e,
...positionData,
};
dataMain.push(newDataMain);
});
posMaster.value = store.fetchPosMaster(dataMain);
})

View file

@ -1050,7 +1050,7 @@ watch(
v-model:reqMaster="reqMaster"
:fetchDataTable="props.fetchDataTable"
:getSummary="getSummary"
:is-position-holder="isPositionHolder"
v-model:is-position-holder="isPositionHolder"
:position-holder-info="positionHolderInfo"
/>