Merge commit 'a6993773a70005f9a09a68d2c429056bb3391794' into iipbs/wr/dev
iipbs_wr / build (push) Waiting to run

This commit is contained in:
leedj312
2025-03-27 15:28:25 +09:00
11 changed files with 196 additions and 72 deletions
+1
View File
@@ -1,3 +1,4 @@
'use client'
import Link from "next/link";
import { Button } from "@common/components/ui";
@@ -93,7 +93,7 @@ export default function Home() {
</div>
<div className="colsapn-1 pr-11 max-h-full ovreflow-y-scroll">
<ScrollArea>
<RainRegForm data={rinBdstForm || []} ></RainRegForm>
<RainRegForm data={rinBdstForm || []} isModal={false} ></RainRegForm>
</ScrollArea>
</div>
@@ -1,7 +1,7 @@
import { z } from "zod";
const rainZod = {
export const rainZod = {
instlCmptnDt: z.date(),
instlCst: z.number(),
pntfColKnd: z.string(),
@@ -20,7 +20,7 @@ const rainZod = {
}
const rainDefZod= {
export const rainDefZod= {
instlCmptnDt: new Date(),
instlCst: 0,
pntfColKnd: "",
@@ -37,7 +37,7 @@ const rainDefZod= {
grntchBdstCertNo: "",
grntchBdstCertGrd: "",
}
const bdstZod ={
export const bdstZod ={
ctpvCd: z.string(), // 시도
sggCd: z.string(), // 시군구
daddr: z.string(), // 위치
@@ -51,7 +51,7 @@ const bdstZod ={
bdstNm: z.string(),
}
const bdstDefZod={
export const bdstDefZod={
ctpvCd: '', // 시도
sggCd: '', // 시군구
daddr: '', // 위치
@@ -65,9 +65,3 @@ const bdstDefZod={
bdstNm: '',
}
export const rainForm = z.object({
...rainZod,
...bdstZod
});
export const rainDefault= {...rainDefZod,bdstDefZod};
@@ -1,32 +1,166 @@
import { FormField, FormUi } from "@common/business_components";
import { useWrStore } from "@/app/store";
import { selectClass } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
import { FormField, FormUi, SelectBox } from "@common/business_components";
import { Input } from "@common/components";
export default function BdstReg(form: any) {
const { code } = useWrStore((state) => {
return state;
});
export default function BdstReg(form:any){
return(
<>
<div className="grid grid-cols-4 gap-2 mt-4 pl-6">
<div className="col-span-2">
<FormField
control={form.control}
name="instlCmptnDt"
render={({ field }) => (
<FormUi label="설치완료일">
<Input
return (
<>
<div className="grid grid-cols-6 gap-2 mt-4 pl-6">
<div className="col-span-3">
<FormField
control={form.control}
name="ctpvCd"
render={({ field }) => (
<FormUi label="시도">
<SelectBox
className={""}
selectClass={selectClass}
label={""}
selectArray={code.cityCd}
onSelectValue={(val) => {
field.onChange(val);
}}
value={field.value}
/>
</FormUi>
)}
/>
</div>
<div className="col-span-3">
<FormField
control={form.control}
name="sggCd"
render={({ field }) => (
<FormUi label="시군구">
<SelectBox
className={""}
selectClass={selectClass}
label={""}
selectArray={code.cityCd}
onSelectValue={(val) => {
field.onChange(val);
}}
value={field.value}
/>
</FormUi>
)}
/>
</div>
<div className="col-span-2">
<FormField
control={form.control}
name="bdstNm"
render={({ field }) => (
<FormUi label="건축물명">
<Input
className=""
type="date"
onChange={(e) => field.onChange(e.target.value ? new Date(e.target.value) : undefined)}
value={field.value ? field?.value.toString().split('T')[0] : ""}
placeholder="1,000,000"
type="text"
{...field}
/>
</FormUi>
)}
/>
</div>
</div>
</>
)
}
</FormUi>
)}
/>
</div>
<div className="col-span-2">
<FormField
control={form.control}
name="daddr"
render={({ field }) => (
<FormUi label="위치">
<Input
className=""
placeholder="1,000,000"
type="search"
{...field}
/>
</FormUi>
)}
/>
<div className="col-span-2">
<FormField
control={form.control}
name="bdstUsgCd"
render={({ field }) => (
<FormUi label="건축물용도">
<SelectBox
className={""}
selectClass={selectClass}
label={""}
selectArray={code.cityCd}
onSelectValue={(val) => {
field.onChange(val);
}}
value={field.value}
/>
</FormUi>
)}
/>
</div>
<div className="col-span-2">
<FormField
control={form.control}
name="frstArchPrmsnDt"
render={({ field }) => (
<FormUi label="최초건축허가일">
<Input
className=""
placeholder="1,000,000"
type="date"
{...field}
/>
</FormUi>
)}
/>
</div>
<div className="col-span-2">
<FormField
control={form.control}
name="archArea"
render={({ field }) => (
<FormUi label="건축면적(m³)">
<Input
className=""
placeholder="1,000,000"
type="number"
{...field}
/>
</FormUi>
)}
/>
</div>
<div className="col-span-2">
<FormField
control={form.control}
name=""
render={({ field }) => (
<FormUi label="법정의무대상여부">
<SelectBox
className={""}
selectClass={selectClass}
label={""}
selectArray={code.cityCd}
onSelectValue={(val) => {
field.onChange(val);
}}
value={field.value}
/>
</FormUi>
)}
/>
</div>
</div>
</div>
</>
);
}
@@ -9,21 +9,26 @@ import { FormUi } from "@common/business_components";
import { useWrStore } from "@/app/store";
import { selectClass, type rainRuseBd, } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
import { useEffect } from "react";
import { rainDefault, rainForm } from "@/components/lib/type/zod/fcltReg/controlZod";
import { bdstDefZod, bdstZod, rainDefZod, rainZod } from "@/components/lib/type/zod/fcltReg/controlZod";
import BdstReg from "../bdstReg/component";
const formSchema = rainForm;
export function RainRegForm({data,isModal}:{data:rainRuseBd[], isModal:boolean} ) {
console.log(isModal)
const formSchema = isModal
? z.object({ ...rainZod, ...bdstZod })
: z.object(rainZod)
console.log(formSchema)
export function RainRegForm({data}:{data:rainRuseBd[]} ) {
const { rain ,code} = useWrStore((state) => state);
const {rainFcltCd } = code
useEffect(() => {
if (data && data.length > 0) {
console.log(data)
const selectedOption = rainFcltCd.find(item => item.val === String(data[0].pntfColKnd));
const selectedOption = rainFcltCd.find(item => item.val === String(data[0]?.pntfColKnd ?? ""));
const formData = {
...data[0],
pntfColKnd: selectedOption ? selectedOption.val : ""
pntfColKnd: selectedOption ? selectedOption.val : "",
instlCmptnDt: data[0]?.instlCmptnDt ? new Date(data[0].instlCmptnDt) : undefined
};
form.reset(formData);
}
@@ -31,24 +36,8 @@ export function RainRegForm({data}:{data:rainRuseBd[]} ) {
const form = useForm<z.infer<typeof formSchema>>({
resolver: zodResolver(formSchema),
defaultValues: rainDefault
// {
// instlCmptnDt: new Date(),
// instlCst: 0,
// pntfColKnd: "",
// pntfColArea: 0,
// filtrTrtmfctYn: "N",
// filtrTrtmfctCpct: "",
// filtrTrtmfctPrs: "",
// instlCstSprtYn: "",
// instlCstSprtAmt: "",
// grntchCstSprtYn: "",
// grntchCstSprtCst: "",
// grntchBdstCertYn: "",
// grntchBdstCertYr: "",
// grntchBdstCertNo: "",
// grntchBdstCertGrd: "",
// },
defaultValues: isModal ? {...rainDefZod, ...bdstDefZod} : {...rainDefZod}
});
// form 값이 변경될 때마다 로그 출력
@@ -117,7 +106,9 @@ export function RainRegForm({data}:{data:rainRuseBd[]} ) {
)}
/>
</div>
</div>
</div>
{isModal?<BdstReg></BdstReg> :<></>}
<div className=" my-4">
<h1 className="bg-gray-400 text-xl text-center border-2 p-2 mt-4 pl-6">
빗물이용시설 정보
@@ -62,7 +62,7 @@ export function BdstReg(){
</div>
<div>
<ScrollArea>
<RainRegForm data={rainBdstForm || []} ></RainRegForm>
<RainRegForm data={rainBdstForm || []} isModal={true} ></RainRegForm>
</ScrollArea>
</div>
</>
@@ -2,7 +2,7 @@
export default function MainDiv(props: {children: React.ReactNode}) {
return (
<div className="min-h-screen bg-gray-50 p-8">
<div className="min-h-screen bg-container">
{props.children}
</div>
)
@@ -5,7 +5,7 @@ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from ".
/** 차트 기본 스타일 */
interface SelectBox1 {
text:string,
val:string
val:string|number
}
const SelectBox = React.forwardRef<
@@ -22,10 +22,11 @@ export function UiTable({ tableData, headlist, pageSize, total, children, headNa
return (
<>
{headName ? <div className="card-header">
{headName}
<h3 className="text-2xl font-medium text-label">{headName}</h3>
</div> : <></>}
<Table>
<TableHeader>
<div className="card !m-[1.2rem] max-h-[40rem] overflow-auto !p-0r">
<Table>
<TableHeader>
{children ? <>{children}</> : <TableRow>
{headlist?.map((head) => (
<TableHead key={head.id}>{head.title}</TableHead>
@@ -41,8 +42,9 @@ export function UiTable({ tableData, headlist, pageSize, total, children, headNa
</TableRow>
))}
</TableBody>
</Table>
{total <= 0 ? <></> : <UiPageNations total={total} cur={cur} pageSize={pageSize} />}
</Table>
{total <= 0 ? <></> : <UiPageNations total={total} cur={cur} pageSize={pageSize} />}
</div>
</>
);
}
@@ -2,7 +2,9 @@
function Title(props: {title: string}) {
return (
<h1 className="text-2xl font-bold mb-6">{props.title}</h1>
<h2 className="px-[1.8rem] pt-[2rem] text-[2.4rem] font-semibold text-title">
{props.title}
</h2>
)
}