This commit is contained in:
Daseul Kim 2025-02-04 18:20:54 +09:00
commit d4d19dbefd
6 changed files with 22 additions and 12 deletions

View File

@ -34,11 +34,11 @@ export default function ImgLoad() {
const handleModal = () => { const handleModal = () => {
setFloorPlanState({ ...floorPlanState, refFileModalOpen: false, toggleRotate: false }) setFloorPlanState({ ...floorPlanState, refFileModalOpen: false, toggleRotate: false })
setCurrentCanvasPlan({ // setCurrentCanvasPlan({
...currentCanvasPlan, // ...currentCanvasPlan,
bgImageName: refImage?.name ?? null, // bgImageName: refImage?.name ?? null,
mapPositionAddress, // mapPositionAddress,
}) // })
} }
useEffect(() => { useEffect(() => {

View File

@ -131,12 +131,16 @@ export function useRefFiles() {
// setCurrentCanvasPlan((prev) => ({ ...prev, bgImageName: currentCanvasPlan.id, mapPositionAddress: queryRef.current.value })) // setCurrentCanvasPlan((prev) => ({ ...prev, bgImageName: currentCanvasPlan.id, mapPositionAddress: queryRef.current.value }))
} }
/**
* 배경 이미지 로드를 위한 세팅
*/
useEffect(() => { useEffect(() => {
if (!currentBgImage) { if (!currentBgImage) {
return return
} }
console.log('🚀 ~ useEffect ~ currentBgImage:', currentBgImage) console.log('🚀 ~ useEffect ~ currentBgImage:', currentBgImage)
handleBackImageLoadToCanvas(`plan-images/${currentCanvasPlan.id}.png`) // handleBackImageLoadToCanvas(`plan-images/${currentCanvasPlan.id}.png`)
handleBackImageLoadToCanvas(currentBgImage)
setCurrentCanvasPlan((prev) => ({ ...prev, bgImageName: refImage?.name ?? null, mapPositionAddress: queryRef.current.value })) setCurrentCanvasPlan((prev) => ({ ...prev, bgImageName: refImage?.name ?? null, mapPositionAddress: queryRef.current.value }))
}, [currentBgImage]) }, [currentBgImage])
@ -147,15 +151,15 @@ export function useRefFiles() {
const handleUploadImageRefFile = async (file) => { const handleUploadImageRefFile = async (file) => {
const formData = new FormData() const formData = new FormData()
formData.append('file', file) formData.append('file', file)
formData.append('fileName', currentCanvasPlan.id) // formData.append('fileName', currentCanvasPlan.id)
// const res = await post({ url: `${process.env.NEXT_PUBLIC_API_SERVER_PATH}/api/image-upload`, data: formData }) // const res = await post({ url: `${process.env.NEXT_PUBLIC_API_SERVER_PATH}/api/image-upload`, data: formData })
const res = await post({ url: `http://localhost:3000/api/image-upload`, data: formData }) const res = await post({ url: `${process.env.NEXT_PUBLIC_HOST_URL}/image/upload`, data: formData })
console.log('🚀 ~ handleUploadImageRefFile ~ res:', res) console.log('🚀 ~ handleUploadImageRefFile ~ res:', res)
const image = await readImage(res.fileNm) // const image = await readImage(res.filePath)
console.log('🚀 ~ handleUploadImageRefFile ~ file:', image) // console.log('🚀 ~ handleUploadImageRefFile ~ file:', image)
setCurrentBgImage(image) setCurrentBgImage(`${process.env.NEXT_PUBLIC_HOST_URL}${res.filePath}`)
setRefImage(file) setRefImage(file)
} }

View File

@ -394,6 +394,7 @@ export function usePlan(params = {}) {
canvas, canvas,
plans, plans,
currentCanvasPlan, currentCanvasPlan,
setCurrentCanvasPlan,
selectedPlan, selectedPlan,
saveCanvas, saveCanvas,
handleCurrentPlan, handleCurrentPlan,

View File

@ -72,7 +72,8 @@ const writeImage = async (fileName, file) => {
} }
const readImage = async (fileName) => { const readImage = async (fileName) => {
const file = await fs.readFile(`${FILE_PATH}/${fileName}`) // const file = await fs.readFile(`${FILE_PATH}/${fileName}`)
const file = await fs.readFile(`${process.env.NEXT_PUBLIC_HOST_URL}${fileName}`)
// .then((res) => { // .then((res) => {
// console.log('readImage-then', res) // console.log('readImage-then', res)
// }) // })

View File

@ -877,6 +877,7 @@
"estimate.detail.roofCns": "屋根材・仕様施工", "estimate.detail.roofCns": "屋根材・仕様施工",
"estimate.detail.remarks": "備考", "estimate.detail.remarks": "備考",
"estimate.detail.fileFlg": "後日資料提出", "estimate.detail.fileFlg": "後日資料提出",
"estimate.detail.dragFileGuide": "(※北面設置の場合、ファイル添付が必須です.)",
"estimate.detail.header.fileList1": "ファイル添付", "estimate.detail.header.fileList1": "ファイル添付",
"estimate.detail.fileList.btn": "ファイル選択", "estimate.detail.fileList.btn": "ファイル選択",
"estimate.detail.fileList.extCheck": "画像ファイルのみ添付可能です。", "estimate.detail.fileList.extCheck": "画像ファイルのみ添付可能です。",
@ -942,6 +943,7 @@
"estimate.detail.save.alertMsg": "保存されました。見積書で製品を変更すると、図面や回路には反映されません。", "estimate.detail.save.alertMsg": "保存されました。見積書で製品を変更すると、図面や回路には反映されません。",
"estimate.detail.copy.alertMsg": "コピーされました。", "estimate.detail.copy.alertMsg": "コピーされました。",
"estimate.detail.save.requiredFileUpload": "ファイル添付が必須のアイテムがあります。ファイルを添付するか、後日添付をチェックしてください。", "estimate.detail.save.requiredFileUpload": "ファイル添付が必須のアイテムがあります。ファイルを添付するか、後日添付をチェックしてください。",
"estimate.detail.save.requiredNorthArrangementFileUpload": "北面にモジュールを配置した場合、北面配置許可書を必ず添付する必要があります.",
"estimate.detail.save.requiredItem": "製品は1つ以上登録する必要があります。", "estimate.detail.save.requiredItem": "製品は1つ以上登録する必要があります。",
"estimate.detail.save.requiredCharger": "担当者は必須です。", "estimate.detail.save.requiredCharger": "担当者は必須です。",
"estimate.detail.save.requiredObjectName": "案件名は必須です。", "estimate.detail.save.requiredObjectName": "案件名は必須です。",

View File

@ -877,6 +877,7 @@
"estimate.detail.roofCns": "지붕재・사양시공", "estimate.detail.roofCns": "지붕재・사양시공",
"estimate.detail.remarks": "비고", "estimate.detail.remarks": "비고",
"estimate.detail.fileFlg": "후일자료제출", "estimate.detail.fileFlg": "후일자료제출",
"estimate.detail.dragFileGuide": "(※ 북면설치인 경우, 파일 첨부가 필수입니다.)",
"estimate.detail.header.fileList1": "파일첨부", "estimate.detail.header.fileList1": "파일첨부",
"estimate.detail.fileList.btn": "파일선택", "estimate.detail.fileList.btn": "파일선택",
"estimate.detail.fileList.extCheck": "이미지 파일만 첨부 가능합니다.", "estimate.detail.fileList.extCheck": "이미지 파일만 첨부 가능합니다.",
@ -942,6 +943,7 @@
"estimate.detail.save.alertMsg": "저장되었습니다. 견적서에서 제품을 변경할 경우 도면 및 회로에 반영되지 않습니다.", "estimate.detail.save.alertMsg": "저장되었습니다. 견적서에서 제품을 변경할 경우 도면 및 회로에 반영되지 않습니다.",
"estimate.detail.copy.alertMsg": "복사되었습니다.", "estimate.detail.copy.alertMsg": "복사되었습니다.",
"estimate.detail.save.requiredFileUpload": "파일첨부가 필수인 아이템이 있습니다. 파일을 첨부하거나 후일첨부를 체크해주십시오.", "estimate.detail.save.requiredFileUpload": "파일첨부가 필수인 아이템이 있습니다. 파일을 첨부하거나 후일첨부를 체크해주십시오.",
"estimate.detail.save.requiredNorthArrangementFileUpload": "북면에 모듈을 배치한 경우, 북면배치허가서를 반드시 첨부해야 합니다.",
"estimate.detail.save.requiredItem": "제품은 1개이상 등록해야 됩니다.", "estimate.detail.save.requiredItem": "제품은 1개이상 등록해야 됩니다.",
"estimate.detail.save.requiredCharger": "담당자는 필수값 입니다.", "estimate.detail.save.requiredCharger": "담당자는 필수값 입니다.",
"estimate.detail.save.requiredObjectName": "안건명은 필수값 입니다.", "estimate.detail.save.requiredObjectName": "안건명은 필수값 입니다.",