From 09de176d16b73679b9d670980fb85a51e5f2f7e3 Mon Sep 17 00:00:00 2001 From: ljpark Date: Mon, 6 Apr 2026 10:15:27 +0900 Subject: [PATCH 1/8] =?UTF-8?q?wr:=20modal=20toast=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/map/LayerPopUp/HasuFacilty/HasuFacility.tsx | 3 +++ .../ui/map/LayerPopUp/HedfFacilty/HtdfFacilty.tsx | 3 +++ .../map/LayerPopUp/RainFacility/RainFacility.tsx | 3 +++ .../ui/map/LayerPopUp/RswtFacilty/RswtFacilty.tsx | 3 +++ .../ui/map/LayerPopUp/RuseFacilty/RuseFacility.tsx | 3 +++ .../chkgd/pbnPrfExcelModal/pbnPrfExcelModal.tsx | 10 ++++++++-- .../ui/modal/coReg/coRegExcel/coRegExcelModal.tsx | 14 +++++++++----- .../ui/modal/fcltReg/bdstRegModal/bdstRegModal.tsx | 8 +++++--- .../fcltReg/fcOrgwtsRegModal/fcOrgwtsRegModal.tsx | 10 ++++++++-- 9 files changed, 45 insertions(+), 12 deletions(-) diff --git a/apps/wr/components/ui/map/LayerPopUp/HasuFacilty/HasuFacility.tsx b/apps/wr/components/ui/map/LayerPopUp/HasuFacilty/HasuFacility.tsx index 067723ccf..beaf26b81 100644 --- a/apps/wr/components/ui/map/LayerPopUp/HasuFacilty/HasuFacility.tsx +++ b/apps/wr/components/ui/map/LayerPopUp/HasuFacilty/HasuFacility.tsx @@ -1,3 +1,6 @@ +/** + * map 시설물 layer > 하수처리시설 modal + */ import { useWrStore } from "@/app/store"; import { btnClass } from "@/app/store/common/code"; import { pbnMapTableSize } from "@/app/store/map/pbnstMap"; diff --git a/apps/wr/components/ui/map/LayerPopUp/HedfFacilty/HtdfFacilty.tsx b/apps/wr/components/ui/map/LayerPopUp/HedfFacilty/HtdfFacilty.tsx index f10574148..86da242d7 100644 --- a/apps/wr/components/ui/map/LayerPopUp/HedfFacilty/HtdfFacilty.tsx +++ b/apps/wr/components/ui/map/LayerPopUp/HedfFacilty/HtdfFacilty.tsx @@ -1,3 +1,6 @@ +/** + * map 시설물 layer > 온배수시설 modal + */ import { useWrStore } from "@/app/store"; import { htdfMapSize } from "@/app/store/map/htdflMap"; import { rainMapSize } from "@/app/store/map/rainMap"; diff --git a/apps/wr/components/ui/map/LayerPopUp/RainFacility/RainFacility.tsx b/apps/wr/components/ui/map/LayerPopUp/RainFacility/RainFacility.tsx index a980712e9..74bf0aa55 100644 --- a/apps/wr/components/ui/map/LayerPopUp/RainFacility/RainFacility.tsx +++ b/apps/wr/components/ui/map/LayerPopUp/RainFacility/RainFacility.tsx @@ -1,3 +1,6 @@ +/** + * map 시설물 layer > 빗물이용시설 modal + */ import { useWrStore } from "@/app/store"; import { rainMapSize } from "@/app/store/map/rainMap"; import type { customRainBdst } from "@/app/store/ruseFcltMng/fcltReg/rainReg"; diff --git a/apps/wr/components/ui/map/LayerPopUp/RswtFacilty/RswtFacilty.tsx b/apps/wr/components/ui/map/LayerPopUp/RswtFacilty/RswtFacilty.tsx index 6cad8f105..4fe818568 100644 --- a/apps/wr/components/ui/map/LayerPopUp/RswtFacilty/RswtFacilty.tsx +++ b/apps/wr/components/ui/map/LayerPopUp/RswtFacilty/RswtFacilty.tsx @@ -1,3 +1,6 @@ +/** + * map 시설물 layer > 중수도시설 modal + */ import { useWrStore } from "@/app/store"; import { rainMapSize } from "@/app/store/map/rainMap"; import type { customRswtBdst } from "@/app/store/ruseFcltMng/fcltReg/rswtReg"; diff --git a/apps/wr/components/ui/map/LayerPopUp/RuseFacilty/RuseFacility.tsx b/apps/wr/components/ui/map/LayerPopUp/RuseFacilty/RuseFacility.tsx index 59a8fcc57..8ed06293b 100644 --- a/apps/wr/components/ui/map/LayerPopUp/RuseFacilty/RuseFacility.tsx +++ b/apps/wr/components/ui/map/LayerPopUp/RuseFacilty/RuseFacility.tsx @@ -1,3 +1,6 @@ +/** + * map 시설물 layer > 하수재이용시설 modal + */ import { useWrStore } from "@/app/store"; import { btnClass } from "@/app/store/common/code"; import { ruseMapSize } from "@/app/store/map/ruseMap"; diff --git a/apps/wr/components/ui/modal/chkgd/pbnPrfExcelModal/pbnPrfExcelModal.tsx b/apps/wr/components/ui/modal/chkgd/pbnPrfExcelModal/pbnPrfExcelModal.tsx index 3881e5813..0857340e3 100644 --- a/apps/wr/components/ui/modal/chkgd/pbnPrfExcelModal/pbnPrfExcelModal.tsx +++ b/apps/wr/components/ui/modal/chkgd/pbnPrfExcelModal/pbnPrfExcelModal.tsx @@ -1,3 +1,6 @@ +/** + * 재이용실적등록> 하수재이용 실적등록 파일등록 modal + */ import { excelToPbnPrfData } from "@/app/store/prfmncReg/pbnstPrfmncReg/excel"; import { pbnPrfRegExcelZod } from "@/app/store/prfmncReg/pbnstPrfmncReg/headList"; import type { @@ -17,8 +20,9 @@ import { Button, Input } from "@common/components/ui"; import { zodResolver } from "@hookform/resolvers/zod"; import { useEffect, useState } from "react"; import { useForm } from "react-hook-form"; -import toast from "react-hot-toast"; +// import toast from "react-hot-toast"; import type { z } from "zod"; +import { useAlertStore } from "@/src/shared/lib"; export default function PbnPrfExcelModal({ data, @@ -29,6 +33,7 @@ export default function PbnPrfExcelModal({ setIsExcelOPen: (open: boolean) => void; setModalExcelData: (excelData: PrfType) => void; }) { + const alert = useAlertStore((state) => state.setMessage); const [file, setFile] = useState(null); const [excelData, setExcelData] = useState(); const form = useForm>({ @@ -65,7 +70,8 @@ export default function PbnPrfExcelModal({ if (file) { const isFile = file; if (form.getValues("ym").length < 1) { - toast.error("파일업로드 이전에 등록년도를 작성해주세요 "); + // toast.error("파일업로드 이전에 등록년도를 작성해주세요 "); + alert("파일업로드 이전에 등록년도를 작성해주세요 "); setFile(null); return; } diff --git a/apps/wr/components/ui/modal/coReg/coRegExcel/coRegExcelModal.tsx b/apps/wr/components/ui/modal/coReg/coRegExcel/coRegExcelModal.tsx index bfc958598..c1bfda0ff 100644 --- a/apps/wr/components/ui/modal/coReg/coRegExcel/coRegExcelModal.tsx +++ b/apps/wr/components/ui/modal/coReg/coRegExcel/coRegExcelModal.tsx @@ -8,9 +8,10 @@ import { Button, Input } from "@common/components/ui"; import { zodResolver } from "@hookform/resolvers/zod"; import { useState } from "react"; import { useForm } from "react-hook-form"; -import toast from "react-hot-toast"; +// import toast from "react-hot-toast"; import type { z } from "zod"; import { useConfirm } from "@frontend-opensource/use-react-hooks"; +import { useAlertStore } from "@/src/shared/lib"; export default function CoRegExcel({ isModal, @@ -18,6 +19,7 @@ export default function CoRegExcel({ isModal: (open: boolean) => void; }) { const { confirm } = useConfirm(); + const alert = useAlertStore((state) => state.setMessage); const { ldrmnt, loadingOpen } = useWrStore((state) => state); const { isLoading } = ldrmnt; const form = useForm>({ @@ -76,11 +78,12 @@ export default function CoRegExcel({ await ldrmntRegData(array); isModal(false); loadingOpen(false); - toast.success(`잠재수요처 등록이 요청되었습니다.`); - } catch (e) { + // toast.success(`잠재수요처 등록이 요청되었습니다.`); + alert("잠재수요처 등록이 요청되었습니다."); + } catch (e: any) { console.log(e); loadingOpen(false); - alert(e); + // alert(e.message); return true; } }) @@ -90,7 +93,8 @@ export default function CoRegExcel({ }); } else { loadingOpen(false); - toast.error(`엑셀 파일을 선택해 주세요.`); + // toast.error(`엑셀 파일을 선택해 주세요.`); + alert("엑셀 파일을 선택해 주세요."); } }; diff --git a/apps/wr/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal.tsx b/apps/wr/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal.tsx index 89584ad3d..236797711 100644 --- a/apps/wr/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal.tsx +++ b/apps/wr/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal.tsx @@ -18,7 +18,8 @@ import { } from "@common/business_components"; import { Button, Input, Label } from "@common/components"; import { useEffect, useState } from "react"; -import toast from "react-hot-toast"; +// import toast from "react-hot-toast"; +import { useAlertStore } from "@/src/shared/lib"; export type objSearchType = { sgg: string | number; @@ -47,7 +48,7 @@ export function BdstReg({ const { code, bdst, auth, findBdst } = useWrStore((state) => { return state; }); - + const alert = useAlertStore((state) => state.setMessage); const { laeSeCd } = auth; const [bdstTable, setBdstTable] = useState(); @@ -73,7 +74,8 @@ export function BdstReg({ findBdst(String(data), searchTxt || "", moType); }else{ - toast.error("시도 또는 시군구를 선택하여 주십시오."); + // toast.error("시도 또는 시군구를 선택하여 주십시오."); + alert("시도 또는 시군구를 선택하여 주십시오."); } }; diff --git a/apps/wr/components/ui/modal/fcltReg/fcOrgwtsRegModal/fcOrgwtsRegModal.tsx b/apps/wr/components/ui/modal/fcltReg/fcOrgwtsRegModal/fcOrgwtsRegModal.tsx index ac79d761a..3be1806f8 100644 --- a/apps/wr/components/ui/modal/fcltReg/fcOrgwtsRegModal/fcOrgwtsRegModal.tsx +++ b/apps/wr/components/ui/modal/fcltReg/fcOrgwtsRegModal/fcOrgwtsRegModal.tsx @@ -1,3 +1,6 @@ +/** + * 재이용시설등록 > 하수재이용시설등록 - 취수하수처리장 추가 modal + */ "use client"; import { useWrStore } from "@/app/store"; import type { @@ -12,7 +15,8 @@ import { Button } from "@common/business_components/ui/table/lib/button"; import { Input } from "@common/components/ui"; import { ArrowLeft, ArrowRight } from "lucide-react"; import { useEffect, useRef, useState } from "react"; -import toast from "react-hot-toast"; +// import toast from "react-hot-toast"; +import { useAlertStore } from "@/src/shared/lib"; export default function FcOrgwtsRegModal({ onRightSet, @@ -23,6 +27,7 @@ export default function FcOrgwtsRegModal({ closeModal?: (val: boolean) => void; initTableData?: any[]; }) { + const alert = useAlertStore((state) => state.setMessage); const { code, pbnst, getSwtrmtFcltNm, searchFclts } = useWrStore( (state) => state ); @@ -53,7 +58,8 @@ export default function FcOrgwtsRegModal({ closeModal?.(false) } else { - toast.error("취수하수처리장 목록을 선택해주세요.") + // toast.error("취수하수처리장 목록을 선택해주세요."); + alert("취수하수처리장 목록을 선택해주세요."); } } From c9378a0048e35cd73db5815788eec925370351ac Mon Sep 17 00:00:00 2001 From: ljpark Date: Mon, 6 Apr 2026 15:02:38 +0900 Subject: [PATCH 2/8] =?UTF-8?q?wr:=20=EA=B3=84=ED=86=B5=EB=8F=84=20?= =?UTF-8?q?=ED=8C=8C=EC=9D=BC=EB=8B=A4=EC=9A=B4=EB=A1=9C=EB=93=9C=EB=AA=85?= =?UTF-8?q?,=201=EA=B1=B4=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruseFcltMng/fcltReg/pbnstReg/index.tsx | 29 +++++++++++++++ .../fcltReg/pbnstReg/mngReg/mngRegForm.tsx | 36 ++++++++++--------- .../src/ui/file-upload/lib/file_upload.tsx | 6 +++- 3 files changed, 53 insertions(+), 18 deletions(-) diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/index.tsx index a616c8041..35458abd5 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/index.tsx @@ -69,6 +69,7 @@ type pubFacActions = { pbnstInsert(pbnstRes: customPbnst): Promise; fileDelete: (atflCd: string) => void; fileDownLoad: (atflCd: string) => void; + fileDownLoadName: (atflCd: string, fileName: string) => void; pbnstRuseFcltUpdate: (ruseRes: customPbnst[]) => void; pbnstRuseBizUpdate: (ruseRes: fcBizType[]) => void; pubHasuSearch: (page: string, sggOrCity: string, searchTxt: string) => void; @@ -297,6 +298,34 @@ export const pubFacActionsExport: (set: any) => pubFacActions = (set: any) => { throw new Error(`Error downloading file: ${error}`); } }, + // 파일다운로드(원본 파일명 지정) : 화면에 보여지는 파일명으로 저장 + fileDownLoadName: async (atflCd: string, fileName: string) => { + try { + const response = await fetch( + `/attach-service/api/v1/atflcd/download/${atflCd}`, + { + method: "GET", + headers: { + accept: "application/octet-stream", + }, + } + ); + if (!response.ok) { + throw new Error(`오류 발생: ${response.status}`); + } + console.log(response); + const blob = await response.blob(); + const blobUrl = window.URL.createObjectURL(blob); + const a = document.createElement("a"); + a.href = blobUrl; + a.download = fileName || "downloaded_file"; + a.click(); + window.URL.revokeObjectURL(blobUrl); + } catch (error) { + console.error("Error downloading file with name:", error); + throw new Error(`Error downloading file with name: ${error}`); + } + }, //원수취수 팝업의 하수처리 시설 리스트 조회 getFcOrgwts: async (fcltPkList: string[], size: number) => { const fcOrgwtsNmList = await postFectch( diff --git a/apps/wr/components/ui/form/fcltReg/pbnstReg/mngReg/mngRegForm.tsx b/apps/wr/components/ui/form/fcltReg/pbnstReg/mngReg/mngRegForm.tsx index eef115a5c..85364f0d1 100644 --- a/apps/wr/components/ui/form/fcltReg/pbnstReg/mngReg/mngRegForm.tsx +++ b/apps/wr/components/ui/form/fcltReg/pbnstReg/mngReg/mngRegForm.tsx @@ -44,7 +44,7 @@ const diagramFileTypes = ".pdf,.jpg,.jpeg,.png,.bmp"; * - with-layout 적용 * - 하수처리시설에 하수재이용 시설 시설 정보를 등록한다. * - form으로 시설정보 및 차수별 정보의 컴포넌트 데이터를 관리한다 - * indexMng: 시설정보 + * indexMng: 재이용시설정보 * indexBiz: 차수별 정보 * 로 하수재이용 시설에 등록된 시설 및 차수별 정보를 관리한다. * */ @@ -61,7 +61,7 @@ export function PbnstMngForm({ setIndexMng: (index: number) => void; readonly: boolean; }) { - const { code, pbnst, fileDelete, fileDownLoad } = useWrStore( + const { code, pbnst, fileDelete, fileDownLoadName } = useWrStore( (state) => state ); const [planFiles, setPlanFiles] = useState(null); @@ -150,10 +150,10 @@ export function PbnstMngForm({ } else { fileList?.forEach((item, index) => { const idx = files?.indexOf(item.file); - if (idx < 0) { - setReFiles.splice(index); - fileDelete(item.atflCd as string); - } + if (idx < 0) { + setReFiles.splice(index, 1); + fileDelete(item.atflCd as string); + } }); } // eslint-disable-next-line @typescript-eslint/no-unused-expressions @@ -183,7 +183,7 @@ export function PbnstMngForm({ useEffect(() => { setRelationFiles([]); setPlanFiles([]); - console.log("indexMng ", indexMng); + // console.log("indexMng ", indexMng); const currentItem = form.getValues(`items.${indexMng}`); const defaultFiles = currentItem?.fcFiles || []; @@ -443,7 +443,7 @@ export function PbnstMngForm({ fileDownLoad(item.atflCd)} + onClick={() => fileDownLoadName(item.atflCd, item.file.name)} > {item.file.name} @@ -462,11 +462,12 @@ export function PbnstMngForm({ }} fileTypes={diagramFileTypes} onFileClick={(index) => { - fileDownLoad( - relationfiles?.find( - (item, fileIndex) => fileIndex === index - )?.atflCd as string + const target = relationfiles?.find( + (item, fileIndex) => fileIndex === index ); + if (target?.atflCd) { + fileDownLoadName(target.atflCd, target.file.name); + } }} > @@ -481,7 +482,7 @@ export function PbnstMngForm({ fileDownLoad(item.atflCd)} + onClick={() => fileDownLoadName(item.atflCd, item.file.name)} > {item.file.name} @@ -500,11 +501,12 @@ export function PbnstMngForm({ }} fileTypes={diagramFileTypes} onFileClick={(index) => { - fileDownLoad( - planFiles?.find( - (item, fileIndex) => fileIndex === index - )?.atflCd as string + const target = planFiles?.find( + (item, fileIndex) => fileIndex === index ); + if (target?.atflCd) { + fileDownLoadName(target.atflCd, target.file.name); + } }} > diff --git a/packages/common/business_components/src/ui/file-upload/lib/file_upload.tsx b/packages/common/business_components/src/ui/file-upload/lib/file_upload.tsx index 030ddda95..ede52a538 100644 --- a/packages/common/business_components/src/ui/file-upload/lib/file_upload.tsx +++ b/packages/common/business_components/src/ui/file-upload/lib/file_upload.tsx @@ -37,6 +37,7 @@ type FileUploaderContextType = { const FileUploaderContext = createContext(null); +//현재 value 배열에서 해당 index만 뺀 newFiles 생성 export const useFileUpload = () => { const context = useContext(FileUploaderContext); if (!context) { @@ -348,13 +349,16 @@ export const FileUploaderItem = forwardRef< {children}