Option 구조 변경

This commit is contained in:
김민식 2025-03-17 14:38:11 +09:00
parent 65e77ad2ed
commit 55067cb4f8
2 changed files with 48 additions and 12 deletions

View File

@ -475,15 +475,17 @@ export default function CircuitTrestleSetting({ id }) {
// //
const getStepUpListData = () => { const getStepUpListData = () => {
return stepUpListData[0].pcsItemList.map((item) => { const pcs = []
console.log(stepUpListData)
stepUpListData[0].pcsItemList.map((item, index) => {
return item.serQtyList return item.serQtyList
.filter((serQty) => serQty.selected) .filter((serQty) => serQty.selected)
.map((serQty, index) => { .forEach((serQty) => {
return { pcs.push({
pcsMkrCd: item.pcsMkrCd, pcsMkrCd: item.pcsMkrCd,
pcsSerCd: item.pcsSerCd, pcsSerCd: item.pcsSerCd,
pcsItemId: item.itemId, pcsItemId: item.itemId,
pscOptCd: index === 0 ? seletedMainOption.code : seletedSubOption.code, pscOptCd: getPcsOptCd(index),
paralQty: serQty.paralQty, paralQty: serQty.paralQty,
connections: item.connList?.length connections: item.connList?.length
? [ ? [
@ -492,9 +494,43 @@ export default function CircuitTrestleSetting({ id }) {
}, },
] ]
: [], : [],
} })
// return {
// pcsMkrCd: item.pcsMkrCd,
// pcsSerCd: item.pcsSerCd,
// pcsItemId: item.itemId,
// pscOptCd: getPcsOptCd(index),
// paralQty: serQty.paralQty,
// connections: item.connList?.length
// ? [
// {
// connItemId: item.connList[0].itemId,
// },
// ]
// : [],
// }
}) })
}) })
return pcs
}
const getPcsOptCd = (index) => {
console.log(selectedModels)
console.log(seletedMainOption)
console.log(seletedSubOption)
if (selectedModels.some((model) => model.pcsSerParallelYn === 'Y')) {
if (selectedModels.length > 1) {
if (index === 0) {
return seletedMainOption.code
} else {
return seletedSubOption.code
}
} else {
return seletedMainOption.code
}
} else {
return seletedMainOption.code
}
} }
const handleStepUp = () => { const handleStepUp = () => {

View File

@ -640,13 +640,13 @@ export const useTrestle = () => {
//surfaces.pcses들을 배열로 묶는다 //surfaces.pcses들을 배열로 묶는다
const pcses = surfaces[0].pcses.filter((pcs) => pcs !== null && pcs !== undefined) const pcses = surfaces[0].pcses.filter((pcs) => pcs !== null && pcs !== undefined)
surfaces.forEach((surface, index) => { // surfaces.forEach((surface, index) => {
if (index !== 0) { // if (index !== 0) {
if (surface.pcses) { // if (surface.pcses) {
pcses.concat(surface.pcses) // pcses.concat(surface.pcses)
} // }
} // }
}) // })
const allModules = surfaces.map((surface) => surface.modules).flat() const allModules = surfaces.map((surface) => surface.modules).flat()
// 모듈 파라미터 생성 // 모듈 파라미터 생성