From e30130dc8f54918924e5221b7b4103f8b0afb2ca Mon Sep 17 00:00:00 2001 From: jyha00 Date: Tue, 8 Jul 2025 20:59:35 +0900 Subject: [PATCH] =?UTF-8?q?=EC=9E=A0=EC=9E=AC=EC=88=98=EC=9A=94=EC=B2=98?= =?UTF-8?q?=20=EC=97=91=EC=85=80=20=EB=8B=A4=EC=9A=B4=EB=A1=9C=EB=93=9C=20?= =?UTF-8?q?=EC=88=98=EC=A0=95,=20=ED=8E=98=EC=9D=B4=EC=A7=95=20=EC=B2=98?= =?UTF-8?q?=EB=A6=AC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wr/app/matMng/coMng/ldrmntCoSttn/page.tsx | 14 +++++----- .../app/store/matDmd/ldrmntCoSttn/index.tsx | 9 +++--- .../ruseFcltMng/fcltSttn/htdflSttn/index.tsx | 2 -- .../ruseFcltMng/fcltSttn/rainSttn/index.tsx | 2 -- .../ruseFcltMng/fcltSttn/rswtSttn/excel.tsx | 3 +- .../ruseFcltMng/fcltSttn/rswtSttn/index.tsx | 8 ++++-- .../coReg/coRegExcel/coRegExcelModal.tsx | 28 +++++++++++-------- 7 files changed, 37 insertions(+), 29 deletions(-) diff --git a/apps/wr/app/matMng/coMng/ldrmntCoSttn/page.tsx b/apps/wr/app/matMng/coMng/ldrmntCoSttn/page.tsx index 271754938..5ce69d508 100644 --- a/apps/wr/app/matMng/coMng/ldrmntCoSttn/page.tsx +++ b/apps/wr/app/matMng/coMng/ldrmntCoSttn/page.tsx @@ -42,7 +42,7 @@ export default function LdrmntCoSttn() { const [bdstTable, setBdstTable] = useState(); const [searchTxt, setSearchTxt] = useState(); const [excelData, setExcelData] = useState(); - const [isExcelDownload, setIsExcelDownload] = useState(false); + // const [isExcelDownload, setIsExcelDownload] = useState(false); const excelClick = useCallback(() => { excelDownload( @@ -77,20 +77,20 @@ export default function LdrmntCoSttn() { const excelDownloadClick = useCallback(() => { const cityNm = computeCityNm(); ldrmntSearch(true, pageNation, String(ldrmntResCount), cityNm, searchTxt || ""); - setIsExcelDownload(true); - }, [objSearch, pageNation, searchTxt, code, ldrmntSearch, computeCityNm]); + // setIsExcelDownload(true); + }, [objSearch, pageNation, searchTxt, code, ldrmntSearch, computeCityNm, ldrmntResCount]); useEffect(() => { - if (isExcelDownload && excelData && excelData.length > 0) { + if (/*isExcelDownload &&*/ excelData && excelData.length > 0) { downloadExcel({ data: excelData, fileName: "잠재수요처 관리", sheetNameArray: ["Sheet1"], headerRange: "A1:F1" }); - setIsExcelDownload(false); + // setIsExcelDownload(false); } - }, [excelData, isExcelDownload]); + }, [excelData, /*isExcelDownload*/]); const [isExcelOpen, setIsExcelOpen] = useState<{ isModal: boolean; @@ -247,7 +247,7 @@ export default function LdrmntCoSttn() { tableData={bdstTable || []} headlist={ldrmntHeadListExport} pageSize={20} - total={10000} + total={ldrmntResCount || 0} cellClick={(index: number | undefined, headId: string) => { cellClick(index ?? undefined, headId) }} onPageChange={setPageNation} /> diff --git a/apps/wr/app/store/matDmd/ldrmntCoSttn/index.tsx b/apps/wr/app/store/matDmd/ldrmntCoSttn/index.tsx index 734aca547..73c1bad7d 100644 --- a/apps/wr/app/store/matDmd/ldrmntCoSttn/index.tsx +++ b/apps/wr/app/store/matDmd/ldrmntCoSttn/index.tsx @@ -60,7 +60,7 @@ export const ldrmntActionsExport: (set: any) => ldrmntActions = ( return { ldrmntInit: async (con: string) => { try { - const ldrmntRes = await getFetch( + const ldrmntRes = await getFetchWithCount( fetchType.WR, `/reuseFc/request/temp/1/20/${con}` ); @@ -70,7 +70,8 @@ export const ldrmntActionsExport: (set: any) => ldrmntActions = ( ...state, ldrmnt: { ...state.ldrmnt, - ldrmntRes: ldrmntRes, + ldrmntRes: ldrmntRes.data, + ldrmntResCount: ldrmntRes.count, isInit: false, excelList: excelDownList, }, @@ -120,7 +121,7 @@ export const ldrmntActionsExport: (set: any) => ldrmntActions = ( fetchType.WR, searchUrl ); - +console.log("알이에스", ldrmntRes) if (isExcel) { let excelDownList: ExcelType[] = []; ldrmntRes.data.forEach((item: customLdrmnt) => { @@ -139,7 +140,7 @@ export const ldrmntActionsExport: (set: any) => ldrmntActions = ( ldrmnt: { ...state.ldrmnt, excelList: excelDownList, - + ldrmntResCount: ldrmntRes.count, }, }; }); diff --git a/apps/wr/app/store/ruseFcltMng/fcltSttn/htdflSttn/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltSttn/htdflSttn/index.tsx index 29f68a6d6..fb264f669 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltSttn/htdflSttn/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltSttn/htdflSttn/index.tsx @@ -77,7 +77,6 @@ export const htdflSttnActionsExport: (set: any) => htdflSttnActions = ( htdflSttn: { ...state.htdflSttn, excelList: htdflExcel, - htdflSttnResCount: htdflSttnRes.count }, }; }); @@ -119,7 +118,6 @@ export const htdflSttnActionsExport: (set: any) => htdflSttnActions = ( htdflSttn: { ...state.htdflSttn, excelList: htdflExcel, - htdflSttnResCount: htdflSttnRes.count }, }; }); diff --git a/apps/wr/app/store/ruseFcltMng/fcltSttn/rainSttn/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltSttn/rainSttn/index.tsx index 3ad7090ec..6c987298f 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltSttn/rainSttn/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltSttn/rainSttn/index.tsx @@ -153,7 +153,6 @@ export const rainSttnActionsExport: (set: any) => rainSttnActions = ( rainSttn: { ...state.rainSttn, excelList: rainExcel, - rainSttnResCount: rainSttnRes.count, }, }; }); @@ -164,7 +163,6 @@ export const rainSttnActionsExport: (set: any) => rainSttnActions = ( rainSttn: { ...state.rainSttn, rainSttnRes: rainSttnRes.data, - rainSttnResCount: rainSttnRes.count, isInit: false, }, }; diff --git a/apps/wr/app/store/ruseFcltMng/fcltSttn/rswtSttn/excel.tsx b/apps/wr/app/store/ruseFcltMng/fcltSttn/rswtSttn/excel.tsx index 9c3eb4a14..442b027e3 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltSttn/rswtSttn/excel.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltSttn/rswtSttn/excel.tsx @@ -1,6 +1,7 @@ import type { SelectDataType } from "@common/business_components/ui"; import type { customRswtBdst } from "../../fcltReg/rswtReg"; import { useWrStore } from "@/app/store"; +import { bdstUsgCd } from "@/app/store/common/code/basicCode"; export const excelRSwtSttnParsing = ( excel: customRswtBdst[], @@ -14,7 +15,7 @@ export const excelRSwtSttnParsing = ( sggCode.find((sgg) => sgg.val === item.sggCd.toString())?.text ?? "", item.bdstNm ?? "", item.daddr ?? "", - String(item.bdstUsgCd === -1 || item.bdstUsgCd === undefined ? "확인불가" : item.bdstUsgCd ?? ""), //건축물용도 + bdstUsgCd.find((cd)=> cd.val === item.reuseBuilding?.[0]?.bdstUsgCd.toString())?.text ?? "", //건축물용도 String(item.frstArchPrmsnDt ?? ""), String(item.archArea.split('.')[0] === '-1' ? '확인불가' : item.archArea.split('.')[0]), String(item.reuseBuilding?.[0]?.rswtrObj.wtrUsqty ?? "0"), //물사용량 diff --git a/apps/wr/app/store/ruseFcltMng/fcltSttn/rswtSttn/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltSttn/rswtSttn/index.tsx index 716b4d517..e76095bd5 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltSttn/rswtSttn/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltSttn/rswtSttn/index.tsx @@ -79,7 +79,6 @@ export const rswtSttnActionsExport: (set: any) => rswtSttnActions = ( rswtSttn: { ...state.rswtSttn, excelList: rswtExcel, - rswtSttnResCount: rswtSttnRes.count, }, }; }); @@ -112,6 +111,12 @@ export const rswtSttnActionsExport: (set: any) => rswtSttnActions = ( (con ? `/${con}` : "/0") + (txt ? `/${txt}` : "") ); + console.log("주소",`/reuseFc/waterreuseFc` + + (page ? `/${page}` : "/1") + + (total ? `/${total}` : "/20") + + (con ? `/${con}` : "/0") + + (txt ? `/${txt}` : "")) + console.log("rswtSttnRes", rswtSttnRes) if (isExcel) { const rswtExcel = excelRSwtSttnParsing(rswtSttnRes, sidoCode, sggCode); set((state: rswtSttnState) => { @@ -120,7 +125,6 @@ export const rswtSttnActionsExport: (set: any) => rswtSttnActions = ( rswtSttn: { ...state.rswtSttn, excelList: rswtExcel, - rswtSttnResCount: rswtSttnRes.count, }, }; }); diff --git a/apps/wr/components/ui/modal/coReg/coRegExcel/coRegExcelModal.tsx b/apps/wr/components/ui/modal/coReg/coRegExcel/coRegExcelModal.tsx index 36645003e..24fef023c 100644 --- a/apps/wr/components/ui/modal/coReg/coRegExcel/coRegExcelModal.tsx +++ b/apps/wr/components/ui/modal/coReg/coRegExcel/coRegExcelModal.tsx @@ -5,7 +5,7 @@ import { names } from "@/app/store/matDmd/ldrmntCoSttn/excel"; import { filePicked, FileUpload, FormUi, Title } from "@common/business_components/ui"; import { Form, FormField } from "@common/business_components/ui/form"; import LoadingOverlay from "@common/business_components/ui/loadingBar"; -import { Button, Progress } from "@common/components/ui"; +import { Button, Input, Progress } from "@common/components/ui"; import { zodResolver } from "@hookform/resolvers/zod"; import { useEffect, useState } from "react"; import { useForm } from "react-hook-form"; @@ -13,7 +13,7 @@ import toast from "react-hot-toast"; import type { z } from "zod"; export default function CoRegExcel({ isModal }: { isModal: (open: boolean) => void }) { - const { ldrmnt,loadingOpen } = useWrStore((state) => state); + const { ldrmnt, loadingOpen } = useWrStore((state) => state); const { isLoading } = ldrmnt; const form = useForm>({ resolver: zodResolver(coRegExcel), @@ -23,6 +23,13 @@ export default function CoRegExcel({ isModal }: { isModal: (open: boolean) => vo const [file, setFiles] = useState(); + const handleFileChange = (e: React.ChangeEvent) => { + const selectedFile = e.target.files?.[0]; + if (selectedFile) { + setFiles(selectedFile); + } + }; + const onSubmit = (values: z.infer) => { loadingOpen(true); if (file) { @@ -59,7 +66,7 @@ export default function CoRegExcel({ isModal }: { isModal: (open: boolean) => vo alert(e) return true; } - }).catch((e)=>{ + }).catch((e) => { console.log("file", e); }); }; @@ -90,14 +97,13 @@ export default function CoRegExcel({ isModal }: { isModal: (open: boolean) => vo name="file" render={({ field }) => ( - { - if (files && files?.length === 1) setFiles(files[0]); - }} - fileTypes="" - maxFiles={1} - > +
+ +
)} />