From d5258bd4a85f5ce3d62326dcd7fcfb1fe7c91820 Mon Sep 17 00:00:00 2001 From: swcho Date: Wed, 25 Jun 2025 11:16:12 +0900 Subject: [PATCH 1/5] =?UTF-8?q?feat:=20UiTable=20=EC=84=A0=ED=83=9D?= =?UTF-8?q?=EB=90=9C=20index=20=EB=A6=AC=EC=85=8B=20props=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/business_components/src/ui/table/index.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/common/business_components/src/ui/table/index.tsx b/packages/common/business_components/src/ui/table/index.tsx index a6c5cfdee..4a778357d 100644 --- a/packages/common/business_components/src/ui/table/index.tsx +++ b/packages/common/business_components/src/ui/table/index.tsx @@ -19,6 +19,7 @@ type UiTableProps = { resetPageNo?: boolean; children?: React.ReactNode | undefined; boldArray?: number[]; + resetSelection?: boolean; } type UiHeadProps = { @@ -28,7 +29,7 @@ type UiHeadProps = { visible?:boolean; } -export function UiTable({ tableData, headlist, pageSize, total, headName, children, cellClick, onPageChange, className = '', resetPageNo = false, boldArray = [] }: UiTableProps) { +export function UiTable({ tableData, headlist, pageSize, total, headName, children, cellClick, onPageChange, className = '', resetPageNo = false, boldArray = [], resetSelection = false }: UiTableProps) { const [cur, setCur] = useState(1); const [idx, setIdx] = useState(-1); const [isCheck, seIsCheck] = useState(false); @@ -41,6 +42,12 @@ export function UiTable({ tableData, headlist, pageSize, total, headName, childr } }, [onPageChange, resetPageNo]); + useEffect(() => { + if (resetSelection) { + setIdx(-1); + } + }, [resetSelection]); + const handlePageChange = (page: number) => { setCur(page); onPageChange(page); From 3a17089838d76716af1f61bf6dc20a5d66ee0e87 Mon Sep 17 00:00:00 2001 From: jyha00 Date: Wed, 25 Jun 2025 11:24:44 +0900 Subject: [PATCH 2/5] =?UTF-8?q?=EC=9E=AC=EC=9D=B4=EC=9A=A9=EC=8B=A4?= =?UTF-8?q?=EC=A0=81=ED=98=84=ED=99=A9=20=EC=B0=A8=ED=8A=B8=20=EB=8D=B0?= =?UTF-8?q?=EC=9D=B4=ED=84=B0=20=EC=88=98=EC=A0=95=20=EC=99=84=EB=A3=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../prfmncSttn/pbnstPrfmncSttn/page.tsx | 155 ++++++++++-------- apps/wr/app/store/common/code/index.ts | 16 +- .../prfmncSttn/pbnstPrfmncSttn/index.tsx | 66 +++++--- 3 files changed, 148 insertions(+), 89 deletions(-) diff --git a/apps/wr/app/ruseFcltMng/prfmncSttn/pbnstPrfmncSttn/page.tsx b/apps/wr/app/ruseFcltMng/prfmncSttn/pbnstPrfmncSttn/page.tsx index 8064aa2bb..8130dfbd5 100644 --- a/apps/wr/app/ruseFcltMng/prfmncSttn/pbnstPrfmncSttn/page.tsx +++ b/apps/wr/app/ruseFcltMng/prfmncSttn/pbnstPrfmncSttn/page.tsx @@ -33,6 +33,10 @@ export default function PbnstPrfmncSttn() { const ref = useRef({} as ReturnType); const [swtrmtFcltNm, setSwtrmtFcltNm] = useState(); const [pbnRuseNm, setPbnRuseNm] = useState(""); + + const [searchYear, setSearchYear] = useState( + String(new Date().getFullYear()) + ); const [excelData, setExcelData] = useState([]); const excelClick = useCallback(() => { excelDownload( @@ -43,7 +47,6 @@ export default function PbnstPrfmncSttn() { 2 ); }, [excelData]); - const [chartConfig, setChartConfig] = useState({}); const [chartData, setChartData] = useState([]); const [dnInUsage, setDnInUsage] = useState([]); @@ -138,7 +141,8 @@ export default function PbnstPrfmncSttn() { setPrfData([]); } } - + + const [chartId, setChartId] = useState(); useEffect(() => { // 누적 변수 초기화 let wshwtr = 0, @@ -192,67 +196,69 @@ export default function PbnstPrfmncSttn() { if (rawData) { rawData.forEach((item) => { // 실적 테이블 데이터 - prfTableData(item.prfList, year); + if (chartId){ + if(item.prfList?.[0]?.ym.slice(0, 4) === year && item.prfList?.[0]?.pbnstRuseFcltFk === chartId) + prfTableData(item.prfList, year); + item.prfList.filter((e) => e.ym.slice(0, 4) === year && e.pbnstRuseFcltFk === chartId).forEach((element) => { + // 누적 + wshwtr += element.wshwtr; + coolUswtr += element.coolUswtr; + cleanUswtr += element.cleanUswtr; + drwtUswtr += element.drwtUswtr; + dltnUswtr += element.dltnUswtr; + ithlRswtr += element.ithlRswtr; + ithlEtcUswtr += element.ithlEtcUswtr; + cleanToilUswtr += element.cleanToilUswtr; + resn += element.resn; + lndwtr += element.lndwtr; + hydUswtr += element.hydUswtr; + ugwtChr += element.ugwtChr; + farmUswtr += element.farmUswtr; + rvrKeepUswtr += element.rvrKeepUswtr; + indstUswtr += element.indstUswtr; - item.prfList.filter((e) => e.ym.slice(0, 4) === year).forEach((element) => { - // 누적 - wshwtr += element.wshwtr; - coolUswtr += element.coolUswtr; - cleanUswtr += element.cleanUswtr; - drwtUswtr += element.drwtUswtr; - dltnUswtr += element.dltnUswtr; - ithlRswtr += element.ithlRswtr; - ithlEtcUswtr += element.ithlEtcUswtr; - cleanToilUswtr += element.cleanToilUswtr; - resn += element.resn; - lndwtr += element.lndwtr; - hydUswtr += element.hydUswtr; - ugwtChr += element.ugwtChr; - farmUswtr += element.farmUswtr; - rvrKeepUswtr += element.rvrKeepUswtr; - indstUswtr += element.indstUswtr; + // 월별 합계 + inUsageSum = element.wshwtr + + element.coolUswtr + + element.cleanUswtr + + element.drwtUswtr + + element.dltnUswtr + + element.ithlRswtr + + element.ithlEtcUswtr + + element.cleanToilUswtr + + element.resn; + outUsageSum = element.lndwtr + + element.hydUswtr + + element.ugwtChr + + element.farmUswtr + + element.rvrKeepUswtr + + element.indstUswtr; + inUsageArr.push(inUsageSum); + outUsageArr.push(outUsageSum); - // 월별 합계 - inUsageSum = element.wshwtr - + element.coolUswtr - + element.cleanUswtr - + element.drwtUswtr - + element.dltnUswtr - + element.ithlRswtr - + element.ithlEtcUswtr - + element.cleanToilUswtr - + element.resn; - outUsageSum = element.lndwtr - + element.hydUswtr - + element.ugwtChr - + element.farmUswtr - + element.rvrKeepUswtr - + element.indstUswtr; - inUsageArr.push(inUsageSum); - outUsageArr.push(outUsageSum); + // 막대차트 + const month = Number(element.ym.slice(4, 6)); + barData.push({ label: `${month}월`, "장내용수": inUsageSum, "장외용수": outUsageSum }); - // 막대차트 - const month = Number(element.ym.slice(4, 6)); - barData.push({ label: `${month}월`, "장내용수": inUsageSum, "장외용수": outUsageSum }); + // 라인차트 + wshwtrData.push({ label: `${month}월`, val: element.wshwtr, color: "red" }); + coolUswtrData.push({ label: `${month}월`, val: element.coolUswtr, color: "orange" }); + cleanUswtrData.push({ label: `${month}월`, val: element.cleanUswtr, color: "yellow" }); + drwtUswtrData.push({ label: `${month}월`, val: element.drwtUswtr, color: "pink" }); + dltnUswtrData.push({ label: `${month}월`, val: element.dltnUswtr, color: "purple" }); + ithlRswtrData.push({ label: `${month}월`, val: element.ithlRswtr, color: "green" }); + ithlEtcUswtrData.push({ label: `${month}월`, val: element.ithlEtcUswtr, color: "blue" }); + cleanToilUswtrData.push({ label: `${month}월`, val: element.cleanToilUswtr, color: "magenta" }); + resnData.push({ label: `${month}월`, val: element.resn, color: "skyblue" }); - // 라인차트 - wshwtrData.push({ label: `${month}월`, val: element.wshwtr, color: "red" }); - coolUswtrData.push({ label: `${month}월`, val: element.coolUswtr, color: "orange" }); - cleanUswtrData.push({ label: `${month}월`, val: element.cleanUswtr, color: "yellow" }); - drwtUswtrData.push({ label: `${month}월`, val: element.drwtUswtr, color: "pink" }); - dltnUswtrData.push({ label: `${month}월`, val: element.dltnUswtr, color: "purple" }); - ithlRswtrData.push({ label: `${month}월`, val: element.ithlRswtr, color: "green" }); - ithlEtcUswtrData.push({ label: `${month}월`, val: element.ithlEtcUswtr, color: "blue" }); - cleanToilUswtrData.push({ label: `${month}월`, val: element.cleanToilUswtr, color: "magenta" }); - resnData.push({ label: `${month}월`, val: element.resn, color: "skyblue" }); - - lndwtrData.push({ label: `${month}월`, val: element.lndwtr, color: "red" }); - hydUswtrData.push({ label: `${month}월`, val: element.hydUswtr, color: "orange" }); - ugwtChrData.push({ label: `${month}월`, val: element.ugwtChr, color: "yellow" }); - farmUswtrData.push({ label: `${month}월`, val: element.farmUswtr, color: "green" }); - rvrKeepUswtrData.push({ label: `${month}월`, val: element.rvrKeepUswtr, color: "blue" }); - indstUswtrData.push({ label: `${month}월`, val: element.indstUswtr, color: "purple" }); - }); + lndwtrData.push({ label: `${month}월`, val: element.lndwtr, color: "red" }); + hydUswtrData.push({ label: `${month}월`, val: element.hydUswtr, color: "orange" }); + ugwtChrData.push({ label: `${month}월`, val: element.ugwtChr, color: "yellow" }); + farmUswtrData.push({ label: `${month}월`, val: element.farmUswtr, color: "green" }); + rvrKeepUswtrData.push({ label: `${month}월`, val: element.rvrKeepUswtr, color: "blue" }); + indstUswtrData.push({ label: `${month}월`, val: element.indstUswtr, color: "purple" }); + }); + } }); // 도넛차트 데이터 @@ -316,7 +322,7 @@ export default function PbnstPrfmncSttn() { setDnInUsage(dnInData); setDnOutUsage(dnOutData); } - }, [rawData, year]); + }, [rawData, year, chartId]); useEffect(() => { const newChartConfig = chartData.reduce((config, element) => { @@ -440,24 +446,37 @@ export default function PbnstPrfmncSttn() { }, [outLineData]); useEffect(() => { - if (!pbnstPrfmncSttn.isInit) { - pbnstPrfmncInit("1", "11"); + const returnType: ReturnType = { + sidoValue: "0", + sigunValue: "0", + partValue: "A", + regionValue: "0", + unitWaterShedValue: "", + middleRegionValue: "", + envPartValue: "", + sidoText: "", + sigunText: "" } - }, [pbnstPrfmncSttn.isInit, pbnstPrfmncInit]); + tableHeadMaker(Number(searchYear), Number(searchYear)); + pbnstPrfmncSearch(returnType, "", searchYear, searchYear) + }, []); useEffect(() => { setbdstTable(prfmncRes); }, [prfmncRes]); - const [searchYear, setSearchYear] = useState( - String(new Date().getFullYear()) - ); + useEffect(() => { if (pbnRuseNm.length > 1) pbnNmSearch("1", "23", ref.current, pbnRuseNm, searchYear); }, [pbnRuseNm]); + const cellClick = (index: number | undefined, headId: string) => { + if (index !== undefined && headId !== undefined) { + setChartId(prfmncRes[index].pbnstRuseFcltPk) + } + } return ( <> @@ -551,7 +570,9 @@ export default function PbnstPrfmncSttn() { headlist={pbnstPrfHeadList} pageSize={20} total={10000} - cellClick={() => { }} + cellClick={(index: number | undefined, headId: string) => { + cellClick(index ?? undefined, headId); + }} onPageChange={() => { }} /> diff --git a/apps/wr/app/store/common/code/index.ts b/apps/wr/app/store/common/code/index.ts index 74001b27c..e7fca8180 100644 --- a/apps/wr/app/store/common/code/index.ts +++ b/apps/wr/app/store/common/code/index.ts @@ -181,10 +181,20 @@ export type comCodeType = comCodeState & comCodeActions; export const getSggCd = async (set: any) => { const sgg = await getFetch("common", "/addr/sgg"); - const sggCd = sgg.map((item: any) => ({ + /* const sggCd = sgg.map((item: any) => ({ val: item.adstDstrCd, text: item.gugun, - })); + })); */ + + const sggCd = [ + { text: "전체", val: '0' }, + ...sgg + .map((item: any) => ({ + text: item.gugun || '', + val: String(item.adstDstrCd) || '' + })) + ]; + set((state: comCodeState) => ({ code: { ...state.code, @@ -332,7 +342,7 @@ export const codeActionExport: (set: any) => comCodeActions = (set: any) => { val: item.adstDstrCd, text: item.gugun, })); - + const city = await getFetch("common", "/addr/city"); const cityCd = city.map((item: any) => ({ val: item.adstDstrCd, diff --git a/apps/wr/app/store/prfmncSttn/pbnstPrfmncSttn/index.tsx b/apps/wr/app/store/prfmncSttn/pbnstPrfmncSttn/index.tsx index d0e958785..c2cee87d6 100644 --- a/apps/wr/app/store/prfmncSttn/pbnstPrfmncSttn/index.tsx +++ b/apps/wr/app/store/prfmncSttn/pbnstPrfmncSttn/index.tsx @@ -75,7 +75,7 @@ export const pbnstPrfmncSttnActionsExport: (set: any) => pbnstPrfmncSttnActions for (let i = startYear; i <= endYear; i++) { const yearHead = JSON.parse(JSON.stringify(pbnstYearHeadListExport)); if (yearHead) { - yearHead.forEach((item: { id?: number; }) => { + yearHead.forEach((item: { id?: string; }) => { if (item.id) { item.id = i + item.id; @@ -92,6 +92,7 @@ export const pbnstPrfmncSttnActionsExport: (set: any) => pbnstPrfmncSttnActions return { ...state, pbnstPrfmncSttn: { + ...state.pbnstPrfmncSttn, pbnstPrfHeadList: [...yearHeader], selectYearList: selectList }, @@ -106,7 +107,7 @@ export const pbnstPrfmncSttnActionsExport: (set: any) => pbnstPrfmncSttnActions pbnstPrfmncSttn: { ...state.pbnstPrfmncSttn, prfmncRes: prfmncRes, - isInit: false, + isInit: true, }, })); } catch (e) { @@ -115,8 +116,7 @@ export const pbnstPrfmncSttnActionsExport: (set: any) => pbnstPrfmncSttnActions }, pbnstPrfmncSearch: async (returnType: ReturnType, swtrmtFcltNm: string, fromDate: string, toDate: string) => { let searchUrl = ""; - - if (returnType.sigunValue !== undefined) { + if (returnType.sigunValue !== "0") { if (swtrmtFcltNm !== "") { searchUrl = `/prcsFclt/info/1/20/${returnType.partValue}/${returnType.sigunValue}/0/1/SW${'/' + swtrmtFcltNm}`; } else { @@ -134,6 +134,7 @@ export const pbnstPrfmncSttnActionsExport: (set: any) => pbnstPrfmncSttnActions fetchType.COMMON, searchUrl ); + const bscFctCdList = pbnstRes.map((item: any) => { return item.bscFctCd; }) @@ -147,32 +148,59 @@ export const pbnstPrfmncSttnActionsExport: (set: any) => pbnstPrfmncSttnActions let usageSum = 0; let year = ""; const yearsData = [] + res.data.forEach((item) => { + if (item.prfList.length === 0) { + const year = ""; // 연도 정보가 없으면 빈 문자열, 필요시 item에서 추출 + const yearVal = { year: year, pbnstRuseFcltPk: item.pbnstRuseFcltPk ?? "" }; + yearVal[year + "inUsage"] = 0; + yearVal[year + "outUsage"] = 0; + yearVal[year + "total"] = 0; + yearsData.push(yearVal); + } item.prfList.forEach((acc) => { - year = acc.ym.substring(0, 4); - inUsageSum = acc.wshwtr + acc.coolUswtr + acc.cleanUswtr + acc.drwtUswtr + - acc.dltnUswtr + acc.ithlRswtr + acc.ithlEtcUswtr + acc.cleanToilUswtr + acc.resn; - outUsageSum = acc.lndwtr + acc.hydUswtr + acc.ugwtChr + acc.farmUswtr + acc.rvrKeepUswtr + acc.indstUswtr; - const yearData = yearsData.find(yearItem => yearItem.year === year && yearItem.pbnstRuseFcltPk == acc.pbnstRuseFcltPk) + year = acc.ym?.substring(0, 4) ?? ""; + inUsageSum = + (acc.wshwtr ?? 0) + + (acc.coolUswtr ?? 0) + + (acc.cleanUswtr ?? 0) + + (acc.drwtUswtr ?? 0) + + (acc.dltnUswtr ?? 0) + + (acc.ithlRswtr ?? 0) + + (acc.ithlEtcUswtr ?? 0) + + (acc.cleanToilUswtr ?? 0) + + (acc.resn ?? 0); + outUsageSum = + (acc.lndwtr ?? 0) + + (acc.hydUswtr ?? 0) + + (acc.ugwtChr ?? 0) + + (acc.farmUswtr ?? 0) + + (acc.rvrKeepUswtr ?? 0) + + (acc.indstUswtr ?? 0); + const yearData = yearsData.find( + (yearItem) => + yearItem.year === year && + yearItem.pbnstRuseFcltPk == acc.pbnstRuseFcltPk + ); if (yearData) { - yearData.inUsageSum += inUsageSum; - yearData.outUsageSum += outUsageSum; + yearData[year + "inUsage"] += inUsageSum; + yearData[year + "outUsage"] += outUsageSum; + yearData[year + "total"] += (inUsageSum + outUsageSum); } else { - const yearVal = { year: year, pbnstRuseFcltPk: acc.pbnstRuseFcltFk } - yearVal[year + 'inUsage'] = inUsageSum; - yearVal[year + 'outUsage'] = outUsageSum; - yearVal[year + 'total'] = inUsageSum + outUsageSum; + const yearVal = { year: year, pbnstRuseFcltPk: acc.pbnstRuseFcltFk }; + yearVal[year + "inUsage"] = inUsageSum; + yearVal[year + "outUsage"] = outUsageSum; + yearVal[year + "total"] = inUsageSum + outUsageSum; yearsData.push(yearVal); } - - }) - }) + }); + }); const resData: any[] = [] pbnstRes.forEach((acc) => { let data = yearsData.find((item) => item.pbnstRuseFcltPk.substring(0, 11) === acc.bscFctCd) if (data) { - resData.push({ ...data, ...acc }) + resData.push({ ...acc, ...data }) } }) return set((state: pbnstPrfmncSttnState) => ({ From 7092da42d646b7ecd417601b3f8f2e1e2217d056 Mon Sep 17 00:00:00 2001 From: jyha00 Date: Wed, 25 Jun 2025 14:15:14 +0900 Subject: [PATCH 3/5] =?UTF-8?q?=EC=9E=AC=EC=9D=B4=EC=9A=A9=EC=8B=A4?= =?UTF-8?q?=EC=A0=81=ED=98=84=ED=99=A9=20=ED=85=8C=EC=9D=B4=EB=B8=94=20?= =?UTF-8?q?=EC=B4=88=EA=B8=B0=ED=99=94=20=EC=88=98=EC=A0=95=20=EC=99=84?= =?UTF-8?q?=EB=A3=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../prfmncSttn/pbnstPrfmncSttn/page.tsx | 20 ++++++++++++------- .../prfmncSttn/pbnstPrfmncSttn/index.tsx | 4 ++-- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/apps/wr/app/ruseFcltMng/prfmncSttn/pbnstPrfmncSttn/page.tsx b/apps/wr/app/ruseFcltMng/prfmncSttn/pbnstPrfmncSttn/page.tsx index 8130dfbd5..a50c08071 100644 --- a/apps/wr/app/ruseFcltMng/prfmncSttn/pbnstPrfmncSttn/page.tsx +++ b/apps/wr/app/ruseFcltMng/prfmncSttn/pbnstPrfmncSttn/page.tsx @@ -91,6 +91,7 @@ export default function PbnstPrfmncSttn() { const prfFilter = prfList?.filter((e) => e.ym.slice(0, 4) === year) if (prfList && prfFilter.length > 0) { + prfList?.forEach((prfItem) => { const month = Number(prfItem?.ym?.slice(4)); // "MM" const monthKey = `${month}월`; @@ -194,11 +195,13 @@ export default function PbnstPrfmncSttn() { const dnOutData: dnChartForm[] = []; if (rawData) { + prfTableData([], year) rawData.forEach((item) => { // 실적 테이블 데이터 if (chartId){ - if(item.prfList?.[0]?.ym.slice(0, 4) === year && item.prfList?.[0]?.pbnstRuseFcltFk === chartId) - prfTableData(item.prfList, year); + if(item.prfList?.[0]?.ym.slice(0, 4) === year && item.prfList?.[0]?.pbnstRuseFcltFk === chartId){ + prfTableData(item.prfList, year); + } item.prfList.filter((e) => e.ym.slice(0, 4) === year && e.pbnstRuseFcltFk === chartId).forEach((element) => { // 누적 wshwtr += element.wshwtr; @@ -463,6 +466,7 @@ export default function PbnstPrfmncSttn() { useEffect(() => { setbdstTable(prfmncRes); + if(prfmncRes?.[0]?.pbnstRuseFcltPk) setChartId(prfmncRes[0].pbnstRuseFcltPk) }, [prfmncRes]); @@ -525,21 +529,21 @@ export default function PbnstPrfmncSttn() { setPbnRuseNm(searchNm || ""); }} setRtnData={function (rtnData: any[]): void { - setbdstTable(rtnData); + // setbdstTable(rtnData); }} searchList={pbnstSttn.pbnstSearchData || []} > - { }} /> + onSelectValue={() => { }} /> */} } queryClick={function (returnType: ReturnType): void { - pbnstPrfmncSearch(returnType, swtrmtFcltNm ?? "", fromDate, toDate); + pbnstPrfmncSearch(returnType, pbnRuseNm ?? "", fromDate, toDate); if (fromDate && toDate) { const fromNum = Number(fromDate); const toNum = Number(toDate); @@ -573,7 +577,9 @@ export default function PbnstPrfmncSttn() { cellClick={(index: number | undefined, headId: string) => { cellClick(index ?? undefined, headId); }} - onPageChange={() => { }} + onPageChange={() => { } + } + index={0} />
diff --git a/apps/wr/app/store/prfmncSttn/pbnstPrfmncSttn/index.tsx b/apps/wr/app/store/prfmncSttn/pbnstPrfmncSttn/index.tsx index c2cee87d6..b513085ae 100644 --- a/apps/wr/app/store/prfmncSttn/pbnstPrfmncSttn/index.tsx +++ b/apps/wr/app/store/prfmncSttn/pbnstPrfmncSttn/index.tsx @@ -152,7 +152,7 @@ export const pbnstPrfmncSttnActionsExport: (set: any) => pbnstPrfmncSttnActions res.data.forEach((item) => { if (item.prfList.length === 0) { const year = ""; // 연도 정보가 없으면 빈 문자열, 필요시 item에서 추출 - const yearVal = { year: year, pbnstRuseFcltPk: item.pbnstRuseFcltPk ?? "" }; + const yearVal = { year: year, pbnstRuseFcltPk: item.pbnstRuseFcltPk ?? "", ruseUtztnFcltNm : item.ruseUtztnFcltNm ?? "" }; yearVal[year + "inUsage"] = 0; yearVal[year + "outUsage"] = 0; yearVal[year + "total"] = 0; @@ -188,7 +188,7 @@ export const pbnstPrfmncSttnActionsExport: (set: any) => pbnstPrfmncSttnActions yearData[year + "outUsage"] += outUsageSum; yearData[year + "total"] += (inUsageSum + outUsageSum); } else { - const yearVal = { year: year, pbnstRuseFcltPk: acc.pbnstRuseFcltFk }; + const yearVal = { year: year, pbnstRuseFcltPk: acc.pbnstRuseFcltFk, ruseUtztnFcltNm : item.ruseUtztnFcltNm ?? "" }; yearVal[year + "inUsage"] = inUsageSum; yearVal[year + "outUsage"] = outUsageSum; yearVal[year + "total"] = inUsageSum + outUsageSum; From 4e1c66a221fe6620e0ca67dc976ff4fd72503178 Mon Sep 17 00:00:00 2001 From: jyha00 Date: Wed, 25 Jun 2025 14:18:34 +0900 Subject: [PATCH 4/5] =?UTF-8?q?UiTable=20index=20=EA=B0=92=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/common/business_components/src/ui/table/index.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/common/business_components/src/ui/table/index.tsx b/packages/common/business_components/src/ui/table/index.tsx index 4a778357d..cd25bc8db 100644 --- a/packages/common/business_components/src/ui/table/index.tsx +++ b/packages/common/business_components/src/ui/table/index.tsx @@ -20,6 +20,7 @@ type UiTableProps = { children?: React.ReactNode | undefined; boldArray?: number[]; resetSelection?: boolean; + index?:number; } type UiHeadProps = { @@ -29,9 +30,9 @@ type UiHeadProps = { visible?:boolean; } -export function UiTable({ tableData, headlist, pageSize, total, headName, children, cellClick, onPageChange, className = '', resetPageNo = false, boldArray = [], resetSelection = false }: UiTableProps) { +export function UiTable({ tableData, headlist, pageSize, total, headName, children, cellClick, onPageChange, className = '', resetPageNo = false, boldArray = [], resetSelection = false, index=-1 }: UiTableProps) { const [cur, setCur] = useState(1); - const [idx, setIdx] = useState(-1); + const [idx, setIdx] = useState(index); const [isCheck, seIsCheck] = useState(false); From 7c95c1ad8c0d8b4d74fa109020d9bec032049485 Mon Sep 17 00:00:00 2001 From: jyha00 Date: Wed, 25 Jun 2025 18:32:24 +0900 Subject: [PATCH 5/5] =?UTF-8?q?=EC=A7=80=EB=8F=84=EC=A0=90=EA=B2=80?= =?UTF-8?q?=EA=B2=B0=EA=B3=BC=EB=93=B1=EB=A1=9D=20=EB=AA=A8=EB=8B=AC=20?= =?UTF-8?q?=EC=98=A4=EB=A5=98=20=EC=88=98=EC=A0=95,=20=EC=84=A0=ED=83=9D?= =?UTF-8?q?=EB=90=98=EC=A7=80=20=EC=95=8A=EC=9D=80=20=EA=B0=92=20disabled?= =?UTF-8?q?=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruseFcltMng/prfmncReg/chkgdnReg/page.tsx | 9 +- .../prfmncReg/chkgdnReg/rainChkgdn/excel.tsx | 186 +++++++++--------- .../prfmncReg/chkgdnReg/rswrtChkgdn/index.tsx | 12 ++ apps/wr/components/lib/func/TableData.tsx | 3 +- .../chkgdTable/rswtChkgd/rswtChkgdTable.tsx | 2 +- 5 files changed, 113 insertions(+), 99 deletions(-) diff --git a/apps/wr/app/ruseFcltMng/prfmncReg/chkgdnReg/page.tsx b/apps/wr/app/ruseFcltMng/prfmncReg/chkgdnReg/page.tsx index 3517adfc3..0468cfd3b 100644 --- a/apps/wr/app/ruseFcltMng/prfmncReg/chkgdnReg/page.tsx +++ b/apps/wr/app/ruseFcltMng/prfmncReg/chkgdnReg/page.tsx @@ -41,6 +41,7 @@ export default function Page() { isRainSttn, rswtChkgdnInit, + rswtChkPolInit, rswtChkDetilsUpdate, rswtChkDelete, rswtrChkExcelDownload, @@ -85,7 +86,6 @@ export default function Page() { }, [rainChkgdn.isInit, rainChkInit]); useEffect(() => { - if (rswtChkgdn.excelList[0]?.data.length > 1) excelArrayDownload( "중수도시설 지도점검", @@ -119,7 +119,6 @@ export default function Page() { const handleClick = useCallback( (data: any) => { - if (data) setIsModal({ open: !isModal.open, data: data }); }, [isModal] @@ -181,8 +180,10 @@ export default function Page() { label={""} selectClass={""} selectArray={rainChkgdn.fcltDiv} - onSelectValue={(val: string | number) => - setSelFcltDiv(String(val)) + onSelectValue={(val: string | number) =>{ + if(val === "RST") rswtChkPolInit(); + setSelFcltDiv(String(val)) + } } value={selFcltDiv ?? rainChkgdn.fcltDiv[0]?.val} /> diff --git a/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/excel.tsx b/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/excel.tsx index ed23740d0..5754c02fc 100644 --- a/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/excel.tsx +++ b/apps/wr/app/store/prfmncReg/chkgdnReg/rainChkgdn/excel.tsx @@ -32,106 +32,106 @@ export const buildingToExcelType = ( sggCdoe: SelectDataType[], ) => { const excelData: string[][] = []; - buildings.forEach((building) => { - useTypes.forEach((useType) => { - excelData.push([ - building.bdstInfoPk.toString(), - sidoCode.find((sido) => sido.val === building.ctpvCd.toString()) - ?.text || "", - sggCdoe.find((sido) => sido.val === building.sggCd.toString()) - ?.text || "", - building.daddr, - building.bdstNm, - "", - "", - "", - "", - useType, - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - ]); - }); + buildings.forEach((building) => { + useTypes.forEach((useType) => { + excelData.push([ + building.bdstInfoPk.toString(), + sidoCode.find((sido) => sido.val === building.ctpvCd.toString()) + ?.text || "", + sggCdoe.find((sido) => sido.val === building.sggCd.toString()) + ?.text || "", + building.daddr, + building.bdstNm, + "", + "", + "", + "", + useType, + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + ]); }); - return excelData; - + }); + return excelData; + }; export const excelToRainChkData = (excelData: any, year: string) => { const rainChkgdData: rainChkZodType[] = excelData.map((item: any) => { if (item["점검일"] !== undefined) { - const checkYmd = item["점검일"].replace(/\./g, "") - let vltnDt = item["과태료 부과일(위반일)"] - if (vltnDt !== undefined) { - vltnDt = vltnDt .replace(/\./g, "") - } - const makeGuidDetail = Array.from({ length: 12 }, (_, i) => { - let month = `${i + 1}`; - const splyData = item[`보급_${month}월`]; - const ruseData = item[`빗물_${month}월`]; - if (month.length < 2) month = "0" + month; - return { - utztnUsgCd: item["이용용도"], - ym: year + month, - chckYmd: checkYmd, - splyUswtrUtztnQnt: splyData !== undefined ? splyData : 0, - ruseFcltUtztnQnt: ruseData !== undefined ? ruseData : 0, - flg: "RNB", - }; - }); - - return { - - bdstRuseFcltFk: Number(item["NO"]), - chckYmd: checkYmd, - spwtPositn: item["유량측정방법"], - rgtr: TEST_UUID, - oilqMeasMthd: item["운영관리형태"], - anlOperCst: Number(item["연간운영비(원/년)"]) ?? 0, - operMngCd: item["유량측정방법"], - guideDetails: makeGuidDetail, - rainyDetails: [ - { + const checkYmd = item["점검일"].replace(/\./g, "") + let vltnDt = item["과태료 부과일(위반일)"] + if (vltnDt !== undefined) { + vltnDt = vltnDt ? vltnDt.replace(/\./g, "") : ""; + } + const makeGuidDetail = Array.from({ length: 12 }, (_, i) => { + let month = `${i + 1}`; + const splyData = item[`보급_${month}월`]; + const ruseData = item[`빗물_${month}월`]; + if (month.length < 2) month = "0" + month; + return { utztnUsgCd: item["이용용도"], - ph: Number(item["PH"]) ?? 0, - trbt: Number(item["탁도"]) ?? 0, - grssClfg: Number(item["총대장균군수"]) ?? 0, - etc: item["기타"] ?? "", // 필드 누락 방지 - vltnDt: vltnDt, - vltnMttr: item["위반사항"], - levyAmt: Number(item["과태료부과금액(천원)"]) ?? 0, - rgtr: TEST_UUID, - }, - ], - }; - } + ym: year + month, + chckYmd: checkYmd, + splyUswtrUtztnQnt: Number(splyData ?? 0), + ruseFcltUtztnQnt: Number(ruseData ?? 0), + flg: "RNB", + }; + }); + + return { + + bdstRuseFcltFk: Number(item["NO"]), + chckYmd: checkYmd, + spwtPositn: item["유량측정방법"] ?? "", + rgtr: TEST_UUID, + oilqMeasMthd: item["운영관리형태"] ?? "", + anlOperCst: Number(item["연간운영비(원/년)"]) ?? 0, + operMngCd: item["유량측정방법"] ?? "", + guideDetails: makeGuidDetail, + rainyDetails: [ + { + utztnUsgCd: item["이용용도"] ?? "", + ph: Number(item["PH"] ?? 0), + trbt: Number(item["탁도"] ?? 0), + grssClfg: Number(item["총대장균군수"] ?? 0), + etc: item["기타"] ?? "", // 필드 누락 방지 + vltnDt: vltnDt ?? "", + vltnMttr: item["위반사항"] ?? "", + levyAmt: Number(item["과태료부과금액(천원)"] ?? 0), + rgtr: TEST_UUID, + }, + ], + }; + } }).filter((el: any) => el !== undefined); return rainChkgdData; }; diff --git a/apps/wr/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/index.tsx b/apps/wr/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/index.tsx index c6737b31e..8b7c5f91d 100644 --- a/apps/wr/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/index.tsx +++ b/apps/wr/app/store/prfmncReg/chkgdnReg/rswrtChkgdn/index.tsx @@ -55,6 +55,7 @@ type rswtChkgdnActions = { rswtChkDelete: (chkgdnPks: number[]) => void; rswtChkDetilsUpdate: (rswtChkDetails: rswtrChkDetailsZodType[]) => void; rswtChkPolAndGuide: (chkGdnPk: number) => void; + rswtChkPolInit: () => void; rwstPolAndGuideUpdate: (rswtChk: rswtChkZodType[]) => void; rswtChkHeadChange: (rswtChkgdn: rswtChkgdnState, isEdit: boolean) => void; }; @@ -237,6 +238,17 @@ export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = ( })); } catch (error) {} }, + rswtChkPolInit: () => { + try { + return set((state: rswtChkgdnState) => ({ + ...state, + rswtChkgdn: { + ...state.rswtChkgdn, + rswtChkPolGuide: undefined, + }, + })); + } catch (error) {} + }, rwstPolAndGuideUpdate: async (rswtChk: rswtChkZodType[]) => { try { const chData = await makeMdfrChk(rswtChk); diff --git a/apps/wr/components/lib/func/TableData.tsx b/apps/wr/components/lib/func/TableData.tsx index c21a7e70a..dbb3aa7a6 100644 --- a/apps/wr/components/lib/func/TableData.tsx +++ b/apps/wr/components/lib/func/TableData.tsx @@ -152,7 +152,8 @@ export const chRowspanTable = ( onChange={(e) => { handleChange(rowIndex, head.id, e.target.value); }} - value={value} + value={value ?? ""} + disabled={!selectedIds.includes(row.chkgdnPk)} /> ) : ( (head.id === "totalSplyUswtrUtztnQnt" || head.id === "totalRuseFcltUtztnQnt" || head.id === "splyUswtrUtztnQnt" || head.id === "ruseFcltUtztnQnt") ? ( diff --git a/apps/wr/components/ui/table/chkgdTable/rswtChkgd/rswtChkgdTable.tsx b/apps/wr/components/ui/table/chkgdTable/rswtChkgd/rswtChkgdTable.tsx index 20db75f50..da6cacc9a 100644 --- a/apps/wr/components/ui/table/chkgdTable/rswtChkgd/rswtChkgdTable.tsx +++ b/apps/wr/components/ui/table/chkgdTable/rswtChkgd/rswtChkgdTable.tsx @@ -62,7 +62,7 @@ export default function RswtChkgdTable({ [makeTableData, handleRswtClick] ); useEffect(() => { - if (rswtChkgdn.rswtChkPolGuide.length > 0) + if (rswtChkgdn.rswtChkPolGuide?.length > 0) handleRswtClick(rswtChkgdn.rswtChkPolGuide[0]); }, [rswtChkgdn.rswtChkPolGuide]);