#746 견적서 케이블 관련
This commit is contained in:
parent
9104771a46
commit
53f35a5e7c
@ -99,7 +99,6 @@ export default function Estimate({}) {
|
||||
|
||||
const initEstimate = (currPid = currentPid) => {
|
||||
console.log('🚀 ~ initEstimate ~ currPid:', currPid)
|
||||
setCableItem('')
|
||||
closeAll()
|
||||
setObjectNo(objectRecoil.floorPlanObjectNo)
|
||||
|
||||
@ -1031,8 +1030,9 @@ export default function Estimate({}) {
|
||||
item.showSaleTotPrice = '0'
|
||||
}
|
||||
})
|
||||
|
||||
let dispCableFlgCnt = 0
|
||||
estimateContextState.itemList.forEach((item) => {
|
||||
// console.log('YJSS::::::::', item)
|
||||
if (item.delFlg === '0') {
|
||||
let amount = Number(item.amount?.replace(/[^0-9]/g, '').replaceAll(',', '')) || 0
|
||||
let salePrice
|
||||
@ -1066,8 +1066,19 @@ export default function Estimate({}) {
|
||||
item.showSalePrice = '0'
|
||||
item.showSaleTotPrice = '0'
|
||||
}
|
||||
|
||||
if (item.dispCableFlg === '1') {
|
||||
// console.log('YJSS22222::::::::', item)
|
||||
dispCableFlgCnt++
|
||||
setCableItem(item.itemId)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
if (dispCableFlgCnt === 0) {
|
||||
setCableItem('100038')
|
||||
}
|
||||
|
||||
let pkgAsp = estimateContextState.pkgAsp ? Number(estimateContextState.pkgAsp.replaceAll(',', '')) : 0
|
||||
|
||||
totals.pkgTotPrice = pkgAsp * totals.totVolKw * 1000
|
||||
@ -1095,6 +1106,7 @@ export default function Estimate({}) {
|
||||
}
|
||||
})
|
||||
|
||||
let dispCableFlgCnt = 0
|
||||
estimateContextState.itemList.forEach((item) => {
|
||||
delete item.showSalePrice
|
||||
delete item.showSaleTotPrice
|
||||
@ -1122,9 +1134,21 @@ export default function Estimate({}) {
|
||||
item.showSalePrice = '0'
|
||||
item.showSaleTotPrice = '0'
|
||||
}
|
||||
|
||||
if (item.dispCableFlg === '1') {
|
||||
dispCableFlgCnt++
|
||||
}
|
||||
|
||||
if (item.dispCableFlg === '1') {
|
||||
setCableItem(item.itemId)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
if (dispCableFlgCnt === 0) {
|
||||
setCableItem('100038')
|
||||
}
|
||||
|
||||
totals.vatPrice = totals.supplyPrice * 0.1
|
||||
totals.totPrice = totals.supplyPrice + totals.vatPrice
|
||||
|
||||
@ -1167,6 +1191,26 @@ export default function Estimate({}) {
|
||||
}
|
||||
}, [estimateContextState])
|
||||
|
||||
useEffect(() => {
|
||||
if (cableItemList.lenght > 0 || estimateContextState?.itemList.length > 0) {
|
||||
let dispCableFlgCnt = 0
|
||||
estimateContextState.itemList.map((item) => {
|
||||
if (item.dispCableFlg === '1') {
|
||||
dispCableFlgCnt++
|
||||
cableItemList.map((cable) => {
|
||||
if (item.itemId === cable.clRefChr1) {
|
||||
cable.clRefChr3 = item.itemName
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
if (dispCableFlgCnt === 0) {
|
||||
setCableItem('100038')
|
||||
}
|
||||
}
|
||||
}, [estimateContextState?.itemList, cableItemList])
|
||||
|
||||
return (
|
||||
<div className="sub-content estimate">
|
||||
<div className="sub-content-inner">
|
||||
@ -1718,7 +1762,6 @@ export default function Estimate({}) {
|
||||
}}
|
||||
value={cableItem}
|
||||
>
|
||||
{/* <option value={''}>selected</option> */}
|
||||
{cableItemList.length > 0 &&
|
||||
cableItemList.map((row) => (
|
||||
<option key={row.clRefChr1} value={row.clRefChr1}>
|
||||
@ -1858,9 +1901,10 @@ export default function Estimate({}) {
|
||||
}
|
||||
}}
|
||||
menuPlacement={'auto'}
|
||||
getOptionLabel={(x) => x.clRefChr2}
|
||||
getOptionLabel={(x) => x.clRefChr3}
|
||||
getOptionValue={(x) => x.clRefChr1}
|
||||
isClearable={false}
|
||||
isDisabled={true}
|
||||
value={cableItemList.filter(function (option) {
|
||||
return option.clRefChr1 === item.itemId
|
||||
})}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user