From 964268090982029689bbfff50e656a878aaff447 Mon Sep 17 00:00:00 2001 From: ljpark Date: Fri, 20 Mar 2026 14:47:21 +0900 Subject: [PATCH] =?UTF-8?q?wr:=20=EC=9E=A0=EC=9E=AC=EC=88=98=EC=9A=94?= =?UTF-8?q?=EC=B2=98=20=EC=B6=94=EA=B0=80=EB=93=B1=EB=A1=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/store/matDmd/ldrmntCoSttn/index.tsx | 12 +++-- .../coReg/coRegExcel/coRegExcelModal.tsx | 48 +++++++++++++++---- 2 files changed, 47 insertions(+), 13 deletions(-) diff --git a/apps/wr/app/store/matDmd/ldrmntCoSttn/index.tsx b/apps/wr/app/store/matDmd/ldrmntCoSttn/index.tsx index 8de791c89..45c6c5773 100644 --- a/apps/wr/app/store/matDmd/ldrmntCoSttn/index.tsx +++ b/apps/wr/app/store/matDmd/ldrmntCoSttn/index.tsx @@ -114,10 +114,11 @@ export const ldrmntActionsExport: (set: any) => ldrmntActions = ( }); }, ldrmntRegData: async (data) => { - await deleteFectch( - `/reuseFc/request/temp`, - ); - console.log("deleteFectch", deleteFectch) + // 잠재수요처 - 삭제 주석 처리 + // await deleteFectch( + // `/reuseFc/request/temp`, + // ); + // console.log("deleteFectch", deleteFectch) const response = await postFectch( "/reuseFc/request/temp", @@ -125,7 +126,8 @@ export const ldrmntActionsExport: (set: any) => ldrmntActions = ( fetchType.WR ); - console.log('response ', response) + console.log('response ', response); + return response; }, ldrmntSearch: async (isExcel: boolean, page: number, total: string, sggCd: string, coNm: string) => { diff --git a/apps/wr/components/ui/modal/coReg/coRegExcel/coRegExcelModal.tsx b/apps/wr/components/ui/modal/coReg/coRegExcel/coRegExcelModal.tsx index 1e51fb11c..bc625ec78 100644 --- a/apps/wr/components/ui/modal/coReg/coRegExcel/coRegExcelModal.tsx +++ b/apps/wr/components/ui/modal/coReg/coRegExcel/coRegExcelModal.tsx @@ -10,18 +10,20 @@ import { useState } from "react"; import { useForm } from "react-hook-form"; import toast from "react-hot-toast"; import type { z } from "zod"; +import { useConfirm } from "@frontend-opensource/use-react-hooks"; export default function CoRegExcel({ isModal, }: { isModal: (open: boolean) => void; }) { + const { confirm } = useConfirm(); const { ldrmnt, loadingOpen } = useWrStore((state) => state); const { isLoading } = ldrmnt; const form = useForm>({ resolver: zodResolver(coRegExcel), }); - const { ldrmntRegData } = useWrStore((state) => state); + const { ldrmntRegData, ldrmntDelete } = useWrStore((state) => state); const [file, setFiles] = useState(); @@ -32,8 +34,7 @@ export default function CoRegExcel({ // } // }; - //TODO:Onsubmit을 써야하는지 - const onSubmit = () => { + const onSubmit = (isReplaceAll = false) => { loadingOpen(true); if (file) { filePicked(file, 0) @@ -59,10 +60,23 @@ export default function CoRegExcel({ return false; }); } + if (isReplaceAll) { + const isConfirmed = await confirm( + "기존 등록된 잠재수요처를 \n모두 삭제후 등록처리됩니다. 실행하시겠습니까?", + ); + + if (!isConfirmed) { + loadingOpen(false); + return; + } + + await ldrmntDelete(); + } + await ldrmntRegData(array); isModal(false); loadingOpen(false); - toast.success(`잠재수요처 등록이 완료되었습니다.`); + toast.success(`잠재수요처 등록이 요청되었습니다.`); } catch (e) { console.log(e); loadingOpen(false); @@ -72,7 +86,10 @@ export default function CoRegExcel({ }) .catch((e) => { console.log("file", e); + loadingOpen(false); }); + } else { + loadingOpen(false); } }; @@ -81,7 +98,7 @@ export default function CoRegExcel({
- + e.preventDefault()}>
@@ -89,9 +106,24 @@ export default function CoRegExcel({

{"잠재수요처 파일"}

- +
+ + +