From b5b907040963227e3c97701fc1768208536c8359 Mon Sep 17 00:00:00 2001 From: Daseul Kim Date: Tue, 3 Dec 2024 16:26:32 +0900 Subject: [PATCH 1/5] =?UTF-8?q?refactor:=20plan=20=EC=83=9D=EC=84=B1=20?= =?UTF-8?q?=EC=8B=9C=20=EB=B9=88=EC=BA=94=EB=B2=84=EC=8A=A4=20=EB=B0=94?= =?UTF-8?q?=EB=A1=9C=20=EC=A0=80=EC=9E=A5=ED=95=98=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit canvas plan 생성 시 빈 캔버스 데이터를 DB에 저장 후 표출되도록 로직 변경 initCanvasPlans 삭제 --- src/app/QcastProvider.js | 2 +- src/components/floor-plan/CanvasLayout.jsx | 10 +- src/components/floor-plan/CanvasMenu.jsx | 10 +- src/hooks/usePlan.js | 127 +++++++-------------- src/locales/ja.json | 1 + src/locales/ko.json | 1 + src/store/canvasAtom.js | 6 - 7 files changed, 52 insertions(+), 105 deletions(-) diff --git a/src/app/QcastProvider.js b/src/app/QcastProvider.js index 23ad5a75..16a62d63 100644 --- a/src/app/QcastProvider.js +++ b/src/app/QcastProvider.js @@ -34,7 +34,7 @@ export const QcastProvider = ({ children }) => { const targetElement = document.getElementById('canvas') if (!targetElement && currentCanvasPlan?.id && planSave) { setPlanSave((prev) => !prev) - checkUnsavedCanvasPlan(currentCanvasPlan.userId) + checkUnsavedCanvasPlan() } else if (targetElement && currentCanvasPlan?.id) { setPlanSave(true) } diff --git a/src/components/floor-plan/CanvasLayout.jsx b/src/components/floor-plan/CanvasLayout.jsx index fcaabb6f..9e48873e 100644 --- a/src/components/floor-plan/CanvasLayout.jsx +++ b/src/components/floor-plan/CanvasLayout.jsx @@ -20,7 +20,7 @@ export default function CanvasLayout({ children }) { const { getMessage } = useMessage() const { swalFire } = useSwal() - const { plans, initCanvasPlans, modifiedPlans, loadCanvasPlanData, handleCurrentPlan, handleAddPlan, handleDeletePlan } = usePlan() + const { plans, modifiedPlans, loadCanvasPlanData, handleCurrentPlan, handleAddPlan, handleDeletePlan } = usePlan() useEffect(() => { loadCanvasPlanData(session.userId, objectNo, pid) @@ -34,10 +34,9 @@ export default function CanvasLayout({ children }) { - +
+ + {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 5/5] =?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) {