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) => { .then(async (res) => {
const dataMain: PosMaster[] = []; const dataMain: PosMaster[] = [];
totalPage.value = Math.ceil(res.data.result.total / reqMaster.pageSize); totalPage.value = Math.ceil(res.data.result.total / reqMaster.pageSize);
totalData.value = res.data.result.total;
res.data.result.data.forEach((e: PosMaster) => { res.data.result.data.forEach((e: PosMaster) => {
const p = e.positions; const p = e.positions;
if (p.length !== 0) { let positionData = {};
const a = p.find((el: Position) => el.positionIsSelected === true);
const { id, ...rest } = a ? a : p[0]; if (p?.length > 0) {
const test = { const selectedPos = p.find(
...e, (el: Position) => el.positionIsSelected === true
...rest, );
}; const targetPosition = selectedPos || p[0];
dataMain.push(test); const { id, ...rest } = targetPosition;
positionData = rest;
} }
const newDataMain = {
...e,
...positionData,
};
dataMain.push(newDataMain);
}); });
posMaster.value = store.fetchPosMaster(dataMain); posMaster.value = store.fetchPosMaster(dataMain);
}) })

View file

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