From 682cc1297c0700622ca0fd387171e2db617635fd Mon Sep 17 00:00:00 2001 From: leedj312 Date: Mon, 15 Sep 2025 17:45:22 +0900 Subject: [PATCH] =?UTF-8?q?=EC=A7=80=EB=8F=84=EC=A0=90=EA=B2=80=20?= =?UTF-8?q?=EC=97=91=EC=85=80=20=EB=93=B1=EB=A1=9D=EC=8B=9C=20lodingbar?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../prfmncReg/chkgdnReg/rswrtChkgdn/index.tsx | 12 ++- .../ui/modal/chkgd/chkgdExcel/chkgdExcel.tsx | 75 ++++++++++--------- .../ui/modal/chkgd/chkgdModal/chkgdModal.tsx | 2 +- .../chkgdTable/rainChkgd/rainChkgdTable.tsx | 2 - .../chkgdTable/rswtChkgd/rswtChkgdTable.tsx | 2 - 5 files changed, 52 insertions(+), 41 deletions(-) diff --git a/apps/wr/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/index.tsx b/apps/wr/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/index.tsx index afba2f813..23591ae42 100644 --- a/apps/wr/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/index.tsx +++ b/apps/wr/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/index.tsx @@ -84,6 +84,7 @@ type rswtChkgdnActions = { rswtChkPolInit: () => void; rwstPolAndGuideUpdate: (rswtChk: rswtChkZodType[]) => void; rswtChkHeadChange: (rswtChkgdn: rswtChkgdnState, isEdit: boolean) => void; + setRswtChkLoading:(status:boolean) =>void }; export type rswtChkgdnType = rswtChkgdnState & rswtChkgdnActions; @@ -394,6 +395,15 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = ( } catch (e) { console.error(e); } - }, + },setRswtChkLoading:(status:boolean) =>{ + set((state: rswtChkgdnState) => ({ + ...state, + rswtChkgdn: { + ...state.rswtChkgdn, + isLoading: status, + }, + })); + } + }; }; diff --git a/apps/wr/components/ui/modal/chkgd/chkgdExcel/chkgdExcel.tsx b/apps/wr/components/ui/modal/chkgd/chkgdExcel/chkgdExcel.tsx index 84dd7d8e3..24a983dce 100644 --- a/apps/wr/components/ui/modal/chkgd/chkgdExcel/chkgdExcel.tsx +++ b/apps/wr/components/ui/modal/chkgd/chkgdExcel/chkgdExcel.tsx @@ -18,6 +18,7 @@ import { SelectBox, Title, } from "@common/business_components/ui"; +import LoadingOverlay from "@common/business_components/ui/loadingBar"; import { Button, Input } from "@common/components/ui"; import { zodResolver } from "@hookform/resolvers/zod"; import { useEffect, useRef, useState } from "react"; @@ -35,9 +36,12 @@ export default function ChkgdExcel({ setYearChange: (year: string) => void; }) { const { + rswtChkgdn, + rainChkgdn, rainChkExcelDataUPload, rswtChkExceDataUpload, setRainChkLoading, + setRswtChkLoading, } = useWrStore((state) => { return state; }); @@ -110,43 +114,38 @@ export default function ChkgdExcel({ setRainChkLoading(false); }); } else if (type === "RST") { - filePickedArray(file, 0).then((res) => { - + setRswtChkLoading(true); + filePickedArray(file, 0) + .then((res) => { + if (res && res?.length > 1) { + const guideData = excelToRswtGuideData( + res[0], + form.getValues("chckYr") + ); + const polutionData = excelToRswtPolution(res[1]); - if (res && res?.length > 1) { - const guideData = excelToRswtGuideData( - res[0], - form.getValues("chckYr"), - ); - const polutionData = excelToRswtPolution(res[1]); - - - - const keyGenerator = (item: rswtChkZodType) => `${item.bdstRuseFcltSn}|${item.chckYmd}|${item.utztnUsgCd}`; - const totalData: rswtChkZodType[] = guideData.map( - (guide) => { - const fusion = polutionData.find( - (polution) => - guide.bdstRuseFcltSn === polution.bdstRuseFcltSn && - guide.chckYmd === polution.chckYmd && - guide.utztnUsgCd === polution.utztnUsgCd - ); + const totalData: rswtChkZodType[] = guideData.map((guide) => { + const fusion = polutionData.find( + (polution) => + guide.bdstRuseFcltSn === polution.bdstRuseFcltSn && + guide.chckYmd === polution.chckYmd && + guide.utztnUsgCd === polution.utztnUsgCd + ); - if (fusion) { - return { - ...guide, - rswtrPollutions: fusion?.rswtrPollutions, - rswtrDetails: fusion?.rswtrDetails, - }; - } else { - return { - ...guide, - }; - } + if (fusion) { + return { + ...guide, + rswtrPollutions: fusion?.rswtrPollutions, + rswtrDetails: fusion?.rswtrDetails, + }; + } else { + return { + ...guide, + }; } - ); + }); const guideKey = new Set(guideData.map(keyGenerator)); const onlypolution = polutionData.filter( (item) => !guideKey.has(keyGenerator(item)) @@ -158,7 +157,7 @@ export default function ChkgdExcel({ ]; const issues: string[] = []; - rswtExcelDataCheck(listTotalData,issues) + rswtExcelDataCheck(listTotalData, issues); if (issues && issues.length > 0) { issues.some((err, index) => { @@ -169,8 +168,9 @@ export default function ChkgdExcel({ } else { setExcelRswtData(listTotalData); } - } - }); + } + }) + .finally(() => setRswtChkLoading(false)); } } }, [file]); @@ -222,6 +222,11 @@ export default function ChkgdExcel({ return ( <> + +
diff --git a/apps/wr/components/ui/modal/chkgd/chkgdModal/chkgdModal.tsx b/apps/wr/components/ui/modal/chkgd/chkgdModal/chkgdModal.tsx index 196ac4b27..d6f0e3a26 100644 --- a/apps/wr/components/ui/modal/chkgd/chkgdModal/chkgdModal.tsx +++ b/apps/wr/components/ui/modal/chkgd/chkgdModal/chkgdModal.tsx @@ -6,7 +6,7 @@ import { codeToText } from "@/components/lib/func/commom"; import { GuideDetailsTable } from "@/components/ui/table/chkgdTable/guideDetailTable/guideDetailTable"; import { ScrollArea, Title } from "@common/business_components/ui"; import { Button } from "@common/components/ui"; -import React, { useEffect, useState } from "react"; +import React, { useEffect, useState } from "react"; import type { z } from "zod"; export default function ChkgdModal({ diff --git a/apps/wr/components/ui/table/chkgdTable/rainChkgd/rainChkgdTable.tsx b/apps/wr/components/ui/table/chkgdTable/rainChkgd/rainChkgdTable.tsx index b29d8d935..4717e8346 100644 --- a/apps/wr/components/ui/table/chkgdTable/rainChkgd/rainChkgdTable.tsx +++ b/apps/wr/components/ui/table/chkgdTable/rainChkgd/rainChkgdTable.tsx @@ -9,7 +9,6 @@ import { chRowspanTable, rainChkTableData } from "@/components/lib/func/TableData"; -import LoadingOverlay from "@common/business_components/ui/loadingBar"; import UiPageNations from "@common/business_components/ui/table/uiPageNations"; import { Table, @@ -191,7 +190,6 @@ export default function RainChkgdTable({ return ( <> - {headMakeprfmnc( diff --git a/apps/wr/components/ui/table/chkgdTable/rswtChkgd/rswtChkgdTable.tsx b/apps/wr/components/ui/table/chkgdTable/rswtChkgd/rswtChkgdTable.tsx index aa74ad2c2..e931cf706 100644 --- a/apps/wr/components/ui/table/chkgdTable/rswtChkgd/rswtChkgdTable.tsx +++ b/apps/wr/components/ui/table/chkgdTable/rswtChkgd/rswtChkgdTable.tsx @@ -13,7 +13,6 @@ import { chRowspanTable, rswtChkTableData, } from "@/components/lib/func/TableData"; -import LoadingOverlay from "@common/business_components/ui/loadingBar"; import UiPageNations from "@common/business_components/ui/table/uiPageNations"; import { Table, TableBody, TableHeader } from "@common/components/ui"; import { useCallback, useEffect, useState } from "react"; @@ -138,7 +137,6 @@ export default function RswtChkgdTable({ return ( <> -
{headMakeprfmnc(headList?.headList, headList?.upHeadList)}