From 3b72acce817c7dc62d98724b9987fac19d7a80f1 Mon Sep 17 00:00:00 2001 From: "hyojun.choi" Date: Tue, 3 Dec 2024 16:40:35 +0900 Subject: [PATCH 01/35] =?UTF-8?q?=EB=AA=A8=EB=93=88=20=EA=B3=84=EC=82=B0?= =?UTF-8?q?=20=EC=9E=91=EC=97=85=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/module/useModuleBasicSetting.js | 35 ++++++++++++----------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/src/hooks/module/useModuleBasicSetting.js b/src/hooks/module/useModuleBasicSetting.js index 0b3be4d5..21fcb81f 100644 --- a/src/hooks/module/useModuleBasicSetting.js +++ b/src/hooks/module/useModuleBasicSetting.js @@ -932,16 +932,19 @@ export function useModuleBasicSetting() { moduleSetupSurface.set({ modules: setupedModules }) // setModuleIsSetup(moduleSetupArray) }) + console.log(calculateForApi()) } - const calculateForApi = (moduleSetupArray) => { + const calculateForApi = () => { // TODO : 현재는 남쪽기준. 동,서,북 분기처리 필요 const centerPoints = [] - moduleSetupArray.forEach((module, index) => { + const modules = canvas.getObjects().filter((obj) => obj.name === 'module') + + modules.forEach((module, index) => { module.tempIndex = index const { x, y } = module.getCenterPoint() const { width, height } = module - centerPoints.push({ x, y, width, height, index }) + centerPoints.push({ x, y, width: Math.abs(width), height: Math.abs(height), index }) const circle = new fabric.Circle({ radius: 5, fill: 'red', @@ -951,7 +954,7 @@ export function useModuleBasicSetting() { index: index, selectable: false, }) - canvas.add(circle) + // canvas.add(circle) }) //완전 노출 하면 @@ -970,7 +973,7 @@ export function useModuleBasicSetting() { centerPoints.forEach((centerPoint, index) => { const { x, y, width, height } = centerPoint // centerPoints중에 현재 centerPoint와 x값이 같고, y값이 y-height값과 같은 centerPoint가 있는지 확인 - const bottomCell = centerPoints.filter((centerPoint) => centerPoint.x === x && Math.abs(centerPoint.y - (y + height)) < 2) + const bottomCell = centerPoints.filter((centerPoint) => Math.abs(centerPoint.x - x) < 2 && Math.abs(centerPoint.y - (y + height)) < 2) if (bottomCell.length === 1) { touchDimension++ return @@ -1000,7 +1003,7 @@ export function useModuleBasicSetting() { centerPoints.forEach((centerPoint, index) => { const { x, y, width, height } = centerPoint - const topCell = centerPoints.filter((centerPoint) => centerPoint.x === x && Math.abs(centerPoint.y - (y - height)) < 2) + const topCell = centerPoints.filter((centerPoint) => Math.abs(centerPoint.x - x) < 2 && Math.abs(centerPoint.y - (y - height)) < 2) if (topCell.length === 1) { return } @@ -1030,8 +1033,8 @@ export function useModuleBasicSetting() { const points = cells.map((cell) => { return cell.getCenterPoint() })*/ - const groupPoints = groupCoordinates(centerPoints) - + const groupPoints = groupCoordinates(centerPoints, modules[0]) + console.log('groupPoints', groupPoints) groupPoints.forEach((group) => { // 각 그룹에서 y값이 큰 값을 찾는다. // 그리고 그 y값과 같은 값을 가지는 centerPoint를 찾는다. @@ -1051,21 +1054,21 @@ export function useModuleBasicSetting() { } // polygon 내부 cell들의 centerPoint 배열을 그룹화 해서 반환 - const groupCoordinates = (points) => { + const groupCoordinates = (points, moduleExample) => { const groups = [] const visited = new Set() - const width = 100 - const height = 100 - const horizonPadding = 5 // 가로 패딩 - const verticalPadding = 3 // 세로 패딩 + const width = Math.floor(moduleExample.width) + const height = Math.floor(moduleExample.height) + const horizonPadding = 0 // 가로 패딩 + const verticalPadding = 0 // 세로 패딩 function isAdjacent(p1, p2) { const dx = Math.abs(p1.x - p2.x) const dy = Math.abs(p1.y - p2.y) return ( - (dx === width + horizonPadding && dy === 0) || - (dx === 0 && dy === height + verticalPadding) || - (dx === width / 2 + horizonPadding / 2 && dy === height + verticalPadding) + (Math.abs(width + horizonPadding - dx) < 2 && dy < 2) || + (dx < 2 && Math.abs(dy - height + verticalPadding)) < 2 || + (Math.abs(dx - width / 2 + horizonPadding / 2) < 2 && Math.abs(dy - height + verticalPadding) < 2) ) } From e6e600602da0d11fe8a5d2f07707206c2440ad7c Mon Sep 17 00:00:00 2001 From: basssy Date: Tue, 3 Dec 2024 17:43:15 +0900 Subject: [PATCH 02/35] =?UTF-8?q?=EA=B2=AC=EC=A0=81=EC=84=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/estimate/Estimate.jsx | 122 ++++++++++++------ .../estimate/useEstimateController.js | 19 +-- src/locales/ja.json | 1 + src/locales/ko.json | 1 + 4 files changed, 97 insertions(+), 46 deletions(-) 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 (
    -
    - { - setSpecialNoteList((specialNote) => - specialNote.map((temp) => (temp.code === row.code ? { ...temp, check: !temp.check } : temp)), - ) - - settingShowContent(row.code, event) +
    +
    + { + setSpecialNoteList((specialNote) => + specialNote.map((temp) => (temp.code === row.code ? { ...temp, check: !temp.check } : temp)), + ) + }} + /> + +
    + { + settingShowContent(row.code) }} - /> - + > + {row.codeNm} +
    ) @@ -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)", From 75abf8c3922e212d02e5222d100861ec6114a146 Mon Sep 17 00:00:00 2001 From: basssy Date: Tue, 3 Dec 2024 17:44:03 +0900 Subject: [PATCH 03/35] =?UTF-8?q?return=20=EC=A3=BC=EC=84=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/floorPlan/estimate/useEstimateController.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hooks/floorPlan/estimate/useEstimateController.js b/src/hooks/floorPlan/estimate/useEstimateController.js index dfd66960..63f92832 100644 --- a/src/hooks/floorPlan/estimate/useEstimateController.js +++ b/src/hooks/floorPlan/estimate/useEstimateController.js @@ -293,7 +293,7 @@ export const useEstimateController = (planNo) => { // 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) { From 5de9242e08aa1532bed35b44c2c83036dbf20e7c Mon Sep 17 00:00:00 2001 From: yjnoh Date: Tue, 3 Dec 2024 17:54:52 +0900 Subject: [PATCH 04/35] =?UTF-8?q?=EC=B5=9C=EB=8C=80=EB=B0=B0=EC=B9=98=20?= =?UTF-8?q?=EC=9E=91=EC=97=85=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/module/useModuleBasicSetting.js | 74 ++++++++++++++--------- 1 file changed, 46 insertions(+), 28 deletions(-) diff --git a/src/hooks/module/useModuleBasicSetting.js b/src/hooks/module/useModuleBasicSetting.js index 0b3be4d5..979ee7ec 100644 --- a/src/hooks/module/useModuleBasicSetting.js +++ b/src/hooks/module/useModuleBasicSetting.js @@ -4,19 +4,21 @@ import { rectToPolygon, setSurfaceShapePattern } from '@/util/canvas-util' import { roofDisplaySelector } from '@/store/settingAtom' import offsetPolygon from '@/util/qpolygon-utils' import { QPolygon } from '@/components/fabric/QPolygon' -import { QLine } from '@/components/fabric/QLine' import { moduleSetupSurfaceState, moduleIsSetupState } from '@/store/canvasAtom' import { useEvent } from '@/hooks/useEvent' import { POLYGON_TYPE, BATCH_TYPE } from '@/common/common' import * as turf from '@turf/turf' import { v4 as uuidv4 } from 'uuid' +import { useSwal } from '@/hooks/useSwal' export function useModuleBasicSetting() { const canvas = useRecoilValue(canvasState) const roofDisplay = useRecoilValue(roofDisplaySelector) const [moduleSetupSurface, setModuleSetupSurface] = useRecoilState(moduleSetupSurfaceState) - // const [moduleIsSetup, setModuleIsSetup] = useRecoilState(moduleIsSetupState) + const [moduleIsSetup, setModuleIsSetup] = useRecoilState(moduleIsSetupState) const { addTargetMouseEventListener, addCanvasMouseEventListener, initEvent } = useEvent() + const { swalFire } = useSwal() + // const { addTargetMouseEventListener, addCanvasMouseEventListener, initEvent } = useContext(EventContext) let selectedModuleInstSurfaceArray = [] @@ -440,6 +442,7 @@ export function useModuleBasicSetting() { //자동 모듈 설치(그리드 방식) const autoModuleSetup = (placementRef) => { + initEvent() //마우스 이벤트 초기화 const isChidori = placementRef.isChidori.current === 'true' ? true : false const setupLocation = placementRef.setupLocation.current const isMaxSetup = placementRef.isMaxSetup.current === 'true' ? true : false @@ -472,14 +475,20 @@ export function useModuleBasicSetting() { } }) - moduleSetupSurfaces.forEach((obj) => { - if (obj.modules) { - obj.modules.forEach((module) => { - canvas?.remove(module) - }) - obj.modules = [] - } - }) + // console.log('moduleIsSetup', moduleIsSetup) + + // if (moduleIsSetup.length > 0) { + // swalFire({ text: 'alert 아이콘 테스트입니다.', icon: 'error' }) + // } + + // moduleSetupSurfaces.forEach((obj) => { + // if (obj.modules) { + // obj.modules.forEach((module) => { + // canvas?.remove(module) + // }) + // obj.modules = [] + // } + // }) notSelectedTrestlePolygons.forEach((obj) => { if (obj.modules) { @@ -614,20 +623,20 @@ export function useModuleBasicSetting() { if (isMaxSetup) totalWidth = totalWidth * 2 //최대배치시 2배로 늘려서 반씩 검사하기위함 for (let j = 0; j < diffTopEndPoint; j++) { - bottomMargin = j === 0 ? 1 : 0 + bottomMargin = j === 0 ? 1 : 2 for (let i = 0; i <= totalWidth; i++) { - leftMargin = i === 0 ? 1.1 : 0 //숫자가 0이면 0, 1이면 1로 바꾸기 + leftMargin = i === 0 ? 1 : 2 chidoriLength = 0 if (isChidori) { chidoriLength = j % 2 === 0 ? 0 : width / 2 } square = [ - [startColPoint + tempMaxWidth * i - chidoriLength, startPoint.y1 - height * j - bottomMargin], - [startColPoint + tempMaxWidth * i + width - chidoriLength, startPoint.y1 - height * j - bottomMargin], - [startColPoint + tempMaxWidth * i + width - chidoriLength, startPoint.y1 - height * j - height - bottomMargin], - [startColPoint + tempMaxWidth * i - chidoriLength, startPoint.y1 - height * j - height - bottomMargin], - [startColPoint + tempMaxWidth * i - chidoriLength, startPoint.y1 - height * j - bottomMargin], + [startColPoint + tempMaxWidth * i - chidoriLength + leftMargin, startPoint.y1 - height * j - bottomMargin], + [startColPoint + tempMaxWidth * i + width - chidoriLength + leftMargin, startPoint.y1 - height * j - bottomMargin], + [startColPoint + tempMaxWidth * i + width - chidoriLength + leftMargin, startPoint.y1 - height * j - height - bottomMargin], + [startColPoint + tempMaxWidth * i - chidoriLength + leftMargin, startPoint.y1 - height * j - height - bottomMargin], + [startColPoint + tempMaxWidth * i - chidoriLength + leftMargin, startPoint.y1 - height * j - bottomMargin], ] let squarePolygon = turf.polygon([square]) @@ -674,9 +683,9 @@ export function useModuleBasicSetting() { if (isMaxSetup) totalHeight = totalHeight * 2 //최대배치시 2배로 늘려서 반씩 검사 for (let i = 0; i <= totalWidth; i++) { - bottomMargin = i === 0 ? 1 : 0.1 + bottomMargin = i === 0 ? 1 : 2 for (let j = 0; j < totalHeight; j++) { - leftMargin = i === 0 ? 0 : 0.5 * i + leftMargin = i === 0 ? 1 : 2 chidoriLength = 0 if (isChidori) { chidoriLength = i % 2 === 0 ? 0 : height / 2 @@ -746,17 +755,19 @@ export function useModuleBasicSetting() { if (isMaxSetup) diffRightEndPoint = diffRightEndPoint * 2 //최대배치시 2배로 늘려서 반씩 검사하기위함 for (let j = 0; j < diffBottomEndPoint; j++) { + bottomMargin = j === 0 ? 1 : 2 for (let i = 0; i < diffRightEndPoint; i++) { + leftMargin = i === 0 ? 1 : 2 chidoriLength = 0 if (isChidori) { chidoriLength = j % 2 === 0 ? 0 : width / 2 } square = [ - [startColPoint + tempMaxWidth * i + chidoriLength, startPoint.y1 + height * j + 1], - [startColPoint + tempMaxWidth * i + chidoriLength, startPoint.y1 + height * j + height + 1], - [startColPoint + tempMaxWidth * i + width + chidoriLength, startPoint.y1 + height * j + height + 1], - [startColPoint + tempMaxWidth * i + width + chidoriLength, startPoint.y1 + height * j + 1], - [startColPoint + tempMaxWidth * i + chidoriLength, startPoint.y1 + height * j + 1], + [startColPoint + tempMaxWidth * i + chidoriLength + leftMargin, startPoint.y1 + height * j + bottomMargin], + [startColPoint + tempMaxWidth * i + chidoriLength + leftMargin, startPoint.y1 + height * j + height + bottomMargin], + [startColPoint + tempMaxWidth * i + width + chidoriLength + leftMargin, startPoint.y1 + height * j + height + bottomMargin], + [startColPoint + tempMaxWidth * i + width + chidoriLength + leftMargin, startPoint.y1 + height * j + bottomMargin], + [startColPoint + tempMaxWidth * i + chidoriLength + leftMargin, startPoint.y1 + height * j + bottomMargin], ] let squarePolygon = turf.polygon([square]) @@ -804,9 +815,9 @@ export function useModuleBasicSetting() { if (isMaxSetup) totalHeight = totalHeight * 2 //최대배치시 2배로 늘려서 반씩 검사 for (let i = 0; i <= totalWidth; i++) { + bottomMargin = j === 0 ? 1 : 2 for (let j = 0; j < totalHeight; j++) { - bottomMargin = j === 0 ? 0.5 : 0.5 * j - leftMargin = i === 0 ? 0 : 0.5 * i + leftMargin = i === 0 ? 1 : 2 chidoriLength = 0 if (isChidori) { chidoriLength = i % 2 === 0 ? 0 : height / 2 @@ -912,11 +923,12 @@ export function useModuleBasicSetting() { } }) + canvas?.renderAll() + //나간애들 제외하고 설치된 애들로 겹친애들 삭제 하기 setupedModules.forEach((module, index) => { if (isMaxSetup && index > 0) { const isOverlap = turf.booleanOverlap(polygonToTurfPolygon(setupedModules[index - 1]), polygonToTurfPolygon(module)) - //겹치는지 확인 if (isOverlap) { //겹쳐있으면 삭제 @@ -930,7 +942,13 @@ export function useModuleBasicSetting() { }) moduleSetupSurface.set({ modules: setupedModules }) - // setModuleIsSetup(moduleSetupArray) + + // const moduleArray = [...moduleIsSetup] + // moduleArray.push({ + // surfaceId: moduleSetupSurface.surfaceId, + // moduleSetupArray: setupedModules, + // }) + // setModuleIsSetup(moduleArray) }) } From e1eae2ae4547e432ee5e457b8686a57e4e9d2656 Mon Sep 17 00:00:00 2001 From: changkyu choi Date: Tue, 3 Dec 2024 18:31:31 +0900 Subject: [PATCH 05/35] =?UTF-8?q?=EB=B0=B0=EC=B9=98=EB=A9=B4=20=EC=B4=88?= =?UTF-8?q?=EA=B8=B0=EC=84=A4=EC=A0=95=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../placementShape/PlacementShapeSetting.jsx | 103 ++------------- .../modal/placementShape/SizeGuide.jsx | 2 +- src/hooks/option/useCanvasSetting.js | 119 +++++++++++++++++- 3 files changed, 125 insertions(+), 99 deletions(-) diff --git a/src/components/floor-plan/modal/placementShape/PlacementShapeSetting.jsx b/src/components/floor-plan/modal/placementShape/PlacementShapeSetting.jsx index 26d6f1b9..1ce18a85 100644 --- a/src/components/floor-plan/modal/placementShape/PlacementShapeSetting.jsx +++ b/src/components/floor-plan/modal/placementShape/PlacementShapeSetting.jsx @@ -1,113 +1,26 @@ import { useEffect, useState } from 'react' -import { useRecoilState } from 'recoil' - -import { canvasSettingState } from '@/store/canvasAtom' -import { basicSettingState } from '@/store/settingAtom' import { useMessage } from '@/hooks/useMessage' -import { useAxios } from '@/hooks/useAxios' -import { useSwal } from '@/hooks/useSwal' import { usePopup } from '@/hooks/usePopup' import SizeGuide from '@/components/floor-plan/modal/placementShape/SizeGuide' import MaterialGuide from '@/components/floor-plan/modal/placementShape/MaterialGuide' import WithDraggable from '@/components/common/draggable/WithDraggable' +import { useCanvasSetting } from '@/hooks/option/useCanvasSetting' + export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, setShowPlaceShapeModal }) { - const [objectNo, setObjectNo] = useState('test123241008001') // 후에 삭제 필요 const [showSizeGuideModal, setShowSizeGuidModal] = useState(false) const [showMaterialGuideModal, setShowMaterialGuidModal] = useState(false) - const [selectedRoofMaterial, setSelectedRoofMaterial] = useState(1) - const [canvasSetting, setCanvasSetting] = useRecoilState(canvasSettingState) const { closePopup } = usePopup() - const [basicSetting, setBasicSettings] = useRecoilState(basicSettingState) - const { getMessage } = useMessage() - const { get, post } = useAxios() - const { swalFire } = useSwal() + + const { basicSetting, setBasicSettings, fetchBasicSettings, basicSettingSave } = useCanvasSetting() // 데이터를 최초 한 번만 조회 useEffect(() => { - console.log('PlacementShapeSetting useEffect 실행') - - fetchSettings() - }, [objectNo]) - - // PlacementShapeSetting 조회 및 초기화 - const fetchSettings = async () => { - try { - await get({ url: `/api/canvas-management/canvas-basic-settings/by-object/${objectNo}` }).then((res) => { - if (res.length == 0) return - - // 'roofs' 배열을 생성하여 각 항목을 추가 - const roofsRow = res.map((item) => { - return { - roofSizeSet: item.roofSizeSet, - roofAngleSet: item.roofAngleSet, - } - }) - - const roofsArray = res.some((item) => !item.roofSeq) - ? //최초 지붕재 추가 정보의 경우 roofsArray를 초기화 설정 - res.map(() => ({ - roofApply: true, - roofSeq: 1, - roofType: 1, - roofWidth: 200, - roofHeight: 200, - roofHajebichi: 200, - roofGap: 0, - roofLayout: 'parallel', - })) - : res.map((item) => ({ - roofApply: item.roofApply === '' || item.roofApply === false ? false : true, - roofSeq: item.roofSeq, - roofType: item.roofType, - roofWidth: item.roofWidth, - roofHeight: item.roofHeight, - roofHajebichi: item.roofHajebichi, - roofGap: item.roofGap, - roofLayout: item.roofLayout, - })) - console.log('roofsArray ', roofsArray) - // 나머지 데이터와 함께 'roofs' 배열을 patternData에 넣음 - const patternData = { - roofSizeSet: roofsRow[0].roofSizeSet, // 첫 번째 항목의 값을 사용 - roofAngleSet: roofsRow[0].roofAngleSet, // 첫 번째 항목의 값을 사용 - roofs: roofsArray, // 만들어진 roofs 배열 - } - - // 데이터 설정 - setBasicSettings({ ...patternData }) - }) - } catch (error) { - console.error('Data fetching error:', error) - } - - if (!(Object.keys(canvasSetting).length === 0 && canvasSetting.constructor === Object)) { - setBasicSettings({ ...canvasSetting }) - } - } - - const submitCanvasConfig = async () => { - try { - const patternData = { - objectNo, - roofSizeSet: basicSetting.roofSizeSet, - roofAngleSet: basicSetting.roofAngleSet, - roofMaterialsAddList: basicSetting.roofs, - } - - await post({ url: `/api/canvas-management/canvas-basic-settings`, data: patternData }).then((res) => { - swalFire({ text: getMessage(res.returnMessage) }) - }) - - //Recoil 설정 - setCanvasSetting({ ...basicSetting }) - } catch (error) { - swalFire({ text: getMessage(res.returnMessage), icon: 'error' }) - } - } + fetchBasicSettings() + }, []) // Function to update the roofType and corresponding values const handleRoofTypeChange = (index, value) => { @@ -122,7 +35,7 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set roofWidth: 265, roofHeight: 235, roofGap: 455, - hajebichi: 0, + roofHajebichi: 0, } } else if (roofType === 2) { updatedRoofs[index] = { @@ -490,7 +403,7 @@ export default function PlacementShapeSetting({ id, pos = { x: 50, y: 180 }, set
    -
    diff --git a/src/components/floor-plan/modal/placementShape/SizeGuide.jsx b/src/components/floor-plan/modal/placementShape/SizeGuide.jsx index 1f9d2770..fff7dbe8 100644 --- a/src/components/floor-plan/modal/placementShape/SizeGuide.jsx +++ b/src/components/floor-plan/modal/placementShape/SizeGuide.jsx @@ -14,7 +14,7 @@ export default function SizeGuide({ setShowSizeGuidModal }) {
    - + diff --git a/src/hooks/option/useCanvasSetting.js b/src/hooks/option/useCanvasSetting.js index d37ce040..6c73efcc 100644 --- a/src/hooks/option/useCanvasSetting.js +++ b/src/hooks/option/useCanvasSetting.js @@ -1,6 +1,13 @@ import { useCallback, useEffect, useState } from 'react' import { useRecoilState, useRecoilValue, useResetRecoilState, useSetRecoilState } from 'recoil' -import { adsorptionPointModeState, adsorptionRangeState, canvasState, planSizeSettingState, dotLineGridSettingState } from '@/store/canvasAtom' +import { + adsorptionPointModeState, + adsorptionRangeState, + canvasState, + planSizeSettingState, + dotLineGridSettingState, + canvasSettingState, +} from '@/store/canvasAtom' import { globalLocaleStore } from '@/store/localeAtom' import { useMessage } from '@/hooks/useMessage' import { useAxios } from '@/hooks/useAxios' @@ -11,6 +18,7 @@ import { settingModalFirstOptionsState, settingModalSecondOptionsState, settingModalGridOptionsState, + basicSettingState, } from '@/store/settingAtom' import { POLYGON_TYPE } from '@/common/common' import { globalFontAtom } from '@/store/fontAtom' @@ -70,6 +78,9 @@ export function useCanvasSetting() { const [color, setColor] = useColor(gridColor ?? '#FF0000') const [colorTemp, setColorTemp] = useState() + const [canvasSetting, setCanvasSetting] = useRecoilState(canvasSettingState) + const [basicSetting, setBasicSettings] = useRecoilState(basicSettingState) + const SelectOptions = [ { id: 1, name: getMessage('modal.canvas.setting.grid.dot.line.setting.line.origin'), value: 1 }, { id: 2, name: '1/2', value: 1 / 2 }, @@ -112,6 +123,14 @@ export function useCanvasSetting() { console.log('useCanvasSetting 실행1', correntObjectNo) }, []) + // 배치면 초기설정 변경 시 + useEffect(() => { + //console.log('useCanvasSetting canvasSetting 실행', canvasSetting) + if (canvasSetting.flag) { + basicSettingSave() + } + }, [canvasSetting]) + //흡착점 ON/OFF 변경 시 useEffect(() => { //console.log('useCanvasSetting 실행2', adsorptionPointMode.fontFlag, correntObjectNo) @@ -232,6 +251,95 @@ export function useCanvasSetting() { } } + // 기본설정(PlacementShapeSetting) 조회 및 초기화 + const fetchBasicSettings = async () => { + try { + await get({ url: `/api/canvas-management/canvas-basic-settings/by-object/${correntObjectNo}` }).then((res) => { + console.log('fetchBasicSettings res ', res) + if (res.length == 0) return + + // 'roofs' 배열을 생성하여 각 항목을 추가 + const roofsRow = res.map((item) => { + return { + roofSizeSet: item.roofSizeSet, + roofAngleSet: item.roofAngleSet, + } + }) + + const roofsArray = res.some((item) => !item.roofSeq) + ? //최초 지붕재 추가 정보의 경우 roofsArray를 초기화 설정 + res.map(() => ({ + flag: false, + roofApply: true, + roofSeq: 1, + roofType: 1, + roofWidth: 265, + roofHeight: 235, + roofHajebichi: 0, + roofGap: 455, + // roofType: 1, + // roofWidth: 200, + // roofHeight: 200, + // roofHajebichi: 200, + // roofGap: 0, + roofLayout: 'parallel', + })) + : res.map((item) => ({ + flag: false, + roofApply: item.roofApply === '' || item.roofApply === false ? false : true, + roofSeq: item.roofSeq, + roofType: item.roofType, + roofWidth: item.roofWidth, + roofHeight: item.roofHeight, + roofHajebichi: item.roofHajebichi, + roofGap: item.roofGap, + roofLayout: item.roofLayout, + })) + console.log('roofsArray ', roofsArray) + // 나머지 데이터와 함께 'roofs' 배열을 patternData에 넣음 + const patternData = { + roofSizeSet: roofsRow[0].roofSizeSet, // 첫 번째 항목의 값을 사용 + roofAngleSet: roofsRow[0].roofAngleSet, // 첫 번째 항목의 값을 사용 + roofs: roofsArray, // 만들어진 roofs 배열 + } + + //console.error('patternData', patternData) + + // 데이터 설정 + setBasicSettings({ ...patternData }) + }) + } catch (error) { + console.error('Data fetching error:', error) + } + + if (!(Object.keys(canvasSetting).length === 0 && canvasSetting.constructor === Object)) { + setBasicSettings({ ...canvasSetting }) + } + //setCanvasSetting({ ...basicSetting }) + } + + // 기본설정(PlacementShapeSetting) 저장 + const basicSettingSave = async () => { + try { + const patternData = { + objectNo: correntObjectNo, + roofSizeSet: basicSetting.roofSizeSet, + roofAngleSet: basicSetting.roofAngleSet, + roofMaterialsAddList: basicSetting.roofs, + } + + await post({ url: `/api/canvas-management/canvas-basic-settings`, data: patternData }).then((res) => { + swalFire({ text: getMessage(res.returnMessage) }) + }) + + //Recoil 설정 + setCanvasSetting({ ...basicSetting, flag: false }) + } catch (error) { + swalFire({ text: getMessage(res.returnMessage), icon: 'error' }) + } + } + + // CanvasSetting 조회 및 초기화 const fetchSettings = async () => { try { const res = await get({ url: `/api/canvas-management/canvas-settings/by-object/${correntObjectNo}` }) @@ -382,7 +490,7 @@ export function useCanvasSetting() { } } - // 옵션 클릭 후 저장 + // CanvasSetting 옵션 클릭 후 저장 const onClickOption2 = useCallback(async () => { // 서버에 전송할 데이터 const dataToSend = { @@ -592,7 +700,6 @@ export function useCanvasSetting() { adsorptionRange, setAdsorptionRange, fetchSettings, - //onClickOption, frontSettings, globalFont, setGlobalFont, @@ -621,5 +728,11 @@ export function useCanvasSetting() { setGridColor, color, setColor, + canvasSetting, + setCanvasSetting, + basicSetting, + setBasicSettings, + fetchBasicSettings, + basicSettingSave, } } From 921b19b7e63971b83889463fbfb3476d242838b3 Mon Sep 17 00:00:00 2001 From: basssy Date: Wed, 4 Dec 2024 08:50:44 +0900 Subject: [PATCH 06/35] =?UTF-8?q?=EC=B2=A8=EB=B6=80=ED=8C=8C=EC=9D=BC=20?= =?UTF-8?q?=EC=82=AD=EC=A0=9C/=EB=B3=B5=EC=9B=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/estimate/Estimate.jsx | 50 ++++++++++++++++++++-------- 1 file changed, 36 insertions(+), 14 deletions(-) diff --git a/src/components/estimate/Estimate.jsx b/src/components/estimate/Estimate.jsx index ff9e7af2..6c77d183 100644 --- a/src/components/estimate/Estimate.jsx +++ b/src/components/estimate/Estimate.jsx @@ -61,7 +61,7 @@ export default function Estimate({ params }) { const objectRecoil = useRecoilValue(floorPlanObjectState) //견적서 상세데이터 - const { estimateContextState, setEstimateContextState, addItem, handleEstimateFileDownload } = useEstimateController(params.pid) + const { estimateContextState, setEstimateContextState, addItem } = useEstimateController(params.pid) //견적특이사항 List const [specialNoteList, setSpecialNoteList] = useState([]) @@ -120,7 +120,6 @@ export default function Estimate({ params }) { let url = `/api/estimate/special-note-title-list` get({ url: url }).then((res) => { if (isNotEmptyArray(res)) { - //디테일 ATTR001、ATTR002、ATTR003、ATTR007、ATTR009、ATTR010、ATTR015、ATTR019 if (estimateContextState?.estimateOption) { res.map((row) => { let estimateOption = estimateContextState?.estimateOption?.split('、') @@ -226,8 +225,20 @@ export default function Estimate({ params }) { } }, [estimateContextState?.fileList]) + // 삭제누른 첨부파일 복원 + const returnOriginFile = (no) => { + originFiles.map((file) => { + if (file.no === no) { + file.delFlg = '0' + } + }) + + setOriginFiles((prev) => { + return [...prev] + }) + } // 기존첨부파일 삭제 (플래그값 추가?) 저장할때 플래그값에 따라 진짜 삭제 - const deleteOriginFile = (objectNo, no) => { + const deleteOriginFile = (no) => { originFiles.map((file) => { if (file.no === no) { file.delFlg = '1' @@ -235,12 +246,15 @@ export default function Estimate({ params }) { }) // console.log('originFiles::', originFiles) - setOriginFiles(originFiles) - const delParams = { - userId: session.userId, - objectNo: objectNo, - no: no, - } + setOriginFiles((prev) => { + return [...prev] + }) + // setOriginFiles(originFiles) + // const delParams = { + // userId: session.userId, + // objectNo: objectNo, + // no: no, + // } alert(getMessage('estimate.detail.alert.delFile')) // await promisePost({ url: 'api/file/fileDelete', data: delParams }).then((res) => { // if (res.status === 204) { @@ -1139,24 +1153,32 @@ export default function Estimate({ params }) { return (
  • - + 플래그::::::{originFile.delFlg} /// + {originFile.faileName} - {/*
    +
    {originFile.faileName} - -
    */} +
  • ) From 69d11336d57e6ffa8ab6d821fff7b0c9b6292bff Mon Sep 17 00:00:00 2001 From: basssy Date: Wed, 4 Dec 2024 08:52:52 +0900 Subject: [PATCH 07/35] =?UTF-8?q?=ED=99=95=EC=9D=B8=EC=9A=A9=20=EC=86=8C?= =?UTF-8?q?=EC=8A=A4=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/estimate/Estimate.jsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/estimate/Estimate.jsx b/src/components/estimate/Estimate.jsx index 6c77d183..6b257645 100644 --- a/src/components/estimate/Estimate.jsx +++ b/src/components/estimate/Estimate.jsx @@ -1153,7 +1153,6 @@ export default function Estimate({ params }) { return (
  • - 플래그::::::{originFile.delFlg} /// {originFile.faileName} {estimateRecoilState?.docNo !== null && (sessionState.storeId === 'T01' || sessionState.storeLvl === '1') && ( @@ -342,9 +342,13 @@ export default function CanvasMenu(props) { }} > - {getMessage('plan.menu.estimate.copy')} + {getMessage('plan.menu.estimate.copy')} )} +
    )} diff --git a/src/locales/ja.json b/src/locales/ja.json index 8efb602d..1dea67e7 100644 --- a/src/locales/ja.json +++ b/src/locales/ja.json @@ -164,6 +164,7 @@ "plan.menu.estimate.save": "保存", "plan.menu.estimate.reset": "初期化", "plan.menu.estimate.copy": "見積書のコピー", + "plan.menu.estimate.unLock": "ロック解除", "plan.menu.simulation": "発展シミュレーション", "plan.menu.simulation.excel": "Excel", "plan.menu.simulation.pdf": "PDF", diff --git a/src/locales/ko.json b/src/locales/ko.json index ad437c99..b1d7c7da 100644 --- a/src/locales/ko.json +++ b/src/locales/ko.json @@ -168,6 +168,7 @@ "plan.menu.estimate.save": "저장", "plan.menu.estimate.reset": "초기화", "plan.menu.estimate.copy": "견적서 복사", + "plan.menu.estimate.unLock": "잠금 해제", "plan.menu.simulation": "발전 시뮬레이션", "plan.menu.simulation.excel": "Excel", "plan.menu.simulation.pdf": "PDF", From fecae44c9ab78e9d89ac8caa1070753b5ba63d63 Mon Sep 17 00:00:00 2001 From: basssy Date: Wed, 4 Dec 2024 12:36:49 +0900 Subject: [PATCH 10/35] =?UTF-8?q?=EA=B2=AC=EC=A0=81=EC=84=9C=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/estimate/Estimate.jsx | 35 ++++++++++------------------ 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/src/components/estimate/Estimate.jsx b/src/components/estimate/Estimate.jsx index 192a7e8e..534eda0b 100644 --- a/src/components/estimate/Estimate.jsx +++ b/src/components/estimate/Estimate.jsx @@ -245,29 +245,10 @@ export default function Estimate({ params }) { } }) - // console.log('originFiles::', originFiles) setOriginFiles((prev) => { return [...prev] }) - // setOriginFiles(originFiles) - // const delParams = { - // userId: session.userId, - // objectNo: objectNo, - // no: no, - // } alert(getMessage('estimate.detail.alert.delFile')) - // await promisePost({ url: 'api/file/fileDelete', data: delParams }).then((res) => { - // if (res.status === 204) { - // setOriginFiles(originFiles.filter((file) => file.objectNo === objectNo && file.no !== no)) - // setEstimateContextState({ - // fileList: originFiles.filter((file) => file.objectNo === objectNo && file.no !== no), - // originFiles: originFiles.filter((file) => file.objectNo === objectNo && file.no !== no), - // newFileList: originFiles.filter((file) => file.objectNo === objectNo && file.no !== no), - // }) - - // alert(getMessage('plan.message.delete')) - // } - // }) } //가격표시 option 목록 최초세팅 && 주문분류 변경시 @@ -609,7 +590,7 @@ export default function Estimate({ params }) { let updateList = [] let updates = {} get({ url: apiUrl }).then((res) => { - // console.log('아이템디테일::::::::', res) + console.log('아이템디테일::::::::', res) updates.objectNo = objectNo updates.planNo = planNo updates.itemId = res.itemId @@ -631,6 +612,8 @@ export default function Estimate({ params }) { updates.itemGroup = res.itemGroup updates.delFlg = '0' // 삭제플래그 0 updates.saleTotPrice = (res.salePrice * estimateContextState.itemList[index].amount).toString() + //console.log('updates::', updates) + //console.log('estimateContextState.itemList[index].amount::', estimateContextState.itemList[index].amount) // updates.saleTotPrice = '' updates.amount = '' updates.openFlg = res.openFlg @@ -765,7 +748,7 @@ export default function Estimate({ params }) { makeUniqueSpecialNoteCd(itemList) itemList.forEach((item) => { - // console.log('YJOD::::::', item) + console.log('YJOD::::::', item) delete item.showSalePrice delete item.showSaleTotPrice if (item.delFlg === '0') { @@ -794,7 +777,7 @@ export default function Estimate({ params }) { itemList.sort((a, b) => a.dispOrder - b.dispOrder) makeUniqueSpecialNoteCd(itemList) itemList.forEach((item) => { - // console.log('YJSSS::', 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 @@ -1570,7 +1553,13 @@ export default function Estimate({ params }) {
  • From dd92a47b0b51c610979ae3856e5012c0b9da821c Mon Sep 17 00:00:00 2001 From: "hyojun.choi" Date: Wed, 4 Dec 2024 13:59:58 +0900 Subject: [PATCH 11/35] =?UTF-8?q?moduleSetupSurfaces=20=EB=B3=84=20?= =?UTF-8?q?=EA=B3=84=EC=82=B0=20=EC=9E=91=EC=97=85=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/module/useModuleBasicSetting.js | 228 +++++++++++----------- 1 file changed, 118 insertions(+), 110 deletions(-) diff --git a/src/hooks/module/useModuleBasicSetting.js b/src/hooks/module/useModuleBasicSetting.js index 4e5e3534..4a435a11 100644 --- a/src/hooks/module/useModuleBasicSetting.js +++ b/src/hooks/module/useModuleBasicSetting.js @@ -955,120 +955,128 @@ export function useModuleBasicSetting() { const calculateForApi = () => { // TODO : 현재는 남쪽기준. 동,서,북 분기처리 필요 - const centerPoints = [] - const modules = canvas.getObjects().filter((obj) => obj.name === 'module') - modules.forEach((module, index) => { - module.tempIndex = index - const { x, y } = module.getCenterPoint() - const { width, height } = module - centerPoints.push({ x, y, width: Math.abs(width), height: Math.abs(height), index }) - const circle = new fabric.Circle({ - radius: 5, - fill: 'red', - name: 'redCircle', - left: x - 5, - top: y - 5, - index: index, - selectable: false, + const moduleSufaces = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.MODULE_SETUP_SURFACE) + const results = [] + + moduleSufaces.forEach((moduleSurface) => { + const centerPoints = [] + const modules = moduleSurface.modules + + modules.forEach((module, index) => { + module.tempIndex = index + const { x, y } = module.getCenterPoint() + const { width, height } = module + centerPoints.push({ x, y, width: Math.abs(width), height: Math.abs(height), index }) + const circle = new fabric.Circle({ + radius: 5, + fill: 'red', + name: 'redCircle', + left: x - 5, + top: y - 5, + index: index, + selectable: false, + }) + // canvas.add(circle) + }) + + //완전 노출 하면 + let exposedBottom = 0 + // 반 노출 하면 + let exposedHalfBottom = 0 + // 완전 노출 상면 + let exposedTop = 0 + //반 노출 상면 + let exposedHalfTop = 0 + // 완전 접면 + let touchDimension = 0 + //반접면 + let halfTouchDimension = 0 + // 노출하면 체크 + centerPoints.forEach((centerPoint, index) => { + const { x, y, width, height } = centerPoint + // centerPoints중에 현재 centerPoint와 x값이 같고, y값이 y-height값과 같은 centerPoint가 있는지 확인 + const bottomCell = centerPoints.filter((centerPoint) => Math.abs(centerPoint.x - x) < 2 && Math.abs(centerPoint.y - (y + height)) < 2) + if (bottomCell.length === 1) { + touchDimension++ + return + } + + const bottomLeftPoint = { x: x - width / 2, y: y + height } + const bottomRightPoint = { x: x + width / 2, y: y + height } + + // 바로 아래에 셀이 없는 경우 물떼세 배치가 왼쪽 되어있는 셀을 찾는다. + const leftBottomCnt = centerPoints.filter( + (centerPoint) => Math.abs(centerPoint.x - bottomLeftPoint.x) < 2 && Math.abs(centerPoint.y - bottomLeftPoint.y) < 2, + ).length + const rightBottomCnt = centerPoints.filter( + (centerPoint) => Math.abs(centerPoint.x - bottomRightPoint.x) < 2 && Math.abs(centerPoint.y - bottomRightPoint.y) < 2, + ).length + if (leftBottomCnt + rightBottomCnt === 2) { + touchDimension++ + return + } + if (leftBottomCnt + rightBottomCnt === 1) { + halfTouchDimension++ + exposedHalfBottom++ + return + } + }) + // 노출상면 체크 + + centerPoints.forEach((centerPoint, index) => { + const { x, y, width, height } = centerPoint + const topCell = centerPoints.filter((centerPoint) => Math.abs(centerPoint.x - x) < 2 && Math.abs(centerPoint.y - (y - height)) < 2) + if (topCell.length === 1) { + return + } + + const topLeftPoint = { x: x - width / 2, y: y - height } + const topRightPoint = { x: x + width / 2, y: y - height } + + const leftTopCnt = centerPoints.filter( + (centerPoint) => Math.abs(centerPoint.x - topLeftPoint.x) < 2 && Math.abs(centerPoint.y - topRightPoint.y) < 2, + ).length + const rightTopCnt = centerPoints.filter( + (centerPoint) => Math.abs(centerPoint.x - topRightPoint.x) < 2 && Math.abs(centerPoint.y - topRightPoint.y) < 2, + ).length + + if (leftTopCnt + rightTopCnt === 1) { + exposedHalfTop++ + return + } + if (leftTopCnt + rightTopCnt === 0) { + exposedTop++ + return + } + }) + // 완전 노출 하면 계산 + + /*const cells = canvas.getObjects().filter((obj) => polygon.id === obj.parentId) + const points = cells.map((cell) => { + return cell.getCenterPoint() + })*/ + const groupPoints = groupCoordinates(centerPoints, modules[0]) + console.log('groupPoints', groupPoints) + groupPoints.forEach((group) => { + // 각 그룹에서 y값이 큰 값을 찾는다. + // 그리고 그 y값과 같은 값을 가지는 centerPoint를 찾는다. + const maxY = group.reduce((acc, cur) => (acc.y > cur.y ? acc : cur)).y + const maxYCenterPoint = group.filter((centerPoint) => Math.abs(centerPoint.y - maxY) < 2) + exposedBottom += maxYCenterPoint.length + }) + + results.push({ + exposedBottom, + exposedHalfBottom, + exposedTop, + exposedHalfTop, + touchDimension, + halfTouchDimension, }) - // canvas.add(circle) }) - //완전 노출 하면 - let exposedBottom = 0 - // 반 노출 하면 - let exposedHalfBottom = 0 - // 완전 노출 상면 - let exposedTop = 0 - //반 노출 상면 - let exposedHalfTop = 0 - // 완전 접면 - let touchDimension = 0 - //반접면 - let halfTouchDimension = 0 - // 노출하면 체크 - centerPoints.forEach((centerPoint, index) => { - const { x, y, width, height } = centerPoint - // centerPoints중에 현재 centerPoint와 x값이 같고, y값이 y-height값과 같은 centerPoint가 있는지 확인 - const bottomCell = centerPoints.filter((centerPoint) => Math.abs(centerPoint.x - x) < 2 && Math.abs(centerPoint.y - (y + height)) < 2) - if (bottomCell.length === 1) { - touchDimension++ - return - } - - const bottomLeftPoint = { x: x - width / 2, y: y + height } - const bottomRightPoint = { x: x + width / 2, y: y + height } - - // 바로 아래에 셀이 없는 경우 물떼세 배치가 왼쪽 되어있는 셀을 찾는다. - const leftBottomCnt = centerPoints.filter( - (centerPoint) => Math.abs(centerPoint.x - bottomLeftPoint.x) < 2 && Math.abs(centerPoint.y - bottomLeftPoint.y) < 2, - ).length - const rightBottomCnt = centerPoints.filter( - (centerPoint) => Math.abs(centerPoint.x - bottomRightPoint.x) < 2 && Math.abs(centerPoint.y - bottomRightPoint.y) < 2, - ).length - if (leftBottomCnt + rightBottomCnt === 2) { - touchDimension++ - return - } - if (leftBottomCnt + rightBottomCnt === 1) { - halfTouchDimension++ - exposedHalfBottom++ - return - } - }) - // 노출상면 체크 - - centerPoints.forEach((centerPoint, index) => { - const { x, y, width, height } = centerPoint - const topCell = centerPoints.filter((centerPoint) => Math.abs(centerPoint.x - x) < 2 && Math.abs(centerPoint.y - (y - height)) < 2) - if (topCell.length === 1) { - return - } - - const topLeftPoint = { x: x - width / 2, y: y - height } - const topRightPoint = { x: x + width / 2, y: y - height } - - const leftTopCnt = centerPoints.filter( - (centerPoint) => Math.abs(centerPoint.x - topLeftPoint.x) < 2 && Math.abs(centerPoint.y - topRightPoint.y) < 2, - ).length - const rightTopCnt = centerPoints.filter( - (centerPoint) => Math.abs(centerPoint.x - topRightPoint.x) < 2 && Math.abs(centerPoint.y - topRightPoint.y) < 2, - ).length - - if (leftTopCnt + rightTopCnt === 1) { - exposedHalfTop++ - return - } - if (leftTopCnt + rightTopCnt === 0) { - exposedTop++ - return - } - }) - // 완전 노출 하면 계산 - - /*const cells = canvas.getObjects().filter((obj) => polygon.id === obj.parentId) - const points = cells.map((cell) => { - return cell.getCenterPoint() - })*/ - const groupPoints = groupCoordinates(centerPoints, modules[0]) - console.log('groupPoints', groupPoints) - groupPoints.forEach((group) => { - // 각 그룹에서 y값이 큰 값을 찾는다. - // 그리고 그 y값과 같은 값을 가지는 centerPoint를 찾는다. - const maxY = group.reduce((acc, cur) => (acc.y > cur.y ? acc : cur)).y - const maxYCenterPoint = group.filter((centerPoint) => Math.abs(centerPoint.y - maxY) < 2) - exposedBottom += maxYCenterPoint.length - }) - - return { - exposedBottom, - exposedHalfBottom, - exposedTop, - exposedHalfTop, - touchDimension, - halfTouchDimension, - } + return results } // polygon 내부 cell들의 centerPoint 배열을 그룹화 해서 반환 From 7a7a6f4c08c12e9fc597e4880cd6e8e3eaff11ab Mon Sep 17 00:00:00 2001 From: basssy Date: Wed, 4 Dec 2024 14:20:59 +0900 Subject: [PATCH 12/35] =?UTF-8?q?=EA=B2=AC=EC=A0=81=EC=84=9C=20=EC=83=81?= =?UTF-8?q?=EC=84=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/estimate/Estimate.jsx | 44 +++++++------------ .../estimate/useEstimateController.js | 20 ++++----- 2 files changed, 25 insertions(+), 39 deletions(-) diff --git a/src/components/estimate/Estimate.jsx b/src/components/estimate/Estimate.jsx index 534eda0b..65a24def 100644 --- a/src/components/estimate/Estimate.jsx +++ b/src/components/estimate/Estimate.jsx @@ -9,7 +9,7 @@ import SingleDatePicker from '../common/datepicker/SingleDatePicker' import EstimateFileUploader from './EstimateFileUploader' import { useAxios } from '@/hooks/useAxios' import { globalLocaleStore } from '@/store/localeAtom' -import { isNotEmptyArray, isObjectNotEmpty, queryStringFormatter } from '@/util/common-utils' +import { isEmptyArray, isNotEmptyArray, isObjectNotEmpty, queryStringFormatter } from '@/util/common-utils' import dayjs from 'dayjs' import { useCommonCode } from '@/hooks/common/useCommonCode' import { useEstimateController } from '@/hooks/floorPlan/estimate/useEstimateController' @@ -209,11 +209,12 @@ export default function Estimate({ params }) { }, [files]) useEffect(() => { - if (originFiles.length > 0) { - setEstimateContextState({ - originFiles: originFiles, - }) - } + // console.log('USEEFFECT originFiles::::::::::', originFiles) + // if (originFiles.length > 0) { + // setEstimateContextState({ + // originFiles: originFiles, + // }) + // } }, [originFiles]) //상세에서 내려온 첨부파일 set 만들기 @@ -232,10 +233,12 @@ export default function Estimate({ params }) { file.delFlg = '0' } }) - setOriginFiles((prev) => { return [...prev] }) + setEstimateContextState({ + originFiles: originFiles, + }) } // 기존첨부파일 삭제 (플래그값 추가?) 저장할때 플래그값에 따라 진짜 삭제 const deleteOriginFile = (no) => { @@ -248,6 +251,9 @@ export default function Estimate({ params }) { setOriginFiles((prev) => { return [...prev] }) + setEstimateContextState({ + originFiles: originFiles, + }) alert(getMessage('estimate.detail.alert.delFile')) } @@ -427,20 +433,6 @@ export default function Estimate({ params }) { } } } - // 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' }) @@ -590,7 +582,7 @@ export default function Estimate({ params }) { let updateList = [] let updates = {} get({ url: apiUrl }).then((res) => { - console.log('아이템디테일::::::::', res) + // console.log('아이템디테일::::::::', res) updates.objectNo = objectNo updates.planNo = planNo updates.itemId = res.itemId @@ -605,16 +597,12 @@ export default function Estimate({ params }) { updates.pkgMaterialFlg = res.pkgMaterialFlg updates.pnowW = res.pnowW updates.salePrice = res.salePrice - // updates.salePrice = '' updates.specification = res.specification updates.unit = res.unit updates.specialNoteCd = res.spnAttrCds updates.itemGroup = res.itemGroup updates.delFlg = '0' // 삭제플래그 0 updates.saleTotPrice = (res.salePrice * estimateContextState.itemList[index].amount).toString() - //console.log('updates::', updates) - //console.log('estimateContextState.itemList[index].amount::', estimateContextState.itemList[index].amount) - // updates.saleTotPrice = '' updates.amount = '' updates.openFlg = res.openFlg @@ -748,7 +736,7 @@ export default function Estimate({ params }) { makeUniqueSpecialNoteCd(itemList) itemList.forEach((item) => { - console.log('YJOD::::::', item) + // console.log('YJOD::::::', item) delete item.showSalePrice delete item.showSaleTotPrice if (item.delFlg === '0') { @@ -777,7 +765,7 @@ export default function Estimate({ params }) { itemList.sort((a, b) => a.dispOrder - b.dispOrder) makeUniqueSpecialNoteCd(itemList) itemList.forEach((item) => { - console.log('YJSSS::', 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 diff --git a/src/hooks/floorPlan/estimate/useEstimateController.js b/src/hooks/floorPlan/estimate/useEstimateController.js index cde893ed..dea8c9aa 100644 --- a/src/hooks/floorPlan/estimate/useEstimateController.js +++ b/src/hooks/floorPlan/estimate/useEstimateController.js @@ -3,7 +3,7 @@ import { useContext, useEffect, useReducer, useState } from 'react' import { useRecoilState, useRecoilValue } from 'recoil' import { globalLocaleStore } from '@/store/localeAtom' import { estimateState, floorPlanObjectState } from '@/store/floorPlanObjectAtom' -import { isObjectNotEmpty } from '@/util/common-utils' +import { isObjectNotEmpty, isEmptyArray } from '@/util/common-utils' import { SessionContext } from '@/app/SessionProvider' import { useMessage } from '@/hooks/useMessage' import { useRouter } from 'next/navigation' @@ -59,6 +59,7 @@ export const useEstimateController = (planNo) => { item.delFlg = '0' }) } + setEstimateContextState(res.data) } } @@ -155,13 +156,6 @@ export const useEstimateController = (planNo) => { return alert(getMessage('estimate.detail.save.requiredEstimateDate')) } - //첨부파일을 첨부안했는데 - //아이템 fileUploadFlg가1(첨부파일 필수)이 1개라도 있는데 후일 자료 제출(fileFlg) 체크안했으면(0) alert 저장안돼 - // console.log('새로추가첨부파일:::', estimateData.newFileList) - // console.log('기존첨부파일:::', estimateData.originFiles) - - // console.log('estimateData::', estimateData) - //기존에 첨부된 파일이 있으면 파일첨부관련 통과 if (estimateData?.originFiles?.length > 0) { originFileFlg = true @@ -169,8 +163,9 @@ export const useEstimateController = (planNo) => { if (flag) { if (!originFileFlg) { //기존에 첨부된 파일이 없으면 - if (estimateData.newFileList?.length < 1) { - //새로 첨부한 파일이 있으면 + // if (estimateData.newFileList?.length < 1) { + if (isEmptyArray(estimateData.newFileList)) { + //새로 첨부한 파일이 없으면 if (estimateData.itemList.length > 1) { estimateData.itemList.map((row) => { if (row.delFlg === '0') { @@ -244,7 +239,7 @@ export const useEstimateController = (planNo) => { //1. 첨부파일 저장시작 const formData = new FormData() if (estimateData?.newFileList?.length > 0) { - console.log('새로추가한 첨부파일있음:::', estimateData?.newFileList) + // console.log('새로추가한 첨부파일있음:::', estimateData?.newFileList) estimateData.newFileList.forEach((file) => { formData.append('files', file) }) @@ -316,12 +311,15 @@ export const useEstimateController = (planNo) => { } else { estimateData.deleteFileList = [] } + console.log('최종저장::', estimateData) //2. 상세데이터 저장 // return try { await promisePost({ url: `${ESTIMATE_API_ENDPOINT}/save-estimate`, data: estimateData }).then((res) => { if (res.status === 201) { + estimateData.newFileList = [] + estimateData.originFileList = [] alert(getMessage('estimate.detail.save.alertMsg')) //어디로 보낼지 fetchSetting(objectRecoil.floorPlanObjectNo, estimateData.planNo) From 5cb50ae21e1f0a0a610192a301d3a3c5202858ba Mon Sep 17 00:00:00 2001 From: yjnoh Date: Wed, 4 Dec 2024 14:57:46 +0900 Subject: [PATCH 13/35] =?UTF-8?q?=EC=B2=98=EB=A7=88=EB=A9=B4=20=EC=98=A4?= =?UTF-8?q?=EB=A5=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/module/useModuleBasicSetting.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/hooks/module/useModuleBasicSetting.js b/src/hooks/module/useModuleBasicSetting.js index 4e5e3534..126f064a 100644 --- a/src/hooks/module/useModuleBasicSetting.js +++ b/src/hooks/module/useModuleBasicSetting.js @@ -10,6 +10,7 @@ import { POLYGON_TYPE, BATCH_TYPE } from '@/common/common' import * as turf from '@turf/turf' import { v4 as uuidv4 } from 'uuid' import { useSwal } from '@/hooks/useSwal' +import { canvasSettingState } from '@/store/canvasAtom' export function useModuleBasicSetting() { const canvas = useRecoilValue(canvasState) @@ -18,7 +19,7 @@ export function useModuleBasicSetting() { const [moduleIsSetup, setModuleIsSetup] = useRecoilState(moduleIsSetupState) const { addTargetMouseEventListener, addCanvasMouseEventListener, initEvent } = useEvent() const { swalFire } = useSwal() - + const canvasSetting = useRecoilValue(canvasSettingState) // const { addTargetMouseEventListener, addCanvasMouseEventListener, initEvent } = useContext(EventContext) let selectedModuleInstSurfaceArray = [] @@ -64,6 +65,8 @@ export function useModuleBasicSetting() { const surfaceId = uuidv4() + console.log('roof.moduleCompass', roof.moduleCompass) + let setupSurface = new QPolygon(offsetPoints, { stroke: 'red', fill: 'transparent', @@ -815,9 +818,9 @@ export function useModuleBasicSetting() { if (isMaxSetup) totalHeight = totalHeight * 2 //최대배치시 2배로 늘려서 반씩 검사 for (let i = 0; i <= totalWidth; i++) { - bottomMargin = j === 0 ? 1 : 2 + bottomMargin = i === 0 ? 1 : 2 for (let j = 0; j < totalHeight; j++) { - leftMargin = i === 0 ? 1 : 2 + leftMargin = j === 0 ? 1 : 2 chidoriLength = 0 if (isChidori) { chidoriLength = i % 2 === 0 ? 0 : height / 2 @@ -1203,7 +1206,7 @@ export function useModuleBasicSetting() { const angle2 = Math.abs(Math.round(Math.atan(height2 / adjust2) * (180 / Math.PI) * 1000) / 1000) const angle3 = 180 - (angle1 + angle2) - const charlie = 173.3 + 3 // 평행선길이 약간 여유를 줌 + const charlie = 173.3 // 평행선길이 약간 여유를 줌 const alpha = (charlie * Math.sin((angle1 * Math.PI) / 180)) / Math.sin((angle3 * Math.PI) / 180) const beta = Math.sqrt(alpha ** 2 + charlie ** 2 - 2 * alpha * charlie * Math.cos((angle2 * Math.PI) / 180)) const h = beta * Math.sin((angle1 * Math.PI) / 180) // 높이 @@ -1318,7 +1321,7 @@ export function useModuleBasicSetting() { const angle2 = Math.abs(Math.round(Math.atan(adjust2 / height2) * (180 / Math.PI) * 1000) / 1000) const angle3 = 180 - (angle1 + angle2) - const charlie = 173.3 + 3 // 평행선길이 약간 여유를줌 + const charlie = 173.3 // 평행선길이 약간 여유를줌 const alpha = (charlie * Math.sin((angle1 * Math.PI) / 180)) / Math.sin((angle3 * Math.PI) / 180) const beta = Math.sqrt(alpha ** 2 + charlie ** 2 - 2 * alpha * charlie * Math.cos((angle2 * Math.PI) / 180)) @@ -1434,10 +1437,16 @@ export function useModuleBasicSetting() { return obj } + const manualFlatroofModuleSetup = () => {} + + const autoFlatroofModuleSetup = (placementFlatRef) => {} + return { makeModuleInstArea, manualModuleSetup, autoModuleSetup, restoreModuleInstArea, + manualFlatroofModuleSetup, + autoFlatroofModuleSetup, } } From 9699ccbe0305e60d34f18eb4ddd09a1d45cb4a44 Mon Sep 17 00:00:00 2001 From: yjnoh Date: Wed, 4 Dec 2024 14:58:05 +0900 Subject: [PATCH 14/35] =?UTF-8?q?=EC=9C=A1=EC=A7=80=EB=B6=95=20=EC=9E=91?= =?UTF-8?q?=EC=97=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../floor-plan/modal/basic/BasicSetting.jsx | 45 ++++++++++++------- .../floor-plan/modal/basic/step/Placement.jsx | 9 +++- .../modal/basic/step/pitch/PitchPlacement.jsx | 40 +++++++++++++++-- 3 files changed, 73 insertions(+), 21 deletions(-) diff --git a/src/components/floor-plan/modal/basic/BasicSetting.jsx b/src/components/floor-plan/modal/basic/BasicSetting.jsx index af5d9037..c6dee35b 100644 --- a/src/components/floor-plan/modal/basic/BasicSetting.jsx +++ b/src/components/floor-plan/modal/basic/BasicSetting.jsx @@ -20,7 +20,7 @@ export default function BasicSetting({ id, pos = { x: 50, y: 230 } }) { const orientationRef = useRef(null) const { initEvent } = useEvent() // const { initEvent } = useContext(EventContext) - const { makeModuleInstArea, manualModuleSetup, autoModuleSetup } = useModuleBasicSetting() + const { manualModuleSetup, autoModuleSetup, manualFlatroofModuleSetup, autoFlatroofModuleSetup } = useModuleBasicSetting() const handleBtnNextStep = () => { if (tabNum === 1) { orientationRef.current.handleNextStep() @@ -28,20 +28,16 @@ export default function BasicSetting({ id, pos = { x: 50, y: 230 } }) { setTabNum(tabNum + 1) } - useEffect(() => { - makeModuleInstArea() //기붕 모듈설치면 생성 - - return () => { - initEvent() //모듈설치면 선택 이벤트 삭제 - } - }, []) - const placementRef = { isChidori: useRef('false'), setupLocation: useRef('center'), isMaxSetup: useRef('false'), } + const placementFlatRef = { + setupLocation: useRef('south'), + } + return (
    @@ -66,7 +62,9 @@ export default function BasicSetting({ id, pos = { x: 50, y: 230 } }) { {/*배치면 초기설정 - 입력방법: 육지붕*/} {canvasSetting.roofSizeSet && canvasSetting.roofSizeSet == 3 && tabNum === 2 && } - {canvasSetting.roofSizeSet && canvasSetting.roofSizeSet == 3 && tabNum === 3 && } + {canvasSetting.roofSizeSet && canvasSetting.roofSizeSet == 3 && tabNum === 3 && ( + + )}
    {tabNum !== 1 && ( @@ -80,14 +78,29 @@ export default function BasicSetting({ id, pos = { x: 50, y: 230 } }) { Next )} + {tabNum === 3 && ( <> - - + {canvasSetting.roofSizeSet && canvasSetting.roofSizeSet != 3 && ( + <> + + + + )} + {canvasSetting.roofSizeSet && canvasSetting.roofSizeSet === 3 && ( + <> + + + + )} )}
    diff --git a/src/components/floor-plan/modal/basic/step/Placement.jsx b/src/components/floor-plan/modal/basic/step/Placement.jsx index 13c48a08..a087f3dc 100644 --- a/src/components/floor-plan/modal/basic/step/Placement.jsx +++ b/src/components/floor-plan/modal/basic/step/Placement.jsx @@ -1,5 +1,6 @@ +import { forwardRef, useEffect, useState } from 'react' import { useMessage } from '@/hooks/useMessage' -import { forwardRef, useState } from 'react' +import { useModuleBasicSetting } from '@/hooks/module/useModuleBasicSetting' const Placement = forwardRef((props, refs) => { const { getMessage } = useMessage() @@ -7,6 +8,12 @@ const Placement = forwardRef((props, refs) => { const [setupLocation, setSetupLocation] = useState('center') const [isMaxSetup, setIsMaxSetup] = useState('false') + const { makeModuleInstArea } = useModuleBasicSetting() + + useEffect(() => { + makeModuleInstArea() + }, []) + const moduleData = { header: [ { type: 'check', name: '', prop: 'check', width: 70 }, diff --git a/src/components/floor-plan/modal/basic/step/pitch/PitchPlacement.jsx b/src/components/floor-plan/modal/basic/step/pitch/PitchPlacement.jsx index a2dcd556..239e0a82 100644 --- a/src/components/floor-plan/modal/basic/step/pitch/PitchPlacement.jsx +++ b/src/components/floor-plan/modal/basic/step/pitch/PitchPlacement.jsx @@ -1,7 +1,16 @@ +import { forwardRef, useState, useEffect } from 'react' import { useMessage } from '@/hooks/useMessage' +import { useModuleBasicSetting } from '@/hooks/module/useModuleBasicSetting' -export default function PitchPlacement() { +const PitchPlacement = forwardRef((props, refs) => { const { getMessage } = useMessage() + const [setupLocation, setSetupLocation] = useState('south') + const { makeModuleInstArea } = useModuleBasicSetting() + + useEffect(() => { + makeModuleInstArea() + }, []) + const moduleData = { header: [ { type: 'check', name: '', prop: 'check', width: 70 }, @@ -24,6 +33,12 @@ export default function PitchPlacement() { }, ], } + + const handleSetupLocation = (e) => { + setSetupLocation(e.target.value) + refs.setupLocation.current = e.target.value + } + return ( <>
    @@ -88,11 +103,26 @@ export default function PitchPlacement() {
    - +
    - +
    @@ -102,4 +132,6 @@ export default function PitchPlacement() {
    ) -} +}) + +export default PitchPlacement From cb3780844c3fa8fce131330c6fa6e8d4bf06638a Mon Sep 17 00:00:00 2001 From: basssy Date: Wed, 4 Dec 2024 15:14:51 +0900 Subject: [PATCH 15/35] =?UTF-8?q?=EA=B2=AC=EC=A0=81=EC=84=9C=20=EC=B2=A8?= =?UTF-8?q?=EB=B6=80=ED=8C=8C=EC=9D=BC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/estimate/Estimate.jsx | 19 ++++++++++--------- .../estimate/useEstimateController.js | 3 +-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/components/estimate/Estimate.jsx b/src/components/estimate/Estimate.jsx index 65a24def..6dbde060 100644 --- a/src/components/estimate/Estimate.jsx +++ b/src/components/estimate/Estimate.jsx @@ -202,20 +202,21 @@ export default function Estimate({ params }) { files.map((row) => { fileList.push(row.data) setEstimateContextState({ fileList: row.data, newFileList: fileList }) + // setEstimateContextState({ fileList: row.data }) }) } else { - setEstimateContextState({ fileList: [] }) + setEstimateContextState({ fileList: [], newFileList: [] }) } }, [files]) - useEffect(() => { - // console.log('USEEFFECT originFiles::::::::::', originFiles) - // if (originFiles.length > 0) { - // setEstimateContextState({ - // originFiles: originFiles, - // }) - // } - }, [originFiles]) + // useEffect(() => { + // // console.log('USEEFFECT originFiles::::::::::', originFiles) + // // if (originFiles.length > 0) { + // // setEstimateContextState({ + // // originFiles: originFiles, + // // }) + // // } + // }, [originFiles]) //상세에서 내려온 첨부파일 set 만들기 useEffect(() => { diff --git a/src/hooks/floorPlan/estimate/useEstimateController.js b/src/hooks/floorPlan/estimate/useEstimateController.js index dea8c9aa..9ce5808b 100644 --- a/src/hooks/floorPlan/estimate/useEstimateController.js +++ b/src/hooks/floorPlan/estimate/useEstimateController.js @@ -163,7 +163,6 @@ export const useEstimateController = (planNo) => { if (flag) { if (!originFileFlg) { //기존에 첨부된 파일이 없으면 - // if (estimateData.newFileList?.length < 1) { if (isEmptyArray(estimateData.newFileList)) { //새로 첨부한 파일이 없으면 if (estimateData.itemList.length > 1) { @@ -239,7 +238,6 @@ export const useEstimateController = (planNo) => { //1. 첨부파일 저장시작 const formData = new FormData() if (estimateData?.newFileList?.length > 0) { - // console.log('새로추가한 첨부파일있음:::', estimateData?.newFileList) estimateData.newFileList.forEach((file) => { formData.append('files', file) }) @@ -252,6 +250,7 @@ export const useEstimateController = (planNo) => { setFileList(res) }) } else { + setFileList([]) realSave() } } From d68610440ec1c802bd4c6912f577c8473c94aabc Mon Sep 17 00:00:00 2001 From: yoosangwook Date: Wed, 4 Dec 2024 15:52:45 +0900 Subject: [PATCH 16/35] =?UTF-8?q?=E2=80=BC=EF=B8=8Ffix:=20floor-plan=20?= =?UTF-8?q?=ED=95=98=EC=9C=84=20=EB=A0=8C=EB=8D=94=EB=A7=81=EC=8B=9C=20?= =?UTF-8?q?=EC=A1=B0=EA=B1=B4=EB=B6=80=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - floot-plan , estimate, simulator 렌더링 조건 분리 - ManagementProvider 에 리코일 로직 추가 --- src/app/floor-plan/FloorPlanProvider.js | 2 -- src/app/floor-plan/layout.js | 10 +++++++++- src/app/management/ManagementProvider.js | 8 ++++++++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/app/floor-plan/FloorPlanProvider.js b/src/app/floor-plan/FloorPlanProvider.js index ba2a8226..37399ddd 100644 --- a/src/app/floor-plan/FloorPlanProvider.js +++ b/src/app/floor-plan/FloorPlanProvider.js @@ -2,8 +2,6 @@ import { correntObjectNoState } from '@/store/settingAtom' import { notFound, usePathname, useSearchParams } from 'next/navigation' -// import { ErrorBoundary } from 'next/dist/client/components/error-boundary' -// import ServerError from '../error' import { createContext, useReducer, useState } from 'react' import { useSetRecoilState } from 'recoil' diff --git a/src/app/floor-plan/layout.js b/src/app/floor-plan/layout.js index 2a6fb8fd..19c730cf 100644 --- a/src/app/floor-plan/layout.js +++ b/src/app/floor-plan/layout.js @@ -3,15 +3,23 @@ import FloorPlanProvider from './FloorPlanProvider' import FloorPlan from '@/components/floor-plan/FloorPlan' import CanvasLayout from '@/components/floor-plan/CanvasLayout' +import { usePathname } from 'next/navigation' export default function FloorPlanLayout({ children }) { console.log('🚀 ~ FloorPlanLayout ~ FloorPlanLayout:') + const pathname = usePathname() + console.log('🚀 ~ FloorPlanLayout ~ pathname:', pathname) return ( <> - {children} + {pathname.includes('estimate') || pathname.includes('simulator') ? ( +
    {children}
    + ) : ( + {children} + )} + {/* {children} */}
    diff --git a/src/app/management/ManagementProvider.js b/src/app/management/ManagementProvider.js index 197b30c0..f1e3a91b 100644 --- a/src/app/management/ManagementProvider.js +++ b/src/app/management/ManagementProvider.js @@ -1,6 +1,9 @@ 'ues client' import { createContext, useEffect, useState } from 'react' +import { useSearchParams } from 'next/navigation' +import { useSetRecoilState } from 'recoil' +import { correntObjectNoState } from '@/store/settingAtom' export const ManagementContext = createContext({ managementState: {}, @@ -10,6 +13,11 @@ export const ManagementContext = createContext({ const ManagementProvider = ({ children }) => { const [managementState, setManagementState] = useState({}) + const setCurrentObjectNo = useSetRecoilState(correntObjectNoState) + const searchParams = useSearchParams() + const objectNo = searchParams.get('objectNo') + setCurrentObjectNo(objectNo) + useEffect(() => { console.log('🚀 ~ managementState:', managementState) }, [managementState]) From f290491caa12b4e2157365e36f568625b4998866 Mon Sep 17 00:00:00 2001 From: basssy Date: Wed, 4 Dec 2024 16:03:51 +0900 Subject: [PATCH 17/35] =?UTF-8?q?=EA=B2=AC=EC=A0=81=EC=84=9C=20=EC=B2=A8?= =?UTF-8?q?=EB=B6=80=ED=8C=8C=EC=9D=BC..?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/estimate/Estimate.jsx | 7 +++++++ .../floorPlan/estimate/useEstimateController.js | 13 ++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/components/estimate/Estimate.jsx b/src/components/estimate/Estimate.jsx index 6dbde060..94d4d479 100644 --- a/src/components/estimate/Estimate.jsx +++ b/src/components/estimate/Estimate.jsx @@ -224,6 +224,13 @@ export default function Estimate({ params }) { //드래그영역 비워주기 setFiles([]) setOriginFiles(estimateContextState.fileList) + } else { + // setOriginFiles([]) + if (originFiles.length > 0) { + let file + file = originFiles.filter((item) => item.delFlg === '0') + setOriginFiles(file) + } } }, [estimateContextState?.fileList]) diff --git a/src/hooks/floorPlan/estimate/useEstimateController.js b/src/hooks/floorPlan/estimate/useEstimateController.js index 9ce5808b..c5c77253 100644 --- a/src/hooks/floorPlan/estimate/useEstimateController.js +++ b/src/hooks/floorPlan/estimate/useEstimateController.js @@ -3,7 +3,7 @@ import { useContext, useEffect, useReducer, useState } from 'react' import { useRecoilState, useRecoilValue } from 'recoil' import { globalLocaleStore } from '@/store/localeAtom' import { estimateState, floorPlanObjectState } from '@/store/floorPlanObjectAtom' -import { isObjectNotEmpty, isEmptyArray } from '@/util/common-utils' +import { isObjectNotEmpty, isEmptyArray, isNotEmptyArray } from '@/util/common-utils' import { SessionContext } from '@/app/SessionProvider' import { useMessage } from '@/hooks/useMessage' import { useRouter } from 'next/navigation' @@ -158,8 +158,15 @@ export const useEstimateController = (planNo) => { //기존에 첨부된 파일이 있으면 파일첨부관련 통과 if (estimateData?.originFiles?.length > 0) { - originFileFlg = true + let cnt = estimateData.originFiles.filter((file) => file.delFlg === '0').length + + if (cnt == 0) { + originFileFlg = false + } else { + originFileFlg = true + } } + if (flag) { if (!originFileFlg) { //기존에 첨부된 파일이 없으면 @@ -318,7 +325,7 @@ export const useEstimateController = (planNo) => { await promisePost({ url: `${ESTIMATE_API_ENDPOINT}/save-estimate`, data: estimateData }).then((res) => { if (res.status === 201) { estimateData.newFileList = [] - estimateData.originFileList = [] + // estimateData.originFiles = [] alert(getMessage('estimate.detail.save.alertMsg')) //어디로 보낼지 fetchSetting(objectRecoil.floorPlanObjectNo, estimateData.planNo) From fecfa673050622ff0ae8e2f663db59ef58dced2b Mon Sep 17 00:00:00 2001 From: yoosangwook Date: Wed, 4 Dec 2024 17:27:57 +0900 Subject: [PATCH 18/35] =?UTF-8?q?=F0=9F=93=8Cfix:=20objectNo=20=EC=84=B8?= =?UTF-8?q?=ED=8C=85=20=EC=9C=84=EC=B9=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/management/ManagementProvider.js | 8 -------- src/components/estimate/Estimate.jsx | 13 ++++++++++++- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/app/management/ManagementProvider.js b/src/app/management/ManagementProvider.js index f1e3a91b..197b30c0 100644 --- a/src/app/management/ManagementProvider.js +++ b/src/app/management/ManagementProvider.js @@ -1,9 +1,6 @@ 'ues client' import { createContext, useEffect, useState } from 'react' -import { useSearchParams } from 'next/navigation' -import { useSetRecoilState } from 'recoil' -import { correntObjectNoState } from '@/store/settingAtom' export const ManagementContext = createContext({ managementState: {}, @@ -13,11 +10,6 @@ export const ManagementContext = createContext({ const ManagementProvider = ({ children }) => { const [managementState, setManagementState] = useState({}) - const setCurrentObjectNo = useSetRecoilState(correntObjectNoState) - const searchParams = useSearchParams() - const objectNo = searchParams.get('objectNo') - setCurrentObjectNo(objectNo) - useEffect(() => { console.log('🚀 ~ managementState:', managementState) }, [managementState]) diff --git a/src/components/estimate/Estimate.jsx b/src/components/estimate/Estimate.jsx index 94d4d479..4eb74504 100644 --- a/src/components/estimate/Estimate.jsx +++ b/src/components/estimate/Estimate.jsx @@ -1,7 +1,7 @@ 'use client' import { useEffect, useState, useContext } from 'react' -import { useRecoilValue } from 'recoil' +import { useRecoilValue, useSetRecoilState } from 'recoil' import { floorPlanObjectState } from '@/store/floorPlanObjectAtom' import { useMessage } from '@/hooks/useMessage' import { useCanvasMenu } from '@/hooks/common/useCanvasMenu' @@ -18,6 +18,8 @@ import Select, { components } from 'react-select' import { convertNumberToPriceDecimal, convertNumberToPriceDecimalToFixed } from '@/util/common-utils' import ProductFeaturesPop from './popup/ProductFeaturesPop' import { v4 as uuidv4 } from 'uuid' +import { correntObjectNoState } from '@/store/settingAtom' +import { useSearchParams } from 'next/navigation' export default function Estimate({ params }) { const [uniqueData, setUniqueData] = useState([]) @@ -74,6 +76,15 @@ export default function Estimate({ params }) { const { setMenuNumber } = useCanvasMenu() + /** + * objectNo 셋팅 + * url로 넘어온 objectNo을 리코일에 세팅 + */ + const setCurrentObjectNo = useSetRecoilState(correntObjectNoState) + const searchParams = useSearchParams() + const currentObjectNo = searchParams.get('objectNo') + setCurrentObjectNo(currentObjectNo) + //새로 추가한 첨부파일 props const fileUploadProps = { uploadFiles: files, From 4e05a7423de7580b1f757bb014c0f1963c6e5682 Mon Sep 17 00:00:00 2001 From: yoosangwook Date: Wed, 4 Dec 2024 17:53:27 +0900 Subject: [PATCH 19/35] =?UTF-8?q?=F0=9F=93=8Cchore:=20session=20=EC=8A=A4?= =?UTF-8?q?=ED=8E=99=20=EC=9E=84=EC=8B=9C=20=EC=88=98=EC=A0=95=20->=20prod?= =?UTF-8?q?uction=20=EB=AA=A8=EB=93=9C=EC=97=90=EC=84=9C=EB=A7=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lib/session.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/session.js b/src/lib/session.js index ff5a2078..bcedecf4 100644 --- a/src/lib/session.js +++ b/src/lib/session.js @@ -3,8 +3,8 @@ export const defaultSession = {} export const sessionOptions = { password: process.env.SESSION_SECRET, cookieName: 'lama-session', - cookieOptions: { - httpOnly: true, - secure: process.env.NODE_ENV === 'production', - }, + // cookieOptions: { + // httpOnly: true, + // secure: process.env.NODE_ENV === 'production', + // }, } From b1c896c01af3c0e058aa116c46a6f1b1bfe38a04 Mon Sep 17 00:00:00 2001 From: basssy Date: Wed, 4 Dec 2024 18:04:46 +0900 Subject: [PATCH 20/35] =?UTF-8?q?=EA=B2=AC=EC=A0=81=EC=84=9C=20=EC=83=81?= =?UTF-8?q?=EC=84=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/estimate/Estimate.jsx | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/components/estimate/Estimate.jsx b/src/components/estimate/Estimate.jsx index 4eb74504..abc9584d 100644 --- a/src/components/estimate/Estimate.jsx +++ b/src/components/estimate/Estimate.jsx @@ -760,14 +760,20 @@ export default function Estimate({ params }) { delete item.showSaleTotPrice if (item.delFlg === '0') { let amount = Number(item.amount?.replace(/[^0-9]/g, '').replaceAll(',', '')) || 0 - let price = Number(item.saleTotPrice?.replaceAll(',', '')) || 0 + // let price = Number(item.saleTotPrice?.replaceAll(',', '')) || 0 + let price + if (amount === 0) { + price = 0 + } else { + price = Number(item.saleTotPrice?.replaceAll(',', '')) || 0 + } if (item.moduleFlg === '1') { const volKw = (item.pnowW * amount) / 1000 totals.totVolKw += volKw } - totals.totAmount += amount totals.supplyPrice += price + totals.totAmount += amount if (item.openFlg === '1') { item.showSalePrice = '0' @@ -778,6 +784,8 @@ export default function Estimate({ params }) { totals.vatPrice = totals.supplyPrice * 0.1 totals.totPrice = totals.supplyPrice + totals.vatPrice + + // console.log('YJOD:::totlas:::', totals) } const calculateYJSSTotals = (itemList) => { @@ -787,11 +795,17 @@ export default function Estimate({ params }) { // 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 + // let salePrice = Number(item.salePrice?.replaceAll(',', '')) || 0 + let salePrice if (item.moduleFlg === '1') { const volKw = (item.pnowW * amount) / 1000 totals.totVolKw += volKw } + if (amount === 0) { + salePrice = 0 + } else { + salePrice = Number(item.salePrice?.replaceAll(',', '')) || 0 + } totals.totAmount += amount if (item.pkgMaterialFlg === '1') { @@ -812,6 +826,8 @@ export default function Estimate({ params }) { totals.supplyPrice = totals.addSupplyPrice + totals.pkgTotPrice totals.vatPrice = totals.supplyPrice * 0.1 totals.totPrice = totals.supplyPrice + totals.vatPrice + + // console.log('YJOD:::totlas:::', totals) } if (estimateContextState.estimateType === 'YJOD') { From 7c26569b613bb226e71f47ac0679049d7482bb85 Mon Sep 17 00:00:00 2001 From: basssy Date: Wed, 4 Dec 2024 18:21:44 +0900 Subject: [PATCH 21/35] =?UTF-8?q?=EA=B2=AC=EC=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/estimate/Estimate.jsx | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/components/estimate/Estimate.jsx b/src/components/estimate/Estimate.jsx index abc9584d..e416cd50 100644 --- a/src/components/estimate/Estimate.jsx +++ b/src/components/estimate/Estimate.jsx @@ -150,10 +150,10 @@ export default function Estimate({ params }) { //detail과 상관없이 디폴트 체크목록 //ATTR003,ATTR007 if (row.code === 'ATTR003') { - row.check = true + //row.check = true } if (row.code === 'ATTR007') { - row.check = true + //row.check = true } }) @@ -203,7 +203,6 @@ export default function Estimate({ params }) { // 견적특이사항 remark 보여주기 const settingShowContent = (code) => { setShowContentCode(code) - // event.stopPropagation() } // 추가한 첨부파일 estimateContextState에 넣기 @@ -1062,8 +1061,8 @@ export default function Estimate({ params }) { return ( <> -
    -
    +
    +
    @@ -1242,7 +1241,7 @@ export default function Estimate({ params }) { settingShowContent(row.code) }} > - {row.codeNm} + {row.codeNm} / {row.code}
    @@ -1267,6 +1266,8 @@ export default function Estimate({ params }) { } else { let pushData = [] popShowSpecialNoteList.map((item) => { + //console.log('showContentCode::', showContentCode) + //console.log('unique::', uniqueData) let option = showContentCode.split('、') option.map((item2) => { if (item.code === item2) { @@ -1483,7 +1484,8 @@ export default function Estimate({ params }) {
    -
    -
    - -
    +
    +
    +
    - +
    + +
    +
    ) })} @@ -1156,7 +1154,8 @@ export default function Estimate({ params }) {
      {originFiles.map((originFile) => { return ( -
    • +
    • + {/*
    • */}
      0 && specialNoteList.map((row) => { return ( -
      + //
      +
      { + // readOnly + // onClick={(event) => { + onChange={() => { setSpecialNoteList((specialNote) => specialNote.map((temp) => (temp.code === row.code ? { ...temp, check: !temp.check } : temp)), ) @@ -1258,7 +1260,7 @@ export default function Estimate({ params }) { if (isObjectNotEmpty(showcontent)) { return ( -
      +
      {showcontent.codeNm}
      @@ -1266,8 +1268,6 @@ export default function Estimate({ params }) { } else { let pushData = [] popShowSpecialNoteList.map((item) => { - //console.log('showContentCode::', showContentCode) - //console.log('unique::', uniqueData) let option = showContentCode.split('、') option.map((item2) => { if (item.code === item2) { @@ -1275,12 +1275,23 @@ export default function Estimate({ params }) { } }) }) - return pushData.map((item) => ( -
      -
      {item.codeNm}
      -
      -
      - )) + //제품에 있는 특이사항만 보여주기 제품에 특이사항이 없으면 전부 + let filterData = pushData.filter((item) => uniqueData.includes(item.code)) + if (filterData.length > 0) { + return filterData.map((item) => ( +
      +
      {item.codeNm}
      +
      +
      + )) + } else { + return pushData.map((item) => ( +
      +
      {item.codeNm}
      +
      +
      + )) + } } } })} @@ -1367,14 +1378,19 @@ export default function Estimate({ params }) {
      {session?.storeLvl === '1' ? ( ) : ( 0 && showSpecialNoteList.map((row) => { return ( -
      +
      {row.codeNm}
      - {/*
      */}
      ) From 269f7cd09551eb48dbd2e62126d4349743d84c92 Mon Sep 17 00:00:00 2001 From: yoosangwook Date: Thu, 5 Dec 2024 10:27:28 +0900 Subject: [PATCH 23/35] =?UTF-8?q?=F0=9F=93=8Cfix:=20=EB=B0=A9=EC=9C=84?= =?UTF-8?q?=EA=B0=81=20=EA=B3=84=EC=82=B0=EC=8B=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/util/common-utils.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util/common-utils.js b/src/util/common-utils.js index fd8f6ca5..06b96b60 100644 --- a/src/util/common-utils.js +++ b/src/util/common-utils.js @@ -113,7 +113,7 @@ export const calculateFlowDirection = (canvasAngle) => { return { down: -canvasAngle, up: 180 - canvasAngle, - left: 90 - canvasAngle, - right: -90 - canvasAngle, + left: 90 - canvasAngle < 180 ? 90 - canvasAngle : 90 - canvasAngle - 360, + right: -90 - canvasAngle < -180 ? -90 - canvasAngle + 360 : -90 - canvasAngle, } } From 0455bc3a31231f98e9d656b58faf0ba19092b758 Mon Sep 17 00:00:00 2001 From: basssy Date: Thu, 5 Dec 2024 10:47:08 +0900 Subject: [PATCH 24/35] =?UTF-8?q?=EA=B2=AC=EC=A0=81=EC=84=9C=20pkgAsp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/floorPlan/estimate/useEstimateController.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/hooks/floorPlan/estimate/useEstimateController.js b/src/hooks/floorPlan/estimate/useEstimateController.js index c5c77253..28037be5 100644 --- a/src/hooks/floorPlan/estimate/useEstimateController.js +++ b/src/hooks/floorPlan/estimate/useEstimateController.js @@ -318,6 +318,10 @@ export const useEstimateController = (planNo) => { estimateData.deleteFileList = [] } + if (estimateData.estimateType === 'YJSS') { + estimateData.pkgAsp = estimateData.pkgAsp.replaceAll(',', '') + } + console.log('최종저장::', estimateData) //2. 상세데이터 저장 // return From 069b4f2363ce407c266bb5789c178a701ed8cf17 Mon Sep 17 00:00:00 2001 From: basssy Date: Thu, 5 Dec 2024 10:58:08 +0900 Subject: [PATCH 25/35] =?UTF-8?q?=EA=B2=AC=EC=A0=81=EC=84=9C=20=EC=83=81?= =?UTF-8?q?=EC=84=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/estimate/Estimate.jsx | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/components/estimate/Estimate.jsx b/src/components/estimate/Estimate.jsx index 6867ba63..bdca2ea6 100644 --- a/src/components/estimate/Estimate.jsx +++ b/src/components/estimate/Estimate.jsx @@ -516,7 +516,7 @@ export default function Estimate({ params }) { setEstimateContextState({ pkgAsp: pkgAsp, - pkgTotPrice: pkgTotPrice.toFixed(3), + pkgTotPrice: pkgTotPrice.toFixed(2), }) //아이템들 중 조건에 맞는애들 뽑아서 상단 공급가액 부가세 총액 수정 setItemChangeYn(true) @@ -833,20 +833,20 @@ export default function Estimate({ params }) { calculateYJODTotals(estimateContextState.itemList) setEstimateContextState({ totAmount: totals.totAmount, - totVolKw: totals.totVolKw.toFixed(3), - supplyPrice: totals.supplyPrice.toFixed(3), - vatPrice: totals.vatPrice.toFixed(3), - totPrice: totals.totPrice.toFixed(3), + totVolKw: totals.totVolKw.toFixed(2), + supplyPrice: totals.supplyPrice.toFixed(2), + vatPrice: totals.vatPrice.toFixed(2), + totPrice: totals.totPrice.toFixed(2), }) } else if (estimateContextState.estimateType === 'YJSS') { calculateYJSSTotals(estimateContextState.itemList) setEstimateContextState({ pkgTotPrice: totals.pkgTotPrice, totAmount: totals.totAmount, - totVolKw: totals.totVolKw.toFixed(3), - supplyPrice: totals.supplyPrice.toFixed(3), - vatPrice: totals.vatPrice.toFixed(3), - totPrice: totals.totPrice.toFixed(3), + totVolKw: totals.totVolKw.toFixed(2), + supplyPrice: totals.supplyPrice.toFixed(2), + vatPrice: totals.vatPrice.toFixed(2), + totPrice: totals.totPrice.toFixed(2), }) } @@ -1317,7 +1317,7 @@ export default function Estimate({ params }) {
      {getMessage('estimate.detail.sepcialEstimateProductInfo.totVolKw')}
      -
      {convertNumberToPriceDecimalToFixed(estimateContextState?.totVolKw, 3)}
      +
      {convertNumberToPriceDecimalToFixed(estimateContextState?.totVolKw, 2)}
      {getMessage('estimate.detail.sepcialEstimateProductInfo.supplyPrice')}
      @@ -1363,7 +1363,7 @@ export default function Estimate({ params }) {
    - + From 6ad8a0cb8a434084ed09921a34687c152faac524 Mon Sep 17 00:00:00 2001 From: Daseul Kim Date: Thu, 5 Dec 2024 10:59:28 +0900 Subject: [PATCH 26/35] =?UTF-8?q?refactor:=20usePlan=20=EB=82=B4=20api=20?= =?UTF-8?q?=ED=98=B8=EC=B6=9C=20=EA=B4=80=EB=A0=A8=20=ED=95=A8=EC=88=98?= =?UTF-8?q?=EB=93=A4=20await=20=ED=82=A4=EC=9B=8C=EB=93=9C=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/usePlan.js | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/hooks/usePlan.js b/src/hooks/usePlan.js index 7e76cac5..b12468b4 100644 --- a/src/hooks/usePlan.js +++ b/src/hooks/usePlan.js @@ -1,6 +1,6 @@ import { useEffect, useState } from 'react' import { useRecoilState } from 'recoil' -import { v4 as uuidv4, validate as isValidUUID } from 'uuid' +import { v4 as uuidv4 } from 'uuid' import { canvasState, currentCanvasPlanState, plansState, modifiedPlansState, modifiedPlanFlagState } from '@/store/canvasAtom' import { useAxios } from '@/hooks/useAxios' import { useMessage } from '@/hooks/useMessage' @@ -177,7 +177,7 @@ export function usePlan() { * objectNo에 해당하는 canvas 목록을 조회 */ const getCanvasByObjectNo = async (userId, objectNo) => { - return get({ url: `/api/canvas-management/canvas-statuses/by-object/${objectNo}/${userId}` }).then((res) => + return await get({ url: `/api/canvas-management/canvas-statuses/by-object/${objectNo}/${userId}` }).then((res) => res.map((item, index) => ({ id: item.id, userId: item.userId, @@ -234,15 +234,15 @@ export function usePlan() { /** * id에 해당하는 canvas 데이터를 삭제 */ - const delCanvasById = (id) => { - return promiseDel({ url: `/api/canvas-management/canvas-statuses/by-id/${id}` }) + const delCanvasById = async (id) => { + return await promiseDel({ url: `/api/canvas-management/canvas-statuses/by-id/${id}` }) } /** * objectNo에 해당하는 canvas 데이터들을 삭제 */ - const delCanvasByObjectNo = (objectNo) => { - return promiseDel({ url: `/api/canvas-management/canvas-statuses/by-object/${objectNo}` }) + const delCanvasByObjectNo = async (objectNo) => { + return await promiseDel({ url: `/api/canvas-management/canvas-statuses/by-object/${objectNo}` }) } /** @@ -279,19 +279,19 @@ export function usePlan() { * 새로운 plan 생성 * 현재 plan의 데이터가 있을 경우 복제 여부를 확인 */ - const handleAddPlan = (userId, objectNo) => { + const handleAddPlan = async (userId, objectNo) => { JSON.parse(currentCanvasData()).objects.length > 0 ? swalFire({ text: `Plan ${currentCanvasPlan.ordering} ` + getMessage('plan.message.confirm.copy'), type: 'confirm', - confirmFn: () => { - postCanvasStatus(userId, objectNo, currentCanvasData()) + confirmFn: async () => { + await postCanvasStatus(userId, objectNo, currentCanvasData()) }, - denyFn: () => { - postCanvasStatus(userId, objectNo, '') + denyFn: async () => { + await postCanvasStatus(userId, objectNo, '') }, }) - : postCanvasStatus(userId, objectNo, '') + : await postCanvasStatus(userId, objectNo, '') } /** @@ -314,10 +314,10 @@ export function usePlan() { /** * plan 삭제 */ - const handleDeletePlan = (e, id) => { + const handleDeletePlan = async (e, id) => { e.stopPropagation() // 이벤트 버블링 방지 - delCanvasById(id) + await delCanvasById(id) .then((res) => { setPlans((plans) => plans.filter((plan) => plan.id !== id)) setModifiedPlans((modifiedPlans) => modifiedPlans.filter((planId) => planId !== currentCanvasPlan.id)) @@ -340,8 +340,8 @@ export function usePlan() { /** * plan 조회 */ - const loadCanvasPlanData = (userId, objectNo, pid) => { - getCanvasByObjectNo(userId, objectNo).then((res) => { + const loadCanvasPlanData = async (userId, objectNo, pid) => { + await getCanvasByObjectNo(userId, objectNo).then((res) => { // console.log('canvas 목록 ', res) if (res.length > 0) { setPlans(res) From bb116768d37a3992820572ab78dfed03ec9e44f5 Mon Sep 17 00:00:00 2001 From: basssy Date: Thu, 5 Dec 2024 13:51:48 +0900 Subject: [PATCH 27/35] =?UTF-8?q?=EB=AC=BC=EA=B1=B4=EC=83=81=EC=84=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/management/StuffDetail.jsx | 24 +++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/components/management/StuffDetail.jsx b/src/components/management/StuffDetail.jsx index 231ce94c..58ccf7f8 100644 --- a/src/components/management/StuffDetail.jsx +++ b/src/components/management/StuffDetail.jsx @@ -75,7 +75,7 @@ export default function StuffDetail() { installHeight: '', //설치높이 conType: '0', //계약조건(잉여 / 전량) remarks: '', //메모 - tempFlag: 'T', //임시저장(1) 저장(0) + tempFlg: 'T', //임시저장(1) 저장(0) } const { register, setValue, getValues, handleSubmit, resetField, control, watch } = useForm({ defaultValues: formInitValue, @@ -108,7 +108,6 @@ export default function StuffDetail() { const [editMode, setEditMode] = useState('NEW') const { managementState, setManagementState } = useContext(ManagementContext) - const [planGridProps, setPlanGridProps] = useState({ planGridData: [], isPageable: false, @@ -283,6 +282,7 @@ export default function StuffDetail() { {getMessage('stuff.detail.planGrid.btn1')}
    {convertNumberToPriceDecimal( - item?.showSaleTotPrice === '0' ? null : item?.saleTotPrice === '0' ? null : item?.saleTotPrice?.replaceAll(',', ''), + item?.showSaleTotPrice === '0' + ? null + : item?.amount === '' + ? null + : item?.saleTotPrice === '0' + ? null + : item?.saleTotPrice?.replaceAll(',', ''), )}
    {getMessage('estimate.detail.sepcialEstimateProductInfo.pkgWeight')}{convertNumberToPriceDecimalToFixed(estimateContextState?.totVolKw, 3)}{convertNumberToPriceDecimalToFixed(estimateContextState?.totVolKw, 2)} {getMessage('estimate.detail.sepcialEstimateProductInfo.pkgPrice')} {convertNumberToPriceDecimal(estimateContextState?.pkgTotPrice)}
    + 신규
    + 상세
    - 신규 {getMessage('stuff.search.title')}
    - + + {/* */} From fb577316a0d5adaa21b6e70a76f7f02a4302f8ac Mon Sep 17 00:00:00 2001 From: yjnoh Date: Thu, 5 Dec 2024 14:40:14 +0900 Subject: [PATCH 29/35] =?UTF-8?q?=EC=9C=A1=EC=A7=80=EB=B6=95=20=EC=88=98?= =?UTF-8?q?=EB=8F=99=20=EB=AA=A8=EB=93=88=20=EC=84=A4=EC=B9=98=20=EC=9E=91?= =?UTF-8?q?=EC=97=85=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../floor-plan/modal/basic/BasicSetting.jsx | 2 +- .../modal/basic/step/pitch/PitchPlacement.jsx | 45 ++- src/hooks/module/useModuleBasicSetting.js | 334 +++++++++++++++++- 3 files changed, 377 insertions(+), 4 deletions(-) diff --git a/src/components/floor-plan/modal/basic/BasicSetting.jsx b/src/components/floor-plan/modal/basic/BasicSetting.jsx index c6dee35b..ea46bd3b 100644 --- a/src/components/floor-plan/modal/basic/BasicSetting.jsx +++ b/src/components/floor-plan/modal/basic/BasicSetting.jsx @@ -93,7 +93,7 @@ export default function BasicSetting({ id, pos = { x: 50, y: 230 } }) { )} {canvasSetting.roofSizeSet && canvasSetting.roofSizeSet === 3 && ( <> -
    diff --git a/src/components/management/StuffDetail.jsx b/src/components/management/StuffDetail.jsx index 5d37538f..9e83ca92 100644 --- a/src/components/management/StuffDetail.jsx +++ b/src/components/management/StuffDetail.jsx @@ -134,6 +134,7 @@ export default function StuffDetail() { field: 'moduleModel', headerName: getMessage('stuff.detail.planGridHeader.moduleModel'), flex: 1, + wrapText: true, cellStyle: { justifyContent: 'flex-start' /* 좌측정렬*/ }, }, { diff --git a/src/hooks/floorPlan/estimate/useEstimateController.js b/src/hooks/floorPlan/estimate/useEstimateController.js index 28037be5..708471ce 100644 --- a/src/hooks/floorPlan/estimate/useEstimateController.js +++ b/src/hooks/floorPlan/estimate/useEstimateController.js @@ -194,9 +194,8 @@ export const useEstimateController = (planNo) => { estimateData.itemList.map((item) => { if (item.delFlg === '0') { item.amount = item.amount?.replaceAll(',', '') - item.salePrice = parseFloat(item.salePrice?.replaceAll(',', '')).toFixed(2) - item.saleTotPrice = parseFloat(item.saleTotPrice?.replaceAll(',', '')).toFixed(2) - + item.salePrice = Number(item.salePrice?.replaceAll(',', '')).toFixed(2) + item.saleTotPrice = Number(item.saleTotPrice?.replaceAll(',', '')).toFixed(2) if (!item.paDispOrder) { if (itemFlg) { if (isNaN(item.amount)) { @@ -227,7 +226,6 @@ export const useEstimateController = (planNo) => { } } }) - estimateData.itemList = estimateData.itemList.filter((item) => item.delFlg === '0' || !item.addFlg) let delCnt = 0 From 60592f0a59ccc33fa824d703d4b5b4d8159ca47d Mon Sep 17 00:00:00 2001 From: basssy Date: Thu, 5 Dec 2024 16:51:25 +0900 Subject: [PATCH 32/35] =?UTF-8?q?=EA=B2=AC=EC=A0=81=EC=84=9C=20=EC=B2=A8?= =?UTF-8?q?=EB=B6=80=ED=8C=8C=EC=9D=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/estimate/Estimate.jsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/components/estimate/Estimate.jsx b/src/components/estimate/Estimate.jsx index 2a49e5db..b139a851 100644 --- a/src/components/estimate/Estimate.jsx +++ b/src/components/estimate/Estimate.jsx @@ -230,6 +230,9 @@ export default function Estimate({ params }) { if (isEmptyArray(files)) { let file file = originFiles.filter((item) => item.delFlg === '0') + setEstimateContextState({ + originFiles: file, + }) setOriginFiles(file) } } From bdffcc78b6b41308e77d43164036a13b6395685a Mon Sep 17 00:00:00 2001 From: "hyojun.choi" Date: Thu, 5 Dec 2024 18:05:47 +0900 Subject: [PATCH 33/35] =?UTF-8?q?moduleSetupSurfaces=20=EB=B3=84=20?= =?UTF-8?q?=EA=B3=84=EC=82=B0=20=EC=9E=91=EC=97=85=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/module/useModuleBasicSetting.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/hooks/module/useModuleBasicSetting.js b/src/hooks/module/useModuleBasicSetting.js index 31c5ee7f..f51cf00f 100644 --- a/src/hooks/module/useModuleBasicSetting.js +++ b/src/hooks/module/useModuleBasicSetting.js @@ -1080,7 +1080,7 @@ export function useModuleBasicSetting() { } leftTopCnt = centerPoints.filter( - (centerPoint) => Math.abs(centerPoint.x - topLeftPoint.x) < 2 && Math.abs(centerPoint.y - topRightPoint.y) < 2, + (centerPoint) => Math.abs(centerPoint.x - topLeftPoint.x) < 2 && Math.abs(centerPoint.y - topLeftPoint.y) < 2, ).length rightTopCnt = centerPoints.filter( (centerPoint) => Math.abs(centerPoint.x - topRightPoint.x) < 2 && Math.abs(centerPoint.y - topRightPoint.y) < 2, @@ -1098,7 +1098,6 @@ export function useModuleBasicSetting() { } if (leftTopCnt + rightTopCnt === 0) { exposedTop++ - return } }) // 완전 노출 하면 계산 From 96290ea060b4ca7c6a36d1e5491e4452a2ecffe3 Mon Sep 17 00:00:00 2001 From: basssy Date: Fri, 6 Dec 2024 08:46:44 +0900 Subject: [PATCH 34/35] =?UTF-8?q?=EB=AC=BC=EA=B1=B4=20=EC=83=81=EC=84=B8?= =?UTF-8?q?=20=20&=20=EA=B2=AC=EC=A0=81=EC=84=9C=20=EC=83=81=EC=84=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/header/Header.jsx | 4 +++- src/components/main/MainContents.jsx | 4 ++-- src/components/management/StuffDetail.jsx | 6 +++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/components/header/Header.jsx b/src/components/header/Header.jsx index fe3c202d..4776b0ff 100644 --- a/src/components/header/Header.jsx +++ b/src/components/header/Header.jsx @@ -155,7 +155,9 @@ export default function Header(props) { onMouseEnter={(e) => ToggleonMouse(e, 'add', 'li > ul')} onMouseLeave={(e) => ToggleonMouse(e, 'remove', 'li > ul')} > - {getMessage(m.name)} + + {getMessage(m.name)} + ) })} diff --git a/src/components/main/MainContents.jsx b/src/components/main/MainContents.jsx index e45cfd33..3cb668cc 100644 --- a/src/components/main/MainContents.jsx +++ b/src/components/main/MainContents.jsx @@ -128,9 +128,9 @@ export default function MainContents() { className="recently-item" onClick={() => { if (row.tempFlg === '0') { - router.push(`/management/stuff/detail?objectNo=${row.objectNo.toString()}`) + router.push(`/management/stuff/detail?objectNo=${row.objectNo.toString()}`, { scroll: false }) } else { - router.push(`/management/stuff/tempdetail?objectNo=${row.objectNo.toString()}`) + router.push(`/management/stuff/tempdetail?objectNo=${row.objectNo.toString()}`, { scroll: false }) } }} > diff --git a/src/components/management/StuffDetail.jsx b/src/components/management/StuffDetail.jsx index 9e83ca92..190e0754 100644 --- a/src/components/management/StuffDetail.jsx +++ b/src/components/management/StuffDetail.jsx @@ -322,7 +322,7 @@ export default function StuffDetail() { } else { setManagementState({}) alert(getMessage('stuff.detail.header.notExistObjectNo')) - router.push('/management/stuff') + router.push('/management/stuff', { scroll: false }) } if (isNotEmptyArray(res.data.planList)) { setPlanGridProps({ ...planGridProps, planGridData: res.data.planList }) @@ -334,7 +334,7 @@ export default function StuffDetail() { setPlanGridProps({ ...planGridProps, planGridData: [] }) alert(getMessage('stuff.detail.header.notExistObjectNo')) - router.push('/management/stuff') + router.push('/management/stuff', { scroll: false }) } }) } else { @@ -1381,7 +1381,7 @@ export default function StuffDetail() { } else { resetStuffRecoil() } - router.push('/management/stuff') + router.push('/management/stuff', { scroll: false }) }) } } From 706af69fefd6a648c3435650e623eaeb2fc1efca Mon Sep 17 00:00:00 2001 From: basssy Date: Fri, 6 Dec 2024 10:15:28 +0900 Subject: [PATCH 35/35] =?UTF-8?q?=EA=B2=AC=EC=A0=81=EC=84=9C=20=EC=83=81?= =?UTF-8?q?=EC=84=B8=20=EB=B4=84=EC=A0=9C=ED=92=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/estimate/Estimate.jsx | 59 ++++++++++++++++------------ 1 file changed, 33 insertions(+), 26 deletions(-) diff --git a/src/components/estimate/Estimate.jsx b/src/components/estimate/Estimate.jsx index b139a851..88ae05fe 100644 --- a/src/components/estimate/Estimate.jsx +++ b/src/components/estimate/Estimate.jsx @@ -661,12 +661,14 @@ export default function Estimate({ params }) { bomItem.salePrice = '0' bomItem.saleTotPrice = '0' bomItem.unitPrice = '0' + bomItem.showSalePrice = '0' } else { bomItem.dispOrder = (index + 1 + Number(dispOrder)).toString() bomItem.paDispOrder = dispOrder bomItem.salePrice = '0' bomItem.saleTotPrice = '0' bomItem.unitPrice = '0' + bomItem.showSalePrice = '0' } bomItem.delFlg = '0' @@ -748,12 +750,10 @@ export default function Estimate({ params }) { makeUniqueSpecialNoteCd(itemList) itemList.forEach((item) => { - // console.log('YJOD::::::', item) delete item.showSalePrice delete item.showSaleTotPrice if (item.delFlg === '0') { let amount = Number(item.amount?.replace(/[^0-9]/g, '').replaceAll(',', '')) || 0 - // let price = Number(item.saleTotPrice?.replaceAll(',', '')) || 0 let price if (amount === 0) { price = 0 @@ -768,6 +768,10 @@ export default function Estimate({ params }) { totals.supplyPrice += price totals.totAmount += amount + if (item.paDispOrder) { + item.showSalePrice = '0' + item.showSaleTotPrice = '0' + } if (item.openFlg === '1') { item.showSalePrice = '0' item.showSaleTotPrice = '0' @@ -777,8 +781,6 @@ export default function Estimate({ params }) { totals.vatPrice = totals.supplyPrice * 0.1 totals.totPrice = totals.supplyPrice + totals.vatPrice - - // console.log('YJOD:::totlas:::', totals) } const calculateYJSSTotals = (itemList) => { @@ -787,7 +789,6 @@ export default function Estimate({ params }) { itemList.forEach((item) => { if (item.delFlg === '0') { let amount = Number(item.amount?.replace(/[^0-9]/g, '').replaceAll(',', '')) || 0 - // let salePrice = Number(item.salePrice?.replaceAll(',', '')) || 0 let salePrice if (item.moduleFlg === '1') { const volKw = (item.pnowW * amount) / 1000 @@ -810,6 +811,14 @@ export default function Estimate({ params }) { item.showSalePrice = '0' item.showSaleTotPrice = '0' } + } else { + item.showSalePrice = '0' + item.showSaleTotPrice = '0' + } + + if (item.openFlg === '1') { + item.showSalePrice = '0' + item.showSaleTotPrice = '0' } } }) @@ -818,18 +827,15 @@ export default function Estimate({ params }) { totals.supplyPrice = totals.addSupplyPrice + totals.pkgTotPrice totals.vatPrice = totals.supplyPrice * 0.1 totals.totPrice = totals.supplyPrice + totals.vatPrice - - // console.log('YJOD:::totlas:::', totals) } - if (estimateContextState.estimateType === 'YJOD') { calculateYJODTotals(estimateContextState.itemList) setEstimateContextState({ totAmount: totals.totAmount, totVolKw: totals.totVolKw.toFixed(2), - supplyPrice: totals.supplyPrice.toFixed(2), - vatPrice: totals.vatPrice.toFixed(2), - totPrice: totals.totPrice.toFixed(2), + supplyPrice: totals.supplyPrice.toFixed(0), //소수첫자리에서 반올림 + vatPrice: totals.vatPrice.toFixed(0), //소수첫자리에서 반올림 + totPrice: totals.totPrice.toFixed(0), //소수첫자리에서 반올림 }) } else if (estimateContextState.estimateType === 'YJSS') { calculateYJSSTotals(estimateContextState.itemList) @@ -837,9 +843,9 @@ export default function Estimate({ params }) { pkgTotPrice: totals.pkgTotPrice, totAmount: totals.totAmount, totVolKw: totals.totVolKw.toFixed(2), - supplyPrice: totals.supplyPrice.toFixed(2), - vatPrice: totals.vatPrice.toFixed(2), - totPrice: totals.totPrice.toFixed(2), + supplyPrice: totals.supplyPrice.toFixed(0), //소수첫자리에서 반올림 + vatPrice: totals.vatPrice.toFixed(0), //소수첫자리에서 반올림 + totPrice: totals.totPrice.toFixed(0), //소수첫자리에서 반올림 }) } @@ -1312,15 +1318,15 @@ export default function Estimate({ params }) {
    {getMessage('estimate.detail.sepcialEstimateProductInfo.supplyPrice')}
    -
    {convertNumberToPriceDecimal(estimateContextState?.supplyPrice)}
    +
    {convertNumberToPriceDecimalToFixed(estimateContextState?.supplyPrice, 0)}
    {getMessage('estimate.detail.sepcialEstimateProductInfo.vatPrice')}
    -
    {convertNumberToPriceDecimal(estimateContextState?.vatPrice)}
    +
    {convertNumberToPriceDecimalToFixed(estimateContextState?.vatPrice, 0)}
    {getMessage('estimate.detail.sepcialEstimateProductInfo.totPrice')}
    -
    {convertNumberToPriceDecimal(estimateContextState?.totPrice)}
    +
    {convertNumberToPriceDecimalToFixed(estimateContextState?.totPrice, 0)}
    @@ -1491,7 +1497,6 @@ export default function Estimate({ params }) {