From 7c41008abedd3022828c8595078a061a928234a0 Mon Sep 17 00:00:00 2001 From: basssy Date: Tue, 29 Oct 2024 16:06:59 +0900 Subject: [PATCH] =?UTF-8?q?=EB=AC=BC=EA=B1=B4=ED=98=84=ED=99=A9=20->=20?= =?UTF-8?q?=EA=B2=AC=EC=A0=81=EC=84=9C=20=EB=AC=BC=EA=B1=B4=EB=B2=88?= =?UTF-8?q?=ED=98=B8=20=EB=A6=AC=EC=BD=94=EC=9D=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../floor-plan/estimate/[mid]/[pid]/page.jsx | 7 +- src/components/estimate/Estimate.jsx | 67 +++++++++++++++++-- src/components/management/StuffDetail.jsx | 2 +- src/store/floorPlanObjectAtom.js | 2 +- 4 files changed, 69 insertions(+), 9 deletions(-) diff --git a/src/app/floor-plan/estimate/[mid]/[pid]/page.jsx b/src/app/floor-plan/estimate/[mid]/[pid]/page.jsx index 80eae575..6e793bf5 100644 --- a/src/app/floor-plan/estimate/[mid]/[pid]/page.jsx +++ b/src/app/floor-plan/estimate/[mid]/[pid]/page.jsx @@ -1,9 +1,12 @@ import Estimate from '@/components/estimate/Estimate' -export default function EstimatePage() { +export default function EstimatePage({ params }) { + //floor-plan/estimate/mid/pid + //mid :5 견적탭 + //pid : 넘어온 플랜번호 return ( <> - + ) } diff --git a/src/components/estimate/Estimate.jsx b/src/components/estimate/Estimate.jsx index e1a453fe..af51ea74 100644 --- a/src/components/estimate/Estimate.jsx +++ b/src/components/estimate/Estimate.jsx @@ -1,14 +1,59 @@ 'use client' -import { useEffect, useState } from 'react' +import { useEffect, useState, useRef } from 'react' import { useMessage } from '@/hooks/useMessage' import SingleDatePicker from '../common/datepicker/SingleDatePicker' import { useRecoilValue } from 'recoil' import { floorPlanObjectState } from '@/store/floorPlanObjectAtom' +import { Button } from '@nextui-org/react' +import { sessionStore } from '@/store/commonAtom' -export default function Estimate() { +export default function Estimate({ params }) { + const sessionState = useRecoilValue(sessionStore) const { getMessage } = useMessage() const objectRecoil = useRecoilValue(floorPlanObjectState) - console.log('견적서화면이군요', objectRecoil.floorPlanObjectNo) + const [objectNo, setObjectNo] = useState('') + const fileInputRef = useRef(null) + const [files, setFiles] = useState([]) //첨부파일 + const fileId = useRef(0) + + useEffect(() => { + setObjectNo(objectRecoil.floorPlanObjectNo) + }, [objectRecoil]) + + useEffect(() => { + if (objectNo) { + //Q101X278191023001 + console.log('세션정보::::', sessionState) + //상세API호출 + } + }, [objectNo]) + + const handleButtonClick = () => { + fileInputRef.current.click() + } + + const onChangeFiles = (e) => { + // e.preventDefault() + // e.persist() + // console.log('파일::', e.target.files[0]) + // console.log('파일::', e.target.files) + // let selectFiles = [] + // let tempFiles = files + // selectFiles = e.target.files + // for (const file of selectFiles) { + // tempFiles = [ + // ...tempFiles, + // { + // id: fileId.current++, + // object: file, + // }, + // ] + // } + // setFiles(tempFiles) + // const formData = new FormData() + // formData.append('file', e.target.files[0]) + } + return (
@@ -18,7 +63,9 @@ export default function Estimate() {
{getMessage('estimate.detail.objectNo')}
-
RX524231020006 (Plan No: 1)
+
+ {objectNo} (Plan No: {params.pid}) +
{getMessage('estimate.detail.estimateNo')}
@@ -165,7 +212,17 @@ export default function Estimate() {
- + +

Drag file here

diff --git a/src/components/management/StuffDetail.jsx b/src/components/management/StuffDetail.jsx index ed47ee99..21dc5d17 100644 --- a/src/components/management/StuffDetail.jsx +++ b/src/components/management/StuffDetail.jsx @@ -262,7 +262,7 @@ export default function StuffDetail() { onClick={() => { //mid:5(견적서), /pid:플랜번호 setFloorPlanObjectNo({ floorPlanObjectNo: params.data.objectNo }) - router.push(`/floor-plan/5/${params.data.planNo}`) + router.push(`/floor-plan/estimate/5/${params.data.planNo}`) }} > diff --git a/src/store/floorPlanObjectAtom.js b/src/store/floorPlanObjectAtom.js index 50cdccf4..3acd49a3 100644 --- a/src/store/floorPlanObjectAtom.js +++ b/src/store/floorPlanObjectAtom.js @@ -3,7 +3,7 @@ import { v1 } from 'uuid' export const floorPlanObjectState = atom({ key: `floorPlanObjectState/${v1()}`, default: { - objectNo: '', //물건번호 + floorPlanObjectNo: '', //물건번호 }, dangerouslyAllowMutability: true, })