견적서
This commit is contained in:
parent
3b72acce81
commit
e6e600602d
@ -191,9 +191,9 @@ export default function Estimate({ params }) {
|
|||||||
}, [specialNoteList])
|
}, [specialNoteList])
|
||||||
|
|
||||||
// 견적특이사항 remark 보여주기
|
// 견적특이사항 remark 보여주기
|
||||||
const settingShowContent = (code, event) => {
|
const settingShowContent = (code) => {
|
||||||
setShowContentCode(code)
|
setShowContentCode(code)
|
||||||
event.stopPropagation()
|
// event.stopPropagation()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 추가한 첨부파일 estimateContextState에 넣기
|
// 추가한 첨부파일 estimateContextState에 넣기
|
||||||
@ -227,7 +227,15 @@ export default function Estimate({ params }) {
|
|||||||
}, [estimateContextState?.fileList])
|
}, [estimateContextState?.fileList])
|
||||||
|
|
||||||
// 기존첨부파일 삭제 (플래그값 추가?) 저장할때 플래그값에 따라 진짜 삭제
|
// 기존첨부파일 삭제 (플래그값 추가?) 저장할때 플래그값에 따라 진짜 삭제
|
||||||
const deleteOriginFile = async (objectNo, no) => {
|
const deleteOriginFile = (objectNo, no) => {
|
||||||
|
originFiles.map((file) => {
|
||||||
|
if (file.no === no) {
|
||||||
|
file.delFlg = '1'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// console.log('originFiles::', originFiles)
|
||||||
|
setOriginFiles(originFiles)
|
||||||
const delParams = {
|
const delParams = {
|
||||||
userId: session.userId,
|
userId: session.userId,
|
||||||
objectNo: objectNo,
|
objectNo: objectNo,
|
||||||
@ -407,25 +415,43 @@ export default function Estimate({ params }) {
|
|||||||
|
|
||||||
if (isNotEmptyArray(data.data2)) {
|
if (isNotEmptyArray(data.data2)) {
|
||||||
estimateContextState.itemList.map((item) => {
|
estimateContextState.itemList.map((item) => {
|
||||||
|
// console.log('기존아이템::', item)
|
||||||
let checkYn = false
|
let checkYn = false
|
||||||
data.data2.map((item2) => {
|
for (let i = 0; i < data.data2.length; i++) {
|
||||||
if (item2) {
|
// console.log('프라이싱결과아이템:::', data.data2[i])
|
||||||
if (item2.itemId === item.itemId) {
|
if (data.data2[i]) {
|
||||||
|
if (data.data2[i].itemId === item.itemId) {
|
||||||
updateList.push({
|
updateList.push({
|
||||||
...item,
|
...item,
|
||||||
openFlg: item2.unitPrice === '0.0' ? '1' : '0',
|
openFlg: data.data2[i].unitPrice === '0.0' ? '1' : '0',
|
||||||
salePrice: item2.unitPrice === null ? '0' : item2.unitPrice,
|
salePrice: data.data2[i].unitPrice === null ? '0' : data.data2[i].unitPrice,
|
||||||
saleTotPrice: (item.amount * item2.unitPrice).toString(),
|
saleTotPrice: (item.amount * data.data2[i].unitPrice).toString(),
|
||||||
})
|
})
|
||||||
checkYn = true
|
checkYn = true
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
// data.data2.map((item2) => {
|
||||||
|
// if (item2) {
|
||||||
|
// // console.log('프라이싱아이템::::', item2)
|
||||||
|
// if (item2.itemId === item.itemId) {
|
||||||
|
// updateList.push({
|
||||||
|
// ...item,
|
||||||
|
// openFlg: item2.unitPrice === '0.0' ? '1' : '0',
|
||||||
|
// salePrice: item2.unitPrice === null ? '0' : item2.unitPrice,
|
||||||
|
// saleTotPrice: (item.amount * item2.unitPrice).toString(),
|
||||||
|
// })
|
||||||
|
// checkYn = true
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
|
||||||
if (!checkYn) {
|
if (!checkYn) {
|
||||||
updateList.push({ ...item, salePrice: '0', saleTotPrice: '0' })
|
updateList.push({ ...item, salePrice: '0', saleTotPrice: '0' })
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
setEstimateContextState({
|
setEstimateContextState({
|
||||||
priceCd: showPriceCd,
|
priceCd: showPriceCd,
|
||||||
itemList: updateList,
|
itemList: updateList,
|
||||||
@ -472,7 +498,7 @@ export default function Estimate({ params }) {
|
|||||||
//주택PKG input 변경
|
//주택PKG input 변경
|
||||||
const onChangePkgAsp = (value) => {
|
const onChangePkgAsp = (value) => {
|
||||||
if (estimateContextState.estimateType === 'YJSS') {
|
if (estimateContextState.estimateType === 'YJSS') {
|
||||||
let pkgAsp = Number(value.replace(/[^0-9]/g, '').replaceAll(',', ''))
|
let pkgAsp = Number(value.replace(/[^-\.0-9]/g, '').replaceAll(',', ''))
|
||||||
if (isNaN(pkgAsp)) {
|
if (isNaN(pkgAsp)) {
|
||||||
pkgAsp = 0
|
pkgAsp = 0
|
||||||
} else {
|
} else {
|
||||||
@ -725,6 +751,7 @@ export default function Estimate({ params }) {
|
|||||||
makeUniqueSpecialNoteCd(itemList)
|
makeUniqueSpecialNoteCd(itemList)
|
||||||
|
|
||||||
itemList.forEach((item) => {
|
itemList.forEach((item) => {
|
||||||
|
// console.log('YJOD::::::', item)
|
||||||
delete item.showSalePrice
|
delete item.showSalePrice
|
||||||
delete item.showSaleTotPrice
|
delete item.showSaleTotPrice
|
||||||
if (item.delFlg === '0') {
|
if (item.delFlg === '0') {
|
||||||
@ -753,10 +780,10 @@ export default function Estimate({ params }) {
|
|||||||
itemList.sort((a, b) => a.dispOrder - b.dispOrder)
|
itemList.sort((a, b) => a.dispOrder - b.dispOrder)
|
||||||
makeUniqueSpecialNoteCd(itemList)
|
makeUniqueSpecialNoteCd(itemList)
|
||||||
itemList.forEach((item) => {
|
itemList.forEach((item) => {
|
||||||
|
// console.log('YJSSS::', item)
|
||||||
if (item.delFlg === '0') {
|
if (item.delFlg === '0') {
|
||||||
let amount = Number(item.amount?.replace(/[^0-9]/g, '').replaceAll(',', '')) || 0
|
let amount = Number(item.amount?.replace(/[^0-9]/g, '').replaceAll(',', '')) || 0
|
||||||
let salePrice = Number(item.salePrice?.replaceAll(',', '')) || 0
|
let salePrice = Number(item.salePrice?.replaceAll(',', '')) || 0
|
||||||
|
|
||||||
if (item.moduleFlg === '1') {
|
if (item.moduleFlg === '1') {
|
||||||
const volKw = (item.pnowW * amount) / 1000
|
const volKw = (item.pnowW * amount) / 1000
|
||||||
totals.totVolKw += volKw
|
totals.totVolKw += volKw
|
||||||
@ -1111,7 +1138,8 @@ export default function Estimate({ params }) {
|
|||||||
{originFiles.map((originFile) => {
|
{originFiles.map((originFile) => {
|
||||||
return (
|
return (
|
||||||
<li className="file-item" key={uuidv4()}>
|
<li className="file-item" key={uuidv4()}>
|
||||||
<span onClick={() => handleEstimateFileDownload(originFile)}>
|
<div className="file-item-wrap">
|
||||||
|
<span>
|
||||||
{originFile.faileName}
|
{originFile.faileName}
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
@ -1122,6 +1150,14 @@ export default function Estimate({ params }) {
|
|||||||
}}
|
}}
|
||||||
></button>
|
></button>
|
||||||
</span>
|
</span>
|
||||||
|
{/* <div className="return-wrap">
|
||||||
|
<span className="return">{originFile.faileName}</span>
|
||||||
|
<button type="button" className="return-btn">
|
||||||
|
<i className="return-ico"></i>
|
||||||
|
{getMessage('estimate.detail.fileList2.btn.return')}
|
||||||
|
</button>
|
||||||
|
</div> */}
|
||||||
|
</div>
|
||||||
</li>
|
</li>
|
||||||
)
|
)
|
||||||
})}
|
})}
|
||||||
@ -1155,21 +1191,29 @@ export default function Estimate({ params }) {
|
|||||||
specialNoteList.map((row) => {
|
specialNoteList.map((row) => {
|
||||||
return (
|
return (
|
||||||
<div key={uuidv4()} className="special-note-check-item">
|
<div key={uuidv4()} className="special-note-check-item">
|
||||||
|
<div className="special-note-check-box">
|
||||||
<div className="d-check-box light">
|
<div className="d-check-box light">
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
id={row.code}
|
id={row.code}
|
||||||
checked={!!row.check}
|
checked={!!row.check}
|
||||||
disabled={row.code === 'ATTR001' ? true : false}
|
disabled={row.code === 'ATTR001' || row.pkgYn === '1' ? true : false}
|
||||||
onChange={(event) => {
|
onClick={(event) => {
|
||||||
setSpecialNoteList((specialNote) =>
|
setSpecialNoteList((specialNote) =>
|
||||||
specialNote.map((temp) => (temp.code === row.code ? { ...temp, check: !temp.check } : temp)),
|
specialNote.map((temp) => (temp.code === row.code ? { ...temp, check: !temp.check } : temp)),
|
||||||
)
|
)
|
||||||
|
|
||||||
settingShowContent(row.code, event)
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<label htmlFor={row.code}>{row.codeNm}</label>
|
<label htmlFor={row.code}></label>
|
||||||
|
</div>
|
||||||
|
<span
|
||||||
|
className="check-name"
|
||||||
|
onClick={() => {
|
||||||
|
settingShowContent(row.code)
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{row.codeNm}
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
@ -1501,7 +1545,9 @@ export default function Estimate({ params }) {
|
|||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td className="al-r">
|
<td className="al-r">
|
||||||
{convertNumberToPriceDecimal(item?.showSaleTotPrice === '0' ? null : item?.saleTotPrice?.replaceAll(',', ''))}
|
{convertNumberToPriceDecimal(
|
||||||
|
item?.showSaleTotPrice === '0' ? null : item?.saleTotPrice === '0' ? null : item?.saleTotPrice?.replaceAll(',', ''),
|
||||||
|
)}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
)
|
)
|
||||||
|
|||||||
@ -18,6 +18,9 @@ const updateItemInList = (itemList, dispOrder, updates) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const useEstimateController = (planNo) => {
|
export const useEstimateController = (planNo) => {
|
||||||
|
const [fileList, setFileList] = useState([])
|
||||||
|
const [deleteFileList, setDeleteFileList] = useState([])
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const { session } = useContext(SessionContext)
|
const { session } = useContext(SessionContext)
|
||||||
const globalLocaleState = useRecoilValue(globalLocaleStore)
|
const globalLocaleState = useRecoilValue(globalLocaleStore)
|
||||||
@ -148,8 +151,8 @@ export const useEstimateController = (planNo) => {
|
|||||||
|
|
||||||
//첨부파일을 첨부안했는데
|
//첨부파일을 첨부안했는데
|
||||||
//아이템 fileUploadFlg가1(첨부파일 필수)이 1개라도 있는데 후일 자료 제출(fileFlg) 체크안했으면(0) alert 저장안돼
|
//아이템 fileUploadFlg가1(첨부파일 필수)이 1개라도 있는데 후일 자료 제출(fileFlg) 체크안했으면(0) alert 저장안돼
|
||||||
console.log('새로추가첨부파일:::', estimateData.newFileList)
|
// console.log('새로추가첨부파일:::', estimateData.newFileList)
|
||||||
console.log('기존첨부파일:::', estimateData.originFiles)
|
// console.log('기존첨부파일:::', estimateData.originFiles)
|
||||||
|
|
||||||
// return
|
// return
|
||||||
|
|
||||||
@ -228,13 +231,12 @@ export const useEstimateController = (planNo) => {
|
|||||||
formData.append('category', '10')
|
formData.append('category', '10')
|
||||||
formData.append('userId', estimateData.userId)
|
formData.append('userId', estimateData.userId)
|
||||||
|
|
||||||
await post({ url: '/api/file/fileUpload', data: formData })
|
await post({ url: '/api/file/fileUpload', data: formData }).then((res) => {
|
||||||
|
console.log('리턴::::::::::::', res)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
//첨부파일저장끝
|
//첨부파일저장끝
|
||||||
|
|
||||||
//제품라인 추가했는데 아이템 안고르고 저장하면itemId=''은 날리고 나머지 저장하기
|
|
||||||
// estimateData.itemList = estimateData.itemList.filter((item) => item.itemId !== '')
|
|
||||||
estimateData.itemList = estimateData.itemList.filter((item) => item.delFlg === '0' || !item.addFlg)
|
estimateData.itemList = estimateData.itemList.filter((item) => item.delFlg === '0' || !item.addFlg)
|
||||||
|
|
||||||
let delCnt = 0
|
let delCnt = 0
|
||||||
@ -287,10 +289,11 @@ export const useEstimateController = (planNo) => {
|
|||||||
estimateOptions = estimateOptionsArray.join('、')
|
estimateOptions = estimateOptionsArray.join('、')
|
||||||
|
|
||||||
estimateData.estimateOption = estimateOptions
|
estimateData.estimateOption = estimateOptions
|
||||||
console.log('최종아이템:::', estimateData.itemList)
|
// console.log('첨부파일::::::::', fileList)
|
||||||
|
// console.log('최종아이템:::', estimateData.itemList)
|
||||||
console.log('최종저장::', estimateData)
|
console.log('최종저장::', estimateData)
|
||||||
//2. 상세데이터 저장
|
//2. 상세데이터 저장
|
||||||
// return
|
return
|
||||||
try {
|
try {
|
||||||
await promisePost({ url: `${ESTIMATE_API_ENDPOINT}/save-estimate`, data: estimateData }).then((res) => {
|
await promisePost({ url: `${ESTIMATE_API_ENDPOINT}/save-estimate`, data: estimateData }).then((res) => {
|
||||||
if (res.status === 201) {
|
if (res.status === 201) {
|
||||||
|
|||||||
@ -841,6 +841,7 @@
|
|||||||
"estimate.detail.fileList.btn": "ファイル選択",
|
"estimate.detail.fileList.btn": "ファイル選択",
|
||||||
"estimate.detail.fileList.extCheck": "そのファイルはイメージファイルではありません",
|
"estimate.detail.fileList.extCheck": "そのファイルはイメージファイルではありません",
|
||||||
"estimate.detail.header.fileList2": "添付ファイル一覧",
|
"estimate.detail.header.fileList2": "添付ファイル一覧",
|
||||||
|
"estimate.detail.fileList2.btn.return": "復元",
|
||||||
"estimate.detail.header.specialEstimate": "見積もりの具体的な",
|
"estimate.detail.header.specialEstimate": "見積もりの具体的な",
|
||||||
"estimate.detail.header.specialEstimateProductInfo": "製品情報",
|
"estimate.detail.header.specialEstimateProductInfo": "製品情報",
|
||||||
"estimate.detail.sepcialEstimateProductInfo.totAmount": "数量 (PCS)",
|
"estimate.detail.sepcialEstimateProductInfo.totAmount": "数量 (PCS)",
|
||||||
|
|||||||
@ -851,6 +851,7 @@
|
|||||||
"estimate.detail.fileList.btn": "파일선택",
|
"estimate.detail.fileList.btn": "파일선택",
|
||||||
"estimate.detail.fileList.extCheck": "해당 파일은 이미지 파일이 아닙니다",
|
"estimate.detail.fileList.extCheck": "해당 파일은 이미지 파일이 아닙니다",
|
||||||
"estimate.detail.header.fileList2": "첨부파일 목록",
|
"estimate.detail.header.fileList2": "첨부파일 목록",
|
||||||
|
"estimate.detail.fileList2.btn.return": "복원",
|
||||||
"estimate.detail.header.specialEstimate": "견적특이사항",
|
"estimate.detail.header.specialEstimate": "견적특이사항",
|
||||||
"estimate.detail.header.specialEstimateProductInfo": "제품정보",
|
"estimate.detail.header.specialEstimateProductInfo": "제품정보",
|
||||||
"estimate.detail.sepcialEstimateProductInfo.totAmount": "수량 (PCS)",
|
"estimate.detail.sepcialEstimateProductInfo.totAmount": "수량 (PCS)",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user