From 74f64cce565717bc982c63fc13d43b6852536d5a Mon Sep 17 00:00:00 2001 From: basssy Date: Wed, 27 Nov 2024 16:29:03 +0900 Subject: [PATCH] =?UTF-8?q?=EA=B2=AC=EC=A0=81=EC=84=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/estimate/Estimate.jsx | 68 ++++++++++++++++++---------- 1 file changed, 45 insertions(+), 23 deletions(-) diff --git a/src/components/estimate/Estimate.jsx b/src/components/estimate/Estimate.jsx index fb1e17b5..b3b41626 100644 --- a/src/components/estimate/Estimate.jsx +++ b/src/components/estimate/Estimate.jsx @@ -146,7 +146,6 @@ export default function Estimate({ params }) { } }) - console.log('최초::::::::', res) setSpecialNoteList(res) setSpecialNoteFirstFlg(true) @@ -176,7 +175,6 @@ export default function Estimate({ params }) { useEffect(() => { //선택된 견적특이사항 setEstimateContextState if (isNotEmptyArray(specialNoteList)) { - console.log('specialNoteList::', specialNoteList) const liveCheckedData = specialNoteList.filter((row) => row.check === true) const data = [] @@ -643,6 +641,51 @@ export default function Estimate({ params }) { }) console.log('YJOD 토탈만들어주기::::::::::', estimateContextState.itemList) + let pushData = [] + let uniquSet = new Set() + + estimateContextState.itemList.forEach((item) => { + if (item.delFlg === '1') { + if (item.specialNoteCd) { + let splitData = item.specialNoteCd.split('、') + splitData.forEach((note) => { + if (!uniquSet.has(note)) { + uniquSet.add(note) + pushData.push(note) + } + }) + + setSpecialNoteFirstFlg(false) + } + } + }) + let estimateOption = estimateContextState?.estimateOption?.split('、') + estimateOption = estimateOption.filter((option) => !pushData.includes(option)) + let estimateOptionString = estimateOption.join('、') + console.log('바꾼값:::::::', estimateOptionString) + + console.log('SpecialNoteLis::', specialNoteList) + + //새로 추가한 아이템 견적 특이사항 체크.. + // specialNoteList.map((row) => { + // let spnAttrCds = res?.spnAttrCds?.split('、') + // let estimateOption = estimateContextState?.estimateOption?.split('、') + // let combineArray = Array.from(new Set([...spnAttrCds, ...estimateOption])).sort() + // row.check = false + // combineArray.map((row2) => { + // if (row.pkgYn === '0') { + // if (row2 === row.code) { + // row.check = true + // } + // } else { + // if (row.code.includes(row2)) { + // row.check = true + // return + // } + // } + // }) + // }) + estimateContextState.itemList.map((item) => { delete item.showSalePrice delete item.showSaleTotPrice @@ -740,27 +783,6 @@ export default function Estimate({ params }) { }) } - //새로 추가한 아이템 견적 특이사항 체크.. - console.log('specialNoteList::', specialNoteList) - // specialNoteList.map((row) => { - // let spnAttrCds = res?.spnAttrCds?.split('、') - // let estimateOption = estimateContextState?.estimateOption?.split('、') - // let combineArray = Array.from(new Set([...spnAttrCds, ...estimateOption])).sort() - // row.check = false - // combineArray.map((row2) => { - // if (row.pkgYn === '0') { - // if (row2 === row.code) { - // row.check = true - // } - // } else { - // if (row.code.includes(row2)) { - // row.check = true - // return - // } - // } - // }) - // }) - setItemChangeYn(false) } }, [itemChangeYn, estimateContextState.itemList])