Merge commit '6cc600a8db85c07887cce74bac34b448be3b4510' into iipbs/wr/dev
This commit is contained in:
+71
-17
@@ -1,27 +1,81 @@
|
||||
'use client'
|
||||
"use client";
|
||||
import Link from "next/link";
|
||||
import { Button } from "@common/components/ui";
|
||||
|
||||
export default function Home() {
|
||||
return (
|
||||
<>
|
||||
<div className="flex">
|
||||
<Button className="place-self-auto">
|
||||
<Link href="ruseFcltMng/fcltReg/pbnstReg"> 하수재이용 시설 등록</Link>
|
||||
</Button>
|
||||
<Button className="place-self-auto">
|
||||
<Link href="ruseFcltMng/fcltReg/rainReg"> 빗물재이용 시설 등록</Link>
|
||||
</Button>
|
||||
<Button className="place-self-auto">
|
||||
<Link href="ruseFcltMng/fcltReg/rswtReg"> 중수도시설 등록</Link>
|
||||
</Button>
|
||||
<div className="flex flex-col gap-8 p-6">
|
||||
{/* 시설 등록 */}
|
||||
<div>
|
||||
<h2 className="text-xl font-semibold mb-4">시설 등록</h2>
|
||||
<div className="grid grid-cols-12 gap-4">
|
||||
<div className="col-span-2">
|
||||
<Button className="w-full">
|
||||
<Link href="ruseFcltMng/fcltReg/pbnstReg">
|
||||
하수재이용 시설 등록
|
||||
</Link>
|
||||
</Button>
|
||||
</div>
|
||||
<div className="col-span-2">
|
||||
<Button className="w-full">
|
||||
<Link href="ruseFcltMng/fcltReg/rainReg">
|
||||
빗물재이용 시설 등록
|
||||
</Link>
|
||||
</Button>
|
||||
</div>
|
||||
<div className="col-span-2">
|
||||
<Button className="w-full">
|
||||
<Link href="ruseFcltMng/fcltReg/rswtReg">중수도시설 등록</Link>
|
||||
</Button>
|
||||
</div>
|
||||
<div className="col-span-2">
|
||||
<Button className="w-full">
|
||||
<Link href="ruseFcltMng/fcltReg/htdflReg">온배수 등록</Link>
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Button className="place-self-auto">
|
||||
<Link href="matMng/matDmd/coReg">수요처 등록</Link>
|
||||
</Button>
|
||||
<Button className="place-self-auto">
|
||||
<Link href="ruseFcltMng/fcltReg/htdflReg">온배수 등록</Link>
|
||||
</Button>
|
||||
{/* 지도점검 결과 */}
|
||||
<div>
|
||||
<h2 className="text-xl font-semibold mb-4">지도점검 결과</h2>
|
||||
<div className="grid grid-cols-12 gap-4">
|
||||
<div className="col-span-2">
|
||||
<Button className="w-full">
|
||||
<Link href="ruseFcltMng/prfmncReg/chkgdnReg">
|
||||
지도점검 결과 등록
|
||||
</Link>
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 시설 현황 */}
|
||||
<div>
|
||||
<h2 className="text-xl font-semibold mb-4">시설 현황</h2>
|
||||
<div className="grid grid-cols-12 gap-4">
|
||||
<div className="col-span-2">
|
||||
<Button className="w-full">
|
||||
<Link href="ruseFcltMng/fcltSttn/pbnstSttn">
|
||||
하수재이용시설현황
|
||||
</Link>
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 수요처 관리 */}
|
||||
<div>
|
||||
<h2 className="text-xl font-semibold mb-4">수요처 관리</h2>
|
||||
<div className="grid grid-cols-12 gap-4">
|
||||
<div className="col-span-2">
|
||||
<Button className="w-full">
|
||||
<Link href="matMng/matDmd/coReg">수요처 등록</Link>
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -9,6 +9,7 @@ import {
|
||||
SearchFormRight,
|
||||
SearchInput,
|
||||
Title,
|
||||
UiModal,
|
||||
UiTable,
|
||||
} from "@common/business_components";
|
||||
import { Button } from "@common/components";
|
||||
@@ -16,16 +17,25 @@ import { headMakeColSpan } from "../rainReg/page";
|
||||
import ListDiv from "@common/business_components/ui/list_div";
|
||||
import { useEffect, useState } from "react";
|
||||
import { tableData } from "@/components/lib/func/commom";
|
||||
import { HtdflRegForm } from "@/components/ui/form/fcltReg/htdflReg/component";
|
||||
import { HtdflRegForm } from "@/components/ui/form/fcltReg/htdflReg/htdflRegForm";
|
||||
import type { chgBuilding } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import BdstChgModal from "@/components/ui/modal/bdstChgModal/bdstChgModal";
|
||||
import { BdstReg } from "@/components/ui/modal/bdstRegModal/bdstRegModal";
|
||||
import type { customHtdflBdst } from "@/app/store/ruseFcltMng/fcltReg/htdflReg";
|
||||
import type { customRswtBdst } from "@/app/store/ruseFcltMng/fcltReg/rswtReg";
|
||||
|
||||
export default function Home() {
|
||||
const { code, htdfl, initHtdfl } = useWrStore((state) => state);
|
||||
const nodeList = headMakeColSpan(htdfl.upHeadList);
|
||||
const [searchTxt, setSearchTxt] = useState("");
|
||||
const [rswtForm, setRswtForm] = useState<customHtdflBdst>();
|
||||
const [htdflForm, setHtdflForm] = useState<customHtdflBdst>();
|
||||
const [bdstTable, setbdstTable] = useState<customHtdflBdst[]>();
|
||||
const [issNewReg,setIsNewReg] = useState<boolean>( false);
|
||||
|
||||
const [bdstChgProps, setBdstChgProps] = useState<{
|
||||
isOpen: boolean;
|
||||
chgBuilding: chgBuilding[];
|
||||
}>({ isOpen: false, chgBuilding: [] });
|
||||
|
||||
const { htdflRes } = htdfl;
|
||||
|
||||
useEffect(() => {
|
||||
@@ -40,12 +50,26 @@ export default function Home() {
|
||||
}
|
||||
}, [code, htdflRes]);
|
||||
|
||||
const cellClick: (val: number | undefined) => void = (val) => {
|
||||
const cellClick: (val: number|undefined ,headId: string) => void = (
|
||||
val
|
||||
,headId) => {
|
||||
if ((bdstTable ?? []).length > 0 && val !== undefined) {
|
||||
{
|
||||
setRswtForm(htdflRes[val]);
|
||||
setHtdflForm(htdflRes[val]);
|
||||
}
|
||||
}
|
||||
|
||||
if (headId === "bdstChgYn" && val !== undefined) {
|
||||
if (
|
||||
htdflRes[val]?.bdstInfoPk != null &&
|
||||
htdflRes[val]?.chgBuilding?.length > 0
|
||||
) {
|
||||
bdstChgModal(htdflRes[val]?.chgBuilding);
|
||||
}
|
||||
}
|
||||
};
|
||||
const bdstChgModal = (chgBuilding: chgBuilding[]) => {
|
||||
setBdstChgProps({ isOpen: true, chgBuilding: chgBuilding });
|
||||
};
|
||||
return (
|
||||
<>
|
||||
@@ -65,8 +89,13 @@ export default function Home() {
|
||||
/>
|
||||
</SearchFormLeft>
|
||||
<SearchFormRight>
|
||||
<Button className="mr-4 rounded-lg">조회</Button>
|
||||
<Button className="mr-4 rounded-lg">신규등록</Button>
|
||||
<Button className="mr-4 rounded-lg" onClick={()=>{initHtdfl(searchTxt||"")}}>조회</Button>
|
||||
<Button
|
||||
className="mr-4 rounded-lg"
|
||||
onClick={() => setIsNewReg(!issNewReg)}
|
||||
>
|
||||
신규등록
|
||||
</Button>
|
||||
</SearchFormRight>
|
||||
</SearchDiv>
|
||||
</div>
|
||||
@@ -81,7 +110,7 @@ export default function Home() {
|
||||
pageSize={100}
|
||||
total={10}
|
||||
headName={"○건축물 목록"}
|
||||
cellClick={cellClick}
|
||||
cellClick={(val,headId)=>{cellClick(val||undefined , headId)}}
|
||||
>
|
||||
{nodeList}
|
||||
</UiTable>
|
||||
@@ -91,13 +120,33 @@ export default function Home() {
|
||||
<ListDiv>
|
||||
<ScrollArea>
|
||||
<HtdflRegForm
|
||||
htdflForm={rswtForm ?? ({} as customRswtBdst)}
|
||||
htdflForm={htdflForm ?? ({} as customHtdflBdst)}
|
||||
isModal={false}
|
||||
/>
|
||||
</ScrollArea>
|
||||
</ListDiv>
|
||||
</div>
|
||||
</div>
|
||||
<UiModal
|
||||
body={<BdstReg moType="HTB"></BdstReg>}
|
||||
bodyClass="w-[90vw] max-w-none"
|
||||
open={issNewReg}
|
||||
onOpenChange={(open) => {
|
||||
setIsNewReg(open);
|
||||
}}
|
||||
/>
|
||||
|
||||
<UiModal
|
||||
bodyClass={""}
|
||||
open={bdstChgProps.isOpen}
|
||||
body={<BdstChgModal chgBuilding={bdstChgProps.chgBuilding}></BdstChgModal>}
|
||||
onOpenChange={(open) => {
|
||||
setBdstChgProps({ ...bdstChgProps, isOpen: open });
|
||||
}
|
||||
}
|
||||
/>
|
||||
|
||||
|
||||
</ContentsDiv>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -90,8 +90,8 @@ const resetContents = () => {
|
||||
<Tabs defaultValue="mng" onValueChange={handleTabChange}>
|
||||
<div className="flex justify-between items-center">
|
||||
<TabsList>
|
||||
<TabsTrigger value="mng">운영정보</TabsTrigger>
|
||||
<TabsTrigger value="buse">시설정보</TabsTrigger>
|
||||
<TabsTrigger value="mng">시설정보</TabsTrigger>
|
||||
<TabsTrigger value="buse">차수별정보</TabsTrigger>
|
||||
</TabsList>
|
||||
<Button className="rounded-lg" onClick={resetContents}>
|
||||
신규등록
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
"use client";
|
||||
import { useWrStore } from "@/app/store";
|
||||
import type {
|
||||
chgBuilding,
|
||||
customRainBdst,
|
||||
TableUpperProps,
|
||||
} from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import { tableData } from "@/components/lib/func/commom";
|
||||
import { RainRegForm } from "@/components/ui/form/fcltReg/rainReg/component";
|
||||
import { BdstReg } from "@/components/ui/modal/bdstReg/component";
|
||||
import { RainRegForm } from "@/components/ui/form/fcltReg/rainReg/rainRegForm";
|
||||
import BdstChgModal from "@/components/ui/modal/bdstChgModal/bdstChgModal";
|
||||
import { BdstReg } from "@/components/ui/modal/bdstRegModal/bdstRegModal";
|
||||
import {
|
||||
ContentsDiv,
|
||||
ScrollArea,
|
||||
@@ -22,8 +24,6 @@ import ListDiv from "@common/business_components/ui/list_div";
|
||||
import { Button, TableHead, TableRow } from "@common/components";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
|
||||
|
||||
export const headMakeColSpan = (upHeadList: TableUpperProps[]) => {
|
||||
return (
|
||||
<>
|
||||
@@ -53,15 +53,18 @@ export const headMakeColSpan = (upHeadList: TableUpperProps[]) => {
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
export default function Home() {
|
||||
const { rain, code, init } = useWrStore((state) => {
|
||||
return state;
|
||||
});
|
||||
const { rainRes } = rain;
|
||||
const [rainForm, setRainForm] = useState<customRainBdst>();
|
||||
const [issNewReg,setIsNewReg] = useState<boolean>( false);
|
||||
|
||||
const [bdstTable, setbdstTable] = useState<customRainBdst[]>();
|
||||
const [searchTxt , setSearchTxt] = useState<string>()
|
||||
const [searchTxt, setSearchTxt] = useState<string>();
|
||||
const [bdstChgProps, setBdstChgProps] = useState<{isOpen:boolean,chgBuilding:chgBuilding[]}>({isOpen:false,chgBuilding:[] });
|
||||
|
||||
|
||||
const nodeList = headMakeColSpan(rain.upHeadList);
|
||||
useEffect(() => {
|
||||
@@ -72,21 +75,39 @@ export default function Home() {
|
||||
|
||||
useEffect(() => {
|
||||
if (code.sggCd.length > 0) {
|
||||
|
||||
setbdstTable( tableData(rainRes, { code }));
|
||||
setbdstTable(tableData(rainRes, { code }));
|
||||
}
|
||||
}, [code, rainRes]);
|
||||
const cellClick: (val: number | undefined) => void = (val) => {
|
||||
if ((bdstTable ?? []).length > 0 && val !== undefined) {
|
||||
{
|
||||
const cellClick: (val: number | undefined, headId: string) => void = (
|
||||
val,
|
||||
headId
|
||||
) => {
|
||||
if ( val !== undefined) {
|
||||
setRainForm(rainRes[val]);
|
||||
}
|
||||
|
||||
if (headId === "bdstChgYn" && val !== undefined) {
|
||||
|
||||
if (rainRes[val]?.bdstInfoPk != null && rainRes[val]?.chgBuilding.length > 0) {
|
||||
bdstChgModal(rainRes[val].chgBuilding);
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const bdstChgModal = (chgBuilding:chgBuilding[] ) => {
|
||||
setBdstChgProps( {isOpen:true, chgBuilding:chgBuilding } );
|
||||
|
||||
};
|
||||
|
||||
useEffect(()=>{
|
||||
console.log("rainForm", rainForm);
|
||||
},[rainForm])
|
||||
|
||||
|
||||
return (
|
||||
<>
|
||||
<ContentsDiv>
|
||||
<ContentsDiv >
|
||||
<div className="grid grid-cols-4 gap-4 ">
|
||||
<div className="col-span-4">
|
||||
<Title title={"빗물이용시설 등록"} />
|
||||
@@ -96,53 +117,80 @@ export default function Home() {
|
||||
className="col-span-3 my-7"
|
||||
label="건물명"
|
||||
textValue={searchTxt || ""}
|
||||
setText={(e)=>{setSearchTxt(e)}}
|
||||
setText={(e) => {
|
||||
setSearchTxt(e);
|
||||
}}
|
||||
/>
|
||||
</SearchFormLeft>
|
||||
<SearchFormRight>
|
||||
<Button className="mr-4 rounded-lg" onClick={(e)=>{init(searchTxt||"")} }>조회</Button>
|
||||
<UiModal
|
||||
butNm="신규등록"
|
||||
title="건축물 시설 등록(빗물이용시설)"
|
||||
body={<BdstReg moType="RNB"></BdstReg>}
|
||||
bodyClass="sm:max-w-7xl"
|
||||
/>
|
||||
<Button
|
||||
className="mr-4 rounded-lg"
|
||||
onClick={(e) => {
|
||||
init(searchTxt || "");
|
||||
}}
|
||||
>
|
||||
조회
|
||||
</Button>
|
||||
<Button
|
||||
className="mr-4 rounded-lg"
|
||||
onClick={() => setIsNewReg(!issNewReg)}
|
||||
>
|
||||
신규등록
|
||||
</Button>
|
||||
|
||||
</SearchFormRight>
|
||||
</SearchDiv>
|
||||
</div>
|
||||
</div>
|
||||
<div className="grid grid-cols-6 gap-4 ">
|
||||
<div className="grid grid-cols-6 gap-4 ">
|
||||
<div className="col-span-4 max-h-full ovreflow-y-scroll">
|
||||
<ListDiv>
|
||||
<UiTable
|
||||
<ScrollArea className="h-full">
|
||||
<UiTable
|
||||
tableData={bdstTable || []}
|
||||
headlist={rain.upHeadList}
|
||||
pageSize={100}
|
||||
total={10}
|
||||
headName={"○건축물 목록"}
|
||||
cellClick={cellClick}
|
||||
cellClick={(val, headId) => {
|
||||
cellClick(val, headId);
|
||||
}}
|
||||
>
|
||||
{nodeList}
|
||||
</UiTable>
|
||||
</UiTable>
|
||||
</ScrollArea>
|
||||
</ListDiv>
|
||||
</div>
|
||||
<div className="col-span-2 max-h-full ovreflow-y-scroll">
|
||||
<ListDiv>
|
||||
<ScrollArea>
|
||||
<RainRegForm
|
||||
rainForm={rainForm || undefined}
|
||||
rainForm={rainForm ?? {} as customRainBdst}
|
||||
isModal={false}
|
||||
></RainRegForm>
|
||||
</ScrollArea>
|
||||
</ListDiv>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<UiModal
|
||||
body={<BdstReg moType="RNB"></BdstReg>}
|
||||
bodyClass="w-[90vw] max-w-none"
|
||||
open={issNewReg}
|
||||
onOpenChange={(open) => {
|
||||
setIsNewReg(open);
|
||||
}}
|
||||
/>
|
||||
|
||||
<UiModal
|
||||
bodyClass={""}
|
||||
open={bdstChgProps.isOpen}
|
||||
body={<BdstChgModal chgBuilding={bdstChgProps.chgBuilding}></BdstChgModal>}
|
||||
onOpenChange={(open) => {
|
||||
setBdstChgProps({ ...bdstChgProps, isOpen: open });
|
||||
}
|
||||
}
|
||||
/>
|
||||
</ContentsDiv>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
import { useWrStore } from "@/app/store";
|
||||
import { BdstReg } from "@/components/ui/modal/bdstReg/component";
|
||||
import { BdstReg } from "@/components/ui/modal/bdstRegModal/bdstRegModal";
|
||||
import {
|
||||
ContentsDiv,
|
||||
ScrollArea,
|
||||
@@ -13,25 +13,29 @@ import {
|
||||
UiTable,
|
||||
} from "@common/business_components";
|
||||
import ListDiv from "@common/business_components/ui/list_div";
|
||||
import { Button} from "@common/components";
|
||||
import { Button } from "@common/components";
|
||||
import { headMakeColSpan } from "../rainReg/page";
|
||||
import { useEffect, useState } from "react";
|
||||
import type { customRswtBdst } from "@/app/store/ruseFcltMng/fcltReg/rswtReg";
|
||||
import { tableData } from "@/components/lib/func/commom";
|
||||
import { RswtrRegForm } from "@/components/ui/form/fcltReg/rswtrReg/RswtrRegForm";
|
||||
|
||||
import BdstChgModal from "@/components/ui/modal/bdstChgModal/bdstChgModal";
|
||||
import type { chgBuilding } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
|
||||
export default function Home() {
|
||||
const { code,rswt,initRswt } = useWrStore((state) => state);
|
||||
const { code, rswt, initRswt } = useWrStore((state) => state);
|
||||
const nodeList = headMakeColSpan(rswt.upHeadList);
|
||||
const [rswtForm, setRswtForm] = useState<customRswtBdst>();
|
||||
const [searchTxt , setSearchTxt] = useState<string>()
|
||||
const [searchTxt, setSearchTxt] = useState<string>();
|
||||
const [issNewReg, setIsNewReg] = useState<boolean>(false);
|
||||
|
||||
const [bdstTable, setbdstTable] = useState<customRswtBdst[]>();
|
||||
const [bdstChgProps, setBdstChgProps] = useState<{
|
||||
isOpen: boolean;
|
||||
chgBuilding: chgBuilding[];
|
||||
}>({ isOpen: false, chgBuilding: [] });
|
||||
|
||||
const {rswtRes} = rswt;
|
||||
|
||||
|
||||
const { rswtRes } = rswt;
|
||||
|
||||
useEffect(() => {
|
||||
if (!rswt.isInit) {
|
||||
@@ -40,20 +44,31 @@ export default function Home() {
|
||||
}, [rswt.isInit, initRswt]);
|
||||
useEffect(() => {
|
||||
if (code.sggCd.length > 0) {
|
||||
|
||||
setbdstTable( tableData(rswtRes, { code }));
|
||||
setbdstTable(tableData(rswtRes, { code }));
|
||||
}
|
||||
}, [code, rswtRes]);
|
||||
const cellClick: (val: number | undefined) => void = (val) => {
|
||||
console.log(" val ", val)
|
||||
const cellClick: (val: number | undefined, headId: string) => void = (
|
||||
val,
|
||||
headId
|
||||
) => {
|
||||
if ((bdstTable ?? []).length > 0 && val !== undefined) {
|
||||
{
|
||||
console.log(" val ", val)
|
||||
setRswtForm(rswtRes[val]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if (headId === "bdstChgYn" && val !== undefined) {
|
||||
if (
|
||||
rswtRes[val]?.bdstInfoPk != null &&
|
||||
rswtRes[val]?.chgBuilding?.length > 0
|
||||
) {
|
||||
bdstChgModal(rswtRes[val].chgBuilding);
|
||||
}
|
||||
}
|
||||
};
|
||||
const bdstChgModal = (chgBuilding: chgBuilding[]) => {
|
||||
setBdstChgProps({ isOpen: true, chgBuilding: chgBuilding });
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -61,55 +76,82 @@ export default function Home() {
|
||||
<div className="grid grid-cols-4 gap-4 ">
|
||||
<div className="col-span-4">
|
||||
<Title title={"중수도시설 등록 "} />
|
||||
<SearchDiv>
|
||||
<SearchFormLeft>
|
||||
<SearchInput
|
||||
className="col-span-3 my-7"
|
||||
label="건물명:"
|
||||
textValue={searchTxt||""}
|
||||
setText={(e)=>{setSearchTxt(e)}}
|
||||
/>
|
||||
</SearchFormLeft>
|
||||
<SearchFormRight>
|
||||
<Button className="mr-4 rounded-lg" onClick={(e)=>{initRswt(searchTxt||"")} }>조회</Button>
|
||||
<UiModal
|
||||
butNm="신규등록"
|
||||
title="건축물 시설 등록(중수도시설)"
|
||||
body={<BdstReg moType={"RST"}></BdstReg>}
|
||||
bodyClass="sm:max-w-7xl"
|
||||
/>
|
||||
</SearchFormRight>
|
||||
</SearchDiv>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-6 gap-4 ">
|
||||
<div className="col-span-4">
|
||||
<ListDiv>
|
||||
<UiTable
|
||||
tableData={bdstTable||[]}
|
||||
headlist={rswt.upHeadList}
|
||||
pageSize={100}
|
||||
total={10}
|
||||
headName={"○건축물 목록"}
|
||||
cellClick={cellClick}
|
||||
<SearchDiv>
|
||||
<SearchFormLeft>
|
||||
<SearchInput
|
||||
className="col-span-3 my-7"
|
||||
label="건물명:"
|
||||
textValue={searchTxt || ""}
|
||||
setText={(e) => {
|
||||
setSearchTxt(e);
|
||||
}}
|
||||
/>
|
||||
</SearchFormLeft>
|
||||
<SearchFormRight>
|
||||
<Button
|
||||
className="mr-4 rounded-lg"
|
||||
onClick={(e) => {
|
||||
initRswt(searchTxt || "");
|
||||
}}
|
||||
>
|
||||
{nodeList}
|
||||
</UiTable>
|
||||
</ListDiv>
|
||||
</div>
|
||||
<div className="col-span-2 max-h-full ovreflow-y-scroll">
|
||||
<ListDiv>
|
||||
<ScrollArea>
|
||||
<RswtrRegForm
|
||||
rswtForm={rswtForm ?? {} as customRswtBdst}
|
||||
isModal={false}
|
||||
|
||||
/>
|
||||
</ScrollArea>
|
||||
</ListDiv>
|
||||
</div>
|
||||
조회
|
||||
</Button>
|
||||
<Button
|
||||
className="mr-4 rounded-lg"
|
||||
onClick={() => setIsNewReg(!issNewReg)}
|
||||
>
|
||||
신규등록
|
||||
</Button>
|
||||
</SearchFormRight>
|
||||
</SearchDiv>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-6 gap-4 ">
|
||||
<div className="col-span-4">
|
||||
<ListDiv>
|
||||
<UiTable
|
||||
tableData={bdstTable || []}
|
||||
headlist={rswt.upHeadList}
|
||||
pageSize={100}
|
||||
total={10}
|
||||
headName={"○건축물 목록"}
|
||||
cellClick={cellClick}
|
||||
>
|
||||
{nodeList}
|
||||
</UiTable>
|
||||
</ListDiv>
|
||||
</div>
|
||||
<div className="col-span-2 max-h-full ovreflow-y-scroll">
|
||||
<ListDiv>
|
||||
<ScrollArea>
|
||||
<RswtrRegForm
|
||||
rswtForm={rswtForm ?? ({} as customRswtBdst)}
|
||||
isModal={false}
|
||||
/>
|
||||
</ScrollArea>
|
||||
</ListDiv>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<UiModal
|
||||
body={<BdstReg moType="RST"></BdstReg>}
|
||||
bodyClass="w-[90vw] max-w-none"
|
||||
open={issNewReg}
|
||||
onOpenChange={(open) => {
|
||||
setIsNewReg(open);
|
||||
}}
|
||||
/>
|
||||
<UiModal
|
||||
bodyClass={""}
|
||||
open={bdstChgProps.isOpen}
|
||||
body={
|
||||
<BdstChgModal chgBuilding={bdstChgProps.chgBuilding}></BdstChgModal>
|
||||
}
|
||||
onOpenChange={(open) => {
|
||||
setBdstChgProps({ ...bdstChgProps, isOpen: open });
|
||||
}}
|
||||
/>
|
||||
</ContentsDiv>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -0,0 +1,114 @@
|
||||
"use client";
|
||||
import { useWrStore } from "@/app/store";
|
||||
import {
|
||||
ContentsDiv,
|
||||
SearchDiv,
|
||||
SearchFormLeft,
|
||||
SearchFormRight,
|
||||
SelectBox,
|
||||
Title,
|
||||
UiTable,
|
||||
} from "@common/business_components/ui";
|
||||
import ListDiv from "@common/business_components/ui/list_div";
|
||||
import { Button } from "@common/components/ui";
|
||||
import { headMakeprfmnc } from "../../prfmncReg/chkgdnReg/page";
|
||||
|
||||
export default function PbnstSttn() {
|
||||
const { code,pbnStt } = useWrStore((state) => state);
|
||||
|
||||
const nodeList = headMakeprfmnc(pbnStt.pbnSttHeadList, pbnStt.pbnSttHeadNm);
|
||||
|
||||
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>
|
||||
<Button className="mr-4 rounded-lg" onClick={(e) => {}}>
|
||||
조회
|
||||
</Button>
|
||||
<Button className="mr-4 rounded-lg" onClick={() => {}}>
|
||||
다운로드
|
||||
</Button>
|
||||
<Button className="mr-4 rounded-lg" onClick={() => {}}>
|
||||
조회항목설정
|
||||
</Button>
|
||||
</SearchFormRight>
|
||||
</SearchDiv>
|
||||
</div>
|
||||
</div>
|
||||
<div className="grid grid-cols-6 gap-4 ">
|
||||
<div className="col-span-6">
|
||||
<ListDiv>
|
||||
<UiTable
|
||||
headName={undefined}
|
||||
tableData={[]}
|
||||
headlist={pbnStt.pbnSttHeadList}
|
||||
pageSize={0}
|
||||
total={0}
|
||||
cellClick={undefined}
|
||||
onPageChange={function (page: number): void {
|
||||
throw new Error("Function not implemented.");
|
||||
}}
|
||||
>
|
||||
{nodeList}
|
||||
</UiTable>
|
||||
</ListDiv>
|
||||
</div>
|
||||
</div>
|
||||
</ContentsDiv>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
"use client";
|
||||
|
||||
import { useWrStore } from "@/app/store";
|
||||
import {
|
||||
fcltDiv,
|
||||
type chHeadType,
|
||||
} from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn";
|
||||
import {
|
||||
ContentsDiv,
|
||||
SearchDiv,
|
||||
SearchFormLeft,
|
||||
SearchFormRight,
|
||||
SearchInput,
|
||||
SelectBox,
|
||||
Title,
|
||||
UiModal,
|
||||
UiTable,
|
||||
} from "@common/business_components/ui";
|
||||
import ListDiv from "@common/business_components/ui/list_div";
|
||||
import { Button, Input } from "@common/components/ui";
|
||||
import { useState } from "react";
|
||||
import { TableRow, TableHead } from "@common/components";
|
||||
import React from "react";
|
||||
import type { TableUpperProps } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import RainChkgdTable from "@/components/ui/table/rainChkgd/rainChkgdTable";
|
||||
import RswtChkgdTable from "@/components/ui/table/rswtChkgd/rswtChkgdTable";
|
||||
import ChkgdModal from "@/components/ui/modal/chkgdModal/chkgdModal";
|
||||
import ChkgdExcel from "@/components/ui/modal/chkgdExcel/chkgdExcel";
|
||||
|
||||
export const headMakeprfmnc = (
|
||||
upHeadList: TableUpperProps[],
|
||||
makeHeadNm: chHeadType[]
|
||||
) => {
|
||||
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
|
||||
)}
|
||||
</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
|
||||
)}
|
||||
</TableRow>
|
||||
</>
|
||||
);
|
||||
};
|
||||
//-----------------------
|
||||
export default function Page() {
|
||||
const [isDetail, setIsDetail] = useState(false);
|
||||
const [isExcel, setIsExcel] = useState(false);
|
||||
|
||||
|
||||
|
||||
const [testObj, setTestObj] = useState({});
|
||||
|
||||
const [selFcltDiv, setSelFcltDiv] = useState("RST");
|
||||
|
||||
const cellClick = () => {
|
||||
const ch = { bdstNm: "test", chckYmd: "2022-10-10" };
|
||||
setTestObj(ch);
|
||||
};
|
||||
|
||||
return (
|
||||
<ContentsDiv>
|
||||
<div className="grid grid-cols-4 gap-4 ">
|
||||
<div className="col-span-4">
|
||||
<Title title={"지도점검 결과 등록 "} />
|
||||
<SearchDiv>
|
||||
<SearchFormLeft>
|
||||
<SearchInput
|
||||
className="col-span-3 my-7"
|
||||
label=" 지도점검년도"
|
||||
textValue={""}
|
||||
setText={(e) => {}}
|
||||
/>
|
||||
<SelectBox
|
||||
className={"col-span-3 w-full h-full text-2xl"}
|
||||
label={"시설구분"}
|
||||
selectClass={""}
|
||||
selectArray={fcltDiv}
|
||||
onSelectValue={setSelFcltDiv}
|
||||
value={selFcltDiv ?? fcltDiv[0]?.val}
|
||||
/>
|
||||
</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"
|
||||
onClick={() => {
|
||||
setIsExcel(!isDetail);
|
||||
}}>
|
||||
양식받기
|
||||
</Button>
|
||||
</SearchFormRight>
|
||||
</SearchDiv>
|
||||
</div>
|
||||
</div>
|
||||
<div className="grid grid-cols-6 gap-4 ">
|
||||
<div className="col-span-6">
|
||||
<ListDiv>
|
||||
{selFcltDiv === "RNB" ? <RainChkgdTable /> : <RswtChkgdTable />}
|
||||
</ListDiv>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<UiModal
|
||||
open={isDetail}
|
||||
onOpenChange={setIsDetail}
|
||||
bodyClass={"w-[40vw] max-w-none"}
|
||||
body={<ChkgdModal type={selFcltDiv} obj={testObj}></ChkgdModal>}
|
||||
/>
|
||||
|
||||
<UiModal open={isExcel}
|
||||
onOpenChange={setIsExcel}
|
||||
bodyClass={"w-[40vw] max-w-none"}
|
||||
body={<ChkgdExcel type={selFcltDiv}></ChkgdExcel>}
|
||||
/>
|
||||
</ContentsDiv>
|
||||
);
|
||||
}
|
||||
@@ -85,9 +85,9 @@ const orgwtKndCd = [
|
||||
];
|
||||
|
||||
export const chBuCd = [
|
||||
{ val: "1", text: "증축" },
|
||||
{ val: "2", text: "개축" },
|
||||
{ val: "3", text: "재축" },
|
||||
{ val: "증축", text: "증축" },
|
||||
{ val: "개축", text: "개축" },
|
||||
{ val: "재축", text: "재축" },
|
||||
]
|
||||
|
||||
|
||||
@@ -110,8 +110,8 @@ export type comCodeType = comCodeState & comCodeActions;
|
||||
export const getSggCd = async (set: any) => {
|
||||
const sgg = await getFectch("common", "/addr/sgg");
|
||||
const sggCd = sgg.map((item: any) => ({
|
||||
val: item.sggCd,
|
||||
text: item.sggKornNm,
|
||||
val: Number(item.adstDstrCd),
|
||||
text: item.gugun,
|
||||
}));
|
||||
set((state: comCodeState) => ({
|
||||
code: {
|
||||
@@ -123,8 +123,8 @@ export const getSggCd = async (set: any) => {
|
||||
export const getCityCd = async (set: any) => {
|
||||
const city = await getFectch("common", "/addr/city");
|
||||
const cityCd = city.map((item: any) => ({
|
||||
val: item.mctpvCd,
|
||||
text: item.mctpvKornNm,
|
||||
val: Number(item.adstDstrCd),
|
||||
text: item.sido,
|
||||
}));
|
||||
cityCd.unshift({val:0,text:'전체'})
|
||||
set((state: comCodeState) => ({
|
||||
@@ -161,14 +161,14 @@ export const codeActionExport: (set: any) => comCodeActions = (set: any) => {
|
||||
const sgg = await getFectch("common", "/addr/sgg");
|
||||
|
||||
const sggCd = sgg.map((item: any) => ({
|
||||
val: item.sggCd,
|
||||
text: item.sggKornNm,
|
||||
val: Number(item.adstDstrCd),
|
||||
text: item.gugun,
|
||||
}));
|
||||
|
||||
const city = await getFectch("common", "/addr/city");
|
||||
const cityCd = city.map((item: any) => ({
|
||||
val: item.mctpvCd,
|
||||
text: item.mctpvKornNm,
|
||||
val: Number(item.adstDstrCd),
|
||||
text: item.sido,
|
||||
}));
|
||||
|
||||
return set((state: comCodeState) => ({
|
||||
|
||||
@@ -0,0 +1,232 @@
|
||||
import type { TableUpperProps } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import type { text } from "stream/consumers";
|
||||
import { z } from "zod";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
export const rainRegExcel =z.object({
|
||||
bdstInfoPk:z.number().default(111111111),
|
||||
chckYmd:z.date().default(new Date()),
|
||||
file: z.instanceof(File).optional()
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
export const fcltDiv=[
|
||||
{val:'RST', text:'중수도시설'},
|
||||
{val:'RNB', text:'빗물이용시설'},
|
||||
]
|
||||
|
||||
|
||||
export type chHeadType={
|
||||
headNm: string;
|
||||
text: string;
|
||||
length: number;
|
||||
}
|
||||
|
||||
export const rainHeadNm:chHeadType[] = [
|
||||
{headNm:"useQuilty", text:"이용수질(필요시)" , length: 4},
|
||||
{headNm:"feeHist", text:"과태료 부과내역" , length: 3},
|
||||
{headNm:"subWater", text:"연간보급수 이용량(m³)" , length: 13},
|
||||
{headNm:"detailQulity", text:"분기" , length: 11}
|
||||
]
|
||||
|
||||
export const rainChkgdnHeadList:TableUpperProps[] = [
|
||||
{ id: "cityText", title: "시도" },
|
||||
{ id: "sggText", title: "시군구" },
|
||||
{ id: "bdstNm", title: "시설명" },
|
||||
{ id: "operMngCd", title: "운영관리형태" },
|
||||
{ id: "flowCheck", title: "유량측정방법" },
|
||||
{ id: "yearFee", title: "연간운영비(원/년)" },
|
||||
{ id: "rainDtnbaOpct", title: "빗물저류조용량(m³)" },
|
||||
{ id: "checkDay", title: "점검일" },
|
||||
{ id: "utztnUsg", title: "이용용도" },
|
||||
|
||||
{ id: "splyUswtrUtztnQnt", title: "연간보급수이용량(m³)" },
|
||||
{ id: "rainUsg", title: "연간빗물이용량(m³)" },
|
||||
{ id: "ph", title: "PH", upName: "useQuilty", upSequnce: 1 },
|
||||
{ id: "trbt", title: "탁도", upName: "useQuilty", upSequnce: 2 },
|
||||
{ id: "grssClfg", title: "총대장균군수", upName: "useQuilty", upSequnce: 3 },
|
||||
{ id: "etc", title: "기타", upName: "useQuilty", upSequnce: 4 },
|
||||
{ id: "dayFee", title: "부과일(위반일)", upName: "feeHist", upSequnce: 1 },
|
||||
{ id: "guilty", title: "위반사항", upName: "feeHist", upSequnce: 2 },
|
||||
{ id: "fee", title: "부과금액(천원)", upName: "feeHist", upSequnce: 3 },
|
||||
];
|
||||
|
||||
export const supWaterHeadList:TableUpperProps[] = [
|
||||
{ id: "utztnUsgTest", title: "이용용도" },
|
||||
{ id: "total", title: "계" ,upName: "subWater", upSequnce: 1 , edit:true},
|
||||
{ id: "sub1", title: "1월" , upName: "subWater", upSequnce: 2 , edit:true},
|
||||
{ id: "sub2", title: "2월", upName: "subWater", upSequnce: 3 , edit:true},
|
||||
{ id: "sub3", title: "3월", upName: "subWater", upSequnce: 4 , edit:true},
|
||||
{ id: "sub4", title: "4월", upName: "subWater", upSequnce: 5 , edit:true},
|
||||
{ id: "sub5", title: "5월", upName: "subWater", upSequnce: 6 , edit:true},
|
||||
{ id: "sub6", title: "6월", upName: "subWater", upSequnce: 7 , edit:true},
|
||||
{ id: "sub7", title: "7월", upName: "subWater", upSequnce: 8 , edit:true},
|
||||
{ id: "sub8", title: "8월", upName: "subWater", upSequnce: 9 , edit:true},
|
||||
{ id: "sub9", title: "9월", upName: "subWater", upSequnce: 10, edit:true },
|
||||
{ id: "sub10", title: "10월", upName: "subWater", upSequnce: 11 , edit:true},
|
||||
{ id: "sub11", title: "11월", upName: "subWater", upSequnce: 12 , edit:true},
|
||||
{ id: "sub12", title: "12월", upName: "subWater", upSequnce: 13 , edit:true},
|
||||
]
|
||||
|
||||
|
||||
export const rswtDetailHeadList:TableUpperProps[] = [
|
||||
{ id: "utztnUsgTest", title: "이용용도" },
|
||||
{ id: "avre", title: "평균" ,upName: "detailQulity", upSequnce: 1 , edit:true},
|
||||
{ id: "grssClfg", title: "총대장균군수" , upName: "detailQulity", upSequnce: 2 , edit:true},
|
||||
{ id: "combResdch", title: "결합잔류염소", upName: "detailQulity", upSequnce: 3 , edit:true},
|
||||
{ id: "trbt", title: "탁도", upName: "detailQulity", upSequnce: 4 , edit:true},
|
||||
{ id: "bod", title: "BOD", upName: "detailQulity", upSequnce: 5 , edit:true},
|
||||
{ id: "smll", title: "냄새", upName: "detailQulity", upSequnce: 6 , edit:true},
|
||||
{ id: "crmty", title: "색도", upName: "detailQulity", upSequnce: 7 , edit:true},
|
||||
{ id: "tn", title: "T-N", upName: "detailQulity", upSequnce: 8 , edit:true},
|
||||
{ id: "tph", title: "T-P", upName: "detailQulity", upSequnce: 9 , edit:true},
|
||||
{ id: "ph", title: "PH", upName: "detailQulity", upSequnce: 10, edit:true },
|
||||
{ id: "clIonQnt", title: "염화물", upName: "detailQulity", upSequnce: 11 , edit:true},
|
||||
]
|
||||
|
||||
|
||||
export const supWaterData =[{
|
||||
utztnUsgTest:'test',
|
||||
total:100,
|
||||
sub1:10,
|
||||
sub2:10,
|
||||
sub3:10,
|
||||
sub4:10,
|
||||
sub5:10,
|
||||
sub6:10,
|
||||
sub7:10,
|
||||
sub8:10,
|
||||
sub9:10,
|
||||
sub10:10,
|
||||
sub11:10,
|
||||
sub12:10,
|
||||
},
|
||||
{
|
||||
utztnUsgTest:'test22',
|
||||
total:10011,
|
||||
sub1:101,
|
||||
sub2:101,
|
||||
sub3:101,
|
||||
sub4:101,
|
||||
sub5:101,
|
||||
sub6:101,
|
||||
sub7:101,
|
||||
sub8:101,
|
||||
sub9:101,
|
||||
sub10:101,
|
||||
sub11:101,
|
||||
sub12:101,
|
||||
}
|
||||
]
|
||||
|
||||
type supWaterDataType ={
|
||||
utztnUsgTest:string,
|
||||
total:number,
|
||||
sub1:number,
|
||||
sub2:number,
|
||||
sub3:number,
|
||||
sub4:number,
|
||||
sub5:number,
|
||||
sub6:number,
|
||||
sub7:number,
|
||||
sub8:number,
|
||||
sub9:number,
|
||||
sub10:number,
|
||||
sub11:number,
|
||||
sub12:number,
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// export const rainChkgdnHeadList:TableUpperProps[] = [
|
||||
// { id: "cityText", title: "시도" },
|
||||
// { id: "sggText", title: "시군구" },
|
||||
// { id: "bdstNm", title: "시설명" },
|
||||
// { id: "operMngCd", title: "운영관리형태" },
|
||||
// { id: "flowCheck", title: "유량측정방법" },
|
||||
// { id: "yearFee", title: "연간운영비(원/년)" },
|
||||
// { id: "rainDtnbaOpct", title: "빗물저류조용량(m³)" },
|
||||
// { id: "checkDay", title: "점검일" },
|
||||
// { id: "utztnUsg", title: "이용용도" },
|
||||
// { id: "sub1", title: "1월" , upName: "subWater", upSequnce: 1 },
|
||||
// { id: "sub2", title: "2월", upName: "subWater", upSequnce: 2 },
|
||||
// { id: "sub3", title: "3월", upName: "subWater", upSequnce: 3 },
|
||||
// { id: "sub4", title: "4월", upName: "subWater", upSequnce: 4 },
|
||||
// { id: "sub5", title: "5월", upName: "subWater", upSequnce: 5 },
|
||||
// { id: "sub6", title: "6월", upName: "subWater", upSequnce: 6 },
|
||||
// { id: "sub7", title: "7월", upName: "subWater", upSequnce: 7 },
|
||||
// { id: "sub8", title: "8월", upName: "subWater", upSequnce: 8 },
|
||||
// { id: "sub9", title: "9월", upName: "subWater", upSequnce: 9 },
|
||||
// { id: "sub10", title: "10월", upName: "subWater", upSequnce: 10 },
|
||||
// { id: "sub11", title: "11월", upName: "subWater", upSequnce: 11 },
|
||||
// { id: "sub12", title: "12월", upName: "subWater", upSequnce: 12 },
|
||||
|
||||
// { id: "rain1", title: "1월", upName: "yearRainWater", upSequnce: 1 },
|
||||
// { id: "rain2", title: "2월", upName: "yearRainWater", upSequnce: 2 },
|
||||
// { id: "rain3", title: "3월", upName: "yearRainWater", upSequnce: 3 },
|
||||
// { id: "rain4", title: "4월", upName: "yearRainWater", upSequnce: 4 },
|
||||
// { id: "rain5", title: "5월", upName: "yearRainWater", upSequnce: 5 },
|
||||
// { id: "rain6", title: "6월", upName: "yearRainWater", upSequnce: 6 },
|
||||
// { id: "rain7", title: "7월", upName: "yearRainWater", upSequnce: 7 },
|
||||
// { id: "rain8", title: "8월", upName: "yearRainWater", upSequnce: 8 },
|
||||
// { id: "rain9", title: "9월", upName: "yearRainWater", upSequnce: 9 },
|
||||
// { id: "rain10", title: "10월", upName: "yearRainWater", upSequnce: 10 },
|
||||
// { id: "rain11", title: "11월", upName: "yearRainWater", upSequnce: 11 },
|
||||
// { id: "rain12", title: "12월", upName: "yearRainWater", upSequnce: 12 },
|
||||
|
||||
// { id: "ph", title: "PH", upName: "useQuilty", upSequnce: 1 },
|
||||
// { id: "trbt", title: "탁도", upName: "useQuilty", upSequnce: 2 },
|
||||
// { id: "grssClfg", title: "총대장균군수", upName: "useQuilty", upSequnce: 3 },
|
||||
// { id: "etc", title: "기타", upName: "useQuilty", upSequnce: 4 },
|
||||
|
||||
// { id: "dayFee", title: "부과일(위반일)", upName: "feeHist", upSequnce: 1 },
|
||||
// { id: "guilty", title: "위반사항", upName: "feeHist", upSequnce: 2 },
|
||||
// { id: "fee", title: "부과금액(천원)", upName: "feeHist", upSequnce: 3 },
|
||||
// ];
|
||||
|
||||
|
||||
export type rainChkgdnState = {
|
||||
rainChkgdn: {
|
||||
rainChkgdnHeadList:TableUpperProps[]
|
||||
rainHeadNm:chHeadType[]
|
||||
supWaterHeadList:TableUpperProps[]
|
||||
supWaterData:supWaterDataType[]
|
||||
rswtDetailHeadList:TableUpperProps[]
|
||||
};
|
||||
};
|
||||
|
||||
type rainChkgdnActions = {
|
||||
rainChkgdnInit: (sggCd:string, searchTxt:string, flag:string) => void ;
|
||||
};
|
||||
|
||||
|
||||
export type rainChkgdnType = rainChkgdnState & rainChkgdnActions;
|
||||
|
||||
|
||||
export const rainChkgdnStateExport: rainChkgdnState = {
|
||||
rainChkgdn: {
|
||||
rainChkgdnHeadList:rainChkgdnHeadList,
|
||||
rainHeadNm:rainHeadNm,
|
||||
supWaterHeadList:supWaterHeadList,
|
||||
supWaterData:supWaterData,
|
||||
rswtDetailHeadList:rswtDetailHeadList,
|
||||
},
|
||||
};
|
||||
|
||||
export const rainChkgdnActionsExport: (set: any) => rainChkgdnActions = (
|
||||
set: any
|
||||
) => {
|
||||
return {
|
||||
|
||||
rainChkgdnInit: async(sggCd:string, searchTxt:string ,flg:string ) =>{
|
||||
|
||||
},
|
||||
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,72 @@
|
||||
import type { TableUpperProps } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import type { chHeadType } from "../rainChkgdn";
|
||||
|
||||
|
||||
|
||||
export const rswtHeadNm:chHeadType[] = [
|
||||
{headNm:"useQuilty", text:"연간 평균 이용수질" , length: 10},
|
||||
{headNm:"feeHist", text:"과태료 부과내역" , length: 3},
|
||||
]
|
||||
export const rswtChkgdnHeadList: TableUpperProps[] = [
|
||||
{ id: "cityText", title: "시도" },
|
||||
{ id: "sggText", title: "시군구" },
|
||||
{ id: "bdstNm", title: "시설명" },
|
||||
{ id: "operMngCd", title: "운영관리형태" },
|
||||
{ id: "yearFee", title: "연간운영비(원/년)" },
|
||||
{ id: "rainDtnbaOpct", title: "처리용량(m³)" },
|
||||
{ id: "checkDay", title: "점검일" },
|
||||
{id: "checkPoint", title: "채수지점"},
|
||||
{ id: "utztnUsg", title: "이용용도" },
|
||||
{ id: "splyUswtrUtztnQnt", title: "연간보급수이용량(m³)" },
|
||||
{ id: "rswtUsg", title: "연간중수도이용량(m³)" },
|
||||
|
||||
|
||||
{ id: "grssClfgUswtr", title: "총대장균군수", upName: "useQuilty", upSequnce: 1 },
|
||||
{ id: "combResdch", title: "결합잔류염소", upName: "useQuilty", upSequnce: 2 },
|
||||
{ id: "trbt", title: "탁도", upName: "useQuilty", upSequnce: 3 },
|
||||
{ id: "bod", title: "BOD", upName: "useQuilty", upSequnce: 4 },
|
||||
{ id: "smll", title: "냄새", upName: "useQuilty", upSequnce: 5 },
|
||||
{ id: "crmty", title: "색도", upName: "useQuilty", upSequnce: 6 },
|
||||
{ id: "tn", title: "T-N", upName: "useQuilty", upSequnce: 7 },
|
||||
{ id: "tph", title: "T-P", upName: "useQuilty", upSequnce: 8 },
|
||||
{ id: "ph", title: "PH", upName: "useQuilty", upSequnce: 9 },
|
||||
{ id: "clIonQnt", title: "염화물", upName: "useQuilty", upSequnce: 10 },
|
||||
|
||||
|
||||
|
||||
{ id: "dayFee", title: "부과일(위반일)", upName: "feeHist", upSequnce: 1 },
|
||||
{ id: "guilty", title: "위반사항", upName: "feeHist", upSequnce: 2 },
|
||||
{ id: "fee", title: "부과금액(천원)", upName: "feeHist", upSequnce: 3 },
|
||||
|
||||
|
||||
];
|
||||
|
||||
export type rswtChkgdnState = {
|
||||
rswtChkgdn: {
|
||||
rswtChkgdnHeadList: TableUpperProps[];
|
||||
rswtHeadNm:chHeadType[];
|
||||
};
|
||||
};
|
||||
|
||||
type rswtChkgdnActions = {
|
||||
rswtChkgdnInit: (sggCd: string, searchTxt: string, flag: string) => void;
|
||||
};
|
||||
|
||||
export type rswtChkgdnType = rswtChkgdnState & rswtChkgdnActions;
|
||||
|
||||
export const rswtChkgdnStateExport: rswtChkgdnState = {
|
||||
rswtChkgdn: {
|
||||
rswtChkgdnHeadList: rswtChkgdnHeadList,
|
||||
rswtHeadNm:rswtHeadNm
|
||||
},
|
||||
};
|
||||
|
||||
export const rswtChkgdnActionsExport: (set: any) => rswtChkgdnActions = (
|
||||
set: any
|
||||
) => {
|
||||
return {
|
||||
rswtChkgdnInit: async (sggCd: string, searchTxt: string, flg: string) => {
|
||||
|
||||
},
|
||||
};
|
||||
};
|
||||
@@ -1,5 +1,6 @@
|
||||
import { getFectch } from "@/components/lib/api";
|
||||
import type { bdstAll } from "../rainReg";
|
||||
import type { TableProps } from "../pbnstReg";
|
||||
|
||||
type TableUpperProps = {
|
||||
id: string;
|
||||
@@ -19,6 +20,16 @@ type TableUpperProps = {
|
||||
{ id: "archChgArea", title: "면적", upName: "upChangeRe", upSequnce: 3 },
|
||||
];
|
||||
|
||||
|
||||
const bdstChgHeadList: TableProps[] = [
|
||||
{ id: "bdstChgNm", title: "구분" },
|
||||
{ id: "archChgPrmsnDt", title: "허가일" },
|
||||
{ id: "archChgArea", title: "변경면적" },
|
||||
|
||||
];
|
||||
|
||||
|
||||
|
||||
const bdstBase: bdstAll[] = [];
|
||||
|
||||
|
||||
@@ -30,6 +41,7 @@ export type bdstState = {
|
||||
bdst: {
|
||||
bdstBase: any[];
|
||||
moUpHeadList:TableUpperProps[]
|
||||
bdstChgHeadList:TableProps[]
|
||||
};
|
||||
};
|
||||
|
||||
@@ -47,6 +59,7 @@ export const bdstStateExport: bdstState = {
|
||||
bdst: {
|
||||
bdstBase: bdstBase, // Updated to match the array type
|
||||
moUpHeadList:moUpHeadList,
|
||||
bdstChgHeadList:bdstChgHeadList,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -1,138 +1,147 @@
|
||||
import { getFectch } from "@/components/lib/api";
|
||||
import {
|
||||
upHeadList,
|
||||
type TableUpperProps,
|
||||
} from "../rainReg";
|
||||
|
||||
import { getFectch, postFectch, putFectch } from "@/components/lib/api";
|
||||
import { upHeadList, type bdstAll, type chgBuilding, type TableUpperProps } from "../rainReg";
|
||||
|
||||
import { z } from "zod";
|
||||
|
||||
export const hdtflZod = z.object({
|
||||
bdstInfoPk: z.number().nullish().default(0),
|
||||
bdstInfoPk: z.number().nullish(),
|
||||
ctpvCd: z.number().default(0),
|
||||
sggCd: z.number().default(0),
|
||||
daddr: z.string().default(""),
|
||||
bdstNm: z.string().default(""),
|
||||
daddr: z.string().default(" "),
|
||||
bdstNm: z.string().default(" "),
|
||||
frstArchPrmsnDt: z.date().default(() => new Date()),
|
||||
archChgPrmsnDt: z.coerce.date().nullish().default(null),
|
||||
archChgPrmsnDt: z.date().default(() => new Date()).nullish() ,
|
||||
archArea: z.number().default(0),
|
||||
archChgArea: z.number().nullish().default(0),
|
||||
|
||||
reuseBuilding: z.array(
|
||||
z.object({
|
||||
bdstRuseFcltPk: z.number().nullish().default(0),
|
||||
bdstInfoFk: z.number().nullish().default(0),
|
||||
instlCmptnDt: z.coerce.date().default(() => new Date()),
|
||||
instlCst: z.number().nullish().default(0),
|
||||
operMngCd: z.string().nullish().default(""),
|
||||
anlOperCst: z.number().default(0),
|
||||
instlCstSprtYn: z.string().default(""),
|
||||
instlCstSprtAmt: z.number().nullish().default(0),
|
||||
grntchBdstCertYn: z.string().default(""),
|
||||
grntchBdstCertYr: z.string()
|
||||
.max(4, "4자리 연도를 입력하세요")
|
||||
.regex(/^\d{4}$/, "4자리 연도를 입력하세요")
|
||||
.nullish()
|
||||
.default(""),
|
||||
grntchBdstCertNo: z.string().nullish().default(""),
|
||||
grntchBdstCertGrd: z.string().nullish().default(""),
|
||||
crgRdctYn: z.string().default(""),
|
||||
crgRdctBss: z.string().nullish().default(""),
|
||||
crgRdctAmt: z.number().nullish().default(0),
|
||||
ruseFcltFlg: z.string().nullish().default(""),
|
||||
bdstUsgCd: z.number().default(0),
|
||||
lawTrgtYn: z.string().default(""),
|
||||
reuseBuilding: z
|
||||
.array(
|
||||
z.object({
|
||||
bdstRuseFcltPk: z.number().nullish(),
|
||||
bdstInfoFk: z.number().nullish(),
|
||||
instlCmptnDt: z.coerce.date().default(() => new Date()),
|
||||
instlCst: z.number().nullish().default(0),
|
||||
operMngCd: z.string().nullish().default(""),
|
||||
anlOperCst: z.number().default(0),
|
||||
instlCstSprtYn: z.string().default(""),
|
||||
instlCstSprtAmt: z.number().nullish().default(0),
|
||||
grntchBdstCertYn: z.string().default(""),
|
||||
grntchBdstCertYr: z
|
||||
.string()
|
||||
.nullish(),
|
||||
grntchBdstCertNo: z.string().nullish().default(""),
|
||||
grntchBdstCertGrd: z.string().nullish().default(""),
|
||||
crgRdctYn: z.string().default(""),
|
||||
crgRdctBss: z.string().nullish().default(""),
|
||||
crgRdctAmt: z.number().nullish().default(0),
|
||||
ruseFcltFlg: z.string().nullish().default(""),
|
||||
bdstUsgCd: z.number().default(0),
|
||||
lawTrgtYn: z.string().default(""),
|
||||
|
||||
// htdflObj 매핑
|
||||
htdfObj: z.object({
|
||||
htdflFcltPk: z.number().nullish().default(0),
|
||||
bdstRuseFcltFk: z.number().nullish().default(0),
|
||||
etgtType: z.string().default(""),
|
||||
fclCpct: z.number().default(0),
|
||||
plwtYn: z.string().default(""),
|
||||
orgwtWtritSpt: z.number().default(0),
|
||||
orgwtOcrnProcs: z.string().default(""),
|
||||
wtritEntrcTp: z.number().default(0),
|
||||
amtgnr: z.number().default(0),
|
||||
prcsProcsYn: z.string().default(""),
|
||||
prcsFcltCpct: z.number().default(0),
|
||||
fmYn: z.string().default(""),
|
||||
utztnCpct: z.number().default(0),
|
||||
utztnUsg: z.string().default(""),
|
||||
grssClfg: z.number().default(0),
|
||||
combResdch: z.number().default(0),
|
||||
trbt: z.number().default(0),
|
||||
bod: z.number().default(0),
|
||||
smll: z.number().default(0),
|
||||
crmty: z.number().default(0),
|
||||
tn: z.number().default(0),
|
||||
tph: z.number().default(0),
|
||||
ph: z.number().default(0),
|
||||
clIonQnt: z.number().default(0),
|
||||
cdtnv: z.number().default(0),
|
||||
emsnExitTp: z.number().default(0)
|
||||
}).default({})
|
||||
})
|
||||
).default([])
|
||||
// htdflObj 매핑
|
||||
htdflObj: z
|
||||
.object({
|
||||
htdflFcltPk: z.number().nullish(),
|
||||
bdstRuseFcltFk: z.number().nullish(),
|
||||
etgtType: z.string().default(""),
|
||||
fclCpct: z.number().default(0),
|
||||
plwtYn: z.string().default(""),
|
||||
orgwtWtritSpt: z.number().default(0),
|
||||
orgwtOcrnProcs: z.string().default(""),
|
||||
wtritEntrcTp: z.number().max(4, "온도는 100이상이 될 수 없습니다.")
|
||||
.default(0),
|
||||
amtgnr: z.number().default(0),
|
||||
prcsProcsYn: z.string().default(""),
|
||||
prcsFcltCpct: z.number().default(0),
|
||||
fmYn: z.string().default(""),
|
||||
utztnCpct: z.number().default(0),
|
||||
utztnUsg: z.string().default(""),
|
||||
grssClfg: z.number().default(0),
|
||||
combResdch: z.number().default(0),
|
||||
trbt: z.number().default(0),
|
||||
bod: z.number().default(0),
|
||||
smll: z.number().default(0),
|
||||
crmty: z.number().default(0),
|
||||
tn: z.number().default(0),
|
||||
tph: z.number().default(0),
|
||||
ph: z.number().default(0),
|
||||
clIonQnt: z.number().default(0),
|
||||
cdtnv: z.number().default(0),
|
||||
emsnExitTp: z.number().default(0),
|
||||
})
|
||||
.default({}),
|
||||
})
|
||||
)
|
||||
.default([]),
|
||||
chgBuilding: z
|
||||
.array(
|
||||
z.object({
|
||||
bdstInfoFk: z.number().nullish(),
|
||||
archChgPrmsnDt: z.coerce.date() ,
|
||||
archChgArea: z.string().default("-"),
|
||||
bdstChgNm: z.string().default(""),
|
||||
})
|
||||
)
|
||||
.default([]),
|
||||
});
|
||||
|
||||
// export type customHtdfBdst = Omit<bdstAll, 'reuseBuilding'> & {
|
||||
// reuseBuilding: htdfReuseBuilding[];
|
||||
// };
|
||||
export type customHtdflBdst = Omit<bdstAll, 'reuseBuilding'> & {
|
||||
reuseBuilding: htdflReuseBuilding[];
|
||||
};
|
||||
|
||||
export type customHtdflBdst =z.infer<typeof hdtflZod>;
|
||||
//export type customHtdflBdst = z.infer<typeof hdtflZod>;
|
||||
|
||||
// 타입을 조드로 만들어가 하는ㅓㄹ로 테트
|
||||
export type htdflReuseBuilding={
|
||||
bdstRuseFcltPk: number|undefined
|
||||
bdstInfoFk: number|undefined
|
||||
instlCmptnDt: Date| undefined;
|
||||
instlCst: number|undefined
|
||||
operMngCd: string,
|
||||
anlOperCst: number|undefined
|
||||
instlCstSprtYn:string| undefined;
|
||||
instlCstSprtAmt: number|undefined
|
||||
grntchBdstCertYn:string| undefined;
|
||||
grntchBdstCertYr: string| undefined;
|
||||
grntchBdstCertNo:string| undefined;
|
||||
grntchBdstCertGrd:string| undefined;
|
||||
crgRdctYn:string
|
||||
crgRdctBss:string| undefined;
|
||||
crgRdctAmt: number|undefined
|
||||
ruseFcltFlg:string
|
||||
bdstUsgCd: number|undefined
|
||||
lawTrgtYn:string
|
||||
htdflObj:htdflObj
|
||||
}
|
||||
export type htdflReuseBuilding = {
|
||||
bdstRuseFcltPk: number | undefined;
|
||||
bdstInfoFk: number | undefined;
|
||||
instlCmptnDt: Date | undefined;
|
||||
instlCst: number | undefined;
|
||||
operMngCd: string;
|
||||
anlOperCst: number | undefined;
|
||||
instlCstSprtYn: string | undefined;
|
||||
instlCstSprtAmt: number | undefined;
|
||||
grntchBdstCertYn: string | undefined;
|
||||
grntchBdstCertYr: string | undefined;
|
||||
grntchBdstCertNo: string | undefined;
|
||||
grntchBdstCertGrd: string | undefined;
|
||||
crgRdctYn: string;
|
||||
crgRdctBss: string | undefined;
|
||||
crgRdctAmt: number | undefined;
|
||||
ruseFcltFlg: string;
|
||||
bdstUsgCd: number | undefined;
|
||||
lawTrgtYn: string;
|
||||
htdflObj: htdflObj;
|
||||
};
|
||||
|
||||
export type htdflObj = {
|
||||
htdflFcltPk: number
|
||||
bdstRuseFcltFk: number
|
||||
etgtType: string
|
||||
fclCpct: number|undefined
|
||||
plwtYn: string
|
||||
orgwtWtritSpt: number | undefined
|
||||
orgwtOcrnProcs: string
|
||||
wtritEntrcTp: number | undefined
|
||||
amtgnr: number | undefined
|
||||
prcsProcsYn: string
|
||||
prcsFcltCpct: number | undefined
|
||||
fmYn: string
|
||||
utztnCpct: number | undefined
|
||||
utztnUsg: string
|
||||
grssClfg: number | undefined
|
||||
combResdch: number | undefined
|
||||
trbt: number| undefined
|
||||
bod: number| undefined
|
||||
smll: number| undefined
|
||||
crmty: number| undefined
|
||||
tn: number| undefined
|
||||
tph: number| undefined
|
||||
ph: number| undefined
|
||||
clIonQnt: number| undefined
|
||||
cdtnv: number| undefined
|
||||
emsnExitTp:number| undefined
|
||||
}
|
||||
htdflFcltPk: number;
|
||||
bdstRuseFcltFk: number;
|
||||
etgtType: string;
|
||||
fclCpct: number | undefined;
|
||||
plwtYn: string;
|
||||
orgwtWtritSpt: number | undefined;
|
||||
orgwtOcrnProcs: string;
|
||||
wtritEntrcTp: number | undefined;
|
||||
amtgnr: number | undefined;
|
||||
prcsProcsYn: string;
|
||||
prcsFcltCpct: number | undefined;
|
||||
fmYn: string;
|
||||
utztnCpct: number | undefined;
|
||||
utztnUsg: string;
|
||||
grssClfg: number | undefined;
|
||||
combResdch: number | undefined;
|
||||
trbt: number | undefined;
|
||||
bod: number | undefined;
|
||||
smll: number | undefined;
|
||||
crmty: number | undefined;
|
||||
tn: number | undefined;
|
||||
tph: number | undefined;
|
||||
ph: number | undefined;
|
||||
clIonQnt: number | undefined;
|
||||
cdtnv: number | undefined;
|
||||
emsnExitTp: number | undefined;
|
||||
};
|
||||
|
||||
export type htdflFacState = {
|
||||
htdfl: {
|
||||
@@ -142,12 +151,13 @@ export type htdflFacState = {
|
||||
};
|
||||
};
|
||||
type htdflFacSActions = {
|
||||
initHtdfl: (txt:string|undefined) => void;
|
||||
initHtdfl: (txt: string | undefined) => void;
|
||||
htdflUpdate:(data: customHtdflBdst) => void;
|
||||
htdflReg:(data: customHtdflBdst) => void;
|
||||
};
|
||||
|
||||
const htdflRes: customHtdflBdst[] = [];
|
||||
|
||||
|
||||
export type htdflFacType = htdflFacState & htdflFacSActions;
|
||||
|
||||
export const htdflFacStateExport: htdflFacState = {
|
||||
@@ -159,33 +169,103 @@ export const htdflFacStateExport: htdflFacState = {
|
||||
};
|
||||
|
||||
const initFetch = async (txt: string | undefined) => {
|
||||
return await getFectch(
|
||||
const htdflRes = await getFectch(
|
||||
"wr",
|
||||
`/drain/facilityList/1/20/0` //+ (txt ? `/${txt}` : "")
|
||||
`/drain/facilityList/1/20/0` + (txt ? `/${txt}` : "")
|
||||
);
|
||||
const chHtdflRes = htdflRes.map((item: customHtdflBdst) => {
|
||||
return {
|
||||
...item,
|
||||
bdstChgYn: item.chgBuilding.length > 0 ? "Y" : "N",
|
||||
};
|
||||
});
|
||||
return chHtdflRes;
|
||||
};
|
||||
export const htdflFacActionsExport: (set: any) => htdflFacSActions = (
|
||||
set: any
|
||||
) => {
|
||||
return {
|
||||
initHtdfl: async (txt: string|undefined) =>{
|
||||
|
||||
initHtdfl: async (txt: string | undefined) => {
|
||||
try {
|
||||
const res = await initFetch(txt);
|
||||
const htdflRes = await initFetch(txt);
|
||||
set((state: htdflFacState) => {
|
||||
return {
|
||||
...state,
|
||||
htdfl: {
|
||||
...state.htdfl,
|
||||
htdflRes: res,
|
||||
htdflRes: htdflRes,
|
||||
isInit: false,
|
||||
|
||||
},
|
||||
};
|
||||
})
|
||||
});
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
},
|
||||
htdflUpdate: async (data: customHtdflBdst) => {
|
||||
try {
|
||||
const res = await putFectch("/drain/facility", data);
|
||||
if (res.ok) {
|
||||
alert(" 수정이 완료되었습니다.");
|
||||
}
|
||||
|
||||
const htdflRes = await initFetch(undefined);
|
||||
set((state: htdflFacState) => ({
|
||||
...state,
|
||||
htdfl: {
|
||||
...state.htdfl,
|
||||
htdflRes: htdflRes,
|
||||
isInit: false,
|
||||
},
|
||||
}));
|
||||
} catch (errorUpdate) {
|
||||
alert(
|
||||
"업데이트 오류입니다. " +
|
||||
(errorUpdate instanceof Error ? errorUpdate.message : "")
|
||||
);
|
||||
}
|
||||
},
|
||||
htdflReg: async (data: customHtdflBdst) => {
|
||||
try {
|
||||
const res = await postFectch("/drain/facility", data);
|
||||
if (res.ok) {
|
||||
|
||||
if(data.chgBuilding.length > 0){
|
||||
await res
|
||||
.json()
|
||||
.then((resData: any) => {
|
||||
const chPK = resData?.data?.bdstInfoPk;
|
||||
const makeCh = resData.data.chgBuilding.map(
|
||||
(item: chgBuilding) => ({
|
||||
...item,
|
||||
bdstInfoFk: chPK,
|
||||
})
|
||||
);
|
||||
const chch = postFectch("/reuseFc/chgBuilding", makeCh);
|
||||
return chch;
|
||||
})
|
||||
.then((chch: any) => {
|
||||
if (chch.ok) {
|
||||
alert("등록이 완료되었습니다.");
|
||||
}
|
||||
});
|
||||
}else{
|
||||
alert("등록이 완료되었습니다.");
|
||||
|
||||
}
|
||||
}
|
||||
const htdflRes = await initFetch(undefined);
|
||||
set((state: htdflFacState) => ({
|
||||
...state,
|
||||
htdfl: {
|
||||
...state.htdfl,
|
||||
htdflRes: htdflRes,
|
||||
isInit: false,
|
||||
},
|
||||
}));
|
||||
} catch (errorReg) {
|
||||
alert("등록 오류입니다.");
|
||||
}
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
@@ -5,88 +5,71 @@ import { useForm } from "react-hook-form";
|
||||
import { z } from "zod";
|
||||
|
||||
|
||||
export const rainZod = z.object({
|
||||
bdstInfoPk: z.number().nullish(),
|
||||
ctpvCd: z.number().default(0),
|
||||
sggCd: z.number().default(0),
|
||||
daddr: z.string().default(""),
|
||||
bdstNm: z.string().default(""),
|
||||
frstArchPrmsnDt: z.date().default(() => new Date()),
|
||||
archChgPrmsnDt: z.coerce.date().nullish().default(null),
|
||||
archArea: z.number().default(0),
|
||||
archChgArea: z.number().default(0),
|
||||
|
||||
reuseBuilding: z.array(
|
||||
z.object({
|
||||
bdstRuseFcltPk: z.number().nullish(),
|
||||
bdstInfoFk:z.number().nullish(),
|
||||
instlCmptnDt: z.coerce.date().default(() => new Date()),
|
||||
instlCst: z.number().default(0),
|
||||
operMngCd: z.string().nullish().default(""),
|
||||
anlOperCst: z.number().default(0),
|
||||
instlCstSprtYn: z.string().default(""),
|
||||
instlCstSprtAmt: z.number().default(0),
|
||||
grntchBdstCertYn: z.string().default(""),
|
||||
grntchBdstCertYr: z.string()
|
||||
.max(4, "4자리 연도를 입력하세요")
|
||||
.regex(/^\d{4}$/, "4자리 연도를 입력하세요")
|
||||
.default(""),
|
||||
grntchBdstCertNo: z.string().default(""),
|
||||
grntchBdstCertGrd: z.string().default(""),
|
||||
crgRdctYn: z.string().default("").nullish(),
|
||||
crgRdctBss: z.string().default("").nullish(),
|
||||
crgRdctAmt: z.number().default(0),
|
||||
ruseFcltFlg: z.string().default(""),
|
||||
bdstUsgCd: z.number().default(0),
|
||||
lawTrgtYn: z.string().default(""),
|
||||
|
||||
export const rainZod =
|
||||
{ ctpvCd: z.number(),
|
||||
sggCd: z.number(),
|
||||
bdstNm: z.string(),
|
||||
daddr: z.string(),
|
||||
frstArchPrmsnDt: z.date(),
|
||||
archArea: z.number(),
|
||||
bdstInfoPk: z.number().nullish() ,
|
||||
lawTrgtYn: z.string().nullish(),
|
||||
bdstUsgCd: z.number(),
|
||||
bdstRuseFcltPk: z.number().nullish(),
|
||||
bdstInfoFk: z.number().nullish(),
|
||||
operMngCd: z.number().nullish(),
|
||||
anlOperCst: z.number().nullish(),
|
||||
instlCmptnDt: z.date(),
|
||||
instlCst: z.number(),
|
||||
instlCstSprtYn: z.string(),
|
||||
instlCstSprtAmt: z.number(),
|
||||
grntchBdstCertYn: z.string().nullish(),
|
||||
grntchBdstCertNo: z.string().nullish(),
|
||||
grntchBdstCertGrd: z.string().nullish(),
|
||||
grntchBdstCertYr: z.string().nullish(),
|
||||
bdstReuseFcltFk:z.number().nullish(),
|
||||
pntfColKnd: z.string(),
|
||||
pntfColArea: z.number(),
|
||||
dtfcltCpct:z.number().nullish(),
|
||||
filtrTrtmfctCpct: z.number(),
|
||||
filtrTrtmfctYn: z.string(),
|
||||
filtrTrtmfctPrs: z.string(),
|
||||
annRnwtQty:z.number().nullish(),
|
||||
oilqMeasMthd:z.string().nullish(),
|
||||
|
||||
chgBuilding: z.array(
|
||||
z.object({
|
||||
archChgPrmsnDt: z.date().nullish(),
|
||||
archChgArea: z.number().nullish(),
|
||||
bdstChgNm: z.string().nullish(),
|
||||
})
|
||||
).default([]), //
|
||||
rainyObj: z.object({
|
||||
bdstReuseFcltFk: z.number().nullish(),
|
||||
pntfColKnd: z.string().default(""),
|
||||
pntfColArea: z.number().default(0),
|
||||
dtfcltCpct: z.number().default(0),
|
||||
filtrTrtmfctCpct: z.number().default(0),
|
||||
filtrTrtmfctYn: z.string().default(""),
|
||||
filtrTrtmfctPrs: z.string().default(""),
|
||||
annRnwtQty: z.number().default(0),
|
||||
oilqMeasMthd: z.string().default("").nullish()
|
||||
}).default({})
|
||||
})
|
||||
).default([]),
|
||||
|
||||
}
|
||||
chgBuilding: z.array(
|
||||
z.object({
|
||||
bdstInfoFk: z.number().nullish(),
|
||||
archChgPrmsnDt: z.coerce.date(),
|
||||
archChgArea: z.string().default("-"),
|
||||
bdstChgNm: z.string().default(""),
|
||||
})
|
||||
).default([])
|
||||
});
|
||||
|
||||
|
||||
export const rainDefZod= {
|
||||
instlCmptnDt: new Date(),
|
||||
instlCst: 0,
|
||||
pntfColKnd: "",
|
||||
pntfColArea: 0,
|
||||
filtrTrtmfctYn: "Y",
|
||||
filtrTrtmfctCpct: 0,
|
||||
filtrTrtmfctPrs: "",
|
||||
instlCstSprtYn: "",
|
||||
instlCstSprtAmt: 0,
|
||||
grntchBdstCertYn: "",
|
||||
grntchBdstCertYr: "",
|
||||
grntchBdstCertNo: "",
|
||||
grntchBdstCertGrd: "",
|
||||
}
|
||||
|
||||
|
||||
export const bdstDefZod={
|
||||
ctpvCd: 0, // 시도
|
||||
sggCd: 0, // 시군구
|
||||
daddr: '', // 위치
|
||||
bdstUsgCd: 0, // 건축물용도
|
||||
frstArchPrmsnDt: new Date(), // 최초건축허가일
|
||||
archArea: 0, // 건축면적
|
||||
lawTrgtYn: '', // 법적의무대상여부
|
||||
bdstNm: '',
|
||||
|
||||
bdstChgnm:'',
|
||||
archChgPrmsnDt: new Date(), // 건축변경 허가일시
|
||||
archChgArea: 0, // 변경 면적
|
||||
}
|
||||
|
||||
|
||||
export type chgBuilding={
|
||||
bdstInfoFk: number,
|
||||
bdstInfoFk: number|null,
|
||||
archChgPrmsnDt: Date,
|
||||
archChgArea: number,
|
||||
archChgArea: string,
|
||||
bdstChgNm: string
|
||||
}
|
||||
|
||||
@@ -144,8 +127,11 @@ export type TableUpperProps = {
|
||||
title: string;
|
||||
upName?: string;
|
||||
upSequnce?: number;
|
||||
edit?:boolean;
|
||||
visible?:boolean;
|
||||
};
|
||||
|
||||
|
||||
export const upHeadList: TableUpperProps[] = [
|
||||
{ id: "cityText", title: "시도" },
|
||||
{ id: "sggText", title: "시군구" },
|
||||
@@ -156,9 +142,9 @@ export const upHeadList: TableUpperProps[] = [
|
||||
{ id: "frstArchPrmsnDt", title: "최초건축허가일" },
|
||||
{ id: "archArea", title: "건축면적" },
|
||||
{ id: "lawTrgtYn", title: "법적의무대상여부" },
|
||||
{ id: "archChgYn", title: "여부", upName: "upChangeRe", upSequnce: 1 },
|
||||
{ id: "archChgPrmsnDt", title: "허가일", upName: "upChangeRe", upSequnce: 2 },
|
||||
{ id: "archChgArea", title: "면적", upName: "upChangeRe", upSequnce: 3 },
|
||||
{ id: "bdstChgYn", title: "건축물변경여부" },
|
||||
// { id: "archChgPrmsnDt", title: "허가일", upName: "upChangeRe", upSequnce: 2 },
|
||||
// { id: "archChgArea", title: "면적", upName: "upChangeRe", upSequnce: 3 },
|
||||
];
|
||||
|
||||
const rainRes: customRainBdst[] = [];
|
||||
@@ -205,7 +191,7 @@ const rainRes: customRainBdst[] = [];
|
||||
chgBuilding:[{
|
||||
bdstInfoFk: 0,
|
||||
archChgPrmsnDt: new Date(),
|
||||
archChgArea: 0,
|
||||
archChgArea: "-",
|
||||
bdstChgNm: ""
|
||||
|
||||
}]
|
||||
@@ -251,7 +237,16 @@ export const rainFacStateExport: rainFacState = {
|
||||
|
||||
|
||||
const initFetch = async (txt:string|undefined) => {
|
||||
return await getFectch("wr", `/reuseFc/rainyInfoList/1/20/41` +(txt? `/${txt}`:''));
|
||||
|
||||
const rainRes =await getFectch("wr", `/reuseFc/rainyInfoList/1/20/41` +(txt? `/${txt}`:''));
|
||||
const chRainRes = rainRes.map((item: customRainBdst) => {
|
||||
return {
|
||||
...item,
|
||||
bdstChgYn: item.chgBuilding.length > 0 ? "Y" : "N",
|
||||
} })
|
||||
return chRainRes;
|
||||
|
||||
|
||||
};
|
||||
export const rainFacActionsExport: (set: any) => rainFacSActions = (
|
||||
set: any
|
||||
@@ -261,6 +256,8 @@ export const rainFacActionsExport: (set: any) => rainFacSActions = (
|
||||
try {
|
||||
// 파라이터 수정 통합관리자 =0, 시관리자=시코드, 시군구 관리자= 시군구 코드 를 세번째 파라미터로 지정 / 건축물 서치가 있을경우 4번째 파라미터로 던지기 즉 1/20/42(서울시)/영현빌딩 이런식으로)
|
||||
const rainRes = await initFetch(txt);
|
||||
|
||||
|
||||
// 여기서 상태 업데이트
|
||||
return set((state: rainFacState) => ({
|
||||
...state,
|
||||
@@ -297,7 +294,28 @@ export const rainFacActionsExport: (set: any) => rainFacSActions = (
|
||||
try {
|
||||
const res = await postFectch("/reuseFc/rainyInfo", data);
|
||||
if(res.ok){
|
||||
alert(" 등록이 완료되었습니다.")
|
||||
|
||||
if(data.chgBuilding.length > 0){
|
||||
await res.json().then((resData: any) => {
|
||||
|
||||
const chPK = resData?.data?.bdstInfoPk
|
||||
const makeCh= resData.data.chgBuilding.map((item: chgBuilding) =>
|
||||
( {
|
||||
...item,
|
||||
bdstInfoFk: chPK,
|
||||
})
|
||||
);
|
||||
const chch= postFectch("/reuseFc/chgBuilding", makeCh);
|
||||
return chch;
|
||||
}).then((chch: any) => {
|
||||
if(chch.ok) {
|
||||
alert("등록이 완료되었습니다.");
|
||||
|
||||
}
|
||||
})
|
||||
}else{
|
||||
alert("등록이 완료되었습니다.");
|
||||
}
|
||||
}
|
||||
const rainRes = await initFetch(undefined);
|
||||
set((state: rainFacState) => ({
|
||||
|
||||
@@ -5,7 +5,7 @@ import { rswtBdstType } from "@/app/store/common/code";
|
||||
import { z } from "zod";
|
||||
|
||||
export const rswtZod = z.object({
|
||||
bdstInfoPk: z.number().default(0),
|
||||
bdstInfoPk: z.number().nullish(),
|
||||
ctpvCd: z.number().default(0),
|
||||
sggCd: z.number().default(0),
|
||||
daddr: z.string().default(""),
|
||||
@@ -18,8 +18,8 @@ export const rswtZod = z.object({
|
||||
|
||||
reuseBuilding: z.array(
|
||||
z.object({
|
||||
bdstRuseFcltPk: z.number().default(0),
|
||||
bdstInfoFk: z.number().default(0),
|
||||
bdstRuseFcltPk: z.number().nullish(),
|
||||
bdstInfoFk: z.number().nullish(),
|
||||
instlCmptnDt: z.coerce.date().default(() => new Date()),
|
||||
instlCst: z.number().default(0),
|
||||
operMngCd: z.string().nullish().default(""),
|
||||
@@ -43,7 +43,7 @@ export const rswtZod = z.object({
|
||||
lawTrgtYn: z.string().default(""),
|
||||
|
||||
rswtrObj: z.object({
|
||||
bdstRuseFcltFk: z.number().default(0),
|
||||
bdstRuseFcltFk: z.number().nullish(),
|
||||
wtrUsqty: z.number().default(0),
|
||||
oblgTrgtWtrUsqty: z.number().default(0),
|
||||
orgwtKndCd: z.string().default(""),
|
||||
@@ -56,7 +56,19 @@ export const rswtZod = z.object({
|
||||
altUswtrIdntyMthdCd: z.string().default("")
|
||||
}).default({})
|
||||
})
|
||||
).default([])
|
||||
).default([]),
|
||||
|
||||
chgBuilding: z
|
||||
.array(
|
||||
z.object({
|
||||
bdstInfoFk: z.number().nullish(),
|
||||
archChgPrmsnDt: z.coerce.date() ,
|
||||
archChgArea: z.string().default("-"),
|
||||
bdstChgNm: z.string().default(""),
|
||||
})
|
||||
)
|
||||
.default([]),
|
||||
|
||||
});
|
||||
|
||||
|
||||
@@ -125,10 +137,16 @@ export const rswtFacStateExport: rswtFacState = {
|
||||
};
|
||||
|
||||
const initFetch = async (txt: string | undefined) => {
|
||||
return await getFectch(
|
||||
const rswtRes =await getFectch(
|
||||
"wr",
|
||||
`/reuseFc/waterreuseFc/1/20/41` + (txt ? `/${txt}` : "")
|
||||
);
|
||||
const chRswtRes = rswtRes.map((item: customRswtBdst) => {
|
||||
return {
|
||||
...item,
|
||||
bdstChgYn: item.chgBuilding.length > 0 ? "Y" : "N",
|
||||
} })
|
||||
return chRswtRes;
|
||||
};
|
||||
export const rswtFacActionsExport: (set: any) => rswtFacSActions = (
|
||||
set: any
|
||||
@@ -152,10 +170,9 @@ export const rswtFacActionsExport: (set: any) => rswtFacSActions = (
|
||||
rswtUpdate: async (data: customRswtBdst) => {
|
||||
try {
|
||||
const res = await putFectch("/reuseFc/waterreuseFc", data);
|
||||
if(res.ok){
|
||||
alert(" 수정이 완료되었습니다.")
|
||||
if (res.ok) {
|
||||
alert("등록이 완료되었습니다.");
|
||||
}
|
||||
|
||||
const rswtRes = await initFetch(undefined);
|
||||
set((state: rswtFacState) => ({
|
||||
...state,
|
||||
@@ -174,7 +191,29 @@ export const rswtFacActionsExport: (set: any) => rswtFacSActions = (
|
||||
try {
|
||||
const res = await postFectch("/reuseFc/waterreuseFc", data);
|
||||
if(res.ok){
|
||||
alert(" 등록이 완료되었습니다.")
|
||||
if(data.chgBuilding.length > 0){
|
||||
await res
|
||||
.json()
|
||||
.then((resData: any) => {
|
||||
const chPK = resData?.data?.bdstInfoPk;
|
||||
const makeCh = resData.data.chgBuilding.map(
|
||||
(item: chgBuilding) => ({
|
||||
...item,
|
||||
bdstInfoFk: chPK,
|
||||
})
|
||||
);
|
||||
const chch = postFectch("/reuseFc/chgBuilding", makeCh);
|
||||
return chch;
|
||||
})
|
||||
.then((chch: any) => {
|
||||
if (chch.ok) {
|
||||
alert("등록이 완료되었습니다.");
|
||||
}
|
||||
});
|
||||
}else{
|
||||
alert("등록이 완료되었습니다.");
|
||||
|
||||
}
|
||||
}
|
||||
const rainRes = await initFetch(undefined);
|
||||
set((state: rswtFacState) => ({
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
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 const headVisibleSchema = z.array(
|
||||
z.object(
|
||||
Object.fromEntries(
|
||||
pbnSttHeadList.map(col => [col.id, z.boolean()])
|
||||
))
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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 ) =>{
|
||||
|
||||
},
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
@@ -31,6 +31,9 @@ import {
|
||||
} from "./ruseFcltMng/fcltReg/htdflReg";
|
||||
import { codeActionExport, comCodeStateExport, getCityCd, getSggCd, 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";
|
||||
|
||||
export type WrStore = comCodeType&
|
||||
pubFacType &
|
||||
@@ -38,7 +41,12 @@ export type WrStore = comCodeType&
|
||||
rswtFacType &
|
||||
matDmdType &
|
||||
htdflFacType&
|
||||
bdstFulType;
|
||||
bdstFulType&
|
||||
rainChkgdnType&
|
||||
rswtChkgdnType&
|
||||
pbnSttType
|
||||
;
|
||||
|
||||
export const StoreZus = (
|
||||
initState: comCodeState&
|
||||
rainFacState &
|
||||
@@ -46,7 +54,11 @@ export const StoreZus = (
|
||||
rswtFacState &
|
||||
matDmdState &
|
||||
htdflFacState &
|
||||
bdstState= {
|
||||
bdstState &
|
||||
rainChkgdnState&
|
||||
rswtChkgdnState&
|
||||
pbnstSttnState
|
||||
= {
|
||||
...comCodeStateExport,
|
||||
...pubFacStateExport,
|
||||
...rainFacStateExport,
|
||||
@@ -54,6 +66,9 @@ export const StoreZus = (
|
||||
...matDmdStateExport,
|
||||
...htdflFacStateExport,
|
||||
...bdstStateExport,
|
||||
...rainChkgdnStateExport,
|
||||
...rswtChkgdnStateExport,
|
||||
...pbnSttStateExport
|
||||
}
|
||||
) => {
|
||||
return createStore<WrStore>()((set) => {
|
||||
@@ -67,7 +82,10 @@ export const StoreZus = (
|
||||
...matDmdActionsExport(set),
|
||||
...htdflFacActionsExport(set),
|
||||
...codeActionExport(set),
|
||||
...bdstActionsExport(set)
|
||||
...bdstActionsExport(set),
|
||||
...rainChkgdnActionsExport(set),
|
||||
...rswtChkgdnActionsExport(set),
|
||||
...pbnSttActionsExport(set)
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
//8880
|
||||
|
||||
import { DEV_URL_COMMON, DEV_URL_WR } from "../config/";
|
||||
import { DEV_URL_FO, DEV_URL_WR } from "../config/";
|
||||
|
||||
|
||||
|
||||
export const getFectch = async( type:string , url: string) => {
|
||||
const div = type === 'common' ? DEV_URL_COMMON : DEV_URL_WR
|
||||
const div = type === 'common' ? DEV_URL_FO : DEV_URL_WR
|
||||
const response = await fetch( div+url , {
|
||||
method: "GET",
|
||||
headers: {
|
||||
|
||||
@@ -9,7 +9,7 @@ export const getCity = (val: string, sggCd: selectArray[]) => {
|
||||
const data = sggCd
|
||||
.filter((item) => String(item.val).substring(0, 2) === val)
|
||||
.map((item) => ({
|
||||
val: String(item.val),
|
||||
val: item.val,
|
||||
text: item.text // 한국어 텍스트
|
||||
}));
|
||||
return data
|
||||
@@ -20,13 +20,14 @@ export const getCity = (val: string, sggCd: selectArray[]) => {
|
||||
// cd text 넣기
|
||||
export const tableData = ( data: any,code:comCodeState)=>{
|
||||
const chCode = code.code;
|
||||
|
||||
return data?.map((item: { sggCd: string; ctpvCd: string; reuseBuilding: { lawTrgtYn: any , bdstUsgCd:any}[]; }) => {
|
||||
let returnData = {};
|
||||
const sggText = chCode.sggCd.find(
|
||||
(cd) => cd.val === Number(item.sggCd)
|
||||
(cd) => cd.val === item.sggCd
|
||||
)?.text;
|
||||
const cityText = chCode.cityCd.find(
|
||||
(cd) => cd.val === Number(item.ctpvCd)
|
||||
(cd) => cd.val === item.ctpvCd
|
||||
)?.text;
|
||||
|
||||
if (item?.reuseBuilding?.length >0) {
|
||||
@@ -40,6 +41,7 @@ export const getCity = (val: string, sggCd: selectArray[]) => {
|
||||
returnData= { ...item, sggText: sggText, cityText: cityText};
|
||||
}
|
||||
|
||||
// console.log(" returnData ", returnData)
|
||||
return returnData;
|
||||
|
||||
});
|
||||
|
||||
@@ -2,7 +2,7 @@ import { useWrStore } from "@/app/store";
|
||||
import type { selectArray } from "@/app/store/common/code";
|
||||
import { selectClass, type bdstAll } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import { getCity } from "@/components/lib/func/commom";
|
||||
import type { objSearchType } from "@/components/ui/modal/bdstReg/component";
|
||||
import type { objSearchType } from "@/components/ui/modal/bdstRegModal/bdstRegModal";
|
||||
import { FormField, FormUi, DatePicker, SelectBox } from "@common/business_components";
|
||||
import { Button, Input } from "@common/components";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
@@ -59,7 +59,6 @@ export default function BdstReg({ form }: { form: any }) {
|
||||
}, [selectSgg])
|
||||
|
||||
useEffect(() => {
|
||||
console.log("form", form.getValues());
|
||||
const subscription = form.form?.watch((value: any) => {
|
||||
console.log('vale', value)
|
||||
});
|
||||
@@ -164,7 +163,7 @@ export default function BdstReg({ form }: { form: any }) {
|
||||
<div className="col-span-2">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="bdstUsgCd"
|
||||
name="reuseBuilding.0.bdstUsgCd"
|
||||
render={({ field }) => (
|
||||
<FormUi label="건축물용도">
|
||||
<SelectBox
|
||||
@@ -224,7 +223,7 @@ export default function BdstReg({ form }: { form: any }) {
|
||||
<div className="col-span-2">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name=""
|
||||
name="reuseBuilding.0.lawTrgtYn"
|
||||
render={({ field }) => (
|
||||
<FormUi label="법정의무대상여부">
|
||||
<SelectBox
|
||||
@@ -271,10 +270,11 @@ export default function BdstReg({ form }: { form: any }) {
|
||||
selectClass={selectClass}
|
||||
label={""}
|
||||
selectArray={code.chBuCd}
|
||||
|
||||
onSelectValue={(val) => {
|
||||
field.onChange(val);
|
||||
}}
|
||||
value={field.value}
|
||||
value={field.value ?? code.chBuCd[0]?.val}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
@@ -307,9 +307,11 @@ export default function BdstReg({ form }: { form: any }) {
|
||||
<FormUi label="면적">
|
||||
<Input
|
||||
className=""
|
||||
placeholder="1,000,000"
|
||||
placeholder="-"
|
||||
type="text"
|
||||
{...field}
|
||||
value={ field.value??"-"}
|
||||
onChange={(e) => field.onChange((e.target.value))}
|
||||
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
|
||||
@@ -1,447 +0,0 @@
|
||||
"use client";
|
||||
|
||||
import {
|
||||
Form,
|
||||
FormField,
|
||||
FormUi,
|
||||
SelectBox,
|
||||
} from "@common/business_components/ui";
|
||||
import { Button, Input } from "@common/components/ui";
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import { useForm } from "react-hook-form";
|
||||
import { z } from "zod";
|
||||
import { useWrStore } from "@/app/store";
|
||||
import { selectClass } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import { hdtflZod, type customHtdflBdst } from "@/app/store/ruseFcltMng/fcltReg/htdflReg";
|
||||
import { useEffect } from "react";
|
||||
|
||||
|
||||
export function HtdflRegForm({
|
||||
htdflForm,
|
||||
isModal
|
||||
} :{
|
||||
htdflForm:customHtdflBdst;
|
||||
isModal: boolean;
|
||||
} ) {
|
||||
const {code} = useWrStore((state) => state);
|
||||
|
||||
const defaultValues: z.infer<typeof hdtflZod> = hdtflZod.parse({});
|
||||
|
||||
const form = useForm<z.infer<typeof hdtflZod>>({
|
||||
resolver: zodResolver(hdtflZod),
|
||||
defaultValues:defaultValues,
|
||||
});
|
||||
|
||||
// 2. Define a submit handler.hdtflZod
|
||||
function onSubmit(values: z.infer<typeof hdtflZod>) {
|
||||
// Do something with the form values.
|
||||
// ✅ This will be type-safe and validated.
|
||||
console.log(values);
|
||||
}
|
||||
|
||||
const onSelectValue = (val: string | number) => {
|
||||
console.log(val);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if(hdtflZod)
|
||||
console.log("hdtflZod", hdtflZod);
|
||||
const parsedData = hdtflZod.safeParse(htdflForm);
|
||||
if (parsedData.success) {
|
||||
form.reset(parsedData.data);
|
||||
} else {
|
||||
console.error("Invalid data for form reset", parsedData.error);
|
||||
}
|
||||
}, [htdflForm]);
|
||||
|
||||
|
||||
|
||||
return (
|
||||
<Form {...form}>
|
||||
<form onSubmit={form.handleSubmit(onSubmit)}>
|
||||
{/* <div className="flex justify-between items-center mx-3"> */}
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div className="grid grid-cols-6 gap-2 mt-4 pl-6">
|
||||
<div className="col-span-2">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="reuseBuilding.0.htdflObj.etgtType"
|
||||
render={({ field }) => (
|
||||
<FormUi label="발전유형">
|
||||
<SelectBox
|
||||
selectClass={selectClass}
|
||||
selectArray={code.yn}
|
||||
onSelectValue={onSelectValue}
|
||||
{...field}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="col-span-2">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="reuseBuilding.0.htdfObj.fclCpct" // 이름 이상함.
|
||||
render={({ field }) => (
|
||||
<FormUi label="설비용량">
|
||||
<Input
|
||||
className=""
|
||||
placeholder="1,000,000"
|
||||
type="text"
|
||||
{...field}
|
||||
value={field.value ?? ""}
|
||||
onChange={(e) => field.onChange(Number(e.target.value))}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<div className="col-span-2">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="reuseBuilding.0.htdfObj.plwtYn"
|
||||
render={({ field }) => (
|
||||
<FormUi label="담수화 여부">
|
||||
<SelectBox
|
||||
selectClass={selectClass}
|
||||
selectArray={code.yn}
|
||||
onSelectValue={onSelectValue}
|
||||
{...field}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div className=" my-4">
|
||||
<h1 className="bg-gray-400 text-xl text-center border-2 p-2 mt-4 pl-6">
|
||||
온배수 시설 운영현황
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-10 gap-1 mt-4">
|
||||
<div className="col-span-5 pl-6">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="reuseBuilding.0.htdfObj.orgwtwtritspt"
|
||||
render={({ field }) => (
|
||||
<FormUi label="원수취수 지점">
|
||||
<SelectBox
|
||||
selectClass={selectClass}
|
||||
selectArray={code.yn}
|
||||
onSelectValue={onSelectValue}
|
||||
{...field}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<div className="col-span-5">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="orgwtocrnprocs"
|
||||
render={({ field }) => (
|
||||
<FormUi label="원수발생 공정">
|
||||
<Input
|
||||
className=""
|
||||
placeholder="1,000,000"
|
||||
type=""
|
||||
{...field}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<div className="col-span-5 pl-6">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="wtritentrctp"
|
||||
render={({ field }) => (
|
||||
<FormUi label="취수구 온도">
|
||||
<Input
|
||||
className=""
|
||||
placeholder="1,000,000"
|
||||
type=""
|
||||
{...field}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<div className="col-span-5 pl-6">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="wtritentrctp"
|
||||
render={({ field }) => (
|
||||
<FormUi label="발생량(m³/년)">
|
||||
<Input
|
||||
className=""
|
||||
placeholder="1,000,000"
|
||||
type=""
|
||||
{...field}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<div className="col-span-5 pl-6">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="amtgnr"
|
||||
render={({ field }) => (
|
||||
<FormUi label="처리공정">
|
||||
<Input
|
||||
className=""
|
||||
placeholder="1,000,000"
|
||||
type=""
|
||||
{...field}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<div className="col-span-5 pl-6">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="prcsfcltcpct"
|
||||
render={({ field }) => (
|
||||
<FormUi label="처리시설 용량(m³/년)">
|
||||
<Input
|
||||
className=""
|
||||
placeholder="1,000,000"
|
||||
type=""
|
||||
{...field}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<div className="col-span-5 pl-6">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="fmyn"
|
||||
render={({ field }) => (
|
||||
<FormUi label="유량계유무">
|
||||
<SelectBox
|
||||
selectClass={selectClass}
|
||||
label={""}
|
||||
selectArray={code.yn}
|
||||
onSelectValue={onSelectValue}
|
||||
{...field}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<div className="col-span-5 pl-6">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="utztnqnt"
|
||||
render={({ field }) => (
|
||||
<FormUi label="이용량(m³/년)">
|
||||
<Input
|
||||
className=""
|
||||
placeholder="1,000,000"
|
||||
type=""
|
||||
{...field}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<div className="col-span-5 pl-6">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="utztnusgcd"
|
||||
render={({ field }) => (
|
||||
<FormUi label="이용용도">
|
||||
<SelectBox
|
||||
selectClass={selectClass}
|
||||
label={""}
|
||||
selectArray={code.yn}
|
||||
onSelectValue={onSelectValue}
|
||||
{...field}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className=" my-2">
|
||||
<h1 className="bg-gray-400 text-xl text-center border-2 p-2 mt-4 ">
|
||||
요구수질
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-12 gap-4 pl-6">
|
||||
<div className="col-span-6">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="grssClfg"
|
||||
render={({ field }) => (
|
||||
<FormUi label="총대장균군">
|
||||
<Input placeholder="10" type="text" {...field} />
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="col-span-6">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="tn"
|
||||
render={({ field }) => (
|
||||
<FormUi label="총질소">
|
||||
<Input placeholder="10" type="text" {...field} />
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-12 gap-4 pl-6">
|
||||
<div className="col-span-6">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="combResdch"
|
||||
render={({ field }) => (
|
||||
<FormUi label="결합잔류염소">
|
||||
<Input placeholder="10" type="text" {...field} />
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="col-span-6 ">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="tp"
|
||||
render={({ field }) => (
|
||||
<FormUi label="총인">
|
||||
<Input placeholder="10" type="text" {...field} />
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-12 gap-4 pl-6">
|
||||
<div className="col-span-6">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="trbt"
|
||||
render={({ field }) => (
|
||||
<FormUi label="탁도">
|
||||
<Input placeholder="10" type="text" {...field} />
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="col-span-6">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="ph"
|
||||
render={({ field }) => (
|
||||
<FormUi label="수소이온농도">
|
||||
<Input placeholder="10" type="text" {...field} />
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-12 gap-4 pl-6">
|
||||
<div className="col-span-6">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="bod"
|
||||
render={({ field }) => (
|
||||
<FormUi label="생물학적 산소요구량">
|
||||
<Input placeholder="10" type="text" {...field} />
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="col-span-6">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="clIonQnt"
|
||||
render={({ field }) => (
|
||||
<FormUi label="염화물">
|
||||
<Input placeholder="10" type="text" {...field} />
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-12 gap-4 pl-6">
|
||||
<div className="col-span-6">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="smll"
|
||||
render={({ field }) => (
|
||||
<FormUi label="냄새">
|
||||
<Input placeholder="10" type="text" {...field} />
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="col-span-6">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="cdtnv"
|
||||
render={({ field }) => (
|
||||
<FormUi label="전기전도도">
|
||||
<Input placeholder="10" type="text" {...field} />
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-12 gap-4 pl-6">
|
||||
<div className="col-span-6">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="crmty"
|
||||
render={({ field }) => (
|
||||
<FormUi label="색도">
|
||||
<Input placeholder="10" type="text" {...field} />
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="col-span-6">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="emsnexittp"
|
||||
render={({ field }) => (
|
||||
<FormUi label="배출구온도">
|
||||
<Input placeholder="10" type="text" {...field} />
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</Form>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,560 @@
|
||||
"use client";
|
||||
|
||||
import {
|
||||
Form,
|
||||
FormField,
|
||||
FormUi,
|
||||
SelectBox,
|
||||
} from "@common/business_components/ui";
|
||||
import { Button, Input } from "@common/components/ui";
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import { useForm } from "react-hook-form";
|
||||
import { z } from "zod";
|
||||
import { useWrStore } from "@/app/store";
|
||||
import { selectClass } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import {
|
||||
hdtflZod,
|
||||
type customHtdflBdst,
|
||||
} from "@/app/store/ruseFcltMng/fcltReg/htdflReg";
|
||||
import { useEffect } from "react";
|
||||
import BdstReg from "../bdstReg/bdstReg";
|
||||
|
||||
export function HtdflRegForm({
|
||||
htdflForm,
|
||||
isModal,
|
||||
}: {
|
||||
htdflForm: customHtdflBdst;
|
||||
isModal: boolean;
|
||||
}) {
|
||||
const { code, htdflUpdate, htdflReg } = useWrStore((state) => state);
|
||||
|
||||
const defaultValues: z.infer<typeof hdtflZod> = hdtflZod.parse({});
|
||||
|
||||
const form = useForm<z.infer<typeof hdtflZod>>({
|
||||
resolver: zodResolver(hdtflZod),
|
||||
defaultValues: defaultValues,
|
||||
});
|
||||
|
||||
function onSubmit(values: z.infer<typeof hdtflZod>) {
|
||||
if (isModal) {
|
||||
htdflReg(values);
|
||||
} else {
|
||||
htdflUpdate(values);
|
||||
}
|
||||
}
|
||||
|
||||
const onSelectValue = (val: string | number) => {
|
||||
console.log(val);
|
||||
};
|
||||
|
||||
function cleanHtdflData(raw: any): z.infer<typeof hdtflZod> {
|
||||
return {
|
||||
...raw,
|
||||
frstArchPrmsnDt: new Date(raw?.frstArchPrmsnDt || null),
|
||||
archChgPrmsnDt: raw?.archChgPrmsnDt
|
||||
? new Date(raw?.archChgPrmsnDt)
|
||||
: null,
|
||||
chgBuilding: (raw?.chgBuilding || []).map((item: any) => ({
|
||||
...item,
|
||||
archChgPrmsnDt:
|
||||
item?.archChgPrmsnDt === null
|
||||
? new Date()
|
||||
: new Date(item?.archChgPrmsnDt),
|
||||
bdstChgNm: item?.bdstChgNm ?? "", // null → ""
|
||||
})),
|
||||
reuseBuilding: (raw?.reuseBuilding || []).map((item: any) => ({
|
||||
...item,
|
||||
instlCmptnDt: new Date(item?.instlCmptnDt),
|
||||
htdflObj: {
|
||||
...item?.htdflObj,
|
||||
},
|
||||
})),
|
||||
};
|
||||
}
|
||||
useEffect(() => {
|
||||
console.log("form errors:", form.formState.errors);
|
||||
}, [form.formState.errors]);
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
if (hdtflZod) form.reset(cleanHtdflData(htdflForm));
|
||||
}, [htdflForm]);
|
||||
|
||||
return (
|
||||
<Form {...form}>
|
||||
<form onSubmit={form.handleSubmit(onSubmit)}>
|
||||
{/* <div className="flex justify-between items-center mx-3"> */}
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{ isModal && htdflForm != undefined ? (
|
||||
<BdstReg form={form} />
|
||||
) : (
|
||||
<></>
|
||||
)}
|
||||
{isModal ? (
|
||||
<h1 className="pl-3 text-xl col-span-10 mt-4 ">
|
||||
○ 중수도 시설 정보{" "}
|
||||
</h1>
|
||||
) : (
|
||||
<></>
|
||||
)}
|
||||
|
||||
|
||||
|
||||
<div className="grid grid-cols-6 gap-2 mt-4 pl-6">
|
||||
<div className="col-span-2">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="reuseBuilding.0.htdflObj.etgtType"
|
||||
render={({ field }) => (
|
||||
<FormUi label="발전유형(코드정비후 수정)">
|
||||
<Input
|
||||
className=""
|
||||
placeholder="1,000,000"
|
||||
type="text"
|
||||
value={field.value ?? ""}
|
||||
onChange={field.onChange}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="col-span-2">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="reuseBuilding.0.htdflObj.fclCpct" // 이름 이상함.
|
||||
render={({ field }) => (
|
||||
<FormUi label="설비용량">
|
||||
<Input
|
||||
className=""
|
||||
placeholder="1,000,000"
|
||||
type="text"
|
||||
value={field.value ?? 0}
|
||||
onChange={(e) => {
|
||||
field.onChange(Number(e.target.value));
|
||||
}}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<div className="col-span-2">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="reuseBuilding.0.htdflObj.plwtYn"
|
||||
render={({ field }) => (
|
||||
<FormUi label="담수화 여부">
|
||||
<SelectBox
|
||||
className={""}
|
||||
label={""}
|
||||
selectClass={selectClass}
|
||||
selectArray={code.yn}
|
||||
onSelectValue={onSelectValue}
|
||||
value={field.value ?? code.yn[0]?.val}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div className=" my-4">
|
||||
<h1 className="bg-gray-400 text-xl text-center border-2 p-2 mt-4 pl-6">
|
||||
온배수 시설 운영현황
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-10 gap-1 mt-4">
|
||||
<div className="col-span-5 pl-6">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="reuseBuilding.0.htdflObj.orgwtWtritSpt"
|
||||
render={({ field }) => (
|
||||
<FormUi label="원수취수 지점(코드정비후 수정)">
|
||||
<Input
|
||||
className=""
|
||||
placeholder="1,000,000"
|
||||
type="text"
|
||||
value={field.value ?? 0}
|
||||
onChange={(e) => {
|
||||
field.onChange(Number(e.target.value));
|
||||
}}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<div className="col-span-5">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="reuseBuilding.0.htdflObj.orgwtOcrnProcs"
|
||||
render={({ field }) => (
|
||||
<FormUi label="원수발생 공정">
|
||||
<Input
|
||||
className=""
|
||||
placeholder="1,000,000"
|
||||
type=""
|
||||
value={field.value ?? ""}
|
||||
onChange={field.onChange}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<div className="col-span-5 pl-6">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="reuseBuilding.0.htdflObj.wtritEntrcTp"
|
||||
render={({ field }) => (
|
||||
<FormUi label="취수구 온도">
|
||||
<Input
|
||||
className=""
|
||||
placeholder="1,000,000"
|
||||
type=""
|
||||
value={field.value ?? 0}
|
||||
onChange={(e) => {
|
||||
field.onChange(Number(e.target.value));
|
||||
}}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<div className="col-span-5 pl-6">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="reuseBuilding.0.htdflObj.amtgnr"
|
||||
render={({ field }) => (
|
||||
<FormUi label="발생량(m³/년)">
|
||||
<Input
|
||||
className=""
|
||||
placeholder="1,000,000"
|
||||
type=""
|
||||
value={field.value ?? 0}
|
||||
onChange={(e) => field.onChange(Number(e.target.value))}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<div className="col-span-5 pl-6">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="reuseBuilding.0.htdflObj.prcsProcsYn"
|
||||
render={({ field }) => (
|
||||
<FormUi label="처리공정">
|
||||
<SelectBox
|
||||
className={""}
|
||||
label={""}
|
||||
selectClass={selectClass}
|
||||
selectArray={code.yn}
|
||||
onSelectValue={onSelectValue}
|
||||
value={field.value ?? code.yn[0]?.val}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<div className="col-span-5 pl-6">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="reuseBuilding.0.htdflObj.prcsFcltCpct"
|
||||
render={({ field }) => (
|
||||
<FormUi label="처리시설 용량(m³/년)">
|
||||
<Input
|
||||
className=""
|
||||
placeholder="1,000,000"
|
||||
type=""
|
||||
value={field.value ?? 0}
|
||||
onChange={(e) => field.onChange(Number(e.target.value))}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<div className="col-span-5 pl-6">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="reuseBuilding.0.htdflObj.fmYn"
|
||||
render={({ field }) => (
|
||||
<FormUi label="유량계유무">
|
||||
<SelectBox
|
||||
className={""}
|
||||
selectClass={selectClass}
|
||||
label={""}
|
||||
selectArray={code.yn}
|
||||
onSelectValue={onSelectValue}
|
||||
value={field.value ?? code.yn[0]?.val}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<div className="col-span-5 pl-6">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="reuseBuilding.0.htdflObj.utztnCpct"
|
||||
render={({ field }) => (
|
||||
<FormUi label="이용량(m³/년)">
|
||||
<Input
|
||||
className=""
|
||||
placeholder="1,000,000"
|
||||
type=""
|
||||
value={field.value ?? 0}
|
||||
onChange={(e) => field.onChange(Number(e.target.value))}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<div className="col-span-5 pl-6">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="reuseBuilding.0.htdflObj.utztnUsg"
|
||||
render={({ field }) => (
|
||||
<FormUi label="이용용도">
|
||||
<Input
|
||||
className=""
|
||||
placeholder="1,000,000"
|
||||
type="text"
|
||||
value={field.value ?? ""}
|
||||
onChange={field.onChange}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className=" my-2">
|
||||
<h1 className="bg-gray-400 text-xl text-center border-2 p-2 mt-4 ">
|
||||
요구수질
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-12 gap-4 pl-6">
|
||||
<div className="col-span-6">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="reuseBuilding.0.htdflObj.grssClfg"
|
||||
render={({ field }) => (
|
||||
<FormUi label="총대장균군">
|
||||
<Input
|
||||
placeholder="10"
|
||||
type="text"
|
||||
value={field.value ?? 0}
|
||||
onChange={(e) => field.onChange(Number(e.target.value))}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="col-span-6">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="reuseBuilding.0.htdflObj.tn"
|
||||
render={({ field }) => (
|
||||
<FormUi label="총질소">
|
||||
<Input
|
||||
placeholder="10"
|
||||
type="text"
|
||||
value={field.value ?? 0}
|
||||
onChange={(e) => field.onChange(Number(e.target.value))}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-12 gap-4 pl-6">
|
||||
<div className="col-span-6">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="reuseBuilding.0.htdflObj.combResdch"
|
||||
render={({ field }) => (
|
||||
<FormUi label="결합잔류염소">
|
||||
<Input
|
||||
placeholder="10"
|
||||
type="text"
|
||||
value={field.value ?? 0}
|
||||
onChange={(e) => field.onChange(Number(e.target.value))}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="col-span-6 ">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="reuseBuilding.0.htdflObj.tph"
|
||||
render={({ field }) => (
|
||||
<FormUi label="총인">
|
||||
<Input
|
||||
placeholder="10"
|
||||
type="text"
|
||||
value={field.value ?? 0}
|
||||
onChange={(e) => field.onChange(Number(e.target.value))}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-12 gap-4 pl-6">
|
||||
<div className="col-span-6">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="reuseBuilding.0.htdflObj.trbt"
|
||||
render={({ field }) => (
|
||||
<FormUi label="탁도">
|
||||
<Input
|
||||
placeholder="10"
|
||||
type="text"
|
||||
value={field.value ?? 0}
|
||||
onChange={(e) => field.onChange(Number(e.target.value))}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="col-span-6">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="reuseBuilding.0.htdflObj.ph"
|
||||
render={({ field }) => (
|
||||
<FormUi label="수소이온농도">
|
||||
<Input
|
||||
placeholder="10"
|
||||
type="text"
|
||||
value={field.value ?? 0}
|
||||
onChange={(e) => field.onChange(Number(e.target.value))}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-12 gap-4 pl-6">
|
||||
<div className="col-span-6">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="reuseBuilding.0.htdflObj.bod"
|
||||
render={({ field }) => (
|
||||
<FormUi label="생물학적 산소요구량">
|
||||
<Input
|
||||
placeholder="10"
|
||||
type="text"
|
||||
value={field.value ?? 0}
|
||||
onChange={(e) => field.onChange(Number(e.target.value))}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="col-span-6">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="reuseBuilding.0.htdflObj.clIonQnt"
|
||||
render={({ field }) => (
|
||||
<FormUi label="염화물">
|
||||
<Input
|
||||
placeholder="10"
|
||||
type="text"
|
||||
value={field.value ?? 0}
|
||||
onChange={(e) => field.onChange(Number(e.target.value))}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-12 gap-4 pl-6">
|
||||
<div className="col-span-6">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="reuseBuilding.0.htdflObj.smll"
|
||||
render={({ field }) => (
|
||||
<FormUi label="냄새">
|
||||
<Input
|
||||
placeholder="10"
|
||||
type="text"
|
||||
value={field.value ?? 0}
|
||||
onChange={(e) => field.onChange(Number(e.target.value))}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="col-span-6">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="reuseBuilding.0.htdflObj.cdtnv"
|
||||
render={({ field }) => (
|
||||
<FormUi label="전기전도도">
|
||||
<Input
|
||||
placeholder="10"
|
||||
type="text"
|
||||
value={field.value ?? 0}
|
||||
onChange={(e) => field.onChange(Number(e.target.value))}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-12 gap-4 pl-6">
|
||||
<div className="col-span-6">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="reuseBuilding.0.htdflObj.crmty"
|
||||
render={({ field }) => (
|
||||
<FormUi label="색도">
|
||||
<Input
|
||||
placeholder="10"
|
||||
type="text"
|
||||
value={field.value ?? 0}
|
||||
onChange={(e) => field.onChange(Number(e.target.value))}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="col-span-6">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="reuseBuilding.0.htdflObj.emsnExitTp"
|
||||
render={({ field }) => (
|
||||
<FormUi label="배출구온도">
|
||||
<Input
|
||||
placeholder="10"
|
||||
type="text"
|
||||
value={field.value ?? 0}
|
||||
onChange={(e) => field.onChange(Number(e.target.value))}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</Form>
|
||||
);
|
||||
}
|
||||
@@ -120,25 +120,6 @@ const nodeList = headMakeColSpan(pubMngUpHeadList);
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="col-span-3">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="name_2450741594"
|
||||
render={({ field }) => (
|
||||
<FormUi label="설치승인인가일">
|
||||
<DatePicker
|
||||
|
||||
selectClass={'rounded-lg w-full bg-white'} field={{
|
||||
value: instlAprvDate,
|
||||
onChange: (date: Date | undefined): void => {
|
||||
if (date) setInstlAprvDate(date);
|
||||
}
|
||||
}} mode="single" {...field}/>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<div className="col-span-3">
|
||||
<FormField
|
||||
control={form.control}
|
||||
@@ -157,6 +138,24 @@ const nodeList = headMakeColSpan(pubMngUpHeadList);
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<div className="col-span-3">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="name_2450741594"
|
||||
render={({ field }) => (
|
||||
<FormUi label="설치승인인가일">
|
||||
<DatePicker
|
||||
|
||||
selectClass={'rounded-lg w-full bg-white'} field={{
|
||||
value: instlAprvDate,
|
||||
onChange: (date: Date | undefined): void => {
|
||||
if (date) setInstlAprvDate(date);
|
||||
}
|
||||
}} mode="single" {...field}/>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<h1 className="pl-4 text-xl">2. 사업비</h1>
|
||||
<div className="grid grid-cols-10 gap-4">
|
||||
|
||||
+87
-161
@@ -2,10 +2,8 @@
|
||||
|
||||
import { useWrStore } from "@/app/store";
|
||||
import {
|
||||
selectClass,
|
||||
bdstDefZod,
|
||||
rainDefZod,
|
||||
rainZod,
|
||||
selectClass,
|
||||
type customRainBdst,
|
||||
} from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import { DatePicker, FormUi } from "@common/business_components";
|
||||
@@ -17,26 +15,6 @@ import { useForm, type UseFormReturn } from "react-hook-form";
|
||||
import { z } from "zod";
|
||||
import BdstReg from "../bdstReg/bdstReg";
|
||||
|
||||
export const formToObj = (
|
||||
isModal: boolean,
|
||||
formSchema: z.ZodObject<any, "strip", z.ZodTypeAny, any, any>
|
||||
) => {
|
||||
return useForm<z.infer<typeof formSchema>>({
|
||||
resolver: zodResolver(formSchema),
|
||||
defaultValues: isModal
|
||||
? {
|
||||
...rainDefZod,
|
||||
...bdstDefZod,
|
||||
}
|
||||
: {
|
||||
...rainDefZod,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const formSchema = z.object(rainZod);
|
||||
export type RainFormType = UseFormReturn<z.infer<typeof formSchema>>;
|
||||
|
||||
export function RainRegForm({
|
||||
rainForm,
|
||||
isModal,
|
||||
@@ -44,115 +22,59 @@ export function RainRegForm({
|
||||
rainForm: customRainBdst;
|
||||
isModal: boolean;
|
||||
}) {
|
||||
|
||||
const form = formToObj(isModal, formSchema);
|
||||
const { code, rainReg, rainUpdate, rain } = useWrStore((state) => state);
|
||||
const { rainFcltCd } = code;
|
||||
|
||||
useEffect(() => {
|
||||
console.log(rainForm);
|
||||
|
||||
if (rainForm != null) {
|
||||
const data = rainForm;
|
||||
const defaultValues: z.infer<typeof rainZod> = rainZod.parse({});
|
||||
|
||||
const selectedOption = rainFcltCd.find(
|
||||
(item) =>
|
||||
item.val ===
|
||||
String(data?.reuseBuilding?.at(0)?.rainyObj?.pntfColKnd ?? "")
|
||||
);
|
||||
let formData;
|
||||
const form = useForm<z.infer<typeof rainZod>>({
|
||||
resolver: zodResolver(rainZod),
|
||||
defaultValues: defaultValues,
|
||||
});
|
||||
|
||||
|
||||
if (data?.reuseBuilding?.at(0)) {
|
||||
const rb = data.reuseBuilding?.at(0);
|
||||
formData = {
|
||||
...data,
|
||||
...rb?.rainyObj,
|
||||
...data.reuseBuilding?.at(0),
|
||||
pntfColKnd: selectedOption ? String(selectedOption.val) : undefined,
|
||||
frstArchPrmsnDt: new Date(data.frstArchPrmsnDt ||null),
|
||||
instlCmptnDt: new Date(data?.instlCmptnDt ||null)
|
||||
};
|
||||
form.reset(formData);
|
||||
} else {
|
||||
formData = {
|
||||
...data,
|
||||
frstArchPrmsnDt: new Date(data.frstArchPrmsnDt||null)
|
||||
};
|
||||
|
||||
form.reset(formData);
|
||||
}
|
||||
|
||||
|
||||
|
||||
function cleanRainData(raw: any): z.infer<typeof rainZod> {
|
||||
return {
|
||||
...raw,
|
||||
frstArchPrmsnDt: new Date(raw?.frstArchPrmsnDt||null),
|
||||
archChgPrmsnDt: raw?.archChgPrmsnDt ? new Date(raw?.archChgPrmsnDt) : null,
|
||||
reuseBuilding: (raw?.reuseBuilding || []).map((item: any) => ({
|
||||
...item,
|
||||
instlCmptnDt: new Date(item?.instlCmptnDt),
|
||||
operMngCd: item?.operMngCd ?? "", // null → ""
|
||||
grntchBdstCertYr: typeof item?.grntchBdstCertYr === "string"
|
||||
? item?.grntchBdstCertYr
|
||||
: "", // null → ""
|
||||
rainObj: {
|
||||
...item?.rainObj
|
||||
}
|
||||
}))
|
||||
};
|
||||
}
|
||||
}, [rainForm]);
|
||||
|
||||
|
||||
|
||||
|
||||
// form 값이 변경될 때마다 로그 출력
|
||||
useEffect(() => {
|
||||
const subscription = form.watch((value) => {
|
||||
});
|
||||
const subscription = form.watch((value) => {});
|
||||
return () => subscription.unsubscribe();
|
||||
}, [form]);
|
||||
|
||||
const objToForm = (raw: z.infer<typeof formSchema>) => {
|
||||
let regRainForm: customRainBdst;
|
||||
|
||||
|
||||
// 1. 기본 정보 정리
|
||||
const obj = !rainForm ? rain.regRainForm : rainForm;
|
||||
regRainForm = {
|
||||
...obj,
|
||||
ctpvCd: raw?.ctpvCd ,
|
||||
sggCd: raw?.sggCd,
|
||||
daddr: raw?.daddr,
|
||||
bdstNm: raw?.bdstNm,
|
||||
frstArchPrmsnDt: raw?.frstArchPrmsnDt ,
|
||||
archArea: raw?.archArea + "",
|
||||
// archChgArea: raw?.archChgArea || 0, // Ensure archChgArea is always a string
|
||||
};
|
||||
|
||||
const rainObj = regRainForm?.reuseBuilding?.at(0)?.rainyObj;
|
||||
|
||||
if (!regRainForm.reuseBuilding) {
|
||||
regRainForm.reuseBuilding = [];
|
||||
}
|
||||
|
||||
regRainForm.reuseBuilding[0] = {
|
||||
...rainForm?.reuseBuilding?.at(0),
|
||||
|
||||
instlCmptnDt: raw.instlCmptnDt,
|
||||
instlCst: raw.instlCst || rainForm?.reuseBuilding?.at(0)?.instlCst,
|
||||
instlCstSprtYn:
|
||||
raw.instlCstSprtYn || rainForm?.reuseBuilding?.at(0)?.instlCstSprtYn,
|
||||
instlCstSprtAmt:
|
||||
raw.instlCstSprtAmt || rainForm?.reuseBuilding?.at(0)?.instlCstSprtAmt,
|
||||
grntchBdstCertYn:
|
||||
raw.grntchBdstCertYn || rainForm?.reuseBuilding?.at(0)?.grntchBdstCertYn,
|
||||
grntchBdstCertYr:
|
||||
raw.grntchBdstCertYr || rainForm?.reuseBuilding?.at(0)?.grntchBdstCertYr,
|
||||
grntchBdstCertNo:
|
||||
raw.grntchBdstCertNo || rainForm?.reuseBuilding?.at(0)?.grntchBdstCertNo,
|
||||
grntchBdstCertGrd:
|
||||
raw.grntchBdstCertGrd || rainForm?.reuseBuilding?.at(0)?.grntchBdstCertGrd,
|
||||
bdstUsgCd: raw.bdstUsgCd || rainForm?.reuseBuilding?.at(0)?.bdstUsgCd,
|
||||
lawTrgtYn: raw.lawTrgtYn || rainForm?.reuseBuilding?.at(0)?.lawTrgtYn,
|
||||
}
|
||||
regRainForm.reuseBuilding[0].rainyObj = {
|
||||
...rainObj,
|
||||
pntfColKnd: raw.pntfColKnd || rainObj?.pntfColKnd,
|
||||
pntfColArea: raw.pntfColArea || rainObj?.pntfColArea,
|
||||
filtrTrtmfctCpct: raw.filtrTrtmfctCpct || rainObj?.filtrTrtmfctCpct,
|
||||
filtrTrtmfctYn: raw.filtrTrtmfctYn || rainObj?.filtrTrtmfctYn,
|
||||
filtrTrtmfctPrs: raw.filtrTrtmfctPrs || rainObj?.filtrTrtmfctPrs,
|
||||
};
|
||||
function onSubmit(values: z.infer<typeof rainZod>) {
|
||||
|
||||
if (isModal) {
|
||||
// regRainForm.bdstInfoPk = null;
|
||||
rainReg(regRainForm);
|
||||
// regRainForm.bdstInfoPk = null;
|
||||
rainReg(values);
|
||||
} else {
|
||||
rainUpdate(regRainForm);
|
||||
rainUpdate(values);
|
||||
}
|
||||
};
|
||||
|
||||
function onSubmit(values: z.infer<typeof formSchema>) {
|
||||
objToForm(values);
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
@@ -160,6 +82,11 @@ export function RainRegForm({
|
||||
}, [form.formState.errors]);
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
if(rainZod)
|
||||
form.reset( cleanRainData(rainForm))
|
||||
}, [rainForm]);
|
||||
|
||||
|
||||
return (
|
||||
<div className="">
|
||||
@@ -168,14 +95,14 @@ export function RainRegForm({
|
||||
<div>
|
||||
<div className="grid grid-cols-12">
|
||||
<h1 className="pl-3 text-xl col-span-10">
|
||||
{isModal ? "○건축물 운영정보" : "○ 빗물이용시설 운영정보"}
|
||||
{isModal ? "○건축물 운영정보" : "○ 빗물이용시설 정보"}
|
||||
</h1>
|
||||
<Button type="submit" className="mr-4 rounded-lg col-span-2">
|
||||
저장
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
{isModal&&rainForm!=undefined ? <BdstReg form={form}/> : <></>}
|
||||
{isModal && rainForm != undefined ? <BdstReg form={form} /> : <></>}
|
||||
{isModal ? (
|
||||
<h1 className="pl-3 text-xl col-span-10 mt-4 ">
|
||||
○ 빗물이용시설 정보{" "}
|
||||
@@ -191,18 +118,20 @@ export function RainRegForm({
|
||||
<div className="col-span-2">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="instlCmptnDt"
|
||||
name="reuseBuilding.0.instlCmptnDt"
|
||||
render={({ field }) => (
|
||||
<FormUi label="설치완료일">
|
||||
<DatePicker
|
||||
mode={"single"}
|
||||
<DatePicker
|
||||
mode="single"
|
||||
field={{
|
||||
value: new Date(field.value),
|
||||
onChange: (date: Date | undefined) =>
|
||||
field.onChange(date),
|
||||
value:
|
||||
field.value && !isNaN(new Date(field.value).getTime())
|
||||
? new Date(field.value)
|
||||
: new Date(), // Provide a default Date value
|
||||
onChange: (date) => field.onChange(date),
|
||||
}}
|
||||
selectClass={selectClass}
|
||||
></DatePicker>
|
||||
selectClass={""}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
@@ -211,17 +140,16 @@ export function RainRegForm({
|
||||
<div className="col-span-2">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="instlCst"
|
||||
name="reuseBuilding.0.instlCst"
|
||||
render={({ field }) => (
|
||||
<FormUi label="설치비">
|
||||
<Input
|
||||
className=""
|
||||
placeholder="1,000,000"
|
||||
type=""
|
||||
{...field}
|
||||
value={field.value ?? 0}
|
||||
onChange={(e) => {
|
||||
const value = e.target.value;
|
||||
field.onChange(value === "" ? "" : Number(value));
|
||||
field.onChange(e.target.value === "" ? "" : Number(e.target.value));
|
||||
}}
|
||||
/>
|
||||
</FormUi>
|
||||
@@ -241,7 +169,7 @@ export function RainRegForm({
|
||||
<div className="col-span-5 pl-6">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="pntfColKnd"
|
||||
name="reuseBuilding.0.rainyObj.pntfColKnd"
|
||||
render={({ field }) => (
|
||||
<FormUi label="종류">
|
||||
<SelectBox
|
||||
@@ -249,10 +177,9 @@ export function RainRegForm({
|
||||
selectClass={selectClass}
|
||||
label={""}
|
||||
selectArray={rainFcltCd}
|
||||
onSelectValue={(val) => {
|
||||
field.onChange(val);
|
||||
}}
|
||||
value={field.value}
|
||||
onSelectValue={field.onChange}
|
||||
value={field.value ?? rainFcltCd[0]?.val}
|
||||
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
@@ -261,18 +188,15 @@ export function RainRegForm({
|
||||
<div className="col-span-5">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="pntfColArea"
|
||||
name="reuseBuilding.0.rainyObj.pntfColArea"
|
||||
render={({ field }) => (
|
||||
<FormUi label="면적(m³)">
|
||||
<Input
|
||||
className=""
|
||||
placeholder="1,000,000"
|
||||
type=""
|
||||
{...field}
|
||||
onChange={(e) => {
|
||||
const value = e.target.value;
|
||||
field.onChange(value === "" ? "" : Number(value));
|
||||
}}
|
||||
value={field.value ?? 0}
|
||||
onChange={(e) => field.onChange(Number(e.target.value))}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
@@ -287,7 +211,7 @@ export function RainRegForm({
|
||||
<div className="col-span-4 pl-6">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="filtrTrtmfctYn"
|
||||
name="reuseBuilding.0.rainyObj.filtrTrtmfctYn"
|
||||
render={({ field }) => (
|
||||
<FormUi label="유무">
|
||||
<SelectBox
|
||||
@@ -296,7 +220,7 @@ export function RainRegForm({
|
||||
label={""}
|
||||
selectArray={code.yn}
|
||||
onSelectValue={field.onChange}
|
||||
{...field}
|
||||
value={field.value ?? code.yn[0]?.val}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
@@ -305,18 +229,16 @@ export function RainRegForm({
|
||||
<div className="col-span-4">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="filtrTrtmfctCpct"
|
||||
name="reuseBuilding.0.rainyObj.filtrTrtmfctCpct"
|
||||
render={({ field }) => (
|
||||
<FormUi label="용량(m³/일)">
|
||||
<Input
|
||||
className=""
|
||||
placeholder="1,000,000"
|
||||
type=""
|
||||
{...field}
|
||||
onChange={(e) => {
|
||||
const value = e.target.value;
|
||||
field.onChange(value === "" ? "" : Number(value));
|
||||
}}
|
||||
value={field.value ?? 0}
|
||||
onChange={(e) => field.onChange(Number(e.target.value))}
|
||||
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
@@ -325,14 +247,15 @@ export function RainRegForm({
|
||||
<div className="col-span-4">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="filtrTrtmfctPrs"
|
||||
name="reuseBuilding.0.rainyObj.filtrTrtmfctPrs"
|
||||
render={({ field }) => (
|
||||
<FormUi label="처리공정">
|
||||
<Input
|
||||
className=""
|
||||
placeholder="1,000,000"
|
||||
type=""
|
||||
{...field}
|
||||
type=""
|
||||
value={field.value ?? ""}
|
||||
onChange={field.onChange}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
@@ -351,7 +274,7 @@ export function RainRegForm({
|
||||
<div className="col-span-5">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="instlCstSprtYn"
|
||||
name="reuseBuilding.0.instlCstSprtYn"
|
||||
render={({ field }) => (
|
||||
<FormUi label="설치비 지원 여부">
|
||||
<SelectBox
|
||||
@@ -360,7 +283,7 @@ export function RainRegForm({
|
||||
label={""}
|
||||
selectArray={code.yn}
|
||||
onSelectValue={field.onChange}
|
||||
value={field.value}
|
||||
value={field.value ?? code.yn[0]?.val}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
@@ -369,18 +292,18 @@ export function RainRegForm({
|
||||
<div className="col-span-5">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="instlCstSprtAmt"
|
||||
name="reuseBuilding.0.instlCstSprtAmt"
|
||||
render={({ field }) => (
|
||||
<FormUi label="지원금액(원)">
|
||||
<Input
|
||||
className=""
|
||||
placeholder="1,000,000"
|
||||
type=""
|
||||
{...field}
|
||||
onChange={(e) => {
|
||||
const value = e.target.value;
|
||||
field.onChange(value === "" ? "" : Number(value));
|
||||
}}
|
||||
value={field.value ?? 0}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
@@ -395,7 +318,7 @@ export function RainRegForm({
|
||||
<div className="col-span-3 pl-6">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="grntchBdstCertYn"
|
||||
name="reuseBuilding.0.grntchBdstCertYn"
|
||||
render={({ field }) => (
|
||||
<FormUi label="인증여부">
|
||||
<SelectBox
|
||||
@@ -404,7 +327,7 @@ export function RainRegForm({
|
||||
label={""}
|
||||
selectArray={code.yn}
|
||||
onSelectValue={field.onChange}
|
||||
value={field.value}
|
||||
value={field.value ?? code.yn[0]?.val}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
@@ -413,10 +336,11 @@ export function RainRegForm({
|
||||
<div className="col-span-3">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="grntchBdstCertYr"
|
||||
name="reuseBuilding.0.grntchBdstCertYr"
|
||||
render={({ field }) => (
|
||||
<FormUi label="인증년도">
|
||||
<Input className="" placeholder="2024" type="" {...field} />
|
||||
<Input className="" placeholder="2024" type="" value={field.value ?? ""}
|
||||
onChange={field.onChange} />
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
@@ -424,14 +348,15 @@ export function RainRegForm({
|
||||
<div className="col-span-3 pl-6">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="grntchBdstCertNo"
|
||||
name="reuseBuilding.0.grntchBdstCertNo"
|
||||
render={({ field }) => (
|
||||
<FormUi label="인증번호">
|
||||
<Input
|
||||
className=""
|
||||
placeholder="ab1234678"
|
||||
type=""
|
||||
{...field}
|
||||
value={field.value ?? ""}
|
||||
onChange={field.onChange}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
@@ -440,10 +365,11 @@ export function RainRegForm({
|
||||
<div className="col-span-3">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="grntchBdstCertGrd"
|
||||
name="reuseBuilding.0.grntchBdstCertGrd"
|
||||
render={({ field }) => (
|
||||
<FormUi label="인증등급">
|
||||
<Input className="" placeholder="A" type="" {...field} />
|
||||
<Input className="" placeholder="A" type="" value={field.value ?? ""}
|
||||
onChange={field.onChange}/>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
@@ -40,7 +40,7 @@ export function RswtrRegForm({
|
||||
})
|
||||
|
||||
// 2. Define a submit handler.
|
||||
function onSubmit(values: z.infer<typeof rswtZod>) {
|
||||
async function onSubmit(values: z.infer<typeof rswtZod>) {
|
||||
// Do something with the form values.
|
||||
// ✅ This will be type-safe and validated.
|
||||
console.log(values);
|
||||
@@ -48,7 +48,7 @@ export function RswtrRegForm({
|
||||
|
||||
if (isModal) {
|
||||
// regRainForm.bdstInfoPk = null;
|
||||
rswtReg(values);
|
||||
await rswtReg(values);
|
||||
} else {
|
||||
rswtUpdate(values);
|
||||
}
|
||||
@@ -96,7 +96,7 @@ useEffect(() => {
|
||||
<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">
|
||||
저장
|
||||
@@ -107,7 +107,7 @@ useEffect(() => {
|
||||
{isModal && rswtForm != undefined ? (
|
||||
<BdstReg form={form} />
|
||||
) : (
|
||||
<></>
|
||||
<></>
|
||||
)}
|
||||
{isModal ? (
|
||||
<h1 className="pl-3 text-xl col-span-10 mt-4 ">
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
import { useWrStore } from "@/app/store";
|
||||
import { UiTable } from "@common/business_components/ui";
|
||||
import ListDiv from "@common/business_components/ui/list_div";
|
||||
import { useEffect } from "react";
|
||||
|
||||
|
||||
|
||||
import type {
|
||||
chgBuilding,
|
||||
} from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
export default function BdstChgModal({ chgBuilding }: { chgBuilding:chgBuilding[] }) {
|
||||
|
||||
const {bdst,rain} = useWrStore((state) => {
|
||||
return state;
|
||||
});
|
||||
const { bdstChgHeadList } = bdst;
|
||||
console.log("chgBuilding", chgBuilding);
|
||||
|
||||
|
||||
return (
|
||||
<>
|
||||
<ListDiv>
|
||||
<UiTable
|
||||
headlist={bdstChgHeadList}
|
||||
pageSize={-1}
|
||||
total={0}
|
||||
onPageChange={() => {}}
|
||||
headName={"○건축물 변경 이력"}
|
||||
tableData={chgBuilding}
|
||||
children={undefined}
|
||||
cellClick={undefined}
|
||||
/>
|
||||
</ListDiv>
|
||||
</>
|
||||
);
|
||||
}
|
||||
+20
-12
@@ -3,18 +3,18 @@ import { headMakeColSpan } from "@/app/ruseFcltMng/fcltReg/rainReg/page";
|
||||
import { useWrStore } from "@/app/store";
|
||||
import {
|
||||
selectClass,
|
||||
type bdstAll,
|
||||
type customRainBdst,
|
||||
} from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import { ScrollArea, SearchInput, SelectBox, UiTable } from "@common/business_components";
|
||||
import { ScrollArea, SelectBox, UiTable } from "@common/business_components";
|
||||
import { Button, Input, Label } from "@common/components";
|
||||
import { useEffect, useState } from "react";
|
||||
import { RainRegForm } from "../../form/fcltReg/rainReg/component";
|
||||
import { getCityCd, type selectArray } from "@/app/store/common/code";
|
||||
import { RainRegForm } from "../../form/fcltReg/rainReg/rainRegForm";
|
||||
import { type selectArray } from "@/app/store/common/code";
|
||||
import { getCity, tableData } from "@/components/lib/func/commom";
|
||||
import { RswtrRegForm } from "../../form/fcltReg/rswtrReg/RswtrRegForm";
|
||||
import { HtdflRegForm } from "../../form/fcltReg/htdflReg/component";
|
||||
import type { customRswtBdst } from "@/app/store/ruseFcltMng/fcltReg/rswtReg";
|
||||
import { HtdflRegForm } from "../../form/fcltReg/htdflReg/htdflRegForm";
|
||||
import type { customHtdflBdst } from "@/app/store/ruseFcltMng/fcltReg/htdflReg";
|
||||
import { RswtrRegForm } from "../../form/fcltReg/rswtrReg/RswtrRegForm";
|
||||
|
||||
export type objSearchType = {
|
||||
sgg: string|number;
|
||||
@@ -76,18 +76,25 @@ export function BdstReg<T extends MoType>({ moType }: BdstRegProps<T>) {
|
||||
|
||||
setbdstTable( tableData(bdst.bdstBase, { code }));
|
||||
}
|
||||
}, [code, bdst]);
|
||||
}, [ bdst]);
|
||||
|
||||
|
||||
const tableClick: (val: number | undefined) => void = (val) => {
|
||||
const tableClick: (val: number | undefined , headId:string) => void = (val ,headId) => {
|
||||
|
||||
if(val!==undefined && bdst?.bdstBase.length>0){
|
||||
const data:BdstTypeMap[T] =bdst?.bdstBase[val]
|
||||
if (data) {
|
||||
setRainBdstForm(data);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
useEffect(()=>{
|
||||
setbdstTable([]) // 초기화 작업
|
||||
},[])
|
||||
const nodeList = headMakeColSpan(bdst.moUpHeadList);
|
||||
return (
|
||||
<>
|
||||
@@ -125,7 +132,7 @@ export function BdstReg<T extends MoType>({ moType }: BdstRegProps<T>) {
|
||||
pageSize={-10}
|
||||
total={-1}
|
||||
headName={undefined}
|
||||
cellClick={tableClick}
|
||||
cellClick={(idx,headId)=> (tableClick(idx, headId||"" ))}
|
||||
>
|
||||
{nodeList}
|
||||
</UiTable>
|
||||
@@ -135,9 +142,10 @@ export function BdstReg<T extends MoType>({ moType }: BdstRegProps<T>) {
|
||||
<ScrollArea className="h-[60vh]">
|
||||
<div>
|
||||
{ moType === 'RNB'?
|
||||
<RainRegForm rainForm={rainBdstForm} isModal={true} />
|
||||
:moType==='RST'?<RswtrRegForm rswtForm={rainBdstForm } isModal={true}></RswtrRegForm>
|
||||
:<HtdflRegForm></HtdflRegForm>
|
||||
<RainRegForm rainForm={rainBdstForm as customRainBdst} isModal={true} />
|
||||
:moType==='RST'
|
||||
? <RswtrRegForm rswtForm={rainBdstForm as customRswtBdst} isModal={true}></RswtrRegForm>
|
||||
:<HtdflRegForm htdflForm={rainBdstForm as customHtdflBdst} isModal={true}></HtdflRegForm>
|
||||
}
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,92 @@
|
||||
import { rainRegExcel } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn";
|
||||
import { selectClass } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import {
|
||||
DatePicker,
|
||||
FileUpload,
|
||||
Form,
|
||||
FormField,
|
||||
FormUi,
|
||||
Title,
|
||||
} from "@common/business_components/ui";
|
||||
import { Button } from "@common/components/ui";
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
import { useState } from "react";
|
||||
import { useForm } from "react-hook-form";
|
||||
import type { z } from "zod";
|
||||
|
||||
export default function ChkgdExcel({ type }: { type: string }) {
|
||||
const [files, setFiles] = useState(null);
|
||||
|
||||
const [dmdDate, setDmdDate] = useState(new Date());
|
||||
|
||||
const defaultValues: z.infer<typeof rainRegExcel> = rainRegExcel.parse({});
|
||||
|
||||
const form = useForm<z.infer<typeof rainRegExcel>>({
|
||||
resolver: zodResolver(rainRegExcel),
|
||||
defaultValues: defaultValues,
|
||||
});
|
||||
|
||||
const onChangeDate = (val: Date | undefined) => {
|
||||
if (val) setDmdDate(val);
|
||||
};
|
||||
return (
|
||||
<>
|
||||
<div>
|
||||
<Form {...form}>
|
||||
<div>
|
||||
<Title
|
||||
title={
|
||||
type === "RNB"
|
||||
? "빗물 이용시설"
|
||||
: "중수도 이용시설" + "점검 결과등록"
|
||||
}
|
||||
></Title>
|
||||
</div>
|
||||
<div className="flex justify-between">
|
||||
<h3 className="text-2xl font-bold text-gray-900">
|
||||
{"○점검정보 입력"}
|
||||
</h3>
|
||||
|
||||
<Button className="">저장</Button>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="chckYmd"
|
||||
render={({ field }) => (
|
||||
<FormUi label="점검일자">
|
||||
<DatePicker
|
||||
mode="single"
|
||||
field={{
|
||||
value:
|
||||
field.value && !isNaN(new Date(field.value).getTime())
|
||||
? new Date(field.value)
|
||||
: new Date(), // Provide a default Date value
|
||||
onChange: (date) => field.onChange(date),
|
||||
}}
|
||||
selectClass={selectClass}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="file"
|
||||
render={({ field }) => (
|
||||
<FormUi label="점검결과 파일">
|
||||
<FileUpload
|
||||
files={field.value}
|
||||
setFiles={setFiles}
|
||||
fileTypes="excel"
|
||||
></FileUpload>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
</Form>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
import { headMakeprfmnc } from "@/app/ruseFcltMng/prfmncReg/chkgdnReg/page";
|
||||
import { useWrStore } from "@/app/store";
|
||||
import { ScrollArea, Title, UiTable } from "@common/business_components/ui";
|
||||
import { Button } from "@common/components/ui";
|
||||
import { useEffect } from "react";
|
||||
|
||||
export default function ChkgdModal({type, obj}:{type:string , obj:any} ){
|
||||
|
||||
|
||||
const { rainChkgdn} = useWrStore((state) => state);
|
||||
|
||||
|
||||
|
||||
const nodeList = headMakeprfmnc(rainChkgdn?.supWaterHeadList,rainChkgdn?.rainHeadNm ) ;
|
||||
const rswtnodeList = headMakeprfmnc(rainChkgdn?.rswtDetailHeadList,rainChkgdn?.rainHeadNm ) ;
|
||||
|
||||
|
||||
useEffect(() =>{
|
||||
|
||||
},[rainChkgdn])
|
||||
|
||||
|
||||
const cellClick =(val:number|undefined, headId:string)=>{
|
||||
if(val!=undefined)
|
||||
console.log(rainChkgdn.supWaterData[val])
|
||||
|
||||
|
||||
}
|
||||
|
||||
return(
|
||||
<>
|
||||
|
||||
<div>
|
||||
<div>
|
||||
<Title title= {type==='RNB'?'빗물이용시설':'중수도 이용시설' + '지도점검 결과등록' }></Title>
|
||||
</div>
|
||||
<div className="flex justify-between">
|
||||
<h3 className="text-2xl font-bold text-gray-900">{"○"+ obj.bdstNm + `(${obj.chckYmd})`}</h3>
|
||||
|
||||
<Button className="">저장</Button>
|
||||
</div>
|
||||
|
||||
<ScrollArea className="h-[60vh]">
|
||||
<UiTable
|
||||
headName={"연간 보급수이용량"}
|
||||
tableData={rainChkgdn.supWaterData||[]}
|
||||
headlist={rainChkgdn?.supWaterHeadList}
|
||||
pageSize={0}
|
||||
total={0}
|
||||
cellClick={(val, headId) => {
|
||||
cellClick(val, headId);
|
||||
}}
|
||||
onPageChange={function (page: number): void {
|
||||
throw new Error("Function not implemented.");
|
||||
} }>
|
||||
|
||||
{nodeList}
|
||||
</UiTable>
|
||||
|
||||
|
||||
<UiTable
|
||||
headName={"연간 빗물이용량"}
|
||||
tableData={rainChkgdn.supWaterData}
|
||||
headlist={rainChkgdn?.supWaterHeadList}
|
||||
pageSize={0}
|
||||
total={0}
|
||||
cellClick={(val, headId) => {
|
||||
cellClick(val, headId);
|
||||
}}
|
||||
onPageChange={function (page: number): void {
|
||||
throw new Error("Function not implemented.");
|
||||
} }>
|
||||
{nodeList}
|
||||
|
||||
</UiTable>
|
||||
|
||||
{type !=='RNB'?
|
||||
<div>
|
||||
<UiTable
|
||||
headName={"연간이용수질(1분기)"}
|
||||
tableData={[]}
|
||||
headlist={rainChkgdn?.rswtDetailHeadList}
|
||||
pageSize={0}
|
||||
total={0}
|
||||
cellClick={(val, headId) => {
|
||||
cellClick(val, headId);
|
||||
}}
|
||||
onPageChange={function (page: number): void {
|
||||
throw new Error("Function not implemented.");
|
||||
} }>
|
||||
{rswtnodeList}
|
||||
|
||||
</UiTable>
|
||||
|
||||
<UiTable
|
||||
headName={"연간이용수질(2분기)"}
|
||||
tableData={[]}
|
||||
headlist={rainChkgdn?.rswtDetailHeadList}
|
||||
pageSize={0}
|
||||
total={0}
|
||||
cellClick={(val, headId) => {
|
||||
cellClick(val, headId);
|
||||
}}
|
||||
onPageChange={function (page: number): void {
|
||||
throw new Error("Function not implemented.");
|
||||
} }>
|
||||
{rswtnodeList}
|
||||
|
||||
</UiTable>
|
||||
|
||||
<UiTable
|
||||
headName={"연간이용수질(3분기)"}
|
||||
tableData={[]}
|
||||
headlist={rainChkgdn?.rswtDetailHeadList}
|
||||
pageSize={0}
|
||||
total={0}
|
||||
cellClick={(val, headId) => {
|
||||
cellClick(val, headId);
|
||||
}}
|
||||
onPageChange={function (page: number): void {
|
||||
throw new Error("Function not implemented.");
|
||||
} }>
|
||||
{rswtnodeList}
|
||||
|
||||
</UiTable>
|
||||
|
||||
<UiTable
|
||||
headName={"연간이용수질(4분기)"}
|
||||
tableData={[]}
|
||||
headlist={rainChkgdn?.rswtDetailHeadList}
|
||||
pageSize={0}
|
||||
total={0}
|
||||
cellClick={(val, headId) => {
|
||||
cellClick(val, headId);
|
||||
}}
|
||||
onPageChange={function (page: number): void {
|
||||
throw new Error("Function not implemented.");
|
||||
} }>
|
||||
{rswtnodeList}
|
||||
|
||||
</UiTable>
|
||||
</div>
|
||||
:<></>}
|
||||
|
||||
</ScrollArea>
|
||||
</div>
|
||||
</>
|
||||
|
||||
|
||||
|
||||
)
|
||||
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
import { Button, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger } from "@common/components";
|
||||
|
||||
export function PbnstMngModal(butNm:string,chldrn:React.ReactNode) {
|
||||
return (
|
||||
<>
|
||||
<Dialog>
|
||||
<DialogTrigger asChild>
|
||||
<Button variant="outline">{butNm}</Button>
|
||||
</DialogTrigger>
|
||||
<DialogContent className="sm:max-w-md">
|
||||
<DialogHeader>
|
||||
<DialogTitle>Share link</DialogTitle>
|
||||
<DialogDescription>
|
||||
Anyone who has this link will be able to view this.
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
{chldrn}
|
||||
|
||||
|
||||
<DialogFooter className="sm:justify-start">
|
||||
<DialogClose asChild>
|
||||
<Button type="button" variant="secondary">
|
||||
닫기
|
||||
</Button>
|
||||
</DialogClose>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
'use client'
|
||||
|
||||
import { headMakeprfmnc } from "@/app/ruseFcltMng/prfmncReg/chkgdnReg/page";
|
||||
import { useWrStore } from "@/app/store";
|
||||
import { UiTable } from "@common/business_components/ui";
|
||||
|
||||
export default function RainChkgdTable() {
|
||||
|
||||
const { code, rainChkgdn} = useWrStore((state) => state);
|
||||
const nodeList = headMakeprfmnc(rainChkgdn?.rainChkgdnHeadList,rainChkgdn?.rainHeadNm ) ;
|
||||
|
||||
|
||||
return(
|
||||
|
||||
<>
|
||||
<UiTable
|
||||
tableData={[]}
|
||||
headlist={rainChkgdn.rainChkgdnHeadList}
|
||||
pageSize={100}
|
||||
total={10}
|
||||
headName={"지도점검 결과등록"}
|
||||
cellClick={()=>{} } >
|
||||
{nodeList}
|
||||
</UiTable>
|
||||
</>
|
||||
)
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
'use client'
|
||||
|
||||
import { headMakeprfmnc } from "@/app/ruseFcltMng/prfmncReg/chkgdnReg/page";
|
||||
import { useWrStore } from "@/app/store";
|
||||
import { UiTable } from "@common/business_components/ui";
|
||||
|
||||
export default function RswtChkgdTable() {
|
||||
|
||||
const { rswtChkgdn} = useWrStore((state) => state);
|
||||
const nodeList = headMakeprfmnc(rswtChkgdn?.rswtChkgdnHeadList , rswtChkgdn?.rswtHeadNm );
|
||||
|
||||
|
||||
return(
|
||||
|
||||
<>
|
||||
<UiTable
|
||||
tableData={[]}
|
||||
headlist={rswtChkgdn.rswtChkgdnHeadList}
|
||||
pageSize={100}
|
||||
total={10}
|
||||
headName={"지도점검 결과등록"}
|
||||
cellClick={() => { } } onPageChange={function (page: number): void {
|
||||
throw new Error("Function not implemented.");
|
||||
} } >
|
||||
{nodeList}
|
||||
</UiTable>
|
||||
</>
|
||||
)
|
||||
|
||||
}
|
||||
@@ -1,50 +1,29 @@
|
||||
import { Button, Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTrigger } from "@common/components";
|
||||
import { useState } from "react";
|
||||
|
||||
type ModalType = {
|
||||
bodyClass: string;
|
||||
butNm: string;
|
||||
title: string | undefined;
|
||||
body: React.ReactNode;
|
||||
open?: boolean;
|
||||
onOpenChange?: (open: boolean) => void;
|
||||
}
|
||||
|
||||
export function UiModal({ bodyClass, butNm, title, body, open, onOpenChange }: ModalType) {
|
||||
const dialogProps = open !== undefined && onOpenChange !== undefined && title !== undefined
|
||||
? { open, onOpenChange, title }
|
||||
: {};
|
||||
|
||||
export function UiModal({ bodyClass, body, open, onOpenChange }: ModalType) {
|
||||
|
||||
return (
|
||||
<>
|
||||
{!open && (
|
||||
<Dialog>
|
||||
<DialogTrigger asChild>
|
||||
<Button className="mr-4 rounded-lg">{butNm}</Button>
|
||||
</DialogTrigger>
|
||||
<Dialog open={open} onOpenChange={onOpenChange}>
|
||||
<DialogContent className={bodyClass}>
|
||||
<DialogHeader>
|
||||
<DialogDescription>
|
||||
</DialogDescription>
|
||||
|
||||
</DialogHeader>
|
||||
{body}
|
||||
{(open && body)}
|
||||
<DialogFooter className="sm:justify-start">
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
)}
|
||||
{open && (
|
||||
<Dialog {...dialogProps}>
|
||||
<DialogContent className={bodyClass}>
|
||||
<DialogHeader>
|
||||
<DialogDescription>
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
{body}
|
||||
<DialogFooter className="sm:justify-start">
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ type UiTableProps = {
|
||||
pageSize: number;
|
||||
total: number;
|
||||
children: React.ReactNode | undefined;
|
||||
cellClick : ((index:number|undefined)=>void) | undefined;
|
||||
cellClick : ((index:number|undefined, headId:string)=>void )| undefined;
|
||||
onPageChange: (page: number) => void;
|
||||
className?: string;
|
||||
}
|
||||
@@ -21,25 +21,22 @@ type UiHeadProps = {
|
||||
|
||||
export function UiTable({ tableData, headlist, pageSize, total, children, headName, cellClick, onPageChange, className = '' }: UiTableProps) {
|
||||
const [cur, setCur] = useState<number>(1);
|
||||
const [idx, setIdx] = useState<number>(0);
|
||||
const [idx, setIdx] = useState<number>(-1);
|
||||
const handlePageChange = (page: number) => {
|
||||
setCur(page);
|
||||
onPageChange(page);
|
||||
}
|
||||
const handleCellClick = (index: number) => {
|
||||
|
||||
|
||||
const handleCellClick = (index: number,headId:string )=> {
|
||||
if (cellClick) {
|
||||
console.log("cellClick", index);
|
||||
cellClick(index);
|
||||
cellClick(index,headId);
|
||||
setIdx(index);
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
console.log("idx", idx);
|
||||
console.log("idx", idx);
|
||||
|
||||
},[idx])
|
||||
return (
|
||||
<>
|
||||
{headName ? <div className="card-header">
|
||||
@@ -59,7 +56,7 @@ useEffect(() => {
|
||||
<TableRow key={index + "row"} >
|
||||
{headlist?.map((head) => (
|
||||
// <TableCell className={cellClick&&idx==index?"bg-black/10 cursor-pointer":cellClick?"cursor-pointer":""} onClick={()=>handleCellClick(index)} key={head.id + index}>{el[head.id]}</TableCell>
|
||||
<TableCell className={cellClick&&idx==index?"opacity-40 cursor-pointer":cellClick?"cursor-pointer":""} onClick={()=>handleCellClick(index)} key={head.id + index}>{el[head.id]}</TableCell>
|
||||
<TableCell className={cellClick&&idx==index?"opacity-40 cursor-pointer":cellClick?"cursor-pointer":""} onClick={(e)=>handleCellClick(index,head.id)} key={head.id + index}>{el[head.id]}</TableCell>
|
||||
))}
|
||||
</TableRow>
|
||||
))}
|
||||
|
||||
Reference in New Issue
Block a user