스크롤바 작업 중 / business 컴포넌트 적용전

This commit is contained in:
leedj312
2025-03-10 15:15:56 +09:00
parent 03abe7ae90
commit d04a79d1cc
7 changed files with 745 additions and 0 deletions
@@ -0,0 +1,63 @@
'use client'
import { useWrStore } from "@/app/store";
import type { TableUpperProps } from "@/app/store/publicReuseFaciltyInsert";
import { RainReuseFaciltyInsertForm } from "@/components/ui/rainReuseInsertForm";
import { SearchDiv, SelectBox, UiTable } from "@common/business_components";
import { Button, TableHead, TableRow } from "@common/components";
const headMakeColSpan = (upHeadList: TableUpperProps[]) => {
return ( <>
<TableRow>{
upHeadList.map((head: TableUpperProps) =>
(!head.upSequnce?<TableHead rowSpan={2}key={head.id}>{head.title}</TableHead>:
head.upName === 'upChangeRe'&& head.upSequnce=== 1?<TableHead key={head.id} rowSpan={1} colSpan={3}>{'중축 개축 증축 '}</TableHead>:null))}
</TableRow>
<TableRow>
{upHeadList.map((head: TableUpperProps) =>
(head.upName === 'upChangeRe'?<TableHead key={head.id}>{head.title}</TableHead>:null))}
</TableRow>
</> )
}
export default function Home (){
const { building } = useWrStore((state) => state);
const nodeList= headMakeColSpan(building.upHeadList);
const total = 100;
const selectBox = [{text:'서울', value:'대전'}]
const headName= ()=>{
return(
<h1 className="pl-3 text-xl">○건축물 목록</h1>
)
}
return(
<>
{/* <div>
<h1 className="pl-3 text-2xl mr-2" >빗물이용시설 등록 </h1>
<SearchDiv >
<SelectBox className="pl-3 mr-3" label="시군구" selectArray={selectBox} />
<Button className ='mr-2' size='sm'>조회</Button>
<Button className ='mr-2' size='sm'>저장</Button>
<Button className ='mr-2' size='sm'>신규등록</Button>
</SearchDiv>
</div> */}
<div className="grid grid-cols-2 gap-4">
<div className="colsapn-1 ">
<UiTable publicReuseFacility={building.buildingObject} headlist={building.upHeadList} pageSize={100} total={total} headName={headName()}>
{nodeList}
</UiTable>
</div>
<div className="colsapn-1 ovreflow-y">
<RainReuseFaciltyInsertForm></RainReuseFaciltyInsertForm>
</div>
</div>
</>
);
}
@@ -0,0 +1,63 @@
'use client'
import { useWrStore } from "@/app/store";
import type { TableUpperProps } from "@/app/store/publicReuseFaciltyInsert";
import { RswtrReuseFaciltyInsertForm } from "@/components/ui/rswtrReuseFacilityInsetForm";
import { SearchDiv, SelectBox, UiTable } from "@common/business_components";
import { Button, TableHead, TableRow } from "@common/components";
const headMakeColSpan = (upHeadList: TableUpperProps[]) => {
return ( <>
<TableRow>{
upHeadList.map((head: TableUpperProps) =>
(!head.upSequnce?<TableHead rowSpan={2}key={head.id}>{head.title}</TableHead>:
head.upName === 'upChangeRe'&& head.upSequnce=== 1?<TableHead key={head.id} rowSpan={1} colSpan={3}>{'중축 개축 증축 '}</TableHead>:null))}
</TableRow>
<TableRow>
{upHeadList.map((head: TableUpperProps) =>
(head.upName === 'upChangeRe'?<TableHead key={head.id}>{head.title}</TableHead>:null))}
</TableRow>
</> )
}
export default function Home (){
const { building } = useWrStore((state) => state);
const nodeList= headMakeColSpan(building.upHeadList);
const total = 100;
const selectBox = [{text:'서울', value:'대전'}]
const headName= ()=>{
return(
<h1 className="pl-3 text-xl">○건축물 목록</h1>
)
}
return(
<>
{/* <div>
<h1 className="pl-3 text-2xl mr-2" >빗물이용시설 등록 </h1>
<SearchDiv >
<SelectBox className="pl-3 mr-3" label="시군구" selectArray={selectBox} />
<Button className ='mr-2' size='sm'>조회</Button>
<Button className ='mr-2' size='sm'>저장</Button>
<Button className ='mr-2' size='sm'>신규등록</Button>
</SearchDiv>
</div> */}
<div className="grid grid-cols-2 gap-4">
<div className="colsapn-1">
<UiTable publicReuseFacility={building.buildingObject} headlist={building.upHeadList} pageSize={100} total={total} headName={headName()}>
{nodeList}
</UiTable>
</div>
<div className="colsapn-1 h-full">
<RswtrReuseFaciltyInsertForm></RswtrReuseFaciltyInsertForm>
</div>
</div>
</>
);
}
@@ -0,0 +1,108 @@
export type TableUpperProps = {
id: string;
title: string;
upName?: string;
upSequnce?: number;
}
type buildingOfType = {
sido: string,
sigungo: string,
facilityName: string,
location: string,
locationgubun: string,
firstConstructionPermission:string,
facilityCapacity: string,
buildingArea:string,
yn?: string,
permissionDay:string;
authoDay?: string,
area?: string,
reuse?: string,
register?: string,
legalTargetYn:string,
}
const upHeadList:TableUpperProps[] = [
{ id: "sido", title: "시도"},
{ id: "sigungo", title: "시군구"},
{ id: "facilityName", title: "시설명"},
{ id: "location", title: "위치"},
{ id: "locationgubun", title: "지역구분"},
{ id: "facilityCapacity", title: "시설용량"},
{ id: "yn", title: '여부', upName:'upChangeRe' , upSequnce:1 },
{ id: "authoDay", title: '허가일',upName:'upChangeRe', upSequnce:2 },
{ id: "area", title: '면적' ,upName:'upChangeRe',upSequnce:3 }];
const buildingObject:buildingOfType[] = [
{
sido: "서울",
sigungo: "종로구",
facilityName: "그랑서울",
location: "종로 33",
locationgubun: "업무시설",
firstConstructionPermission : '2024-10-10',
buildingArea: "50",
facilityCapacity: "800,000",
reuse: "Y",
permissionDay:'2024-10-10',
register: "Y",
legalTargetYn:"Y"
},
{
sido: "서울",
sigungo: "종로구",
facilityName: "그랑서울",
location: "종로 33",
locationgubun: "업무시설",
firstConstructionPermission : '2024-10-10',
buildingArea: "50",
facilityCapacity: "800,000",
reuse: "Y",
permissionDay:'2024-10-10',
register: "Y",
legalTargetYn:"Y"
},
{
sido: "서울",
sigungo: "종로구",
facilityName: "그랑서울",
location: "종로 33",
locationgubun: "업무시설",
firstConstructionPermission : '2024-10-10',
buildingArea: "50",
facilityCapacity: "800,000",
reuse: "Y",
permissionDay:'2024-10-10',
register: "Y",
legalTargetYn:"Y"
},
]
export type buildingTableState ={ building:{
isInit: boolean;
upHeadList: TableUpperProps[];
buildingObject: buildingOfType[];
}}
type buildingTableActions = {
decrementList: () => void
}
export type buildingTableType = buildingTableState & buildingTableActions;
export const buildingtableStateExport:buildingTableState= {building:{
isInit:false,
upHeadList: upHeadList,
buildingObject: buildingObject,
}}
export const buildingTableActionsExport:(set:any)=>buildingTableActions=(set: any) => {
return {
decrementList:()=>set(
(state:buildingTableState) => {
return (
{building:{
upHeadList: state.building.upHeadList,
buildingObject:
state.building.buildingObject.slice(0, state.building.buildingObject.length - 1)
}})}
)
}
}
+21
View File
@@ -0,0 +1,21 @@
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "default",
"rsc": true,
"tsx": true,
"tailwind": {
"config": "tailwind.config.ts",
"css": "app/globals.css",
"baseColor": "neutral",
"cssVariables": true,
"prefix": ""
},
"aliases": {
"components": "@/components",
"utils": "@/lib/utils",
"ui": "@/components/ui",
"lib": "@/lib",
"hooks": "@/hooks"
},
"iconLibrary": "lucide"
}
+38
View File
@@ -0,0 +1,38 @@
import { FormControl, FormField, FormItem, FormLabel, FormMessage, SelectBox } from "@common/business_components";
import { Input } from "@common/components";
type typeOfForm ={
labelName: string;
type: string;
selectvlaue?: { text: string; val: string }[];
placeholder:any
formName: string;
}
export function IteraterFrom(formData:typeOfForm[],form:any , colSpanValue:string){
return (
<>
{formData.map((data: typeOfForm, index) => (
<FormField key={`${index}+key`}
control={form.control}
name={data.formName}
render={({ field }) => (
<FormItem className='col-span-4' >
<FormLabel>{data.labelName}</FormLabel>
<FormControl>
{data.selectvlaue == undefined ? (
<Input className ='w-64'placeholder= {data.placeholder} type="" {...field} />
) : (
<SelectBox className='' label =''selectArray={data.selectvlaue}></SelectBox>
)}
</FormControl>
<FormMessage />
</FormItem>
)}
/>
))}
</>
);
};
@@ -0,0 +1,233 @@
"use client";
import {
Form,
FormControl,
FormDescription,
FormField,
FormItem,
FormLabel,
FormMessage,
SelectBox,
} from "@common/business_components/ui";
import { Input } from "@common/components/ui";
import { zodResolver } from "@hookform/resolvers/zod";
import { useForm } from "react-hook-form";
import { z } from "zod";
import { IteraterFrom } from "./IteratreForm";
const formSchema = z.object({
username: z.string().min(2).max(50),
facilityName: z.string().min(2).max(50),
});
type typeOfForm = {
labelName: string;
type: string;
selectvlaue?: { text: string; val: string }[];
formName: string;
};
export function RainReuseFaciltyInsertForm() {
const total = 100;
const form = useForm<z.infer<typeof formSchema>>({
resolver: zodResolver(formSchema),
defaultValues: {
username: "",
},
});
// 2. Define a submit handler.
function onSubmit(values: z.infer<typeof formSchema>) {
// Do something with the form values.
// ✅ This will be type-safe and validated.
console.log(values);
}
const selectYNValue = [
{ text: "Y", val: "1" },
{ text: "N", val: "2" },
];
let homeWaterData = [
{
labelName: "종류",
type: "input",
selectvlaue: undefined,
formName: "homeWaterData 1",
placeholder:'ooo'
},
{
labelName: "면적(m³)",
type: "input",
selectvlaue: undefined,
formName: "homeWaterData 2",
placeholder:'1,000,000'
},
];
let filtrTrtmfct = [
{
labelName: "유무",
type: "input",
selectvlaue: undefined,
formName: "filtrTrtmfct 1",
placeholder:'Y'
},
{
labelName: "용량",
type: "input",
selectvlaue: undefined,
formName: "filtrTrtmfct 2",
placeholder:100000
},
{
labelName: "처리공정",
type: "input",
selectvlaue: undefined,
formName: "filtrTrtmfct 3",
placeholder:'원수취수'
},
];
let instlCst = [
{
labelName: "지원여부",
type: "input",
selectvlaue: undefined,
formName: "instlCst 1",
placeholder:'Y'
},
{
labelName: "지원여부(원)",
type: "input",
selectvlaue: undefined,
formName: "instlCst 2",
placeholder:1000000
},
];
let greenBuilding = [
{
labelName: "설치완료일",
type: "chek",
selectvlaue: selectYNValue ,
formName: "greenBuilding 1",
placeholder:'Y'
},
{
labelName: "인증년도",
type: "input",
selectvlaue: undefined,
formName: " greenBuilding 2",
placeholder:'2024'
},
{
labelName: "인증번호",
type: "input",
selectvlaue: undefined,
formName: "greenBuilding 3",
placeholder:'wr123456789'
},
{
labelName: "인증등급",
type: "input",
selectvlaue: undefined,
formName: "greenBuilding 4",
placeholder:'A'
},
];
let baseInfo = [
{
labelName: "설치완료일",
type: "input",
selectvlaue: undefined ,
formName: "baseInfo 1",
placeholder:'2022-1010'
},
{
labelName: "설치비(월)",
type: "input",
selectvlaue: undefined,
formName: " baseInfo 2",
placeholder:'10000000'
},
];
return (
<div className="">
<Form {...form}>
<form onSubmit={form.handleSubmit(onSubmit)}>
{/* <div className="flex justify-between items-center mx-3"> */}
<div>
<div>
<h1 className="pl-3 text-xl ">○ 재이용시설 운영정보</h1>
</div>
</div>
<div className="grid grid-cols-4 gap-2 mt-4">
<div className="col-span-1">
<FormField
control={form.control}
name="name_5616382464"
render={({ field }) => (
<FormItem>
<FormLabel>설치완료일</FormLabel>
<FormControl>
<Input className="w-2/3" placeholder="2022.06.23" type="" {...field} />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
</div>
<div className="col-span-1" >
<FormField
control={form.control}
name="name_9765724553"
render={({ field }) => (
<FormItem>
<FormLabel>설치비(월)</FormLabel>
<FormControl>
<Input className="w-2/3" placeholder="1,000,000" type="" {...field} />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
</div>
</div>
<div className=" my-4">
<h1 className="bg-gray-400 text-xl text-center border-2 p-2 mt-4">
빗물이용시설 정보
</h1>
</div>
<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>
<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=" my-2">
<h1 className="bg-gray-400 text-xl text-center border-2 p-2 mt-4 ">
인센티브 정보
</h1>
</div>
<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>
<h2 className="pl-3 text-l">✓ 2. 녹색건축물 인증</h2>
</div>
<div className="grid grid-cols-16 gap-2 mt-4">{IteraterFrom(greenBuilding,form,'2')}</div>
</form>
</Form>
</div>
);
}
@@ -0,0 +1,219 @@
"use client";
import {
Form,
FormControl,
FormDescription,
FormField,
FormItem,
FormLabel,
FormMessage,
SelectBox,
} from "@common/business_components/ui";
import { Input } from "@common/components/ui";
import { zodResolver } from "@hookform/resolvers/zod";
import { useForm } from "react-hook-form";
import { z } from "zod";
import { IteraterFrom } from "./IteratreForm";
const formSchema = z.object({
username: z.string().min(2).max(50),
facilityName: z.string().min(2).max(50),
});
type typeOfForm = {
labelName: string;
type: string;
selectvlaue?: { text: string; val: string }[];
formName: string;
};
export function RswtrReuseFaciltyInsertForm() {
const total = 100;
const form = useForm<z.infer<typeof formSchema>>({
resolver: zodResolver(formSchema),
defaultValues: {
username: "",
},
});
// 2. Define a submit handler.
function onSubmit(values: z.infer<typeof formSchema>) {
// Do something with the form values.
// ✅ This will be type-safe and validated.
console.log(values);
}
const selectYNValue = [
{ text: "Y", val: "1" },
{ text: "N", val: "2" },
];
let homeWaterData = [
{
labelName: "종류",
type: "check",
selectvlaue: undefined,
formName: "homeWaterData 1",
placeholder:'ooo'
},
{
labelName: "주요처리공정",
type: "input",
selectvlaue: undefined,
formName: "homeWaterData 2",
placeholder:'1,000,000'
},
{
labelName: "이용용도",
type: "check",
selectvlaue: undefined,
formName: "homeWaterData 2",
placeholder:'1,000,000'
}
];
let filtrTrtmfct = [
{
labelName: "설치비지원 여",
type: "input",
selectvlaue: undefined,
formName: "filtrTrtmfct 1",
placeholder:'Y'
},
{
labelName: "용량",
type: "input",
selectvlaue: undefined,
formName: "filtrTrtmfct 2",
placeholder:100000
},
{
labelName: "처리공정",
type: "input",
selectvlaue: undefined,
formName: "filtrTrtmfct 3",
placeholder:'원수취수'
},
];
let instlCst = [
{
labelName: "지원여부",
type: "input",
selectvlaue: undefined,
formName: "instlCst 1",
placeholder:'Y'
},
{
labelName: "지원여부(원)",
type: "input",
selectvlaue: undefined,
formName: "instlCst 2",
placeholder:1000000
},
];
let greenBuilding = [
{
labelName: "설치완료일",
type: "chek",
selectvlaue: selectYNValue ,
formName: "greenBuilding 1",
placeholder:'Y'
},
{
labelName: "인증년도",
type: "input",
selectvlaue: undefined,
formName: " greenBuilding 2",
placeholder:'2024'
},
{
labelName: "인증번호",
type: "input",
selectvlaue: undefined,
formName: "greenBuilding 3",
placeholder:'wr123456789'
},
{
labelName: "인증등급",
type: "input",
selectvlaue: undefined,
formName: "greenBuilding 4",
placeholder:'A'
},
];
let baseInfo = [
{
labelName: "설치완료일",
type: "input",
selectvlaue: undefined ,
formName: "baseInfo 1",
placeholder:'2022-1010'
},
{
labelName: "설치비(월)",
type: "input",
selectvlaue: undefined,
formName: " baseInfo 2",
placeholder:'10000000'
},
{
labelName: "물사용량(m³)",
type: "input",
selectvlaue: undefined,
formName: " baseInfo 2",
placeholder:'10000000'
},
{
labelName: "의무대상 물사용량(m³)",
type: "input",
selectvlaue: undefined,
formName: " baseInfo 2",
placeholder:'10000000'
}
];
return (
<Form {...form}>
<form onSubmit={form.handleSubmit(onSubmit)}>
{/* <div className="flex justify-between items-center mx-3"> */}
<div>
<div>
<h1 className="pl-3 text-xl">○ 중수도 시설현황 등록</h1>
</div>
</div>
<div>
{IteraterFrom(baseInfo,form,'1' )}
</div>
<div className=" my-4">
<h1 className="bg-gray-400 text-xl text-center border-2 p-2 mt-4">
중수도 시설 정보{" "}
</h1>
<div className="grid grid-cols-2 gap-4 mt-4">{IteraterFrom(homeWaterData,form,'3' )}</div>
</div>
<div className=" my-2">
<h1 className="bg-gray-400 text-xl text-center border-2 p-2 mt-4 ">
인센티브 정보
</h1>
</div>
<div>
<h2 className="pl-3 text-l">✓ 1. 설치비 지원</h2>
</div>
<div className="grid grid-cols-2 gap-4 mt-4">{IteraterFrom(filtrTrtmfct,form,'1' )}</div>
<div>
<h2 className="pl-3 text-l">✓ 2. 녹색건축물 인증</h2>
</div>
<div className="grid grid-cols-12 gap-4 mt-4">{IteraterFrom(greenBuilding,form,'1' )}</div>
</form>
</Form>
);
}