diff --git a/apps/wr/app/ruseFcltMng/fcltReg/rainReg/page.tsx b/apps/wr/app/ruseFcltMng/fcltReg/rainReg/page.tsx
index 77dbfb881..5f796a6da 100644
--- a/apps/wr/app/ruseFcltMng/fcltReg/rainReg/page.tsx
+++ b/apps/wr/app/ruseFcltMng/fcltReg/rainReg/page.tsx
@@ -1,7 +1,9 @@
'use client'
import { useWrStore } from "@/app/store";
import type { bdstType, rainRuseType, TableUpperProps } from "@/app/store/ruseFcltMng/fcltReg/rainReg"
+import { BdstReg } from "@/components/ui/form/fcltReg/bdstReg/bdstRegForm";
import { RainRegForm } from "@/components/ui/form/fcltReg/rainReg/component";
+import { BdstRegModal } from "@/components/ui/modal/bdstReg/component";
import { ScrollArea, SearchDiv, SearchInput, UiTable } from "@common/business_components";
import { Button, TableHead, TableRow } from "@common/components";
import { useEffect, useState } from "react";
@@ -55,13 +57,22 @@ export default function Home() {
}
}, [code,bdstObj]);
const cellClick=(val:number)=>{
+
let data
- if(bdstObj.length>0) {
- data =rainRuseObj.filter((item)=> item.bdstInfoFk===val)
+ if((bdstTable ?? []).length > 0) {
+ data =rainRuseObj.filter((item)=> item.bdstInfoFk===bdstTable?.[val]?.bdstInfoPk)
setRinBdstForm(data)
}
}
-
+ const divTest =()=>{
+ return(
+ <>
+
+
+ >
+
+ )
+ }
return (
<>
@@ -75,8 +86,8 @@ export default function Home() {
-
-
+ } />
+ {/* */}
diff --git a/apps/wr/components/ui/form/fcltReg/bdstReg/bdstRegForm.tsx b/apps/wr/components/ui/form/fcltReg/bdstReg/bdstRegForm.tsx
new file mode 100644
index 000000000..f889cb6c5
--- /dev/null
+++ b/apps/wr/components/ui/form/fcltReg/bdstReg/bdstRegForm.tsx
@@ -0,0 +1,63 @@
+'use client'
+import { headMakeColSpan } from "@/app/ruseFcltMng/fcltReg/rainReg/page";
+import { useWrStore } from "@/app/store";
+import { selectClass, type bdstType } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
+import { SelectBox, UiTable } from "@common/business_components";
+import { Button, Input } from "@common/components";
+import { useEffect, useState } from "react";
+
+export function BdstReg(){
+
+ const { rain, code,init } = useWrStore((state) => {
+ return state
+ });
+
+ const[bdstTable, setbdstTable] = useState ();
+ const {bdstObj, rainRuseObj } =rain
+ const getCity =(val:string|number)=>{
+
+ console.log(val)
+ }
+
+ const getSgg =(val:string|number)=>{
+
+ console.log(val)
+ }
+
+ useEffect ( () => {
+ if(code.sggCd.length>0){
+ const table= bdstObj.map((item) => {
+ const sggText= code.sggCd.find((cd)=>cd.val.toString() === item.sggCd )?.text;
+ const cityText= code.cityCd.find((cd)=>cd.val.toString() === item.ctpvCd )?.text;
+ return(
+ {...item,
+ sggText:sggText,
+ cityText:cityText
+ })
+ })
+ setbdstTable(table)
+ }
+ }, [code,bdstObj]);
+
+ const cellClick = ()=>{
+
+ }
+ const nodeList = headMakeColSpan(rain.upHeadList)
+ return(
+ <>
+ 건축물조회
< h2/>
+
+
+
+
+
+
+
+
+
+ {nodeList}
+
+
+ >
+ )
+}
\ No newline at end of file
diff --git a/apps/wr/components/ui/form/fcltReg/rainReg/component.tsx b/apps/wr/components/ui/form/fcltReg/rainReg/component.tsx
index 4748e042f..a6dcb71d0 100644
--- a/apps/wr/components/ui/form/fcltReg/rainReg/component.tsx
+++ b/apps/wr/components/ui/form/fcltReg/rainReg/component.tsx
@@ -1,7 +1,7 @@
"use client";
import { Form, FormField, SelectBox } from "@common/business_components/ui";
-import { Input } from "@common/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";
@@ -33,11 +33,17 @@ export function RainRegForm({data}:{data:rainRuseType[]} ) {
const { rain ,code} = useWrStore((state) => state);
const {rainFcltCd } = code
useEffect(() => {
- console.log(data);
+ console.log("form data:", data);
if (data && data.length > 0) {
- form.reset(data[0]); // Assuming the first item matches the form schema
+ const selectedOption = rainFcltCd.find(item => item.val === String(data[0].pntfColKnd));
+ const formData = {
+ ...data[0],
+ pntfColKnd: selectedOption ? selectedOption.val : ""
+ };
+ console.log("Setting form data:", formData);
+ form.reset(formData);
}
- }, [data]);
+ }, [data, rainFcltCd]);
const form = useForm>({
resolver: zodResolver(formSchema),
@@ -60,6 +66,14 @@ export function RainRegForm({data}:{data:rainRuseType[]} ) {
},
});
+ // form 값이 변경될 때마다 로그 출력
+ useEffect(() => {
+ const subscription = form.watch((value) => {
+ console.log("form values changed:", value);
+ });
+ return () => subscription.unsubscribe();
+ }, [form]);
+
// 2. Define a submit handler.
function onSubmit(values: z.infer) {
// Do something with the form values.
@@ -76,8 +90,9 @@ export function RainRegForm({data}:{data:rainRuseType[]} ) {