중수도 시설 현황 팝업창만 남음
This commit is contained in:
@@ -30,7 +30,7 @@ export default function HtdflRegForm({
|
||||
htdflForm: customHtdflBdst;
|
||||
isModal: boolean;
|
||||
}) {
|
||||
const { code, htdflUpdate, htdflReg } = useWrStore((state) => state);
|
||||
const { code, htdflBdstUpdate, htdflBdstReg } = useWrStore((state) => state);
|
||||
|
||||
const defaultValues: z.infer<typeof hdtflZod> = hdtflZod.parse({});
|
||||
|
||||
@@ -41,15 +41,12 @@ export default function HtdflRegForm({
|
||||
|
||||
const onSubmit = (values: z.infer<typeof hdtflZod>) => {
|
||||
if (isModal) {
|
||||
htdflReg(values);
|
||||
htdflBdstReg(values,'41');
|
||||
} else {
|
||||
htdflUpdate(values);
|
||||
htdflBdstUpdate(values ,'41');
|
||||
}
|
||||
};
|
||||
|
||||
const onSelectValue = (val: string | number) => {
|
||||
console.log(val);
|
||||
};
|
||||
|
||||
const cleanHtdflData = (raw: any): z.infer<typeof hdtflZod> => {
|
||||
return {
|
||||
@@ -159,7 +156,7 @@ export default function HtdflRegForm({
|
||||
label={""}
|
||||
selectClass={selectClass}
|
||||
selectArray={code.yn}
|
||||
onSelectValue={onSelectValue}
|
||||
onSelectValue={field.onChange}
|
||||
value={field.value ?? code.yn[0]?.val}
|
||||
/>
|
||||
</FormUi>
|
||||
@@ -259,7 +256,7 @@ export default function HtdflRegForm({
|
||||
label={""}
|
||||
selectClass={selectClass}
|
||||
selectArray={code.yn}
|
||||
onSelectValue={onSelectValue}
|
||||
onSelectValue={field.onChange}
|
||||
value={field.value ?? code.yn[0]?.val}
|
||||
/>
|
||||
</FormUi>
|
||||
@@ -296,7 +293,7 @@ export default function HtdflRegForm({
|
||||
selectClass={selectClass}
|
||||
label={""}
|
||||
selectArray={code.yn}
|
||||
onSelectValue={onSelectValue}
|
||||
onSelectValue={field.onChange}
|
||||
value={field.value ?? code.yn[0]?.val}
|
||||
/>
|
||||
</FormUi>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useWrStore } from "@/app/store";
|
||||
import { rainSttnHeadListType } from "@/app/store/ruseFcltMng/fcltSttn/rainSttn/headList";
|
||||
import { sttnHeadListType } from "@/app/store/ruseFcltMng/fcltSttn/rainSttn/headList";
|
||||
import { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage } from "@common/business_components/ui";
|
||||
import { Button, Checkbox } from "@common/components/ui";
|
||||
import { zodResolver } from "@hookform/resolvers/zod";
|
||||
@@ -7,38 +7,32 @@ import { useEffect, useState } from "react";
|
||||
import { useForm } from "react-hook-form";
|
||||
import { z } from "zod";
|
||||
|
||||
export default function HeadChModal({type }:{type: string }) {
|
||||
const { rainSttn ,rainChSttnHead} = useWrStore((state) => state);
|
||||
export default function HeadChModal({headList, type }:{headList : z.infer<typeof sttnHeadListType> ,type:string }) {
|
||||
const { rainChSttnHead , rswtChSttnHead} = useWrStore((state) => state);
|
||||
|
||||
|
||||
const { rainSttHeadList, rainSttNodeList } =rainSttn;
|
||||
let items = rainSttHeadList.map(item => ({id:item.id, title:item.title, val:item.visible }));
|
||||
let items = headList.map(item => ({id:item.id, title:item.title, val:item.visible }));
|
||||
|
||||
|
||||
|
||||
// const FormSchema =
|
||||
// z.object({
|
||||
// id: z.string().refine((value) => value.some((item) => item), {
|
||||
// message: "최소한 하나를 선택해주시길 바랍니다.",
|
||||
// }),
|
||||
// visible: z.boolean()
|
||||
// })
|
||||
|
||||
|
||||
const form = useForm<z.infer<typeof rainSttnHeadListType>>({
|
||||
resolver: zodResolver(rainSttnHeadListType),
|
||||
const form = useForm<z.infer<typeof sttnHeadListType>>({
|
||||
resolver: zodResolver(sttnHeadListType),
|
||||
defaultValues: [],
|
||||
})
|
||||
|
||||
|
||||
useEffect(() =>{
|
||||
form.reset(rainSttHeadList)
|
||||
form.reset(headList)
|
||||
|
||||
|
||||
},[rainSttHeadList])
|
||||
},[headList])
|
||||
|
||||
const onSubmit = (headList : z.infer<typeof rainSttnHeadListType> ) =>{
|
||||
rainChSttnHead(headList)
|
||||
const onSubmit = (valueList : z.infer<typeof sttnHeadListType> ) =>{
|
||||
if(type==='RNB'){
|
||||
|
||||
rainChSttnHead(valueList)
|
||||
}else if(type=== 'RST'){
|
||||
rswtChSttnHead(valueList)
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user