견적서 상세

This commit is contained in:
basssy 2024-11-23 01:07:21 +09:00
parent 57bc308dd2
commit 603dc797c0

View File

@ -108,10 +108,10 @@ export default function Estimate({ params }) {
if (estimateContextState?.estimateOption) { if (estimateContextState?.estimateOption) {
res.map((row) => { res.map((row) => {
let estimateOption = estimateContextState?.estimateOption?.split('、') let estimateOption = estimateContextState?.estimateOption?.split('、')
row.text = false row.check = false
estimateOption.map((row2) => { estimateOption.map((row2) => {
if (row2 === row.code) { if (row2 === row.code) {
row.text = true row.check = true
} }
}) })
}) })
@ -135,7 +135,7 @@ export default function Estimate({ params }) {
useEffect(() => { useEffect(() => {
// setEstimateContextState // setEstimateContextState
if (isNotEmptyArray(specialNoteList)) { if (isNotEmptyArray(specialNoteList)) {
const liveCheckedData = specialNoteList.filter((row) => row.text === true) const liveCheckedData = specialNoteList.filter((row) => row.check === true)
const data = [] const data = []
for (let ele of liveCheckedData) { 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) setItemChangeYn(true)
} }
}, [estimateContextState?.estimateType]) }, [estimateContextState?.estimateType])
@ -241,7 +259,6 @@ export default function Estimate({ params }) {
sapSalesStoreCd: session.custCd, sapSalesStoreCd: session.custCd,
docTpCd: estimateContextState.estimateType, docTpCd: estimateContextState.estimateType,
priceCd: showPriceCd, priceCd: showPriceCd,
//itemIdList: estimateContextState.itemList, // delFlg 0..
itemIdList: estimateContextState.itemList.filter((item) => item.delFlg === '0'), itemIdList: estimateContextState.itemList.filter((item) => item.delFlg === '0'),
} }
@ -266,22 +283,22 @@ export default function Estimate({ params }) {
if (res.status === 200) { if (res.status === 200) {
const data = res.data const data = res.data
//itemList itemId unitPrice 0 //itemList itemId unitPrice 0
//itemId //itemId salePrice
if (data.result.code === 200) { if (data.result.code === 200) {
if (isNotEmptyArray(data.data2)) { if (isNotEmptyArray(data.data2)) {
estimateContextState.itemList.map((item) => { estimateContextState.itemList.map((item, itemIndex) => {
let checkYn = false let checkYn = false
data.data2.map((item2) => { data.data2.map((item2) => {
if (item2) { if (item2) {
if (item2.itemId === item.itemId) { 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 checkYn = true
} }
} }
}) })
if (!checkYn) { 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, pkgAsp: pkgAsp,
pkgTotPrice: pkgTotPrice.toFixed(3), pkgTotPrice: pkgTotPrice.toFixed(3),
}) })
//
} }
} }
@ -421,8 +440,8 @@ export default function Estimate({ params }) {
updates.specialNoteCd = res.spnAttrCds updates.specialNoteCd = res.spnAttrCds
updates.itemGroup = res.itemGroup updates.itemGroup = res.itemGroup
updates.delFlg = '0' // 0 updates.delFlg = '0' // 0
// updates.saleTotPrice = res.salePrice * estimateContextState.itemList[index].amount updates.saleTotPrice = (res.salePrice * estimateContextState.itemList[index].amount).toString()
updates.saleTotPrice = '0' // 0
//104671 //104671
let bomList = res.itemBomList let bomList = res.itemBomList
@ -502,6 +521,8 @@ export default function Estimate({ params }) {
useEffect(() => { useEffect(() => {
if (itemChangeYn) { if (itemChangeYn) {
console.log(' 토탈만들어주기::::::::::', estimateContextState.itemList)
let totAmount = 0 let totAmount = 0
let totVolKw = 0 let totVolKw = 0
let supplyPrice = 0 let supplyPrice = 0
@ -888,6 +909,7 @@ export default function Estimate({ params }) {
{/* SpecialNoteList반복문 */} {/* SpecialNoteList반복문 */}
{specialNoteList.length > 0 && {specialNoteList.length > 0 &&
specialNoteList.map((row) => { specialNoteList.map((row) => {
// console.log('rowL::::', row)
return ( return (
<div <div
key={uuidv4()} key={uuidv4()}
@ -900,11 +922,11 @@ export default function Estimate({ params }) {
<input <input
type="checkbox" type="checkbox"
id={row.code} id={row.code}
checked={!!row.text} checked={!!row.check}
disabled={row.code === 'ATTR001' ? true : false} disabled={row.code === 'ATTR001' || row.code === 'ATTR002' ? true : false}
onChange={(event) => { onChange={(event) => {
setSpecialNoteList((specialNote) => 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) settingShowContent(row.code, event)
}} }}