중수도 등록 작업 중 api 테스트 해야함

This commit is contained in:
leedj312
2025-04-09 17:23:04 +09:00
parent 22209fb426
commit 52560d4b1b
13 changed files with 804 additions and 603 deletions
@@ -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 type { customHtdflBdst } from "@/app/store/ruseFcltMng/fcltReg/htdflReg";
import type { customRswtBdst } from "@/app/store/ruseFcltMng/fcltReg/rswtReg";
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";
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}>
신규등록
@@ -6,7 +6,7 @@ import type {
TableUpperProps,
} from "@/app/store/ruseFcltMng/fcltReg/rainReg";
import { tableData } from "@/components/lib/func/commom";
import { RainRegForm } from "@/components/ui/form/fcltReg/rainReg/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 {
@@ -22,7 +22,6 @@ import {
} from "@common/business_components";
import ListDiv from "@common/business_components/ui/list_div";
import { Button, TableHead, TableRow } from "@common/components";
import exp from "constants";
import { useEffect, useState } from "react";
export const headMakeColSpan = (upHeadList: TableUpperProps[]) => {
@@ -53,7 +53,6 @@ export default function Home() {
) => {
if ((bdstTable ?? []).length > 0 && val !== undefined) {
{
console.log(" val ", val);
setRswtForm(rswtRes[val]);
}
}
+3 -3
View File
@@ -85,9 +85,9 @@ const orgwtKndCd = [
];
export const chBuCd = [
{ val: "1", text: "증축" },
{ val: "2", text: "개축" },
{ val: "3", text: "재축" },
{ val: "증축", text: "증축" },
{ val: "개축", text: "개축" },
{ val: "재축", text: "재축" },
]
@@ -1,146 +1,146 @@
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 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(""),
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([])
,chgBuilding: z.array(
z.object({
bdstInfoFk: z.number().nullish(),
archChgPrmsnDt: z.coerce.date(),
archChgArea: z.number().default(0),
bdstChgNm: z.string().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().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().nullable(),
archChgPrmsnDt: z.coerce.date() ,
archChgArea: z.number().default(0),
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: {
@@ -150,12 +150,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 = {
@@ -167,41 +168,80 @@ export const htdflFacStateExport: htdflFacState = {
};
const initFetch = async (txt: string | undefined) => {
const htdflRes = 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) {
alert(" 등록이 완료되었습니다.");
}
const htdflRes = await initFetch(undefined);
set((state: htdflFacState) => ({
...state,
htdfl: {
...state.htdfl,
htdflRes: htdflRes,
isInit: false,
},
}));
} catch (errorReg) {
alert("등록 오류입니다.");
}
},
};
};
@@ -67,7 +67,7 @@ export const rainZod = z.object({
export type chgBuilding={
bdstInfoFk: number,
bdstInfoFk: number|null,
archChgPrmsnDt: Date,
archChgArea: number,
bdstChgNm: string
@@ -291,7 +291,9 @@ export const rainFacActionsExport: (set: any) => rainFacSActions = (
try {
const res = await postFectch("/reuseFc/rainyInfo", data);
if(res.ok){
alert(" 등록이 완료되었습니다.")
// alert(" 등록이 완료되었습니다.")
}
const rainRes = await initFetch(undefined);
set((state: rainFacState) => ({
@@ -271,10 +271,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>
)}
@@ -309,7 +310,7 @@ export default function BdstReg({ form }: { form: any }) {
className=""
placeholder="1,000,000"
type="text"
value={ field.value??""}
value={ field.value??0}
onChange={(e) => field.onChange(Number(e.target.value))}
/>
@@ -12,436 +12,549 @@ 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 {
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,
}: {
htdflForm: customHtdflBdst;
isModal: boolean;
} ) {
const {code} = useWrStore((state) => state);
}) {
const { code, htdflUpdate, htdflReg } = useWrStore((state) => state);
const defaultValues: z.infer<typeof hdtflZod> = hdtflZod.parse({});
const defaultValues: z.infer<typeof hdtflZod> = hdtflZod.parse({});
const form = useForm<z.infer<typeof hdtflZod>>({
resolver: zodResolver(hdtflZod),
defaultValues:defaultValues,
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);
if (isModal) {
htdflReg(values);
} else {
htdflUpdate(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);
}
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>
<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-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 ?? ""}
<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-2">
<FormField
control={form.control}
name="reuseBuilding.0.htdfObj.plwtYn"
render={({ field }) => (
<FormUi label="담수화 여부">
<SelectBox
selectClass={selectClass}
selectArray={code.yn}
onSelectValue={onSelectValue}
{...field}
/>
</FormUi>
)}
/>
/>
</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=" my-4">
<h1 className="bg-gray-400 text-xl text-center border-2 p-2 mt-4 pl-6">
온배수 시설 운영현황
</h1>
<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="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 ">
<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>
</h1>
</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 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="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="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="col-span-6 ">
<FormField
control={form.control}
name="tp"
render={({ field }) => (
<FormUi label="총인">
<Input placeholder="10" type="text" {...field} />
</FormUi>
)}
/>
</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="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="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="col-span-6">
<FormField
control={form.control}
name="ph"
render={({ field }) => (
<FormUi label="수소이온농도">
<Input placeholder="10" type="text" {...field} />
</FormUi>
)}
/>
</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="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="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="col-span-6">
<FormField
control={form.control}
name="clIonQnt"
render={({ field }) => (
<FormUi label="염화물">
<Input placeholder="10" type="text" {...field} />
</FormUi>
)}
/>
</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="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="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="col-span-6">
<FormField
control={form.control}
name="cdtnv"
render={({ field }) => (
<FormUi label="전기전도도">
<Input placeholder="10" type="text" {...field} />
</FormUi>
)}
/>
</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="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 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>
</form>
</Form>
</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">
@@ -95,7 +95,7 @@ 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">
저장
@@ -121,15 +121,17 @@ export function RainRegForm({
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>
)}
/>
@@ -145,10 +147,9 @@ export function RainRegForm({
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>
@@ -176,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>
)}
@@ -195,11 +195,8 @@ export function RainRegForm({
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>
)}
@@ -223,7 +220,7 @@ export function RainRegForm({
label={""}
selectArray={code.yn}
onSelectValue={field.onChange}
{...field}
value={field.value ?? code.yn[0]?.val}
/>
</FormUi>
)}
@@ -239,11 +236,9 @@ export function RainRegForm({
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>
)}
@@ -258,8 +253,9 @@ export function RainRegForm({
<Input
className=""
placeholder="1,000,000"
type=""
{...field}
type=""
value={field.value ?? ""}
onChange={field.onChange}
/>
</FormUi>
)}
@@ -287,7 +283,7 @@ export function RainRegForm({
label={""}
selectArray={code.yn}
onSelectValue={field.onChange}
value={field.value}
value={field.value ?? code.yn[0]?.val}
/>
</FormUi>
)}
@@ -331,7 +327,7 @@ export function RainRegForm({
label={""}
selectArray={code.yn}
onSelectValue={field.onChange}
value={field.value}
value={field.value ?? code.yn[0]?.val}
/>
</FormUi>
)}
@@ -343,7 +339,8 @@ export function RainRegForm({
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>
)}
/>
@@ -358,7 +355,8 @@ export function RainRegForm({
className=""
placeholder="ab1234678"
type=""
{...field}
value={field.value ?? ""}
onChange={field.onChange}
/>
</FormUi>
)}
@@ -370,7 +368,8 @@ export function RainRegForm({
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>
)}
/>
@@ -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 ">
@@ -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 type { customRswtBdst } from "@/app/store/ruseFcltMng/fcltReg/rswtReg";
import { RswtrRegForm } from "../../form/fcltReg/rswtrReg/RswtrRegForm";
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;
@@ -145,7 +145,7 @@ export function BdstReg<T extends MoType>({ moType }: BdstRegProps<T>) {
<RainRegForm rainForm={rainBdstForm as customRainBdst} isModal={true} />
:moType==='RST'
? <RswtrRegForm rswtForm={rainBdstForm as customRswtBdst} isModal={true}></RswtrRegForm>
:<HtdflRegForm></HtdflRegForm>
:<HtdflRegForm htdflForm={rainBdstForm as customHtdflBdst} isModal={true}></HtdflRegForm>
}
</div>