하수재이용시설현황 화면 구현, 버튼 기능 추가해야됨

This commit is contained in:
jyha00
2025-05-16 18:04:18 +09:00
parent 1466e04638
commit 613bfd035b
7 changed files with 400 additions and 216 deletions
+10
View File
@@ -100,6 +100,16 @@ export default function Home() {
<Link href="matMng/matDmd/coReg">수요처 등록</Link>
</Button>
</div>
<div className="col-span-2">
<Button className="w-full">
<Link href="matMng/matDmd/coSttn">수요처 관리</Link>
</Button>
</div>
<div className="col-span-2">
<Button className="w-full">
<Link href="matMng/matDmd/ldrmntCoSttn">잠재수요처 관리</Link>
</Button>
</div>
</div>
</div>
</div>
@@ -65,20 +65,6 @@ export default function HtdflSttn() {
bdstTable !== undefined
) {
setDetailModal({ isOpen: true, data: bdstTable[index] });
} else if (
headId === "chBuildingYn" &&
index !== undefined &&
bdstTable !== undefined
) {
if (
bdstTable[index] &&
bdstTable[index]?.chgBuilding[0]?.bdstChgNm !== null
) {
setBdstChgProps({
isOpen: true,
chBuilding: bdstTable[index].chgBuilding,
});
}
}
};
useEffect(() => {
@@ -106,6 +92,7 @@ export default function HtdflSttn() {
useEffect(() => {
if (htdflSttnRes.length > 0 && code.cityCd.length > 0) {
console.log("htdflSttnRes", htdflSttnRes);
const data = tableData(htdflSttnRes, { code });
const chData = data
.map((item: any) => ({
@@ -205,16 +192,6 @@ export default function HtdflSttn() {
bodyClass={"w-[40vw] max-w-none max-h-[calc(100%-70px)]"}
body={<SttnDetailModal type={"HTB"} formObj={detailModal.data} />}
/>
<UiModal
bodyClass={""}
open={bdstChgProps.isOpen}
body={
<BdstChgModal chgBuilding={bdstChgProps.chBuilding}></BdstChgModal>
}
onOpenChange={(open) => {
setBdstChgProps({ ...bdstChgProps, isOpen: open });
}}
/>
</ContentsDiv>
</>
);
@@ -1,26 +1,36 @@
"use client";
import { useWrStore } from "@/app/store";
import { btnClass } from "@/app/store/common/code";
import {
ContentsDiv,
SearchDiv,
SearchFormLeft,
SearchFormRight,
SelectBox,
SearchBaseForm,
Title,
UiModal,
UiTable,
type ReturnType,
} from "@common/business_components/ui";
import ListDiv from "@common/business_components/ui/list_div";
import { Button } from "@common/components/ui";
import HeadChModal from "@/components/ui/modal/sttn/headChModal/headChModal";
import { useState } from "react";
import { headMakeprfmnc } from "../../prfmncReg/chkgdnReg/TableHead";
import { useCallback, useEffect, useRef, useState } from "react";
import { HeadMakeColSpan } from "@common/business_components/ui/table/HeadMakeColSpan";
import type { customPbnst } from "@/app/store/ruseFcltMng/fcltReg/pbnstReg";
export default function PbnstSttn() {
const { code, rainSttn } = useWrStore((state) => state);
const { code, pbnstSttn } = useWrStore(
(state) => state
);
const ref = useRef<ReturnType>({} as ReturnType);
const [pageNation, setPageNation] = useState(1);
const [isChHead, setIsChHead] = useState(false);
const nodeList = headMakeprfmnc(rainSttn.pbnSttHeadList, rainSttn.pbnSttHeadNm);
const [bdstTable, setBdstTable] = useState<customPbnst[]>();
// const nodeList = headMakeprfmnc(pbnstSttn.pbnSttHeadList, pbnstSttn.pbnSttHeadNm);
const excelClick = useCallback(() => {
// if (codeData) pbnstSttnSearch(1, "10000", codeData);
}, []);
return (
<>
@@ -28,101 +38,56 @@ export default function PbnstSttn() {
<div className="grid grid-cols-4 gap-4 ">
<div className="col-span-4">
<Title title={"하수재이용 시설 현황"} />
<SearchDiv>
<SearchFormLeft>
<SelectBox
className={"col-span-2 w-full h-full text-2xl"}
label={"권역"}
selectClass={""}
selectArray={code.yn}
onSelectValue={() => {}}
value={""}
/>
<SelectBox
className={"col-span-2 w-full h-full text-2xl"}
label={"단위유역"}
selectClass={""}
selectArray={code.yn}
onSelectValue={() => {}}
value={""}
/>
<SelectBox
className={"col-span-2 w-full h-full text-2xl"}
label={"중권역"}
selectClass={""}
selectArray={code.yn}
onSelectValue={() => {}}
value={""}
/>
<SelectBox
className={"col-span-2 w-full h-full text-2xl"}
label={"환경청"}
selectClass={""}
selectArray={code.yn}
onSelectValue={() => {}}
value={""}
/>
<SelectBox
className={"col-span-2 w-full h-full text-2xl"}
label={"시도"}
selectClass={""}
selectArray={code.yn}
onSelectValue={() => {}}
value={""}
/>
<SelectBox
className={"col-span-2 w-full h-full text-2xl"}
label={"시군구"}
selectClass={""}
selectArray={code.yn}
onSelectValue={() => {}}
value={""}
/>
</SearchFormLeft>
<SearchFormRight>
<div className="space-y">
{/* 첫 줄: 버튼 3개 */}
<div className="flex flex-row space-x-2">
<Button size={"sm"} onClick={(e) => {}}>
조회
</Button>
<Button size={"sm"} onClick={() => {}}>
다운로드
</Button>
</div>
<div className="flex flex-row space-x-2 pt-3">
<Button
size={"sm"}
color="green"
onClick={() => {
setIsChHead(true);
}}
>
조회항목설정
</Button>
</div>
</div>
</SearchFormRight>
</SearchDiv>
<SearchBaseForm
selectSidoData={code.cityCd}
selectSigunData={code.sggCd}
selectRegionData={code.rvbsnCd}
selectUnitWaterShedData={code.lgbsnCd}
selectMiddleRegionData={code.mdmbsnCd}
selectEnvPartData={code.lclgvrnmntCd}
rightChildren={
<Button
className={btnClass}
onClick={() => {
setIsChHead(true);
}}
>
조회항목설정
</Button>
}
leftChildren={undefined}
queryClick={function (returnType: ReturnType): void {
// '{partValue: 'A', sidoValue: '0', sigunValue: '0', regionValue: '0', unitWaterShedValue: '0', …}'
let con;
if (returnType.sigunValue != "0") {
con = returnType.sigunValue;
} else {
con = returnType.sidoValue;
}
// pbnstSttnSearch(1, "20", con);
}}
excelClick={excelClick}
initClick={function (): void {}}
btnClass={btnClass}
ref={ref}
/>
</div>
</div>
<div className="grid grid-cols-6 gap-4 ">
<div className="col-span-6">
<ListDiv>
<UiTable
headName={undefined}
tableData={[]}
headlist={rainSttn.pbnSttHeadList}
pageSize={0}
total={0}
cellClick={undefined}
onPageChange={function (page: number): void {
throw new Error("Function not implemented.");
}}
>
{nodeList}
</UiTable>
headName={[]}
tableData={bdstTable || []}
children={
<HeadMakeColSpan upHeadList={pbnstSttn.pbnstSttNodeList} />
}
headlist={pbnstSttn.pbnstSttHeadList}
pageSize={20}
total={100000}
cellClick={(index: number | undefined,headId:string)=>{cellClick(index ?? undefined,headId)} }
onPageChange={setPageNation}
></UiTable>
</ListDiv>
</div>
</div>
@@ -132,7 +97,15 @@ export default function PbnstSttn() {
setIsChHead(!isChHead);
}}
bodyClass={""}
body={<HeadChModal headList={[]} type={""} />}
body={
<HeadChModal
type={"PBN"}
headList={pbnstSttn.pbnstSttHeadList.map((item) => ({
...item,
visible: item.visible ?? false,
}))}
/>
}
/>
</ContentsDiv>
</>
@@ -1,44 +1,28 @@
import type { chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn";
import type { TableUpperProps } from "../../fcltReg/rainReg";
import type { sttnHeadListType } from "../rainSttn/headList";
import type { CommonTableProps } from "@/app/store/common/type/headder";
import { z } from "zod";
export const pbnSttHeadNmExport: chHeadType[] = [
{ headNm: "catchment", text: "유역", length: 3 },
{ headNm: "adminDiv", text: "행정구역", length: 2 },
{ headNm: "rusSup", text: "재이용수공급가능량", length: 3 },
{ headNm: "yearResult", text: "연간실적정보(m³)", length: 3 },
{ headNm: "mngInfo", text: "운영정보", length: 4 },
];
// id는 다확인해야함
export const pbnSttHeadListExport: TableUpperProps[] = [
{ id: "a", title: "권역", upName: "catchment", upSequnce: 1, visible: true },
export const pbnSttHeadListExport: z.infer<typeof sttnHeadListType> = [
{ id: "a", title: "권역", visible: true },
{
id: "aaa",
title: "단위유역",
upName: "catchment",
upSequnce: 2,
visible: true,
},
{
id: "aaaa",
title: "중권역",
upName: "catchment",
upSequnce: 3,
visible: false,
visible: true,
},
{ id: "operMngCd", title: "환경청", visible: true },
{
id: "cityText",
title: "시도",
upName: "adminDiv",
upSequnce: 1,
visible: false,
visible: true,
},
{
id: "sggText",
title: "시군구",
upName: "adminDiv",
upSequnce: 2,
visible: true,
},
{ id: "bdnstNm", title: "시설명", visible: true },
@@ -51,119 +35,280 @@ export const pbnSttHeadListExport: TableUpperProps[] = [
{
id: "fcltCpct",
title: "시설용량(m³/일)",
upName: "rusSup",
upSequnce: 1,
visible: true,
},
{
id: "trbt",
title: "하수처리량(m³/일)",
upName: "rusSup",
upSequnce: 2,
visible: true,
},
{
id: "ruseCpct",
title: "재이용량(m³/일)",
upName: "rusSup",
upSequnce: 3,
visible: true,
},
{
id: "total",
title: "합계",
upName: "yearResult",
upSequnce: 1,
visible: true,
},
{
id: "ithlWtr",
title: "장내용수",
upName: "yearResult",
upSequnce: 2,
visible: true,
},
{
id: "othlWtr",
title: "장외용수",
upName: "yearResult",
upSequnce: 3,
visible: true,
},
{
id: "mngMeth",
title: "운영방식",
upName: "mngInfo",
upSequnce: 1,
visible: true,
},
{
id: "rprtvBzenty",
title: "대행업체",
upName: "mngInfo",
upSequnce: 2,
visible: true,
},
{
id: "firstDay",
title: "시작일",
upName: "mngInfo",
upSequnce: 3,
visible: true,
},
{
id: "LastDay",
title: "종료일",
upName: "mngInfo",
upSequnce: 4,
visible: true,
},
];
// 참고용 지워야함.
// rainChSttnHead: async (checkList: string[], type: string) => {
// const headList =
// type === "pbn"
// ? pbnSttHeadList
// : type === "rain"
// ? rainSttHeadList
// : null;
// let chNm = type === "pbn" ? pbnSttHeadNm : rainSttNodeList;
// headList?.forEach((item) => {
// if (checkList.find((ch) => ch === item.id)) {
// item.visible = false;
// if (item.upName) {
// const upNames = Array.isArray(item.upName)
// ? item.upName
// : [item.upName];
// upNames?.forEach((up) => {
// chNm.find((ch) => {
// if (ch.headNm === up) {
// ch.length = ch.length - 1;
// }
// });
// });
// }
// }
// });
// set((state: rainSttnState) => ({
// sttnCommon: {
// ...state.sttnCommon,
// pbnSttHeadList:
// type === "pbn" ? headList : state.sttnCommon.pbnSttHeadList,
// rainSttHeadList:
// type === "rain" ? headList : state.sttnCommon.rainSttHeadList,
// rainSttNodeList:
// type === "rain" ? chNm : state.sttnCommon.rainSttNodeList,
// pbnSttHeadNm: type === "rain" ? chNm : state.sttnCommon.pbnSttHeadNm,
// },
// }));
// },
// };
// };
// id는 다확인해야함
export const pbnstSttNodeListExport: CommonTableProps[] = [
{
id: "catchment",
title: "유역",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 3,
},
{
id: "operMngCd",
title: "환경청",
visible: true,
row: 1,
rowSpan: 2,
colSpan: 1,
},
{
id: "adminDiv",
title: "행정구역",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 2,
},
{
id: "bdnstNm",
title: "시설명",
visible: true,
row: 1,
rowSpan: 2,
colSpan: 1,
},
{
id: "locDiv",
title: "지역구분",
visible: true,
row: 1,
rowSpan: 2,
colSpan: 1,
},
{
id: "phone",
title: "전화번호",
visible: true,
row: 1,
rowSpan: 2,
colSpan: 1,
},
{
id: "fcltQuantity",
title: "시설용량(톤/일)",
visible: true,
row: 1,
rowSpan: 2,
colSpan: 1,
},
{
id: "rusNm",
title: "재이용시설명",
visible: true,
row: 1,
rowSpan: 2,
colSpan: 1,
},
{
id: "rusSup",
title: "재이용수공급가능량",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 3,
},
{
id: "yearResult",
title: "연간실적정보(m³)",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 3,
},
{
id: "mngInfo",
title: "운영정보",
visible: true,
row: 1,
rowSpan: 1,
colSpan: 4,
},
{
id: "a",
title: "권역",
upName: "catchment",
visible: true,
row: 2,
rowSpan: 1,
colSpan: 1,
},
{
id: "aaa",
title: "단위유역",
upName: "catchment",
visible: true,
row: 2,
rowSpan: 1,
colSpan: 1,
},
{
id: "aaaa",
title: "중권역",
upName: "catchment",
visible: true,
row: 2,
rowSpan: 1,
colSpan: 1,
},
{
id: "cityText",
title: "시도",
upName: "adminDiv",
visible: true,
row: 2,
rowSpan: 1,
colSpan: 1,
},
{
id: "sggText",
title: "시군구",
upName: "adminDiv",
visible: true,
row: 2,
rowSpan: 1,
colSpan: 1,
},
{
id: "fcltCpct",
title: "시설용량(m³/일)",
upName: "rusSup",
visible: true,
row: 2,
rowSpan: 1,
colSpan: 1,
},
{
id: "trbt",
title: "하수처리량(m³/일)",
upName: "rusSup",
visible: true,
row: 2,
rowSpan: 1,
colSpan: 1,
},
{
id: "ruseCpct",
title: "재이용량(m³/일)",
upName: "rusSup",
visible: true,
row: 2,
rowSpan: 1,
colSpan: 1,
},
{
id: "total",
title: "합계",
upName: "yearResult",
visible: true,
row: 2,
rowSpan: 1,
colSpan: 1,
},
{
id: "ithlWtr",
title: "장내용수",
upName: "yearResult",
visible: true,
row: 2,
rowSpan: 1,
colSpan: 1,
},
{
id: "othlWtr",
title: "장외용수",
upName: "yearResult",
visible: true,
row: 2,
rowSpan: 1,
colSpan: 1,
},
{
id: "mngMeth",
title: "운영방식",
upName: "mngInfo",
visible: true,
row: 2,
rowSpan: 1,
colSpan: 1,
},
{
id: "rprtvBzenty",
title: "대행업체",
upName: "mngInfo",
visible: true,
row: 2,
rowSpan: 1,
colSpan: 1,
},
{
id: "firstDay",
title: "시작일",
upName: "mngInfo",
visible: true,
row: 2,
rowSpan: 1,
colSpan: 1,
},
{
id: "LastDay",
title: "종료일",
upName: "mngInfo",
visible: true,
row: 2,
rowSpan: 1,
colSpan: 1,
}
];
@@ -0,0 +1,63 @@
import type { CommonTableProps } from "@/app/store/common/type/headder";
import type { customPbnst } from "../../fcltReg/pbnstReg";
import type { z } from "zod";
import {
pbnSttHeadListExport,
pbnstSttNodeListExport
} from "./headList";
import { fetchType, getFetch } from "@/components/lib/api";
import { controlHeadView } from "../rainSttn";
import type { sttnHeadListType } from "../rainSttn/headList";
const pbnstSttHeadList = pbnSttHeadListExport;
const pbnstSttNodeList = pbnstSttNodeListExport;
export type pbnstSttnState = {
pbnstSttn: {
pbnstSttnRes: customPbnst[];
pbnstSttHeadList: CommonTableProps[];
pbnstSttNodeList: CommonTableProps[];
excelList: [];
isInit: boolean;
};
};
type pbnstSttnActions = {
pbnstChSttnHead: (
headList: z.infer<typeof sttnHeadListType>,
) => void;
};
export type pbnstSttnType = pbnstSttnState & pbnstSttnActions;
export const pbnstSttnStateExport: pbnstSttnState = {
pbnstSttn: {
pbnstSttHeadList: pbnstSttHeadList,
pbnstSttNodeList: pbnstSttNodeList,
pbnstSttnRes:[],
excelList:[],
isInit: false,
},
};
export const pbnstSttnActionsExport: (set: any) => pbnstSttnActions = (
set: any
) => {
return {
pbnstChSttnHead: async (
headList: z.infer<typeof sttnHeadListType>
): Promise<void> => {
console.log('head ', headList)
const changeNodeList= controlHeadView(headList,pbnstSttNodeList)
return set((state: pbnstSttnState) => ({
pbnstSttn: {
...state.pbnstSttn,
pbnstSttHeadList: headList,
pbnstSttNodeList: changeNodeList,
},
}));
},
}
}
+19 -4
View File
@@ -36,6 +36,9 @@ import {
import { rainSttnActionsExport, rainSttnStateExport, type rainSttnState, type rainSttnType } from "./ruseFcltMng/fcltSttn/rainSttn";
import { rswtSttnActionsExport, rswtSttnStateExport, type rswtSttnState, type rswtSttnType } from "./ruseFcltMng/fcltSttn/rswtSttn";
import { htdflSttnActionsExport, htdflSttnStateExport, type htdflSttnState, type htdflSttnType } from "./ruseFcltMng/fcltSttn/htdflSttn";
import { pbnstSttnActionsExport, pbnstSttnStateExport, type pbnstSttnState, type pbnstSttnType } from "./ruseFcltMng/fcltSttn/pbnstSttn";
import { coSttnActionsExport, coSttnStateExport, type coSttnState, type coSttnType } from "./matDmd/coSttn"; // 옮겨야함
import { ldrmntCoSttnActionsExport, ldrmntCoSttnStateExport, type ldrmntCoSttnState, type ldrmntCoSttnType } from "./matDmd/ldrmntCoSttn"; // 옮겨야함
export type WrStore = comCodeType&
pubFacType &
@@ -48,7 +51,10 @@ export type WrStore = comCodeType&
rswtChkgdnType&
rainSttnType&
rswtSttnType&
htdflSttnType
htdflSttnType&
pbnstSttnType&
coSttnType& // 옮겨야함
ldrmntCoSttnType // 옮겨야함
;
export const StoreZus = (
@@ -63,7 +69,10 @@ export const StoreZus = (
rswtChkgdnState&
rainSttnState&
rswtSttnState&
htdflSttnState
htdflSttnState&
pbnstSttnState&
coSttnState& // 옮겨야함
ldrmntCoSttnState // 옮겨야함
= {
...comCodeStateExport,
@@ -77,7 +86,10 @@ export const StoreZus = (
...rswtChkgdnStateExport,
...rainSttnStateExport,
...rswtSttnStateExport,
...htdflSttnStateExport
...htdflSttnStateExport,
...pbnstSttnStateExport,
...coSttnStateExport, // 옮겨야함
...ldrmntCoSttnStateExport, // 옮겨야함
}
) => {
return createStore<WrStore>()((set) => {
@@ -100,7 +112,10 @@ export const StoreZus = (
...rswtChkgdnActionsExport(set),
...rainSttnActionsExport(set),
...rswtSttnActionsExport(set),
...htdflSttnActionsExport(set)
...htdflSttnActionsExport(set),
...pbnstSttnActionsExport(set),
...coSttnActionsExport(set), // 옮겨야함
...ldrmntCoSttnActionsExport(set), // 옮겨야함
};
});
};
@@ -8,7 +8,7 @@ import { useForm } from "react-hook-form";
import { z } from "zod";
export default function HeadChModal({headList, type }:{headList : z.infer<typeof sttnHeadListType> ,type:string }) {
const { rainChSttnHead , rswtChSttnHead, htdflChSttnHead} = useWrStore((state) => state);
const { rainChSttnHead , rswtChSttnHead, htdflChSttnHead, pbnstChSttnHead} = useWrStore((state) => state);
let items = headList.map(item => ({id:item.id, title:item.title, val:item.visible }));
@@ -28,12 +28,13 @@ export default function HeadChModal({headList, type }:{headList : z.infer<typeo
const onSubmit = (valueList : z.infer<typeof sttnHeadListType> ) =>{
if(type==='RNB'){
rainChSttnHead(valueList)
}else if(type=== 'RST'){
rswtChSttnHead(valueList)
}else if(type === 'HTB'){
htdflChSttnHead(valueList)
}else if(type === 'PBN'){
pbnstChSttnHead(valueList)
}
}