diff --git a/apps/wr/app/ruseFcltMng/fcltSttn/pbnstSttn/page.tsx b/apps/wr/app/ruseFcltMng/fcltSttn/pbnstSttn/page.tsx index 7a7a125d2..13a71263e 100644 --- a/apps/wr/app/ruseFcltMng/fcltSttn/pbnstSttn/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltSttn/pbnstSttn/page.tsx @@ -38,16 +38,18 @@ export default function PbnstSttn() { ); const [isChHead, setIsChHead] = useState(false); const [bdstTable, setBdstTable] = useState(); + const [pageNation, setPageNation] = useState(1); const [pbnDetaileData, setPbnDetaileData] = useState<{ isModal: boolean; data: customPbnst; }>({ isModal: false, data: {} as customPbnst }); + const [returnType, setReturnType] = useState({} as ReturnType); const [pbnRuseNm, setPbnRuseNm] = useState(""); const excelClick = useCallback(() => { - pbnstSttnSearch("1", "10000", ref.current, "", searchYear); - }, [pbnstSttnSearch, searchYear, ref.current]); + pbnstSttnSearch(true, "1", "20", ref.current, "", searchYear); + }, [pbnstSttnSearch]); const cellCLick = useCallback( (index: number | undefined) => { @@ -75,7 +77,7 @@ export default function PbnstSttn() { }, [pbnstSttn.excelList]); useEffect(() => { if (!pbnstSttn.isInit) { - pbnSttnInit("1", "13", ref.current, searchYear); + pbnSttnInit("1", "20", ref.current, searchYear); } }, [pbnstSttn.isInit, pbnSttnInit, ref.current]); useEffect(() => { @@ -91,6 +93,10 @@ export default function PbnstSttn() { // pbnNmSearch(String(pageNation), "23", ref.current, pbnRuseNm, searchYear); // }, [pbnRuseNm,pageNation]); + useEffect(() => { + pbnstSttnSearch(false, String(pageNation), "20", returnType, pbnRuseNm, searchYear); + }, [pageNation]); + useEffect(() => { if (pbnstSttn.pbnstDetail.pbnstRuseFcltPk) setPbnDetaileData({ @@ -127,34 +133,36 @@ export default function PbnstSttn() { } leftChildren={
- - setSearchYear(String(val)) - } - /> - - { - setPbnRuseNm(e || ""); - }} - /> -
+ + setSearchYear(String(val)) + } + /> + + { + setPbnRuseNm(e || ""); + }} + /> + } queryClick={function (returnType: ReturnType): void { - pbnstSttnSearch("1", "20", returnType, pbnRuseNm, searchYear); + console.log("시군구코드", returnType) + setReturnType(returnType); + pbnstSttnSearch(false, "1", "20", returnType, pbnRuseNm, searchYear); }} excelClick={excelClick} - initClick={function (): void {}} + initClick={function (): void { }} btnClass={btnClass} ref={ref} isAdmin={false} @@ -178,8 +186,9 @@ export default function PbnstSttn() { }} onPageChange={(page: number) => { pbnstSttnSearch( + false, String(page), - String(13), + String(20), ref.current, pbnRuseNm, searchYear diff --git a/apps/wr/app/ruseFcltMng/prfmncSttn/pbnstPrfmncSttn/page.tsx b/apps/wr/app/ruseFcltMng/prfmncSttn/pbnstPrfmncSttn/page.tsx index da0b7871d..c60ba1673 100644 --- a/apps/wr/app/ruseFcltMng/prfmncSttn/pbnstPrfmncSttn/page.tsx +++ b/apps/wr/app/ruseFcltMng/prfmncSttn/pbnstPrfmncSttn/page.tsx @@ -6,13 +6,11 @@ import { initValInUsage, initValOutUsage, subTotalObj, totalObj, type FcPrfType, import { excelPrfmncSttnParsing } from "@/app/store/prfmncSttn/pbnstPrfmncSttn/excel"; import { excelDownload, yearOptions } from "@/components/lib/func/commom"; import SearchInputText from "@/components/ui/searchInput/searchInput"; -import { CHART_FORM, ContentsDiv, MainChart, ScrollArea, SearchBaseForm, SearchInput, SelectBox, Title, UiTable, type ChartConfig, type ReturnType } from "@common/business_components"; +import { CHART_FORM, ContentsDiv, MainChart, SearchBaseForm, SelectBox, Title, UiTable, type ChartConfig, type ReturnType } from "@common/business_components"; import ListDiv from "@common/business_components/ui/list_div"; -import { Button, Label, Table, TableBody, TableHeader } from "@common/components/ui"; +import { Button, Label } from "@common/components/ui"; import { useCallback, useEffect, useRef, useState } from "react"; import toast, { Toaster } from "react-hot-toast"; -import { headMakeprfmnc } from "../../prfmncReg/chkgdnReg/TableHead"; -import { InputTableBody } from "@/components/lib/func/TableData"; export default function PbnstPrfmncSttn() { const { diff --git a/apps/wr/app/stats/rswtStat/page.tsx b/apps/wr/app/stats/rswtStat/page.tsx index 997e95ca5..39d5bc00a 100644 --- a/apps/wr/app/stats/rswtStat/page.tsx +++ b/apps/wr/app/stats/rswtStat/page.tsx @@ -33,7 +33,7 @@ export default function RswtStat() { data: (excelData as unknown as JSON[]) ?? [], fileName: "중수도재이용통계", sheetNameArray: ["Sheet1"], - headerRange: "A1:O1" + headerRange: "A1:N1" }) } @@ -59,7 +59,7 @@ export default function RswtStat() { return { "시도": item.cityText, "개소": item.ctpvCnt, - "건축연면적(m³)": item.archArea, + // "건축연면적(m³)": item.archArea, "처리용량(m³)": item.filtrTrtmfctCpct, "물사용량(m³/년)": item.wtrUsqty, "중수도+대체수이용량(m³/년)": item.rswtAltSum, diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx index 6ceb75531..ce30e3893 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx @@ -1,5 +1,5 @@ import type { TableUpperProps } from "@/app/store/common/type/header"; -import { getFetch, postFectch, putFectch } from "@/components/lib/api"; +import { getFetch, getFetchWithCount, postFectch, putFectch } from "@/components/lib/api"; import { z } from "zod"; import { makeMdfr, makeRstr } from "../bdstReg"; import toast from "react-hot-toast"; @@ -95,7 +95,9 @@ export const rainFacStateExport: rainFacState = { }; const initFetch = async (code:string|number) => { - const rainRes =await getFetch("wr", `/reuseFc/rainyInfoList/1/10/${code}`); + // const rainRes =await getFetch("wr", `/reuseFc/rainyInfoList/1/10/${code}`); + const rainRes =await getFetchWithCount("wr", `/reuseFc/rainyInfoList/1/10/${code}`); + console.log("데이터", rainRes) return rainRes; }; export const rainFacActionsExport: (set: any) => rainFacSActions = ( @@ -143,7 +145,9 @@ export const rainFacActionsExport: (set: any) => rainFacSActions = ( rainSearch: async(txt:string,pageNation:number) =>{ try{ - const rainRes = await getFetch('wr' , `/reuseFc/rainyInfoList/${pageNation}/20/41` +(txt? `/${txt}`:'')) + // const rainRes = await getFetch('wr' , `/reuseFc/rainyInfoList/${pageNation}/20/41` +(txt? `/${txt}`:'')) + const rainRes = await getFetchWithCount('wr' , `/reuseFc/rainyInfoList/${pageNation}/20/41` +(txt? `/${txt}`:'')) + console.log("rainRes", rainRes) set((state: rainFacState) => { return { rain: { diff --git a/apps/wr/app/store/ruseFcltMng/fcltSttn/htdflSttn/headList.tsx b/apps/wr/app/store/ruseFcltMng/fcltSttn/htdflSttn/headList.tsx index 756c47b9b..bb58b6ea5 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltSttn/htdflSttn/headList.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltSttn/htdflSttn/headList.tsx @@ -105,7 +105,7 @@ export const htdflSttHeadListExport: z.infer = [ export const htdflSttNodeListExport: CommonTableProps[] = [ { id: "bdnstInfo", - title: "1.건축물정보", + title: "건축물정보", visible: true, row: 1, rowSpan: 1, @@ -113,7 +113,7 @@ export const htdflSttNodeListExport: CommonTableProps[] = [ }, { id: "htdflFcltInfo", - title: "2.온배수 시설현황", + title: "온배수 시설현황", visible: true, row: 1, rowSpan: 1, @@ -121,7 +121,7 @@ export const htdflSttNodeListExport: CommonTableProps[] = [ }, { id: "htdflMngInfo", - title: "3.온배수운영현황", + title: "온배수운영현황", visible: true, row: 1, rowSpan: 1, diff --git a/apps/wr/app/store/ruseFcltMng/fcltSttn/pbnstSttn/headList.tsx b/apps/wr/app/store/ruseFcltMng/fcltSttn/pbnstSttn/headList.tsx index 7c2953932..075b91261 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltSttn/pbnstSttn/headList.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltSttn/pbnstSttn/headList.tsx @@ -100,7 +100,7 @@ export const pbnstSttNodeListExport: CommonTableProps[] = [ colSpan: 3, }, { - id: "operMngCd", + id: "rgnNm", title: "환경청", visible: true, row: 1, @@ -116,7 +116,7 @@ export const pbnstSttNodeListExport: CommonTableProps[] = [ colSpan: 2, }, { - id: "bdnstNm", + id: "bscFctNm", title: "시설명", visible: true, row: 1, @@ -124,7 +124,7 @@ export const pbnstSttNodeListExport: CommonTableProps[] = [ colSpan: 1, }, { - id: "locDiv", + id: "efflWqltStndrdNm", title: "지역구분", visible: true, row: 1, @@ -148,7 +148,7 @@ export const pbnstSttNodeListExport: CommonTableProps[] = [ colSpan: 1, }, { - id: "rusNm", + id: "ruseUtztnFcltNm", title: "재이용시설명", visible: true, row: 1, @@ -180,7 +180,7 @@ export const pbnstSttNodeListExport: CommonTableProps[] = [ colSpan: 4, }, { - id: "a", + id: "rvbsn", title: "권역", upName: "catchment", visible: true, @@ -189,7 +189,7 @@ export const pbnstSttNodeListExport: CommonTableProps[] = [ colSpan: 1, }, { - id: "aaa", + id: "lgbsn", title: "단위유역", upName: "catchment", visible: true, @@ -198,7 +198,7 @@ export const pbnstSttNodeListExport: CommonTableProps[] = [ colSpan: 1, }, { - id: "aaaa", + id: "mdmbsn", title: "중권역", upName: "catchment", visible: true, @@ -207,7 +207,7 @@ export const pbnstSttNodeListExport: CommonTableProps[] = [ colSpan: 1, }, { - id: "cityText", + id: "sido", title: "시도", upName: "adminDiv", visible: true, @@ -216,7 +216,7 @@ export const pbnstSttNodeListExport: CommonTableProps[] = [ colSpan: 1, }, { - id: "sggText", + id: "gugun", title: "시군구", upName: "adminDiv", visible: true, @@ -234,7 +234,7 @@ export const pbnstSttNodeListExport: CommonTableProps[] = [ colSpan: 1, }, { - id: "trbt", + id: "splyExtraCpct", title: "하수처리량(m³/일)", upName: "rusSup", visible: true, @@ -252,7 +252,7 @@ export const pbnstSttNodeListExport: CommonTableProps[] = [ colSpan: 1, }, { - id: "total", + id: "usageTotal", title: "합계", upName: "yearResult", visible: true, @@ -261,7 +261,7 @@ export const pbnstSttNodeListExport: CommonTableProps[] = [ colSpan: 1, }, { - id: "ithlWtr", + id: "inUsage", title: "장내용수", upName: "yearResult", visible: true, @@ -270,7 +270,7 @@ export const pbnstSttNodeListExport: CommonTableProps[] = [ colSpan: 1, }, { - id: "othlWtr", + id: "outUsage", title: "장외용수", upName: "yearResult", visible: true, @@ -279,7 +279,7 @@ export const pbnstSttNodeListExport: CommonTableProps[] = [ colSpan: 1, }, { - id: "mngMeth", + id: "operMthd", title: "운영방식", upName: "mngInfo", visible: true, @@ -297,7 +297,7 @@ export const pbnstSttNodeListExport: CommonTableProps[] = [ colSpan: 1, }, { - id: "firstDay", + id: "bgngDt", title: "시작일", upName: "mngInfo", visible: true, @@ -306,7 +306,7 @@ export const pbnstSttNodeListExport: CommonTableProps[] = [ colSpan: 1, }, { - id: "LastDay", + id: "endDt", title: "종료일", upName: "mngInfo", visible: true, diff --git a/apps/wr/app/store/ruseFcltMng/fcltSttn/pbnstSttn/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltSttn/pbnstSttn/index.tsx index 33bce5520..76a13943f 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltSttn/pbnstSttn/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltSttn/pbnstSttn/index.tsx @@ -1,6 +1,6 @@ import type { CommonTableProps, TableUpperProps } from "@/app/store/common/type/header"; import type { z } from "zod"; -import { pbnSttHeadListExport, pbnstSttNodeListExport, ruseDmdHeadListExport, ruseFcltHeadListExport, ruseFcltNodeListExport, ruseGuranteeHeadListExport, rusePplHeadListExport, ruseSplyHeadListExport } from "./headList"; +import { pbnSttHeadListExport, pbnstSttNodeListExport, ruseDmdHeadListExport, ruseFcltHeadListExport, ruseFcltNodeListExport, ruseGuranteeHeadListExport, rusePplHeadListExport, ruseSplyHeadListExport } from "./headList"; import { fetchType, getFetch, postFectch } from "@/components/lib/api"; import { controlHeadView } from "../rainSttn"; import type { sttnHeadListType } from "../rainSttn/headList"; @@ -21,12 +21,12 @@ export type pbnstSttnState = { pbnstSttHeadList: CommonTableProps[]; pbnstSttNodeList: CommonTableProps[]; pbnstDetail: customPbnst; - ruseFcltNodeList:TableUpperProps[] - ruseSplyHeadList:TableUpperProps[] - rusePplHeadList:TableUpperProps[] - ruseGuranteeHeadList:TableUpperProps[] - ruseDmdHeadList:TableUpperProps[] - ruseFcltHeadList:TableUpperProps[] + ruseFcltNodeList: TableUpperProps[] + ruseSplyHeadList: TableUpperProps[] + rusePplHeadList: TableUpperProps[] + ruseGuranteeHeadList: TableUpperProps[] + ruseDmdHeadList: TableUpperProps[] + ruseFcltHeadList: TableUpperProps[] excelList: []; isInit: boolean; }; @@ -35,11 +35,12 @@ export type pbnstSttnState = { type pbnstSttnActions = { pbnstChSttnHead: (headList: z.infer) => void; pbnstSttnSearch: ( + isExcel: boolean, page: string, total: string, reurnValue: ReturnType, searchNm: string | undefined, - year: string + year: string, ) => void; pbnSttnInit: ( page: string, @@ -63,12 +64,12 @@ export const pbnstSttnStateExport: pbnstSttnState = { pbnstSttn: { pbnstSttHeadList: pbnstSttHeadList, pbnstSttNodeList: pbnstSttNodeList, - ruseFcltNodeList:ruseFcltNodeListExport, - ruseSplyHeadList:ruseSplyHeadListExport, - rusePplHeadList:rusePplHeadListExport, - ruseGuranteeHeadList:ruseGuranteeHeadListExport, - ruseDmdHeadList:ruseDmdHeadListExport, - ruseFcltHeadList:ruseFcltHeadListExport, + ruseFcltNodeList: ruseFcltNodeListExport, + ruseSplyHeadList: ruseSplyHeadListExport, + rusePplHeadList: rusePplHeadListExport, + ruseGuranteeHeadList: ruseGuranteeHeadListExport, + ruseDmdHeadList: ruseDmdHeadListExport, + ruseFcltHeadList: ruseFcltHeadListExport, pbnstSttnRes: [], pbnstDetail: {} as customPbnst, pbnstSearchData: [], @@ -84,33 +85,39 @@ const hasuListFetch = async ( searchNm: string | undefined, year: string ) => { + let url = ""; if (reurnValue.partValue === "A") { url = `/prcsFclt/info/${page}/${total}/${reurnValue.partValue}/${ - reurnValue.sidoValue ? reurnValue.sidoValue : reurnValue.sigunValue + // reurnValue.sidoValue ? reurnValue.sidoValue : reurnValue.sigunValue + reurnValue.sigunValue !== '0' ? reurnValue.sigunValue : reurnValue.sidoValue }/0/1/SW` } else if (reurnValue.partValue === "R") { - url = `/prcsFclt/info/${page}/${total}/${reurnValue.partValue}/${ - reurnValue.regionValue - ? reurnValue.regionValue - : reurnValue.unitWaterShedValue - ? reurnValue.unitWaterShedValue - : reurnValue.middleRegionValue + url = `/prcsFclt/info/${page}/${total}/${reurnValue.partValue}/${reurnValue.regionValue + ? reurnValue.regionValue + : reurnValue.unitWaterShedValue + ? reurnValue.unitWaterShedValue + : reurnValue.middleRegionValue }/0/1/SW` } else { url = `/prcsFclt/info/${page}/${total}/${reurnValue.envPartValue}/${reurnValue.sidoValue ? reurnValue.sidoValue : reurnValue.sigunValue}/0/1/SW` - + } - if( searchNm&& searchNm?.length>0){ - url+="/"+searchNm + if (searchNm && searchNm?.length > 0) { + url += "/" + searchNm } + + console.log("주소", url) const pbnList = await getFetch(fetchType.COMMON, url); + console.log("pbnList", pbnList) const arrayList = pbnList.map((item: pubHasuType) => item.bscFctCd); + console.log("어레이리스트", arrayList) const getRuseList = await postFectch( `/reuseFc/pubDetailList/${year}`, arrayList, fetchType.WR ); + console.log("getRuseList", getRuseList) const checkWrRegListRes = getRuseList.data; const data: WaterReuseFacility[] = checkWrRegListRes.map( @@ -167,11 +174,11 @@ const hasuListFetch = async ( outUsage: usage.outUsage, operMthd: item.operList[0]?.operMthd, rprtvBzenty: item.operList[0]?.rprtvBzenty, - bgngDt: moment(item.operList[0]?.bgngDt).format("YYYY-MM-DD") ?? "", + bgngDt: moment(item.operList[0]?.bgngDt).format("YYYY-MM-DD") ?? "", endDt: moment(item.operList[0]?.endDt).format("YYYY-MM-DD") ?? "", searchNm: findData.bscFctNm, searchPk: findData.bscFctCd, - prfList:item?.prfList??[] + prfList: item?.prfList ?? [] }; } ); @@ -196,13 +203,15 @@ export const pbnstSttnActionsExport: (set: any) => pbnstSttnActions = ( })); }, pbnstSttnSearch: async ( + isExcel: boolean, page: string, total: string, reurnValue: ReturnType, searchNm: string | undefined, - year: string + year: string, ) => { try { + console.log("여기") const pbnstSttnRes = await hasuListFetch( page, total, @@ -210,9 +219,12 @@ export const pbnstSttnActionsExport: (set: any) => pbnstSttnActions = ( searchNm, year ); + console.log("pbnstSttnRes", pbnstSttnRes); - if (Number(total) > 9000) { + // if (Number(total) > 9000) { + if (isExcel) { const pbnstExcel = excelPbnstSttnParsing(pbnstSttnRes); + set((state: pbnstSttnState) => { return { ...state, @@ -253,7 +265,6 @@ export const pbnstSttnActionsExport: (set: any) => pbnstSttnActions = ( year ); - console.log('pbnstSttnRes ', pbnstSttnRes) set((state: pbnstSttnState) => { return { ...state, @@ -271,10 +282,9 @@ export const pbnstSttnActionsExport: (set: any) => pbnstSttnActions = ( getPbnStnDetail: async (pbnstRuseFcltPk: string) => { try { let pbnstDetail = await getFetch("wr", `/reuseFc/pubFc/${pbnstRuseFcltPk}`); - if(pbnstDetail.length>=0){ - pbnstDetail= pbnstDetail.find((item: customPbnst) =>item.pbnstRuseFcltPk === pbnstRuseFcltPk) + if (pbnstDetail.length >= 0) { + pbnstDetail = pbnstDetail.find((item: customPbnst) => item.pbnstRuseFcltPk === pbnstRuseFcltPk) } - console.log( 'pbnstDetail ', pbnstDetail) set((state: pbnstSttnState) => { return { ...state, @@ -294,16 +304,16 @@ export const pbnstSttnActionsExport: (set: any) => pbnstSttnActions = ( reurnValue: ReturnType, searchNm: string | undefined, year: string - ) => { + ) => { try { - - const pbnstSttnRes = await hasuListFetch( - page, - total, - reurnValue, - searchNm, - year - ); + + const pbnstSttnRes = await hasuListFetch( + page, + total, + reurnValue, + searchNm, + year + ); set((state: pbnstSttnState) => { return { diff --git a/apps/wr/app/store/stats/rswtStat/excel.tsx b/apps/wr/app/store/stats/rswtStat/excel.tsx index 35f567253..7c6e2b4cc 100644 --- a/apps/wr/app/store/stats/rswtStat/excel.tsx +++ b/apps/wr/app/store/stats/rswtStat/excel.tsx @@ -25,7 +25,7 @@ export const excelRswtStat = (excelList:RswtStatProps[]) : (string | number)[][] //String(item.instlCst) ?? "", "", //건축물면적 - item.archArea ?? "", + // item.archArea ?? "", //처리용량 item.filtrTrtmfctCpct ?? "", //물사용량 diff --git a/apps/wr/app/store/stats/rswtStat/headList.tsx b/apps/wr/app/store/stats/rswtStat/headList.tsx index 877089092..c0860fea7 100644 --- a/apps/wr/app/store/stats/rswtStat/headList.tsx +++ b/apps/wr/app/store/stats/rswtStat/headList.tsx @@ -13,21 +13,22 @@ export const rswtStatHeadListExport :TableUpperProps[]=[ row:0, rowSpan:2 }, - { - id: "a", - title: "시설현황", - row:0, - colSpan:2 - }, - { - id: "archArea", - title: "건축연면적(m³)", - row:1, - }, + // { + // id: "a", + // title: "시설현황", + // row:0, + // colSpan:2 + // }, + // { + // id: "archArea", + // title: "건축연면적(m³)", + // row:1, + // }, { id: "filtrTrtmfctCpct", title: "처리용량(m³)", - row:1, + row:0, + rowSpan:2 }, { id: "wtrUsqty", diff --git a/packages/common/business_components/src/ui/date_month_picker/index.tsx b/packages/common/business_components/src/ui/date_month_picker/index.tsx index d318b561f..1b97d9ce1 100644 --- a/packages/common/business_components/src/ui/date_month_picker/index.tsx +++ b/packages/common/business_components/src/ui/date_month_picker/index.tsx @@ -17,6 +17,7 @@ type MonthPickerProps = { field: { value: string; onChange: (date: string) => void }; // yyyyMM 문자열 selectClass?: string; readOnly?: boolean; + startYear?: number; // 시작 연도 props 추가 }; // yyyyMM → Date 객체 @@ -37,6 +38,7 @@ export const DateMonthPicker = ({ field, selectClass, readOnly = false, + startYear, }: MonthPickerProps) => { const [open, setOpen] = useState(false); @@ -75,6 +77,7 @@ export const DateMonthPicker = ({ diff --git a/packages/common/business_components/src/ui/date_month_picker/mothPicker.tsx b/packages/common/business_components/src/ui/date_month_picker/mothPicker.tsx index acf17fba4..6afbde5e6 100644 --- a/packages/common/business_components/src/ui/date_month_picker/mothPicker.tsx +++ b/packages/common/business_components/src/ui/date_month_picker/mothPicker.tsx @@ -28,9 +28,10 @@ export type MonthPickerProps = { newMonth: Date | undefined, shouldClosePopover?: boolean ) => void; + startYear?: number; }; -export function MonthPicker({ currentMonth, onMonthChange }: MonthPickerProps) { +export function MonthPicker({ currentMonth, onMonthChange, startYear }: MonthPickerProps) { const today = startOfToday(); const currentYear = today.getFullYear(); @@ -46,7 +47,12 @@ const selectedYear = parseInt(yearFromProp); - const yearRange = Array.from({ length: 21 }, (_, i) => currentYear - 20 + i); + // startYear가 없으면 기존과 동일하게 (현재년도 - 20년부터 현재년도까지) + // startYear가 있으면 해당 년도부터 현재년도까지, 내림차순으로 정렬 + const yearRange = startYear + ? Array.from({ length: currentYear - startYear + 1 }, (_, i) => currentYear - i) + : Array.from({ length: 21 }, (_, i) => currentYear - 20 + i); + const months = eachMonthOfInterval({ start: fullYearStart, end: yearEnd }); const getMonthButtonClass = (month: Date) => @@ -77,7 +83,7 @@ const selectedYear = parseInt(yearFromProp); onMonthChange(newDate, false); }} > - + diff --git a/packages/common/business_components/src/ui/dialog_ui/index.tsx b/packages/common/business_components/src/ui/dialog_ui/index.tsx index bbb27d327..df7fffd3a 100644 --- a/packages/common/business_components/src/ui/dialog_ui/index.tsx +++ b/packages/common/business_components/src/ui/dialog_ui/index.tsx @@ -1,7 +1,7 @@ import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader } from "@common/components"; import { cn } from "../../lib/utils"; -type ModalType = { +type ModalType = { bodyClass: string; body: React.ReactNode; open?: boolean; @@ -10,43 +10,45 @@ type ModalType = { noFooterYn?: 'N' | 'Y'; headerTitle?: string; footerContent?: React.ReactNode; + useDirectRender?: boolean; } -export function UiModal({ - bodyClass, - body, - open, +export function UiModal({ + bodyClass, + body, + open, onOpenChange, noHeaderYn = 'N', noFooterYn = 'N', headerTitle, - footerContent + footerContent, + useDirectRender = false }: ModalType) { - + return ( <> - + - {noHeaderYn === 'N' && ( - - - {headerTitle} - - - )} - {(open && body) ? -
{body}
:<> - - - - } - {noFooterYn === 'N' && ( - - {footerContent} - - )} -
-
+ {noHeaderYn === 'N' && ( + + + {headerTitle} + + + )} + {(open && body) ? + useDirectRender + ? body + :
{body}
+ : <> + } + {noFooterYn === 'N' && ( + + {footerContent} + + )} + +
); } diff --git a/packages/common/business_components/src/ui/search_form_left/index.tsx b/packages/common/business_components/src/ui/search_form_left/index.tsx index e7858df2a..4f36c078c 100644 --- a/packages/common/business_components/src/ui/search_form_left/index.tsx +++ b/packages/common/business_components/src/ui/search_form_left/index.tsx @@ -199,7 +199,7 @@ function SearchFormLeft({ isShowPart = false, children, selectSidoData = [], sel setRtnSidoText(selectedSido?.text || ''); } initializeSigunData(val); - onSelectValue(selectSigunData[0]?.val || '0', 'sigun'); + onSelectValue('0', 'sigun'); break; case 'sigun': if (setRtnSigunValue) { diff --git a/packages/common/business_components/src/ui/select/index.tsx b/packages/common/business_components/src/ui/select/index.tsx index 6fa78ccf2..8843aa04e 100644 --- a/packages/common/business_components/src/ui/select/index.tsx +++ b/packages/common/business_components/src/ui/select/index.tsx @@ -1,3 +1,5 @@ +// selectBox + import { Label } from "@common/components"; import React from "react"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "./lib/selectBox"; @@ -5,7 +7,8 @@ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from ". /** 차트 기본 스타일 */ interface SelectBox1 { text:string, - val:string|number + val:string|number, + hidden?: boolean } const SelectBox = React.forwardRef< @@ -20,17 +23,29 @@ const SelectBox = React.forwardRef< readOnly?: boolean // readOnly 속성 추가 } >(({ label, className, selectClass, selectArray, onSelectValue, value, readOnly = false }, ref)=>{ - const placeHolder = selectArray?.[0]?.text ?? ""; + // hidden이 true인 첫 번째 항목을 placeholder로 사용 + const hiddenItem = selectArray.find(item => item.hidden); + const placeHolder = hiddenItem?.text ?? "선택"; + + // hidden이 true인 항목만 드롭다운에서 제외 + const visibleItems = selectArray.filter(item => !item.hidden); + + // 현재 값이 hidden 항목이거나 빈 값인 경우 undefined로 설정하여 placeholder가 표시되도록 함 + const currentValue = value !== undefined && + hiddenItem && + (String(value) === String(hiddenItem.val) || value === "" || value === "0" || value === 0) + ? undefined + : (value !== undefined ? String(value) : undefined); return (
{label && } - - {selectArray.map((selectArray) => ( + {visibleItems.map((selectArray) => ( {selectArray.text} ))} diff --git a/packages/common/business_components/src/ui/table/index-2.tsx b/packages/common/business_components/src/ui/table/index-2.tsx index b6a9750b0..9756d2dfa 100644 --- a/packages/common/business_components/src/ui/table/index-2.tsx +++ b/packages/common/business_components/src/ui/table/index-2.tsx @@ -110,9 +110,7 @@ export function UiTable2({ ? 'text-right' : head.align === 'center' ? 'text-center' - : typeof el[head.id] === 'number' - ? 'text-right' - : 'text-center' + : 'text-center' } ${cellClick && idx === index ? '!font-[1000] cursor-pointer' : cellClick ? 'cursor-pointer' : ''} @@ -141,7 +139,7 @@ export function UiTable2({
{/* 페이지네이션 하단 고정 */} - { ( + {(
void )| undefined; + cellClick: ((index: number | undefined, headId: string) => void) | undefined; onPageChange: (page: number) => void; className?: string; resetPageNo?: boolean; children?: React.ReactNode | undefined; boldArray?: number[]; resetSelection?: boolean; - index?:number; + index?: number; } type UiHeadProps = { id: string; title: string; align?: string; - visible?:boolean; + visible?: boolean; } -export function UiTable({ tableData, headlist, pageSize, total, headName, children, cellClick, onPageChange, className = '', resetPageNo = false, boldArray = [], resetSelection = false, index=-1 }: 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(index); const [isCheck, seIsCheck] = useState(false); @@ -54,77 +54,75 @@ export function UiTable({ tableData, headlist, pageSize, total, headName, childr onPageChange(page); } - const handleCellClick = (index: number,headId:string )=> { + const handleCellClick = (index: number, headId: string) => { if (cellClick) { - cellClick(index,headId); + cellClick(index, headId); setIdx(index); } }; - + return ( <> {headName ?

{headName}

-
: <>} +
: <>}
{children ? children : } - {tableData.length > 0 ? tableData?.map((el: { [key: string]: any}, index) => ( + {tableData.length > 0 ? tableData?.map((el: { [key: string]: any }, index) => ( {headlist - .filter((item) => item.visible != false) - .map((head) => ( - head.id && head.id.length > 1 && ( - boldArray.includes(index) - ? - handleCellClick(index, head.id)} - key={`cell-${head.id}-${index}`} - > - {typeof el[head.id] !== 'number'?String(el[head.id] ?? ''): String(el[head.id]).includes('.') - ? String(el[head.id]).split('.').map((part, index) => - index === 0 ? part.replace(/\B(?=(\d{3})+(?!\d))/g, ",") : part - ).join('.') - : String(el[head.id] ?? '').replace(/\B(?=(\d{3})+(?!\d))/g, ",")} - - : - handleCellClick(index, head.id)} - key={`cell-${head.id}-${index}`} - > - {typeof el[head.id] === 'boolean' - ? { - el[head.id]= checked; - }} - > - - - : - typeof el[head.id] !== 'number'? - String(el[head.id] ?? ''): - String(el[head.id]).includes('.') - ? String(el[head.id]).split('.').map((part, index) => - index === 0 ? part.replace(/\B(?=(\d{3})+(?!\d))/g, ",") : part - ).join('.') - : - String(el[head.id] ?? '').replace(/\B(?=(\d{3})+(?!\d))/g, ",")} - - ) - ))} + .filter((item) => item.visible != false) + .map((head) => ( + head.id && head.id.length > 1 && ( + boldArray.includes(index) + ? + handleCellClick(index, head.id)} + key={`cell-${head.id}-${index}`} + > + {typeof el[head.id] !== 'number' ? String(el[head.id] ?? '') : String(el[head.id]).includes('.') + ? String(el[head.id]).split('.').map((part, index) => + index === 0 ? part.replace(/\B(?=(\d{3})+(?!\d))/g, ",") : part + ).join('.') + : String(el[head.id] ?? '').replace(/\B(?=(\d{3})+(?!\d))/g, ",")} + + : + handleCellClick(index, head.id)} + key={`cell-${head.id}-${index}`} + > + {typeof el[head.id] === 'boolean' + ? { + el[head.id] = checked; + }} + > + + + : + typeof el[head.id] !== 'number' ? + String(el[head.id] ?? '') : + String(el[head.id]).includes('.') + ? String(el[head.id]).split('.').map((part, index) => + index === 0 ? part.replace(/\B(?=(\d{3})+(?!\d))/g, ",") : part + ).join('.') + : + String(el[head.id] ?? '').replace(/\B(?=(\d{3})+(?!\d))/g, ",")} + + ) + ))} )) : <>} diff --git a/packages/common/business_components/src/ui/table/uiPageNations.tsx b/packages/common/business_components/src/ui/table/uiPageNations.tsx index 891fc4c81..ca1f8e0c0 100644 --- a/packages/common/business_components/src/ui/table/uiPageNations.tsx +++ b/packages/common/business_components/src/ui/table/uiPageNations.tsx @@ -40,7 +40,8 @@ export default function UiPageNations(commonPageNationsProps: CommonPageNationsP { + onClick={(e) => { + e.preventDefault(); if (startPage > 1) handlePageChange(startPage - 1); }} /> @@ -53,7 +54,9 @@ export default function UiPageNations(commonPageNationsProps: CommonPageNationsP handlePageChange(pageNum)} + onClick={(e) => { + e.preventDefault(); + handlePageChange(pageNum)}} > {pageNum} @@ -65,7 +68,8 @@ export default function UiPageNations(commonPageNationsProps: CommonPageNationsP { + onClick={(e) => { + e.preventDefault(); if (endPage < totalPages) handlePageChange(endPage + 1); }} />