From cb3780844c3fa8fce131330c6fa6e8d4bf06638a Mon Sep 17 00:00:00 2001 From: basssy Date: Wed, 4 Dec 2024 15:14:51 +0900 Subject: [PATCH 01/14] =?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 02/14] =?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 03/14] =?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 04/14] =?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 05/14] =?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 06/14] =?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 07/14] =?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 09/14] =?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 10/14] =?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 11/14] =?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 }) {
    {getMessage('estimate.detail.sepcialEstimateProductInfo.pkgWeight')} - {convertNumberToPriceDecimalToFixed(estimateContextState?.totVolKw, 3)} + {convertNumberToPriceDecimalToFixed(estimateContextState?.totVolKw, 2)} {getMessage('estimate.detail.sepcialEstimateProductInfo.pkgPrice')} {convertNumberToPriceDecimal(estimateContextState?.pkgTotPrice)} From 6ad8a0cb8a434084ed09921a34687c152faac524 Mon Sep 17 00:00:00 2001 From: Daseul Kim Date: Thu, 5 Dec 2024 10:59:28 +0900 Subject: [PATCH 12/14] =?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 13/14] =?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')}