diff --git a/src/components/estimate/Estimate.jsx b/src/components/estimate/Estimate.jsx index 40d18e4b..0e8803b7 100644 --- a/src/components/estimate/Estimate.jsx +++ b/src/components/estimate/Estimate.jsx @@ -108,10 +108,10 @@ export default function Estimate({ params }) { if (estimateContextState?.estimateOption) { res.map((row) => { let estimateOption = estimateContextState?.estimateOption?.split('、') - row.text = false + row.check = false estimateOption.map((row2) => { if (row2 === row.code) { - row.text = true + row.check = true } }) }) @@ -135,7 +135,7 @@ export default function Estimate({ params }) { useEffect(() => { //선택된 견적특이사항 setEstimateContextState if (isNotEmptyArray(specialNoteList)) { - const liveCheckedData = specialNoteList.filter((row) => row.text === true) + const liveCheckedData = specialNoteList.filter((row) => row.check === true) const data = [] for (let ele of liveCheckedData) { @@ -204,6 +204,24 @@ export default function Estimate({ params }) { } }) + if (estimateContextState.estimateType === 'YJSS') { + if (specialNoteList.length > 0) { + specialNoteList.map((item) => { + if (item.code === 'ATTR002') { + item.check = false + } + }) + } + } else { + if (specialNoteList.length > 0) { + specialNoteList.map((item) => { + if (item.code === 'ATTR002') { + item.check = true + } + }) + } + } + setItemChangeYn(true) } }, [estimateContextState?.estimateType]) @@ -241,7 +259,6 @@ export default function Estimate({ params }) { sapSalesStoreCd: session.custCd, docTpCd: estimateContextState.estimateType, priceCd: showPriceCd, - //itemIdList: estimateContextState.itemList, //아이템 최초정보로 호출 delFlg 0인거만.. itemIdList: estimateContextState.itemList.filter((item) => item.delFlg === '0'), } @@ -266,22 +283,22 @@ export default function Estimate({ params }) { if (res.status === 200) { const data = res.data //기존itemList랑 프라이싱결과랑 비교해서 단가만 업뎃 서로 갯수가 안맞을 수 있음 없는 itemId면 unitPrice 0으로 - //itemId로 비교해서 단가정보만 업데이트 + //itemId로 비교해서 salePrice만 업데이트 if (data.result.code === 200) { if (isNotEmptyArray(data.data2)) { - estimateContextState.itemList.map((item) => { + estimateContextState.itemList.map((item, itemIndex) => { let checkYn = false data.data2.map((item2) => { if (item2) { if (item2.itemId === item.itemId) { - updateList.push({ ...item, unitPrice: item2.unitPrice }) + updateList.push({ ...item, salePrice: item2.unitPrice, saleTotPrice: (item.amount * item2.unitPrice).toString() }) checkYn = true } } }) if (!checkYn) { - updateList.push({ ...item, unitPrice: '0' }) + updateList.push({ ...item, salePrice: '0', saleTotPrice: '0' }) } }) @@ -328,6 +345,8 @@ export default function Estimate({ params }) { pkgAsp: pkgAsp, pkgTotPrice: pkgTotPrice.toFixed(3), }) + + //아이템들 중 조건에 맞는애들 뽑아서 상단 공급가액 부가세 총액 수정 } } @@ -421,8 +440,8 @@ export default function Estimate({ params }) { updates.specialNoteCd = res.spnAttrCds updates.itemGroup = res.itemGroup updates.delFlg = '0' // 삭제플래그 0 - // updates.saleTotPrice = res.salePrice * estimateContextState.itemList[index].amount - updates.saleTotPrice = '0' //추가때는 수량을 안받아서 합계를 무조건 0으로 + updates.saleTotPrice = (res.salePrice * estimateContextState.itemList[index].amount).toString() + //104671 let bomList = res.itemBomList @@ -502,6 +521,8 @@ export default function Estimate({ params }) { useEffect(() => { if (itemChangeYn) { + console.log(' 토탈만들어주기::::::::::', estimateContextState.itemList) + let totAmount = 0 let totVolKw = 0 let supplyPrice = 0 @@ -888,6 +909,7 @@ export default function Estimate({ params }) { {/* SpecialNoteList반복문 */} {specialNoteList.length > 0 && specialNoteList.map((row) => { + // console.log('rowL::::', row) return (
{ setSpecialNoteList((specialNote) => - specialNote.map((temp) => (temp.code === row.code ? { ...temp, text: !temp.text } : temp)), + specialNote.map((temp) => (temp.code === row.code ? { ...temp, check: !temp.check } : temp)), ) settingShowContent(row.code, event) }}