diff --git a/src/components/estimate/Estimate.jsx b/src/components/estimate/Estimate.jsx
index a14622f7..ff9e7af2 100644
--- a/src/components/estimate/Estimate.jsx
+++ b/src/components/estimate/Estimate.jsx
@@ -191,9 +191,9 @@ export default function Estimate({ params }) {
}, [specialNoteList])
// 견적특이사항 remark 보여주기
- const settingShowContent = (code, event) => {
+ const settingShowContent = (code) => {
setShowContentCode(code)
- event.stopPropagation()
+ // event.stopPropagation()
}
// 추가한 첨부파일 estimateContextState에 넣기
@@ -227,7 +227,15 @@ export default function Estimate({ params }) {
}, [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 = {
userId: session.userId,
objectNo: objectNo,
@@ -407,25 +415,43 @@ export default function Estimate({ params }) {
if (isNotEmptyArray(data.data2)) {
estimateContextState.itemList.map((item) => {
+ // console.log('기존아이템::', item)
let checkYn = false
- data.data2.map((item2) => {
- if (item2) {
- if (item2.itemId === item.itemId) {
+ for (let i = 0; i < data.data2.length; i++) {
+ // console.log('프라이싱결과아이템:::', data.data2[i])
+ if (data.data2[i]) {
+ if (data.data2[i].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(),
+ openFlg: data.data2[i].unitPrice === '0.0' ? '1' : '0',
+ salePrice: data.data2[i].unitPrice === null ? '0' : data.data2[i].unitPrice,
+ saleTotPrice: (item.amount * data.data2[i].unitPrice).toString(),
})
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) {
updateList.push({ ...item, salePrice: '0', saleTotPrice: '0' })
}
})
+
setEstimateContextState({
priceCd: showPriceCd,
itemList: updateList,
@@ -472,7 +498,7 @@ export default function Estimate({ params }) {
//주택PKG input 변경
const onChangePkgAsp = (value) => {
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)) {
pkgAsp = 0
} else {
@@ -725,6 +751,7 @@ export default function Estimate({ params }) {
makeUniqueSpecialNoteCd(itemList)
itemList.forEach((item) => {
+ // console.log('YJOD::::::', item)
delete item.showSalePrice
delete item.showSaleTotPrice
if (item.delFlg === '0') {
@@ -753,10 +780,10 @@ export default function Estimate({ params }) {
itemList.sort((a, b) => a.dispOrder - b.dispOrder)
makeUniqueSpecialNoteCd(itemList)
itemList.forEach((item) => {
+ // console.log('YJSSS::', item)
if (item.delFlg === '0') {
let amount = Number(item.amount?.replace(/[^0-9]/g, '').replaceAll(',', '')) || 0
let salePrice = Number(item.salePrice?.replaceAll(',', '')) || 0
-
if (item.moduleFlg === '1') {
const volKw = (item.pnowW * amount) / 1000
totals.totVolKw += volKw
@@ -1111,17 +1138,26 @@ export default function Estimate({ params }) {
{originFiles.map((originFile) => {
return (
- handleEstimateFileDownload(originFile)}>
- {originFile.faileName}
-
-
+
+
+ {originFile.faileName}
+
+
+ {/*
+ {originFile.faileName}
+
+
*/}
+
)
})}
@@ -1155,21 +1191,29 @@ export default function Estimate({ params }) {
specialNoteList.map((row) => {
return (
-
)
@@ -1501,7 +1545,9 @@ export default function Estimate({ params }) {
- {convertNumberToPriceDecimal(item?.showSaleTotPrice === '0' ? null : item?.saleTotPrice?.replaceAll(',', ''))}
+ {convertNumberToPriceDecimal(
+ item?.showSaleTotPrice === '0' ? null : item?.saleTotPrice === '0' ? null : item?.saleTotPrice?.replaceAll(',', ''),
+ )}
|
)
diff --git a/src/hooks/floorPlan/estimate/useEstimateController.js b/src/hooks/floorPlan/estimate/useEstimateController.js
index f59ed69e..dfd66960 100644
--- a/src/hooks/floorPlan/estimate/useEstimateController.js
+++ b/src/hooks/floorPlan/estimate/useEstimateController.js
@@ -18,6 +18,9 @@ const updateItemInList = (itemList, dispOrder, updates) => {
}
export const useEstimateController = (planNo) => {
+ const [fileList, setFileList] = useState([])
+ const [deleteFileList, setDeleteFileList] = useState([])
+
const router = useRouter()
const { session } = useContext(SessionContext)
const globalLocaleState = useRecoilValue(globalLocaleStore)
@@ -148,8 +151,8 @@ export const useEstimateController = (planNo) => {
//첨부파일을 첨부안했는데
//아이템 fileUploadFlg가1(첨부파일 필수)이 1개라도 있는데 후일 자료 제출(fileFlg) 체크안했으면(0) alert 저장안돼
- console.log('새로추가첨부파일:::', estimateData.newFileList)
- console.log('기존첨부파일:::', estimateData.originFiles)
+ // console.log('새로추가첨부파일:::', estimateData.newFileList)
+ // console.log('기존첨부파일:::', estimateData.originFiles)
// return
@@ -228,13 +231,12 @@ export const useEstimateController = (planNo) => {
formData.append('category', '10')
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)
let delCnt = 0
@@ -287,10 +289,11 @@ export const useEstimateController = (planNo) => {
estimateOptions = estimateOptionsArray.join('、')
estimateData.estimateOption = estimateOptions
- console.log('최종아이템:::', estimateData.itemList)
+ // console.log('첨부파일::::::::', fileList)
+ // console.log('최종아이템:::', estimateData.itemList)
console.log('최종저장::', estimateData)
//2. 상세데이터 저장
- // return
+ return
try {
await promisePost({ url: `${ESTIMATE_API_ENDPOINT}/save-estimate`, data: estimateData }).then((res) => {
if (res.status === 201) {
diff --git a/src/locales/ja.json b/src/locales/ja.json
index 7276c6c0..8efb602d 100644
--- a/src/locales/ja.json
+++ b/src/locales/ja.json
@@ -841,6 +841,7 @@
"estimate.detail.fileList.btn": "ファイル選択",
"estimate.detail.fileList.extCheck": "そのファイルはイメージファイルではありません",
"estimate.detail.header.fileList2": "添付ファイル一覧",
+ "estimate.detail.fileList2.btn.return": "復元",
"estimate.detail.header.specialEstimate": "見積もりの具体的な",
"estimate.detail.header.specialEstimateProductInfo": "製品情報",
"estimate.detail.sepcialEstimateProductInfo.totAmount": "数量 (PCS)",
diff --git a/src/locales/ko.json b/src/locales/ko.json
index 42bcd69b..ad437c99 100644
--- a/src/locales/ko.json
+++ b/src/locales/ko.json
@@ -851,6 +851,7 @@
"estimate.detail.fileList.btn": "파일선택",
"estimate.detail.fileList.extCheck": "해당 파일은 이미지 파일이 아닙니다",
"estimate.detail.header.fileList2": "첨부파일 목록",
+ "estimate.detail.fileList2.btn.return": "복원",
"estimate.detail.header.specialEstimate": "견적특이사항",
"estimate.detail.header.specialEstimateProductInfo": "제품정보",
"estimate.detail.sepcialEstimateProductInfo.totAmount": "수량 (PCS)",