ui 수정사항 및 빗물 시설 현황 화면 추가

This commit is contained in:
leedj312
2025-04-22 09:39:57 +09:00
parent 8cb017fee6
commit 7e626b2566
24 changed files with 1113 additions and 495 deletions
+7
View File
@@ -62,6 +62,13 @@ export default function Home() {
</Link>
</Button>
</div>
<div className="col-span-2">
<Button className="w-full">
<Link href="ruseFcltMng/fcltSttn/rainSttn">
빗물재이용시설현황
</Link>
</Button>
</div>
</div>
</div>
@@ -89,13 +89,15 @@ export default function Home() {
/>
</SearchFormLeft>
<SearchFormRight>
<Button className="mr-4 rounded-lg" onClick={()=>{initHtdfl(searchTxt||"")}}>조회</Button>
<div className="flex flex-row space-x-2">
<Button size={"sm"} onClick={()=>{initHtdfl(searchTxt||"")}}>조회</Button>
<Button
className="mr-4 rounded-lg"
size={"sm"}
onClick={() => setIsNewReg(!issNewReg)}
>
신규등록
</Button>
</div>
</SearchFormRight>
</SearchDiv>
</div>
@@ -1,50 +1,62 @@
"use client";
import {
ContentsDiv,
ScrollArea,
SearchDiv,
SearchFormLeft,
SearchFormRight,
SearchInput,
SelectBox,
Title,
UiTable,
} from "@common/business_components";
import { Button } from "@common/components";
import { Button, Input } from "@common/components";
import { useWrStore } from "../../../store";
import { PbnstBuseForm } from "@/components/ui/form/fcltReg/pbnstReg/buseReg/component";
import { Tabs, TabsList, TabsTrigger, TabsContent } from "@common/components";
import { PbnstMngForm} from "@/components/ui/form/fcltReg/pbnstReg/mngReg/component";
import { PbnstMngForm } from "@/components/ui/form/fcltReg/pbnstReg/mngReg/component";
import { useEffect, useState } from "react";
import type { ruseFcltType } from "@/app/store/ruseFcltMng/fcltReg/pbnstReg";
import type { customPbnst, ruseFcltType } from "@/app/store/ruseFcltMng/fcltReg/pbnstReg";
import ListDiv from "@common/business_components/ui/list_div";
import { tableData } from "@/components/lib/func/commom";
export default function PublicReuseFaciltyInsert() {
const { pubFac , pubMng,mngMainValue} = useWrStore((state) => state);
const { pubFacHeadList, publicReuseFacilityData } = pubFac;
const { ruseFclt } = pubMng;
const { code, pubFac, pubHasuInit } = useWrStore((state) => state);
const { pubFacHeadList } = pubFac;
const [currentTab, setCurrentTab] = useState<string>('mng');
const {pbnstReg} = pubFac
const [currentTab, setCurrentTab] = useState<string>("mng");
const [fcltMng, setFcltMng] = useState<ruseFcltType[]>();
const [searchTxt, setSearchTxt] = useState<string>();
const [bdstTable, setbdstTable] = useState<customPbnst[]>();
useEffect(() => {
if (!pubFac.isInit) {
pubHasuInit(undefined);
}
}, [pubFac.isInit, pubHasuInit]);
useEffect(() => {
if (code.sggCd.length > 0) {
console.log("pbnstReg ", pbnstReg)
console.log( " wd ", tableData(pbnstReg, { code }))
setbdstTable(tableData(pbnstReg, { code }));
}
}, [code, pbnstReg]);
const searchDiv = "하수재이용시설 ";
const selectBox = [
{ text: "서울하수처리시설", val: "1_hasu" },
{ text: "서울1하수처리시설", val: "2_hasu" },
{ text: "서울2하수처리시설", val: "3_hasu" },
];
const headName = () => {
return <h1 className="pl-3 text-xl">○공공 하수처리시설 등록</h1>;
};
const onSelectValue = (val: string) => {
console.log(val);
};
const cellClick = (val: number | undefined) => {
if (val === undefined) return;
let data;
if (publicReuseFacilityData[val]) {
data = ruseFclt.filter(
(item) => item.swtrmtFcltFk === publicReuseFacilityData[val]?.swtrmtFcltFk
);
setFcltMng(data);
}
setFcltMng([]);
};
const resetContents = () => {
const resetContents = () => {
setFcltMng([]); // 빈 배열로 설정하여 신규 모드로 전환
};
@@ -54,67 +66,69 @@ const resetContents = () => {
return (
<>
<div className="grid grid-cols-2 gap-4 h-full">
<div className="col-span-4 ">
<h1 className="pl-3 text-xl"> 하수재이용시설 등록</h1>
<div className="m-8">
<ContentsDiv>
<div className="grid grid-cols-4 gap-4 ">
<div className="col-span-4 m-8">
<Title title={"하수재이용시설 등록"} />
<SearchDiv>
<div className="w-4/5 grid grid-cols-12 gap-1 mx-4">
<SelectBox
className="col-span-4"
label={searchDiv}
selectArray={selectBox}
onSelectValue={onSelectValue}
selectClass={undefined}
<SearchFormLeft>
<SearchInput
className="col-span-3 my-7"
label="건물명"
textValue={searchTxt || ""}
setText={(e) => {
setSearchTxt(e);
}}
/>
</div>
<div className="w-1/5 flex items-center justify-end">
</SearchFormLeft>
<SearchFormRight>
<Button className="mr-16 rounded-lg">조회</Button>
</div>
</SearchFormRight>
</SearchDiv>
</div>
</div>
<div className="col-span-1 pl-11 max-h-full">
<UiTable
tableData={publicReuseFacilityData}
headlist={pubFacHeadList}
pageSize={100}
total={10}
headName={headName()}
children={undefined} cellClick={cellClick} />
</div>
<div className="col-span-1 pr-6 max-h-full overflow-y-scroll">
<Tabs defaultValue="mng" onValueChange={handleTabChange}>
<div className="flex justify-between items-center">
<TabsList>
<TabsTrigger value="mng">시설정보</TabsTrigger>
<TabsTrigger value="buse">차수별정보</TabsTrigger>
</TabsList>
<Button className="rounded-lg" onClick={resetContents}>
신규등록
</Button>
</div>
<TabsContent className="max-h-full" value="mng">
<ScrollArea>
<PbnstMngForm
data={fcltMng || []}
/>
<div className="grid grid-cols-6 gap-4">
<div className="col-span-4">
<ScrollArea className="h-[60vh] rounded-md border p-2">
<div className="min-h-[300px]">
<UiTable
tableData={bdstTable || []}
headlist={pubFacHeadList}
pageSize={100}
total={10}
headName={"공공 하수처리시설 등록"}
cellClick={cellClick}
onPageChange={(page: number) => { } } children={undefined} />
</div>
</ScrollArea>
</TabsContent>
<TabsContent value="buse">
<ScrollArea>
<PbnstBuseForm />
</ScrollArea>
</TabsContent>
</Tabs>
</div>
<ListDiv className="col-span-2 pr-6 max-h-full overflow-y-scrolh1l">
<ScrollArea className="h-[60vh]">
<Tabs defaultValue="mng" onValueChange={handleTabChange}>
<div className="flex justify-between items-center">
<TabsList>
<TabsTrigger value="mng">시설정보</TabsTrigger>
<TabsTrigger value="buse">차수별정보</TabsTrigger>
</TabsList>
<Button className="rounded-lg" onClick={resetContents}>
신규등록
</Button>
</div>
<TabsContent className="max-h-full" value="mng">
<PbnstMngForm data={fcltMng || []} />
</TabsContent>
<TabsContent className="max-h-full" value="buse">
<PbnstBuseForm />
</TabsContent>
</Tabs>
</ScrollArea>
</ListDiv>
</div>
</div>
</ContentsDiv>
</>
);
}
@@ -123,9 +123,11 @@ export default function Home() {
}}
/>
</SearchFormLeft>
<SearchFormRight>
<SearchFormRight >
<div className="flex flex-row space-x-2">
<Button
className="mr-4 rounded-lg"
className=""
size={"sm"}
onClick={(e) => {
init(searchTxt || "");
}}
@@ -133,11 +135,13 @@ export default function Home() {
조회
</Button>
<Button
className="mr-4 rounded-lg"
size={"sm"}
className=""
onClick={() => setIsNewReg(!issNewReg)}
>
신규등록
</Button>
</div>
</SearchFormRight>
</SearchDiv>
</div>
@@ -88,8 +88,10 @@ export default function Home() {
/>
</SearchFormLeft>
<SearchFormRight>
<div className="flex flex-row space-x-2">
<Button
className="mr-4 rounded-lg"
size={"sm"}
className="mr-4 "
onClick={(e) => {
initRswt(searchTxt || "");
}}
@@ -97,11 +99,13 @@ export default function Home() {
조회
</Button>
<Button
className="mr-4 rounded-lg"
size={"sm"}
className="mr-4"
onClick={() => setIsNewReg(!issNewReg)}
>
신규등록
</Button>
</div>
</SearchFormRight>
</SearchDiv>
</div>
@@ -17,11 +17,10 @@ import HeadChModal from "@/components/ui/modal/headChModal/headChModal";
import { useState } from "react";
export default function PbnstSttn() {
const { code,pbnStt } = useWrStore((state) => state);
const { code, sttnCommon } = useWrStore((state) => state);
const [isChHead, setIsChHead] = useState(false);
const nodeList = headMakeprfmnc(pbnStt.pbnSttHeadList, pbnStt.pbnSttHeadNm);
const nodeList = headMakeprfmnc(sttnCommon.pbnSttHeadList, sttnCommon.pbnSttHeadNm);
return (
<>
@@ -81,17 +80,29 @@ export default function PbnstSttn() {
/>
</SearchFormLeft>
<SearchFormRight>
<Button className="mr-4 rounded-lg" onClick={(e) => {}}>
조회
</Button>
<Button className="mr-4 rounded-lg" onClick={() => {}}>
다운로드
</Button>
<Button className="mr-4 rounded-lg" onClick={() => {
// setIsChHead(true)
}}>
조회항목설정
</Button>
<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>
</div>
@@ -102,7 +113,7 @@ export default function PbnstSttn() {
<UiTable
headName={undefined}
tableData={[]}
headlist={pbnStt.pbnSttHeadList}
headlist={sttnCommon.pbnSttHeadList}
pageSize={0}
total={0}
cellClick={undefined}
@@ -115,13 +126,14 @@ export default function PbnstSttn() {
</ListDiv>
</div>
</div>
<UiModal open ={isChHead} onOpenChange ={()=>{setIsChHead(!isChHead)}} bodyClass={""} body={<HeadChModal/>}/>
<UiModal
open={isChHead}
onOpenChange={() => {
setIsChHead(!isChHead);
}}
bodyClass={""}
body={<HeadChModal />}
/>
</ContentsDiv>
</>
);
@@ -0,0 +1,247 @@
"use client";
import { useWrStore } from "@/app/store";
import {
ContentsDiv,
SearchDiv,
SearchFormLeft,
SearchFormRight,
SelectBox,
Title,
UiModal,
UiTable,
} from "@common/business_components/ui";
import ListDiv from "@common/business_components/ui/list_div";
import { Button, TableHead, TableRow } from "@common/components/ui";
import { useEffect, useState } from "react";
import type {
TableTripleProps,
} from "@/app/store/ruseFcltMng/fcltReg/rainReg";
import type { chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn";
import { tableData } from "@/components/lib/func/commom";
import HeadChModal from "@/components/ui/modal/headChModal/headChModal";
export const headMakeTriple = (
upHeadList: TableTripleProps[],
makeHeadNm: chHeadType[],
rowCount: number = 2
) => {
return (
<>
{Array.from({ length: rowCount }).map((_, i) => (
<TableRow key={i}>
{
upHeadList
.filter((head: TableTripleProps) => head.visible == true)
.map((head: TableTripleProps) =>
!head.upSequnce[i] ? (
<TableHead
className={`border border-gray-600 px-2 py-1 `}
rowSpan={2}
key={head.id}
>
{head.title}
</TableHead>
) : head.upSequnce[i] === 1 ? (
<TableHead
className={`border border-gray-600 px-2 py-1 `}
key={head.id}
rowSpan={1}
colSpan={
makeHeadNm.find((ch) => ch.headNm === head.upName[i])
?.length
}
>
{makeHeadNm.find((ch) => ch.headNm === head.upName[i])?.text}
</TableHead>
) : null
)}
</TableRow>
))}
<TableRow>
{upHeadList
.map((head: TableTripleProps) =>
makeHeadNm.find((ch) => ch.headNm === head?.upName[1] && head.visible ==true ) ? (
<TableHead
className={`border border-gray-600 px-2 py-1 `}
key={head.id}
>
{head.title}
</TableHead>
) : null
)}
</TableRow>
</>
);
};
export default function RainSttn() {
const { code, rain, init, sttnCommon } = useWrStore((state) => state);
const { rainRes } = rain;
const [isChHead, setIsChHead] = useState(false);
const [bdstTable, setBdstTable] = useState<any[]>();
const [tableHead, setTableHead] = useState<any[]>([]);
let nodeList = headMakeTriple(
sttnCommon.rainSttHeadList,
sttnCommon.rainSttHeadNm
);
useEffect(() => {
if (!rain.isInit) {
init(undefined);
}
}, [rain.isInit, init]);
useEffect(() => {
if (code.sggCd.length > 0) {
const data = tableData(rainRes, { code });
// data 는 위 JSON 객체라고 가정
console.log("sttnCommon " , sttnCommon.rainSttHeadList)
const unVisibleHead = sttnCommon.rainSttHeadList.filter(
(item: TableTripleProps) => item.visible === false
);
console.log("unVisibleHead " , unVisibleHead)
const chData = data
.map((item:any) =>({
...item,
...item.reuseBuilding[0],
...item.reuseBuilding[0].rainyObj
})).filter((item:any) => item.rainyObj !== undefined)
console.log("chData " , chData)
setBdstTable( chData);
}
}, [code, rainRes,sttnCommon]);
return (
<>
<ContentsDiv>
<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>
</div>
</div>
<div className="grid grid-cols-6 gap-4 ">
<div className="col-span-6">
<ListDiv>
<UiTable
headName={[]}
tableData={bdstTable || []}
headlist={sttnCommon.rainSttHeadList}
pageSize={0}
total={0}
cellClick={undefined}
onPageChange={function (page: number): void {
throw new Error("Function not implemented.");
}}
>
{nodeList}
</UiTable>
</ListDiv>
</div>
</div>
<UiModal
open={isChHead}
onOpenChange={() => {
setIsChHead(!isChHead);
}}
bodyClass={""}
body={<HeadChModal type={'rain'}/>}
/>
</ContentsDiv>
</>
);
}
@@ -33,40 +33,48 @@ export const headMakeprfmnc = (
) => {
return (
<>
<TableRow>
{upHeadList
.filter((data) => data.visible !=false)
.map((head: TableUpperProps) =>
!head.upSequnce ? (
<TableHead
className={ `border border-gray-600 px-2 py-1 `}
rowSpan={2} key={head.id}>
{head.title}
</TableHead>
) : head.upSequnce === 1 ? (
<TableHead
className={ `border border-gray-600 px-2 py-1 `}
key={head.id}
rowSpan={1}
colSpan={
makeHeadNm.find((ch) => ch.headNm === head.upName)?.length
}
>
{makeHeadNm.find((ch) => ch.headNm === head.upName)?.text}
</TableHead>
) : null
)}
.map((head: TableUpperProps) =>
!head.upSequnce ? (
<TableHead
className={`border border-gray-600 px-2 py-1 `}
rowSpan={2}
key={head.id}
>
{head.title}
</TableHead>
) : head.upSequnce === 1 ? (
<TableHead
className={`border border-gray-600 px-2 py-1 `}
key={head.id}
rowSpan={1}
colSpan={
makeHeadNm.find((ch) => ch.headNm === head.upName)?.length
}
>
{makeHeadNm.find((ch) => ch.headNm === head.upName)?.text}
</TableHead>
) : null
)}
</TableRow>
<TableRow>
{upHeadList
.filter((data) => data.visible !=false)
.map((head: TableUpperProps) =>
makeHeadNm.find((ch) => ch.headNm === head.upName) ? (
<TableHead
className={ `border border-gray-600 px-2 py-1 `}
key={head.id}>{head.title}</TableHead>
) : null
)}
.filter((data) => data.visible != false)
.map((head: TableUpperProps) =>
makeHeadNm.find((ch) => ch.headNm === head.upName) ? (
<TableHead
className={`border border-gray-600 px-2 py-1 `}
key={head.id}
>
{head.title}
</TableHead>
) : null
)}
</TableRow>
</>
);
@@ -76,8 +84,6 @@ export default function Page() {
const [isDetail, setIsDetail] = useState(false);
const [isExcel, setIsExcel] = useState(false);
const [testObj, setTestObj] = useState({});
const [selFcltDiv, setSelFcltDiv] = useState("RST");
@@ -110,30 +116,39 @@ export default function Page() {
/>
</SearchFormLeft>
<SearchFormRight>
<Button
className="mr-4 rounded-lg"
onClick={(e) => {
cellClick()
setIsDetail(!isDetail);
}}
>
조회
</Button>
<Button className="mr-4 rounded-lg" onClick={() => {}}>
삭제
</Button>
<Button className="mr-4 rounded-lg" onClick={() => {}}>
저장
</Button>
<Button className="mr-4 rounded-lg" onClick={() => {}}>
결과등록
</Button>
<Button className="mr-4 rounded-lg"
<div className="space-y">
<div className="flex flex-row space-x-2">
<Button
size={"sm"}
onClick={(e) => {
cellClick();
setIsDetail(!isDetail);
}}
>
조회
</Button>
<Button size={"sm"} onClick={() => {}}>
삭제
</Button>
<Button size={"sm"} onClick={() => {}}>
저장
</Button>
</div>
<div className="flex flex-row space-x-2 pt-3">
<Button size={"sm"} onClick={() => {}}>
결과등록
</Button>
<Button
color="green"
size={"sm"}
onClick={() => {
setIsExcel(!isDetail);
}}>
양식받기
</Button>
}}
>
양식받기
</Button>
</div>
</div>
</SearchFormRight>
</SearchDiv>
</div>
@@ -153,11 +168,12 @@ export default function Page() {
body={<ChkgdModal type={selFcltDiv} obj={testObj}></ChkgdModal>}
/>
<UiModal open={isExcel}
<UiModal
open={isExcel}
onOpenChange={setIsExcel}
bodyClass={"w-[40vw] max-w-none"}
body={<ChkgdExcel type={selFcltDiv}></ChkgdExcel>}
/>
body={<ChkgdExcel type={selFcltDiv}></ChkgdExcel>}
/>
</ContentsDiv>
);
}
+106 -5
View File
@@ -1,9 +1,10 @@
import { getFectch } from "@/components/lib/api";
import { getFetch } from "@/components/lib/api";
// Description: 공통코드
export type selectArray = {
text: string;
val: string | number;
adstDliStrCd?: string
};
export const yn :selectArray[]=[
@@ -100,6 +101,16 @@ export type comCodeState = {
bdstUsgCd: selectArray[];
cityCd: selectArray[];
sggCd: selectArray[];
rvbsnCd:selectArray[];
mdmbsnCd:selectArray[];
lgbsnCd:selectArray[];
lclgvrnmntCd:selectArray[];
orgwtKndCd:selectArray[];
yn:selectArray[];
};
@@ -108,7 +119,7 @@ export type comCodeState = {
export type comCodeType = comCodeState & comCodeActions;
export const getSggCd = async (set: any) => {
const sgg = await getFectch("common", "/addr/sgg");
const sgg = await getFetch("common", "/addr/sgg");
const sggCd = sgg.map((item: any) => ({
val: Number(item.adstDstrCd),
text: item.gugun,
@@ -121,7 +132,7 @@ export const getSggCd = async (set: any) => {
}));
};
export const getCityCd = async (set: any) => {
const city = await getFectch("common", "/addr/city");
const city = await getFetch("common", "/addr/city");
const cityCd = city.map((item: any) => ({
val: Number(item.adstDstrCd),
text: item.sido,
@@ -135,6 +146,92 @@ export const getCityCd = async (set: any) => {
}));
};
// 권역 API 호출 함수 추가
export const getRegionCd = async (set: any) => {
try{
const rvbsn = await getFetch("common", "/addr/sarea");
const rvbsnCd = rvbsn.map((item: any) => ({
val: Number(item.rvbsnCd),
text: item.rvbsn,
}));
rvbsnCd.unshift({val:0,text:'전체'})
set((state: comCodeState) => ({
code: {
...state.code,
rvbsnCd: rvbsnCd,
},
}));
}catch(error){
console.error('권역 데이터를 가져오는데 실패했습니다:', error);
}
};
// 중권역 API 호출 함수 추가
export const getMiddleRegionCd = async (set: any) => {
try{
const mdmbsn = await getFetch("common", "/addr/midArea");
const mdmbsnCd = mdmbsn.map((item: any) => ({
val: Number(item.rvbsnCd),
text: item.mdmbsn,
}));
mdmbsnCd.unshift({val:0,text:'전체'})
set((state: comCodeState) => ({
code: {
...state.code,
mdmbsnCd: mdmbsnCd,
},
}));
}catch(error){
console.error('중권역 데이터를 가져오는데 실패했습니다:', error);
}
};
// 단위유역 API 호출 함수 추가
export const getUnitWaterShedCd =async (set: any) => {
try{
const lgbsn = await getFetch("common", "/addr/largeArea");
const lgbsnCd = lgbsn.map((item: any) => ({
val: Number(item.rvbsnCd),
text: item.lgbsn,
}));
lgbsnCd.unshift({val:0,text:'전체'})
set((state: comCodeState) => ({
code: {
...state.code,
lgbsnCd: lgbsnCd,
},
}));
}catch(error){
console.error('대영역 데이터를 가져오는데 실패했습니다:', error);
}
};
// 환경청 데이터
export const getEnvPartCd =async (set: any) => {
try{
const lclgvrnmnt = await getFetch('common', '/addr/govArea');
const lclgvrnmntCd = lclgvrnmnt.map((item: any) => ({
val: Number(item.lclgvrnmntCd),
text: item.lclgvrnmntNm,
adstDliStrCd:item.adstDliStrCd
}));
lclgvrnmntCd.unshift({val:0,text:'전체' ,adstDliStrCd:''})
set((state: comCodeState) => ({
code: {
...state.code,
lclgvrnmntCd: lclgvrnmntCd,
},
}));
}catch(error){
console.error('환경청 데이터를 가져오는데 실패했습니다:', error);
}
};
export const comCodeStateExport: comCodeState = {
code: {
isInit: false,
@@ -144,6 +241,10 @@ export const comCodeStateExport: comCodeState = {
orgwtKndCd:orgwtKndCd,
cityCd: [],
sggCd: [],
rvbsnCd:[],
mdmbsnCd:[],
lgbsnCd:[],
lclgvrnmntCd:[],
yn:yn
},
};
@@ -158,14 +259,14 @@ export type comCodeActions = {
export const codeActionExport: (set: any) => comCodeActions = (set: any) => {
return {
codeInit: async () => {
const sgg = await getFectch("common", "/addr/sgg");
const sgg = await getFetch("common", "/addr/sgg");
const sggCd = sgg.map((item: any) => ({
val: Number(item.adstDstrCd),
text: item.gugun,
}));
const city = await getFectch("common", "/addr/city");
const city = await getFetch("common", "/addr/city");
const cityCd = city.map((item: any) => ({
val: Number(item.adstDstrCd),
text: item.sido,
@@ -25,6 +25,7 @@ export type chHeadType={
headNm: string;
text: string;
length: number;
rows?: number;
}
export const rainHeadNm:chHeadType[] = [
@@ -1,4 +1,4 @@
import { getFectch } from "@/components/lib/api";
import { getFetch } from "@/components/lib/api";
import { TEST_UUID, type customRainBdst } from "../rainReg";
import type { TableProps } from "../pbnstReg";
import type { customHtdflBdst } from "../htdflReg";
@@ -164,7 +164,7 @@ type bdstActions = {
const findBdstInfo = async(sggCd:string, searchTxt:string ,flg:string)=>{
return await getFectch('wr', `/reuseFc/building/${flg}/${sggCd}`+(searchTxt?`/${searchTxt}`:'' ))
return await getFetch('wr', `/reuseFc/building/${flg}/${sggCd}`+(searchTxt?`/${searchTxt}`:'' ))
}
@@ -1,4 +1,4 @@
import { getFectch, postFectch, putFectch } from "@/components/lib/api";
import { getFetch, postFectch, putFectch } from "@/components/lib/api";
import { upHeadList, type bdstAll, type chgBuilding, type TableUpperProps } from "../rainReg";
import { z } from "zod";
@@ -123,7 +123,7 @@ export const htdflFacStateExport: htdflFacState = {
};
const initFetch = async (txt: string | undefined) => {
const htdflRes = await getFectch(
const htdflRes = await getFetch(
"wr",
`/drain/facilityList/1/20/0` + (txt ? `/${txt}` : "")
);
@@ -1,10 +1,31 @@
import { z } from "zod";
import type { TableUpperProps } from "../rainReg";
import { getFetch } from "@/components/lib/api";
export const pbnstZod = z.object({
bscFctCd:z.string(),
sido:z.string().default(""),
gugun: z.string().default(""),
bscFctNm:z.string().default(""),
efflWqltStndrdNm:z.string().default(""),
fctCpc:z.number().default(0)
})
export type customPbnst = z.infer<typeof pbnstZod>
export const pbnstReg =[] as customPbnst[];
export type TableProps = {
id: string;
title: string;
};
export type selectLabel = {
text: string;
val: string;
@@ -45,22 +66,15 @@ const selectLabel: selectLabel[] = [{ text: "test", val: "1" }];
const pubFacHeadList: TableProps[] = [
{ id: "sido", title: "시도" },
{ id: "sigungo", title: "시군구" },
{ id: "facilityName", title: "시설명" },
{ id: "location", title: "위치" },
{ id: "locationgubun", title: "지역구분" },
{ id: "facilityCapacity", title: "시설용량" },
{ id: "gugun", title: "시군구" },
{ id: "bscFctNm", title: "시설명" },
{ id: "addr", title: "위치" },
{ id: "efflWqltStndrdNm", title: "지역구분" },
{ id: "fctCpc", title: "시설용량" },
{ id: "yn", title: "재이용여부" },
{ id: "authoDay", title: "등록여부" },
];
const ruseFclt: ruseFcltType[] = [
{ swtrmtFcltFk: "a", fcltCpct: 1000000, swtrmtCpct: 1000000 ,pbnstRuseFcltPk:'aa',fcltNm:'하수1',ruseCpct: 1, splyExtraCpct: 2 },
{ swtrmtFcltFk: "a", fcltCpct: 1300000, swtrmtCpct: 1300000 ,pbnstRuseFcltPk:'ab',fcltNm:'하수2',ruseCpct: 3, splyExtraCpct: 4 },
{ swtrmtFcltFk: "b", fcltCpct: 2000000, swtrmtCpct: 2000000 ,pbnstRuseFcltPk:'bb',fcltNm:'재이용1',ruseCpct: 1, splyExtraCpct: 2 },
{ swtrmtFcltFk: "b", fcltCpct: 2300000, swtrmtCpct: 2300000 ,pbnstRuseFcltPk:'ba',fcltNm:'재이용2' ,ruseCpct: 3, splyExtraCpct: 4 },
];
const pubMngUpHeadList: TableUpperProps[] = [
{ id: "mng", title: "운영방식" },
{ id: "subCo", title: "대행업체" },
@@ -68,126 +82,20 @@ const pubMngUpHeadList: TableUpperProps[] = [
{ id: "endDay", title: "종료일", upName: "upChangeRe", upSequnce: 2 },
];
const date = new Date();
const fcltOperInfo: fcltOperInfoType[] = [
{
mng: "자체운영",
subCo: "-",
startDay: "2024-11-11",
endDay: "2024-11-20",
pbnstRuseFcltPk: "aa",
},
{
mng: "자체운영",
subCo: "한국수자원공사",
startDay: "2022-11-11",
endDay: "2024-09-13",
pbnstRuseFcltPk: "aa",
},
{
mng: "자체운영",
subCo: "스타벅스",
startDay: "2023-11-11",
endDay: "2024-02-19",
pbnstRuseFcltPk: "bb",
},
];
const publicReuseFacilityData: publicReuseFacilityType[] = [
{
sido: "서울",
sigungo: "강남구",
facilityName: "난지",
location: "경기도 고양시 덕양구 대차로 4가",
locationgubun: "500",
facilityCapacity: "800,000",
reuse: "Y",
register: "Y",
swtrmtFcltFk: "a",
},
{
sido: "서울",
sigungo: "강남구",
facilityName: "여의도 중앙",
location: "경기도 고양시 덕양구 대차로 4가",
locationgubun: "500",
facilityCapacity: "800,000",
reuse: "Y",
register: "Y",
swtrmtFcltFk: "b",
},
{
sido: "서울",
sigungo: "강남구",
facilityName: "너의 마음속",
location: "경기도 고양시 덕양구 대차로 4가",
locationgubun: "500",
facilityCapacity: "800,000",
yn: "Y",
authoDay: "2012",
area: "123",
swtrmtFcltFk: "c",
},
];
const erctUswtrCd: selectLabel[] = [
{ text: "처리장연계", val: "1_erct" },
{ text: "자체/연계", val: "2_erct" },
{ text: "자체처리", val: "3_erct" },
];
const cyclCd: selectLabel[] = [
{ text: "1차", val: "1_cyc" },
{ text: "2차", val: "2_cyc" },
];
const seCd: selectLabel[] = [
{ text: "신규", val: "1_Se" },
{ text: "진행", val: "2_Se" },
];
const buseCd: selectLabel[] = [
{ text: "재정", val: "1_bus" },
{ text: "만루", val: "2_bus" },
];
const rprcsCd: selectLabel[] = [
{ text: "물리적처리", val: "1_rprc" },
{ text: "생물학적처리", val: "2_rprc" },
];
const buseMet: selectLabel[] = [
{ text: "재정", val: "1_busemet" },
{ text: "민간투자", val: "2_busemet" },
{ text: "자체", val: "3_busemet" },
];
const rprcLoCd: selectLabel[] = [
{ text: "내부", val: "1_rprc" },
{ text: "외부", val: "2_rprc" },
];
export type pubFacState = {
pubFac: {
isInit: boolean;
pubFacHeadList: TableProps[];
pubMngUpHeadList: TableUpperProps[];
publicReuseFacilityData: publicReuseFacilityType[];
selectLabel: selectLabel[];
erctUswtrCd: selectLabel[];
cyclCd: selectLabel[];
seCd: selectLabel[];
buseCd: selectLabel[];
rprcsCd: selectLabel[];
buseMet: selectLabel[];
rprcLoCd: selectLabel[];
ruseFclt:ruseFcltType[];
};
pubMng:{
//isInit:boolean;
fcltOperInfo: fcltOperInfoType[];
ruseFclt:ruseFcltType[];
pbnstReg:customPbnst[];
}
};
type pubFacActions = {
decrementList: () => void;
mngMainValue:(swtrmtFcltFk:string)=> void;
mngTableValue:(swtrmtFcltFk:string)=> void;
pubHasuInit: (txt:string|undefined) => void;
};
export type pubFacType = pubFacState & pubFacActions;
@@ -197,62 +105,39 @@ export const pubFacStateExport: pubFacState = {
isInit: false,
pubFacHeadList: pubFacHeadList,
pubMngUpHeadList: pubMngUpHeadList,
publicReuseFacilityData: publicReuseFacilityData,
selectLabel: selectLabel,
erctUswtrCd: erctUswtrCd,
cyclCd: cyclCd,
seCd: seCd,
buseCd: buseCd,
rprcsCd: rprcsCd,
buseMet: buseMet,
rprcLoCd: rprcLoCd,
ruseFclt:ruseFclt,
pbnstReg:pbnstReg,
},
pubMng:{
// isInit: false,
fcltOperInfo: fcltOperInfo,
ruseFclt:ruseFclt
}
};
const initFetch = async (txt:string|undefined) => {
const rainRes =await getFetch("common", `/prcsFclt/info/1/20/'A'/41220` +(txt? `/${txt}`:'')+'/0'+'/1' );
return rainRes
};
export const pubFacActionsExport: (set: any) => pubFacActions = (set: any) => {
return {
decrementList: () =>
set((state: pubFacState) => {
return {
pubFac: {
pubFacheadList: state.pubFac.pubFacHeadList,
publicReuseFacilityUper: state.pubFac.publicReuseFacilityData.slice(
0,
state.pubFac.publicReuseFacilityData.length - 1
),
},
};
}),
mngMainValue:(swtrmtFcltFk:string)=>
set((state:pubFacState)=>{
return{
pubMng:{
...state.pubMng,
ruseFclt:state.pubMng.ruseFclt.filter((item)=>
item.swtrmtFcltFk===swtrmtFcltFk
)
pubHasuInit: async(txt:string |undefined)=>{
try{
const pbnstReg = await initFetch(txt)
return set((state:pubFacState)=>({
...state,
pubFac:{
...state.pubFac,
pbnstReg:pbnstReg,
isInit: false,
}
}
}),
mngTableValue:(pbnstRuseFcltPk:string)=>
set((state:pubFacState)=>{
return{
pubMng:{
...state.pubMng,
fcltOperInfo:state.pubMng.fcltOperInfo.filter((item)=>item.pbnstRuseFcltPk===pbnstRuseFcltPk)
}
}
})
}))
}catch(errorHasu){
console.log(errorHasu)
}
}
};
};
@@ -1,12 +1,11 @@
import type { selectArray } from "@/app/store/common/code";
import { getFectch, postFectch, putFectch } from "@/components/lib/api";
import { getFetch, postFectch, putFectch } from "@/components/lib/api";
import { z } from "zod";
import { makeMdfr, makeRstr } from "../bdstReg";
export const TEST_UUID= '2d4b151d-1828-41e0-91d9-4cd28ea1cc7e'
export const rainZod = z.object({
bdstInfoPk: z.number().optional(),
ctpvCd: z.number().default(0),
@@ -19,7 +18,6 @@ export const rainZod = z.object({
archChgArea: z.number().default(0),
rgtr:z.string().nullish(),
mdfr:z.string().nullish(),
reuseBuilding: z.array(
z.object({
bdstRuseFcltPk: z.number().nullish(),
@@ -101,6 +99,15 @@ export type TableUpperProps = {
visible?:boolean;
};
export type TableTripleProps = {
id: string;
title: string;
upName: string[];
upSequnce: number[];
edit?:boolean;
visible?:boolean;
};
export const upHeadList: TableUpperProps[] = [
{ id: "cityText", title: "시도" },
@@ -160,7 +167,7 @@ export const rainFacStateExport: rainFacState = {
const initFetch = async (txt:string|undefined) => {
const rainRes =await getFectch("wr", `/reuseFc/rainyInfoList/1/20/41` +(txt? `/${txt}`:''));
const rainRes =await getFetch("wr", `/reuseFc/rainyInfoList/1/20/41` +(txt? `/${txt}`:''));
const chRainRes = rainRes.map((item: customRainBdst) => {
return {
...item,
@@ -198,7 +205,7 @@ export const rainFacActionsExport: (set: any) => rainFacSActions = (
rainSearTxt: async(txt:string) =>{
try{
const rainRes = await getFectch('wr' , `/reuseFc/rainyInfoList/1/20/41` +(txt? `/${txt}`:''))
const rainRes = await getFetch('wr' , `/reuseFc/rainyInfoList/1/20/41` +(txt? `/${txt}`:''))
set((state: rainFacState) => {
return {
rain: {
@@ -1,4 +1,4 @@
import { getFectch, postFectch, putFectch } from "@/components/lib/api";
import { getFetch, postFectch, putFectch } from "@/components/lib/api";
import { upHeadList, type chgBuilding, type TableUpperProps } from "../rainReg";
import { z } from "zod";
@@ -109,7 +109,7 @@ export const rswtFacStateExport: rswtFacState = {
};
const initFetch = async (txt: string | undefined) => {
const rswtRes =await getFectch(
const rswtRes =await getFetch(
"wr",
`/reuseFc/waterreuseFc/1/20/41` + (txt ? `/${txt}` : "")
);
@@ -1,82 +0,0 @@
import type { chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn";
import type { TableUpperProps } from "../../fcltReg/rainReg";
import { z } from "zod";
export const pbnSttHeadNm: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 pbnSttHeadList:TableUpperProps[] = [
{ id: "a", title: "권역" ,upName:"catchment" ,upSequnce:1,visible:false},
{ id: "aaa", title: "단위유역" ,upName:"catchment" ,upSequnce:2 ,visible:false},
{ id: "aaaa", title: "중권역" ,upName:"catchment" ,upSequnce:3,visible:false},
{ id: "operMngCd", title: "환경청" ,visible:false },
{ id: "cityText", title: "시도" ,upName:"adminDiv" ,upSequnce:1,visible:false},
{ id: "sggText", title: "시군구" ,upName:"adminDiv" ,upSequnce:2,visible:false},
{ id: "bdnstNm", title: "시설명" ,visible:false },
{ id: "locDiv", title: "지역구분" ,visible:false },
{ id: "phone" , title: "전화번호" ,visible:false },
{ id: "fcltQuantity", title: "시설용량(톤/일)" ,visible:false},
{ id: "rusNm", title: "재이용시설명" ,visible:false},
{ id: "fcltCpct", title: "시설용량(m³/일)", upName: "rusSup", upSequnce: 1 ,visible:false},
{ id: "trbt", title: "하수처리량(m³/일)", upName: "rusSup", upSequnce: 2 ,visible:false},
{ id: "ruseCpct", title: "재이용량(m³/일)", upName: "rusSup", upSequnce: 3 ,visible:false},
{ id: "total", title: "합계", upName: "yearResult", upSequnce: 1 ,visible:false},
{ id: "ithlWtr", title: "장내용수", upName: "yearResult", upSequnce: 2 ,visible:false},
{ id: "othlWtr", title: "장외용수", upName: "yearResult", upSequnce: 3 ,visible:false},
{ id: "mngMeth", title: "운영방식", upName: "mngInfo", upSequnce: 1 ,visible:false},
{ id: "rprtvBzenty", title: "대행업체", upName: "mngInfo", upSequnce: 2 ,visible:false},
{ id: "firstDay", title: "시작일", upName: "mngInfo", upSequnce: 3 ,visible:false },
{ id: "LastDay", title: "종료일", upName: "mngInfo", upSequnce: 4 ,visible:false},
];
export type pbnstSttnState = {
pbnStt: {
pbnSttHeadList:TableUpperProps[],
pbnSttHeadNm:chHeadType[]
};
};
type pbnSttActions = {
};
export type pbnSttType = pbnstSttnState & pbnSttActions;
export const pbnSttStateExport: pbnstSttnState = {
pbnStt: {
pbnSttHeadList:pbnSttHeadList,
pbnSttHeadNm:pbnSttHeadNm
},
};
export const pbnSttActionsExport: (set: any) => pbnSttActions = (
set: any
) => {
return {
pbnSttnInit: async(sggCd:string, searchTxt:string ,flg:string ) =>{
},
};
};
@@ -0,0 +1,406 @@
import type { chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn";
import {
upHeadList,
type TableTripleProps,
type TableUpperProps,
} from "../../fcltReg/rainReg";
export const pbnSttHeadNm: 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 pbnSttHeadList: TableUpperProps[] = [
{ id: "a", title: "권역", upName: "catchment", upSequnce: 1, visible: true },
{
id: "aaa",
title: "단위유역",
upName: "catchment",
upSequnce: 2,
visible: true,
},
{
id: "aaaa",
title: "중권역",
upName: "catchment",
upSequnce: 3,
visible: false,
},
{ id: "operMngCd", title: "환경청", visible: true },
{
id: "cityText",
title: "시도",
upName: "adminDiv",
upSequnce: 1,
visible: false,
},
{
id: "sggText",
title: "시군구",
upName: "adminDiv",
upSequnce: 2,
visible: true,
},
{ id: "bdnstNm", title: "시설명", visible: true },
{ id: "locDiv", title: "지역구분", visible: true },
{ id: "phone", title: "전화번호", visible: true },
{ id: "fcltQuantity", title: "시설용량(톤/일)", visible: true },
{ id: "rusNm", title: "재이용시설명", visible: true },
{
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,
},
];
export const rainSttHeadNm: chHeadType[] = [
{ headNm: "bdnstInfo", text: "1.건축물정보", length: 9 },
{ headNm: "rainFcltInfo", text: "2.빗물이용시설정보", length: 7 },
{ headNm: "fcltMngInfo", text: "3.시설운영및 이용정보", length: 2 },
{ headNm: "insenInfo", text: "4.인센티브 정보", length: 9 },
{ headNm: "adminDiv", text: "행정구역", length: 2 },
{ headNm: "pntfCol", text: "집수면", length: 2 },
{ headNm: "filtrTrtmfct", text: "여과등 처리시설", length: 3 },
{ headNm: "instlCstSprt", text: "설치비지원", length: 2 },
{ headNm: "crgRdct", text: "요금감면", length: 3 },
{ headNm: "grntchBdstCert", text: "녹색건축물인증여부", length: 4 },
];
// id는 다확인해야함
export const rainSttHeadList: TableTripleProps[] = [
{
id: "ctpvCd",
title: "시도",
visible: true,
upName: ["bdnstInfo", "adminDiv"],
upSequnce: [1, 1],
},
{
id: "sggCd",
title: "시군구",
visible: true,
upName: ["bdnstInfo", "adminDiv"],
upSequnce: [2, 2],
},
{
id: "bdstNm",
title: "건축물명",
visible: true,
upName: ["bdnstInfo"],
upSequnce: [3],
},
{
id: "daddr",
title: "주소",
visible: true,
upName: ["bdnstInfo"],
upSequnce: [4],
},
{
id: "bdstUsgCd",
title: "건축물용도코드",
visible: true,
upName: ["bdnstInfo"],
upSequnce: [5],
},
{
id: "frstArchPrmsnDt",
title: "최초건축허가일시",
visible: true,
upName: ["bdnstInfo"],
upSequnce: [6],
},
{
id: "archArea",
title: "건축면적",
visible: true,
upName: ["bdnstInfo"],
upSequnce: [7],
},
{
id: "lawTrgtYn",
title: "법적의무대상여부",
visible: true,
upName: ["bdnstInfo"],
upSequnce: [8],
},
{
id: "instlCmptnDt",
title: "설치완료일시",
visible: true,
upName: ["bdnstInfo"],
upSequnce: [9],
},
{
id: "instlCst",
title: "설치비용",
visible: true,
upName: ["rainFcltInfo"],
upSequnce: [1],
},
{
id: "pntfColKnd",
title: "접수지점종류",
visible: true,
upName: ["rainFcltInfo", "pntfCol"],
upSequnce: [2, 1],
},
{
id: "pntfColArea",
title: "접수지점면적",
visible: true,
upName: ["rainFcltInfo", "pntfCol"],
upSequnce: [3, 2],
},
{
id: "filtrTrtmfctYn",
title: "여과처리시설유무",
visible: true,
upName: ["rainFcltInfo", "filtrTrtmfct"],
upSequnce: [4, 1],
},
{
id: "filtrTrtmfctCpct",
title: "여과처리시설용량",
visible: true,
upName: ["rainFcltInfo", "filtrTrtmfct"],
upSequnce: [5, 2],
},
{
id: "filtrTrtmfctPrs",
title: "여과처리시설처리공정",
visible: true,
upName: ["rainFcltInfo", "filtrTrtmfct"],
upSequnce: [6, 3],
},
{
id: "dtfcltCpct",
title: "저류조용량",
visible: true,
upName: ["rainFcltInfo"],
upSequnce: [7],
},
{
id: "operMngCd",
title: "운영관리코드",
visible: true,
upName: ["fcltMngInfo"],
upSequnce: [1],
},
{
id: "annRnwtQty",
title: "연간빗물운영량",
visible: true,
upName: ["fcltMngInfo"],
upSequnce: [2],
},
{
id: "instlCstSprtYn",
title: "설치지원비용여부",
visible: true,
upName: ["insenInfo", "instlCstSprt"],
upSequnce: [1, 1],
},
{
id: "instlCstSprtAmt",
title: "설치지원비용",
visible: true,
upName: ["insenInfo", "instlCstSprt"],
upSequnce: [2, 2],
},
{
id: "crgRdctYn",
title: "감면여부",
visible: true,
upName: ["insenInfo", "crgRdct"],
upSequnce: [3, 1],
}, // 확인필요
{
id: "crgRdctBss",
title: "감면근거",
visible: true,
upName: ["insenInfo", "crgRdct"],
upSequnce: [4, 2],
}, // 확인필요
{
id: "crgRdctAmt",
title: "감면금액",
visible: true,
upName: ["insenInfo", "crgRdct"],
upSequnce: [5, 3],
}, // 확인필요
{
id: "grntchBdstCertYn",
title: "녹색건축물인증여부",
visible: true,
upName: ["insenInfo", "grntchBdstCert"],
upSequnce: [6, 1],
},
{
id: "grntchBdstCertYr",
title: "녹색건축물인증년도",
visible: true,
upName: ["insenInfo", "grntchBdstCert"],
upSequnce: [7, 2],
},
{
id: "grntchBdstCertNo",
title: "녹색건축물인증번호",
visible: true,
upName: ["insenInfo", "grntchBdstCert"],
upSequnce: [8, 3],
},
{
id: "grntchBdstCertGrd",
title: "녹색건축물인증등급",
visible: true,
upName: ["insenInfo", "grntchBdstCert"],
upSequnce: [9, 4],
},
];
export type sttnState = {
sttnCommon: {
pbnSttHeadList: TableUpperProps[];
pbnSttHeadNm: chHeadType[];
rainSttHeadList: TableTripleProps[];
rainSttHeadNm: chHeadType[];
};
};
type sttnActions = {
chSttnHead: (checkList: string[], type: string) => void;
pbnSttnInit: (sggCd: string, searchTxt: string, flg: string) => void;
};
export type sttnType = sttnState & sttnActions;
export const sttnStateExport: sttnState = {
sttnCommon: {
pbnSttHeadList: pbnSttHeadList,
pbnSttHeadNm: pbnSttHeadNm,
rainSttHeadList: rainSttHeadList,
rainSttHeadNm: rainSttHeadNm,
},
};
export const sttnActionsExport: (set: any) => sttnActions = (set: any) => {
return {
pbnSttnInit: async (sggCd: string, searchTxt: string, flg: string) => {},
chSttnHead: async (checkList: string[], type: string) => {
const headList =
type === "pbn"
? pbnSttHeadList
: type === "rain"
? rainSttHeadList
: null;
let chNm = type === "pbn" ? pbnSttHeadNm : rainSttHeadNm;
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: sttnState) => ({
sttnCommon: {
...state.sttnCommon,
pbnSttHeadList: type === "pbn" ? headList : state.sttnCommon.pbnSttHeadList,
rainSttHeadList: type === "rain" ? headList : state.sttnCommon.rainSttHeadList,
rainSttHeadNm: type === "rain" ? chNm : state.sttnCommon.rainSttHeadNm,
pbnSttHeadNm: type === "rain" ? chNm : state.sttnCommon.pbnSttHeadNm,
},
}));
},
};
};
+11 -7
View File
@@ -29,11 +29,11 @@ import {
type htdflFacState,
type htdflFacType,
} from "./ruseFcltMng/fcltReg/htdflReg";
import { codeActionExport, comCodeStateExport, getCityCd, getSggCd, type comCodeState, type comCodeType } from "./common/code";
import { codeActionExport, comCodeStateExport, getCityCd, getEnvPartCd, getMiddleRegionCd, getRegionCd, getSggCd, getUnitWaterShedCd, type comCodeState, type comCodeType } from "./common/code";
import { bdstActionsExport, bdstStateExport, type bdstFulType, type bdstState } from "./ruseFcltMng/fcltReg/bdstReg";
import { rainChkgdnActionsExport, rainChkgdnStateExport, type rainChkgdnState, type rainChkgdnType } from "./prfmncReg/chkgdnReg/rainChkgdn";
import { rswtChkgdnActionsExport, rswtChkgdnStateExport, type rswtChkgdnState, type rswtChkgdnType } from "./prfmncReg/chkgdnReg/rswrtChkgdn";
import { pbnSttActionsExport, pbnSttStateExport, type pbnstSttnState, type pbnSttType } from "./ruseFcltMng/fcltSttn/pbnstSttn";
import { sttnActionsExport, sttnStateExport, type sttnState, type sttnType } from "./ruseFcltMng/fcltSttn/sttn";
export type WrStore = comCodeType&
pubFacType &
@@ -44,7 +44,7 @@ export type WrStore = comCodeType&
bdstFulType&
rainChkgdnType&
rswtChkgdnType&
pbnSttType
sttnType
;
export const StoreZus = (
@@ -57,7 +57,7 @@ export const StoreZus = (
bdstState &
rainChkgdnState&
rswtChkgdnState&
pbnstSttnState
sttnState
= {
...comCodeStateExport,
...pubFacStateExport,
@@ -68,12 +68,16 @@ export const StoreZus = (
...bdstStateExport,
...rainChkgdnStateExport,
...rswtChkgdnStateExport,
...pbnSttStateExport
...sttnStateExport
}
) => {
return createStore<WrStore>()((set) => {
getSggCd(set),
getCityCd(set)
getCityCd(set),
getRegionCd(set),
getMiddleRegionCd(set),
getUnitWaterShedCd(set),
getEnvPartCd(set)
return {
...initState,
...pubFacActionsExport(set),
@@ -85,7 +89,7 @@ export const StoreZus = (
...bdstActionsExport(set),
...rainChkgdnActionsExport(set),
...rswtChkgdnActionsExport(set),
...pbnSttActionsExport(set)
...sttnActionsExport(set)
};
});
};
+1 -1
View File
@@ -4,7 +4,7 @@ import { DEV_URL_FO, DEV_URL_WR } from "../config/";
export const getFectch = async( type:string , url: string) => {
export const getFetch = async( type:string , url: string) => {
const div = type === 'common' ? DEV_URL_FO : DEV_URL_WR
const response = await fetch( div+url , {
method: "GET",
@@ -91,7 +91,7 @@ export default function HtdflRegForm({
<div>
<div className="grid grid-cols-12">
<h1 className="pl-3 text-xl col-span-10">○온배수 시설 정보</h1>
<Button type="submit" className="mr-4 rounded-lg col-span-2">
<Button size={"sm"} type="submit" className="col-start-12 col-span-1">
저장
</Button>
</div>
@@ -16,24 +16,9 @@ const formSchema = z.object({
facilityName: z.string().min(2).max(50),
});
const headMakeColSpan = (upHeadList: TableUpperProps[]) => {
return (<>
<TableRow>{
upHeadList.map((head: TableUpperProps) =>
(!head.upSequnce ? <TableHead rowSpan={2} key={head.id}>{head.title}</TableHead> :
head.upName === 'upChangeRe' && head.upSequnce === 1 ? <TableHead key={head.id} rowSpan={1} colSpan={2}>{'운영대행기간'}</TableHead> : null))}
</TableRow>
<TableRow>
{upHeadList.map((head: TableUpperProps) =>
(head.upName === 'upChangeRe' ? <TableHead key={head.id}>{head.title}</TableHead> : null))}
</TableRow>
</>)
}
export function PbnstBuseForm() {
const { pubFac } = useWrStore((state) => state);
const { pubMngUpHeadList, erctUswtrCd,cyclCd,seCd,buseCd,rprcsCd,buseMet,rprcLoCd} = pubFac;
const nodeList = headMakeColSpan(pubMngUpHeadList);
const { code ,pubFac } = useWrStore((state) => state);
const { pubMngUpHeadList} = pubFac;
const form = useForm<z.infer<typeof formSchema>>({
@@ -79,7 +64,7 @@ const nodeList = headMakeColSpan(pubMngUpHeadList);
name="name_1486273033"
render={({ field }) => (
<FormUi label=''>
<SelectBox label='' selectArray={cyclCd} className={""} selectClass={selectClass} onSelectValue={onSelectValue } {...field}></SelectBox>
<SelectBox label='' selectArray={code.yn} className={""} selectClass={selectClass} onSelectValue={() =>{} } {...field}></SelectBox>
</FormUi>
)}
/>
@@ -103,7 +88,7 @@ const nodeList = headMakeColSpan(pubMngUpHeadList);
name="name_8928357542"
render={({ field }) => (
<FormUi label="구분">
<SelectBox selectArray={seCd} className={""} label={""} selectClass={selectClass} onSelectValue={onSelectValue} />
<SelectBox selectArray={code.yn} className={""} label={""} selectClass={selectClass} onSelectValue={()=>{} } />
</FormUi>
)}
/>
@@ -115,7 +100,7 @@ const nodeList = headMakeColSpan(pubMngUpHeadList);
name="name_9484942814"
render={({ field }) => (
<FormUi label="사업방식">
<SelectBox selectArray={buseMet} className={""} label={""} selectClass={selectClass} onSelectValue={onSelectValue}/>
<SelectBox selectArray={code.yn} className={""} label={""} selectClass={selectClass} onSelectValue={()=>{} }/>
</FormUi>
)}
/>
@@ -276,7 +261,7 @@ const nodeList = headMakeColSpan(pubMngUpHeadList);
name="name_5139286452"
render={({ field }) => (
<FormUi label="재처리방식">
<SelectBox selectArray={rprcsCd} className={""} label={""} selectClass={selectClass} onSelectValue={onSelectValue }/>
<SelectBox selectArray={code.yn} className={""} label={""} selectClass={selectClass} onSelectValue={() =>{} }/>
</FormUi>
)}
/>
@@ -288,7 +273,7 @@ const nodeList = headMakeColSpan(pubMngUpHeadList);
name="name_7233630277"
render={({ field }) => (
<FormUi label="위치(처리장 내외)">
<SelectBox selectArray={rprcLoCd} className={""} label={""} selectClass={selectClass} onSelectValue={onSelectValue}/>
<SelectBox selectArray={code.yn} className={""} label={""} selectClass={selectClass} onSelectValue={()=>{} }/>
</FormUi>
)}
/>
@@ -355,7 +340,7 @@ const nodeList = headMakeColSpan(pubMngUpHeadList);
name="name_5139286452"
render={({ field }) => (
<FormUi label="눙축수처리방식">
<SelectBox selectArray={erctUswtrCd} className={""} label={""} selectClass={selectClass} onSelectValue={onSelectValue}/>
<SelectBox selectArray={code.yn} className={""} label={""} selectClass={selectClass} onSelectValue={() =>{}}/>
</FormUi>
)}
/>
@@ -18,7 +18,6 @@ import {
type TableUpperProps,
} from "@/app/store/ruseFcltMng/fcltReg/rainReg";
import type { fcltOperInfoType, ruseFcltType } from "@/app/store/ruseFcltMng/fcltReg/pbnstReg";
import { PbnstMngModal } from "@/components/ui/modal/pbnstMng/component";
const formSchema = z.object({
fcltNm: z.string().min(2).max(50),
@@ -33,9 +32,8 @@ const formSchema = z.object({
export function PbnstMngForm({ data }: { data: ruseFcltType[] }) {
const { pubFac, pubMng } = useWrStore((state) => state);
const { pubFac } = useWrStore((state) => state);
const { pubMngUpHeadList, isInit } = pubFac;
const { fcltOperInfo } = pubMng;
const [ruseOperData, setRuseOperData] = useState<fcltOperInfoType[]>();
const [files, setFiles] = useState(null);
const [isModalOpen, setIsModalOpen] = useState(false);
@@ -58,11 +56,7 @@ export function PbnstMngForm({ data }: { data: ruseFcltType[] }) {
const selectOptions = data?.map((item) => ({text: item.fcltNm, val: item.pbnstRuseFcltPk})) || [{text:'없음', val:'1'}];
const onSelectValue = (val: string) => {
const selectedData = data?.find((item) => item.pbnstRuseFcltPk === val);
if (selectedData) {
form.reset(selectedData);
setRuseOperData(fcltOperInfo.filter((item) => item.pbnstRuseFcltPk === val));
}
};
@@ -128,7 +122,7 @@ export function PbnstMngForm({ data }: { data: ruseFcltType[] }) {
selectArray={selectOptions}
className={""}
selectClass={selectClass}
onSelectValue={onSelectValue}
onSelectValue={()=>{}}
{...field}
/>
)}
@@ -177,13 +171,14 @@ export function PbnstMngForm({ data }: { data: ruseFcltType[] }) {
</div>
<div className="h-[200px] overflow-y-auto">
<UiTable
tableData={ruseOperData?ruseOperData:[]}
tableData={[]}
headlist={pubMngUpHeadList}
pageSize={100}
total={-1}
headName={""}
cellClick={() => {}}
>
cellClick={() => { } } onPageChange={function (page: number): void {
throw new Error("Function not implemented.");
} } >
{nodeList}
</UiTable>
</div>
@@ -109,7 +109,7 @@ useEffect(() => {
<h1 className="pl-3 text-xl col-span-10">
○ 중수도 시설 정보
</h1>
<Button type="submit" className="mr-4 rounded-lg col-span-2">
<Button size={"sm"} type="submit" className="col-start-12 col-span-1">
저장
</Button>
</div>
@@ -1,36 +1,43 @@
import { useWrStore } from "@/app/store";
import { pbnSttHeadList } from "@/app/store/ruseFcltMng/fcltSttn/pbnstSttn";
import type { TableProps } from "@/app/store/ruseFcltMng/fcltReg/pbnstReg";
import type { TableTripleProps } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
import { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage } from "@common/business_components/ui";
import { Button, Checkbox } from "@common/components/ui";
import { zodResolver } from "@hookform/resolvers/zod";
import { useEffect } from "react";
import { useForm } from "react-hook-form";
import { z } from "zod";
export default function HeadChModal() {
const { pbnStt } = useWrStore((state) => state);
export default function HeadChModal({type }:{type: string }) {
const { sttnCommon ,chSttnHead} = useWrStore((state) => state);
const items = pbnSttHeadList.map(item => ({id:item.id, label:item.title}));
const { rainSttHeadList,pbnSttHeadList } =sttnCommon;
let items = rainSttHeadList.map(item => ({id:item.id, label:item.title}));
const FormSchema = z.object({
items: z.array(z.string()).refine((value) => value.some((item) => item), {
message: "You have to select at least one item.",
data: z.array(z.string()).refine((value) => value.some((item) => item), {
message: "최소한 하나를 선택해주시길 바랍니다.",
}),
})
const form = useForm<z.infer<typeof FormSchema>>({
resolver: zodResolver(FormSchema),
})
defaultValues: {
data: [],
},
})
const onSubmit = (val : z.infer<typeof FormSchema>) =>{
console.log(val)
if(val?.data.length > 0)
chSttnHead(val?.data, 'rain')
}
return (
@@ -40,21 +47,20 @@ export default function HeadChModal() {
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-8">
<FormField
control={form.control}
name="items"
name="data"
render={() => (
<FormItem>
<div className="mb-4">
<FormLabel className="text-base">Sidebar</FormLabel>
<FormDescription>
Select the items you want to display in the sidebar.
</FormDescription>
<FormLabel className="text-2xl"> 조회항목 설정</FormLabel>
</div>
{items.map((item) => (
<FormField
key={item.id}
control={form.control}
name="items"
render={({ field }) => {
name="data"
render={({ field }) =>
{
return (
<FormItem
key={item.id}
@@ -63,7 +69,9 @@ export default function HeadChModal() {
<FormControl>
<Checkbox
checked={field.value?.includes(item.id)}
onCheckedChange={(checked) => {
onCheckedChange={(checked) =>
{
return checked
? field.onChange([...field.value, item.id])
: field.onChange(
@@ -71,10 +79,12 @@ export default function HeadChModal() {
(value) => value !== item.id
)
);
}}
}
}
/>
</FormControl>
<FormLabel className="text-sm font-normal">
<FormLabel className="text-xl">
{item.label}
</FormLabel>
</FormItem>
@@ -86,7 +96,7 @@ export default function HeadChModal() {
</FormItem>
)}
/>
<Button type="submit">Submit</Button>
<Button type="submit">항목 표출 변경</Button>
</form>
</Form>
</div>