견적서 상세

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) {
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 (
<div
key={uuidv4()}
@ -900,11 +922,11 @@ export default function Estimate({ params }) {
<input
type="checkbox"
id={row.code}
checked={!!row.text}
disabled={row.code === 'ATTR001' ? true : false}
checked={!!row.check}
disabled={row.code === 'ATTR001' || row.code === 'ATTR002' ? true : false}
onChange={(event) => {
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)
}}