form 수정

This commit is contained in:
leedj312
2025-03-10 22:17:16 +09:00
parent 818fec3f75
commit 2756b075d0
3 changed files with 30 additions and 14 deletions
+7 -3
View File
@@ -10,7 +10,11 @@ type typeOfForm ={
formName: string;
}
export function IteraterFrom(formData:typeOfForm[],form:any , colSpanValue:string){
type onSelectValue = (val:string) => void;
export function IteraterFrom(formData:typeOfForm[],form:any , formClass:string , onSelectValue:onSelectValue ){
return (
<>
@@ -19,13 +23,13 @@ export function IteraterFrom(formData:typeOfForm[],form:any , colSpanValue:strin
control={form.control}
name={data.formName}
render={({ field }) => (
<FormItem className='col-span-4' >
<FormItem className={formClass} >
<FormLabel>{data.labelName}</FormLabel>
<FormControl>
{data.selectvlaue == undefined ? (
<Input className ='w-64'placeholder= {data.placeholder} type="" {...field} />
) : (
<SelectBox className='' label =''selectArray={data.selectvlaue}></SelectBox>
<SelectBox className='' label='' selectArray={data.selectvlaue} onSelectValue={onSelectValue} ></SelectBox>
)}
</FormControl>
<FormMessage />
@@ -23,7 +23,8 @@ type typeOfForm = {
selectvlaue?: { text: string; val: string }[];
}
export function PublicReuseFaciltyFormInsert() {
const { upHeadList, publicReuseFacilityUper } = useWrStore((state) => state);
const { pubFac } = useWrStore((state) => state);
const { pubFacHeadList, publicReuseFacilityData} = pubFac;
const total = 100;
const form = useForm<z.infer<typeof formSchema>>({
@@ -137,8 +138,8 @@ export function PublicReuseFaciltyFormInsert() {
</div>
<div>
<UiTable
publicReuseFacility={publicReuseFacilityUper}
headlist={upHeadList}
tableData={publicReuseFacilityData}
headlist={pubFacHeadList}
pageSize={100}
total={total}
headName={""}
@@ -234,7 +235,9 @@ export function PublicReuseFaciltyFormInsert() {
name="name_1486273033"
render={({ field }) => (
<FormItem>
<SelectBox label ='등록차수'selectArray={selectboxValue}></SelectBox>
<SelectBox label='등록차수' selectArray={selectboxValue} className={""} onSelectValue={function (val: string): void {
throw new Error("Function not implemented.");
} }></SelectBox>
<FormMessage />
</FormItem>
)}
@@ -260,7 +263,9 @@ export function PublicReuseFaciltyFormInsert() {
render={({ field }) => (
<FormItem >
<FormLabel>구분</FormLabel>
<SelectBox selectArray={selectboxDivValue}></SelectBox>
<SelectBox selectArray={selectboxDivValue} className={""} label={""} onSelectValue={function (val: string): void {
throw new Error("Function not implemented.");
} }></SelectBox>
</FormItem>
)}
/>
@@ -273,7 +278,9 @@ export function PublicReuseFaciltyFormInsert() {
render={({ field }) => (
<FormItem >
<FormLabel>사업방식</FormLabel>
<SelectBox selectArray={selectboxBuisValue}></SelectBox>
<SelectBox selectArray={selectboxBuisValue} className={""} label={""} onSelectValue={function (val: string): void {
throw new Error("Function not implemented.");
} }></SelectBox>
</FormItem>
)}
/>
@@ -477,7 +484,9 @@ export function PublicReuseFaciltyFormInsert() {
<FormItem>
<FormLabel className="w-32" >재처리방식</FormLabel>
<FormControl>
<SelectBox selectArray={selectboxReuseMethodValue}></SelectBox>
<SelectBox selectArray={selectboxReuseMethodValue} className={""} label={""} onSelectValue={function (val: string): void {
throw new Error("Function not implemented.");
} }></SelectBox>
</FormControl>
<FormMessage />
</FormItem>
@@ -152,7 +152,10 @@ export function RainReuseFaciltyInsertForm() {
},
];
const onSelectValue=(val:string)=>{
console.log(val)
}
return (
<div className="">
<Form {...form}>
@@ -204,12 +207,12 @@ export function RainReuseFaciltyInsertForm() {
<div>
<h2 className="pl-3 text-l">✓ 1. 집수면</h2>
</div>
<div className="grid grid-cols-4 gap-2 mt-4">{IteraterFrom(homeWaterData,form,'2')}</div>
<div className="grid grid-cols-4 gap-2 mt-4">{IteraterFrom(homeWaterData,form,'2',onSelectValue)}</div>
<div>
<h2 className="pl-3 text-l">✓ 2. 여과 등 처리시설</h2>
</div>
<div className="grid grid-cols-12 gap-2 mt-4">{IteraterFrom(filtrTrtmfct,form,'2' )}</div>
<div className="grid grid-cols-12 gap-2 mt-4">{IteraterFrom(filtrTrtmfct,form,'2' ,onSelectValue)}</div>
<div className=" my-2">
<h1 className="bg-gray-400 text-xl text-center border-2 p-2 mt-4 ">
인센티브 정보
@@ -218,12 +221,12 @@ export function RainReuseFaciltyInsertForm() {
<div>
<h2 className="pl-3 text-l">✓ 1. 설치비 지원</h2>
</div>
<div className="grid grid-cols-2 gap-2 mt-4">{IteraterFrom(instlCst,form,'2' )}</div>
<div className="grid grid-cols-2 gap-2 mt-4">{IteraterFrom(instlCst,form,'2' ,onSelectValue)}</div>
<div>
<h2 className="pl-3 text-l">✓ 2. 녹색건축물 인증</h2>
</div>
<div className="grid grid-cols-16 gap-2 mt-4">{IteraterFrom(greenBuilding,form,'2')}</div>
<div className="grid grid-cols-16 gap-2 mt-4">{IteraterFrom(greenBuilding,form,'2',onSelectValue)}</div>
</form>