Merge commit 'f2f7c86cd1810f5d0c74440f711a0b00ffdf4848' into iipbs/wr/dev
iipbs_wr / build (push) Waiting to run

This commit is contained in:
leedj312
2025-07-07 20:33:02 +09:00
17 changed files with 260 additions and 212 deletions
@@ -38,16 +38,18 @@ export default function PbnstSttn() {
);
const [isChHead, setIsChHead] = useState(false);
const [bdstTable, setBdstTable] = useState<WaterReuseFacility[]>();
const [pageNation, setPageNation] = useState(1);
const [pbnDetaileData, setPbnDetaileData] = useState<{
isModal: boolean;
data: customPbnst;
}>({ isModal: false, data: {} as customPbnst });
const [returnType, setReturnType] = useState<ReturnType>({} as ReturnType);
const [pbnRuseNm, setPbnRuseNm] = useState<string>("");
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={
<div className="col-span-3 flex items-center">
<SelectBox
className="w-48 h-full text-2xl"
label="연도"
selectClass={"w-full "}
selectArray={yearOptions}
value={searchYear}
onSelectValue={(val: string | number) =>
setSearchYear(String(val))
}
/>
<Label className="w-64 mt-2 mx-4 text-xl text-gray-600">
{"하수처리시설명 "}
</Label>
<SearchInput
className={"text-2xl w-full ㅍ"}
label=""
textValue={pbnRuseNm || ""}
setText={(e) => {
setPbnRuseNm(e || "");
}}
/>
</div>
<SelectBox
className="w-48 h-full text-2xl"
label="연도"
selectClass={"w-full "}
selectArray={yearOptions}
value={searchYear}
onSelectValue={(val: string | number) =>
setSearchYear(String(val))
}
/>
<Label className="w-64 mt-2 mx-4 text-xl text-gray-600">
{"하수처리시설명 "}
</Label>
<SearchInput
className={"text-2xl w-full ㅍ"}
label=""
textValue={pbnRuseNm || ""}
setText={(e) => {
setPbnRuseNm(e || "");
}}
/>
</div>
}
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
@@ -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 {
+2 -2
View File
@@ -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,
@@ -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: {
@@ -105,7 +105,7 @@ export const htdflSttHeadListExport: z.infer<typeof sttnHeadListType> = [
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,
@@ -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,
@@ -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<typeof sttnHeadListType>) => 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 {
+1 -1
View File
@@ -25,7 +25,7 @@ export const excelRswtStat = (excelList:RswtStatProps[]) : (string | number)[][]
//String(item.instlCst) ?? "",
"",
//건축물면적
item.archArea ?? "",
// item.archArea ?? "",
//처리용량
item.filtrTrtmfctCpct ?? "",
//물사용량
+13 -12
View File
@@ -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",
@@ -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 = ({
<MonthPicker
currentMonth={parsedDate}
onMonthChange={handleSelect}
startYear={startYear}
/>
</PopoverContent>
</Popover>
@@ -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);
}}
>
<SelectTrigger className="w-[120px] h-7">
<SelectTrigger className="w-[140px] h-9 text-base">
<SelectValue placeholder="년도" />
</SelectTrigger>
<SelectContent>
@@ -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 (
<>
<Dialog open={open} onOpenChange={onOpenChange}>
<Dialog open={open} onOpenChange={onOpenChange}>
<DialogContent className={bodyClass}>
{noHeaderYn === 'N' && (
<DialogHeader>
<DialogDescription>
{headerTitle}
</DialogDescription>
</DialogHeader>
)}
{(open && body) ?
<div> {body}</div>:<></>
}
{noFooterYn === 'N' && (
<DialogFooter className="sm:justify-start">
{footerContent}
</DialogFooter>
)}
</DialogContent>
</Dialog>
{noHeaderYn === 'N' && (
<DialogHeader>
<DialogDescription>
{headerTitle}
</DialogDescription>
</DialogHeader>
)}
{(open && body) ?
useDirectRender
? body
: <div>{body}</div>
: <></>
}
{noFooterYn === 'N' && (
<DialogFooter className="sm:justify-start">
{footerContent}
</DialogFooter>
)}
</DialogContent>
</Dialog>
</>
);
}
@@ -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) {
@@ -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 (
<div className={className+" flex items-center"} ref={ref}>
{label && <Label className="whitespace-nowrap w-20 text-xl text-gray-600">{label}</Label>}
<Select onValueChange={onSelectValue} value={value !== undefined ? String(value) : undefined}>
<Select onValueChange={onSelectValue} value={currentValue} disabled={readOnly}>
<SelectTrigger className={selectClass?selectClass:"flex-1 p-2 border rounded"}>
<SelectValue placeholder={placeHolder} />
</SelectTrigger>
<SelectContent>
{selectArray.map((selectArray) => (
{visibleItems.map((selectArray) => (
<SelectItem key={selectArray.val} value={String(selectArray.val)}>{selectArray.text}</SelectItem>
))}
</SelectContent>
@@ -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({
</div>
{/* 페이지네이션 하단 고정 */}
{ (
{(
<div className="sticky left-0 right-0 bottom-0 bg-white z-20 mt-5">
<UiPageNations
total={total}
@@ -9,28 +9,28 @@ import { boolean } from "zod";
type UiTableProps = {
headName: React.ReactNode | undefined;
tableData: { [key: string]:any}[];
tableData: { [key: string]: any }[];
headlist: UiHeadProps[];
pageSize: number;
total: number;
cellClick : ((index:number|undefined, headId:string)=>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<number>(1);
const [idx, setIdx] = useState<number>(index);
const [isCheck, seIsCheck] = useState<boolean>(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 ? <div className="card-header">
<h3 className="text-2xl font-medium text-label">{headName}</h3>
</div> : <></>}
</div> : <></>}
<div className={`card !m-[1.2rem] !p-0r ${className}`}>
<Table variant="secondary">
<TableHeader className="font-bold">
{children ? children : <HeadMakeColSpan upHeadList={headlist} />}
</TableHeader>
<TableBody className='text-center'>
{tableData.length > 0 ? tableData?.map((el: { [key: string]: any}, index) => (
{tableData.length > 0 ? tableData?.map((el: { [key: string]: any }, index) => (
<TableRow key={`row-${index}`}>
{headlist
.filter((item) => item.visible != false)
.map((head) => (
head.id && head.id.length > 1 && (
boldArray.includes(index)
?
<TableCell
className={`${head.align === 'right' ? 'text-right' : head.align === 'center' ? 'text-center' : typeof el[head.id] === 'number' ? 'text-right' : 'text-center'} ${
cellClick && idx === index ? '!font-[1000] cursor-pointer' :
cellClick ? 'cursor-pointer' : ''
} !font-bold`}
onClick={() => 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, ",")}
</TableCell>
:
<TableCell
className={`${head.align === 'right' ? 'text-right' : head.align === 'center' ? 'text-center' : typeof el[head.id] === 'number' ? 'text-right' : 'text-center'} ${
cellClick && idx === index ? '!font-[1000] cursor-pointer' :
cellClick ? 'cursor-pointer' : ''
}`}
onClick={() => handleCellClick(index, head.id)}
key={`cell-${head.id}-${index}`}
>
{typeof el[head.id] === 'boolean'
?<Checkbox
checked={el[head.id] === true}
onCheckedChange={(checked) => {
el[head.id]= checked;
}}
>
<Check className="h-6 w-6 text-primary" />
</Checkbox>
:
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, ",")}
</TableCell>
)
))}
.filter((item) => item.visible != false)
.map((head) => (
head.id && head.id.length > 1 && (
boldArray.includes(index)
?
<TableCell
className={`${head.align === 'right' ? 'text-right' : head.align === 'center' ? 'text-center' : 'text-center'} ${cellClick && idx === index ? '!font-[1000] cursor-pointer' :
cellClick ? 'cursor-pointer' : ''
} !font-bold`}
onClick={() => 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, ",")}
</TableCell>
:
<TableCell
className={`${head.align === 'right' ? 'text-right' : head.align === 'center' ? 'text-center' : 'text-center'} ${cellClick && idx === index ? '!font-[1000] cursor-pointer' :
cellClick ? 'cursor-pointer' : ''
}`}
onClick={() => handleCellClick(index, head.id)}
key={`cell-${head.id}-${index}`}
>
{typeof el[head.id] === 'boolean'
? <Checkbox
checked={el[head.id] === true}
onCheckedChange={(checked) => {
el[head.id] = checked;
}}
>
<Check className="h-6 w-6 text-primary" />
</Checkbox>
:
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, ",")}
</TableCell>
)
))}
</TableRow>
)) : <></>}
</TableBody>
@@ -40,7 +40,8 @@ export default function UiPageNations(commonPageNationsProps: CommonPageNationsP
<PaginationItem>
<PaginationPrevious
href="#"
onClick={() => {
onClick={(e) => {
e.preventDefault();
if (startPage > 1) handlePageChange(startPage - 1);
}}
/>
@@ -53,7 +54,9 @@ export default function UiPageNations(commonPageNationsProps: CommonPageNationsP
<PaginationLink
href="#"
isActive={pageNum === pageProps.cur}
onClick={() => handlePageChange(pageNum)}
onClick={(e) => {
e.preventDefault();
handlePageChange(pageNum)}}
>
{pageNum}
</PaginationLink>
@@ -65,7 +68,8 @@ export default function UiPageNations(commonPageNationsProps: CommonPageNationsP
<PaginationItem>
<PaginationNext
href="#"
onClick={() => {
onClick={(e) => {
e.preventDefault();
if (endPage < totalPages) handlePageChange(endPage + 1);
}}
/>