작업중
This commit is contained in:
@@ -1,10 +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, UiModal, UiTable } from "@common/business_components";
|
||||
import type { bdstType, rainRuseBd, TableUpperProps } from "@/app/store/ruseFcltMng/fcltReg/rainReg"
|
||||
import { RainRegForm } from "@/components/ui/form/fcltReg/rainReg/component";
|
||||
import { BdstReg } from "@/components/ui/modal/bdstReg/component";
|
||||
import { ScrollArea, SearchDiv, SearchInput, Title, UiModal, UiTable } from "@common/business_components";
|
||||
import { Button, TableHead, TableRow } from "@common/components";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
@@ -26,7 +25,7 @@ export default function Home() {
|
||||
return state
|
||||
});
|
||||
const {bdstObj, rainRuseObj } =rain
|
||||
const [rinBdstForm, setRinBdstForm] = useState <rainRuseType[]> ();
|
||||
const [rinBdstForm, setRinBdstForm] = useState <rainRuseBd[]> ();
|
||||
const [bdstTable, setbdstTable] = useState <bdstType[]> ();
|
||||
const nodeList = headMakeColSpan(rain.upHeadList);
|
||||
const headName = () => {
|
||||
@@ -70,7 +69,7 @@ export default function Home() {
|
||||
<>
|
||||
<div className="grid grid-cols-2 gap-4 ">
|
||||
<div className='col-span-2'>
|
||||
<h1 className="pl-3 text-2xl" >빗물이용시설 등록 </h1>
|
||||
<Title title={"빗물이용시설 등록"}/>
|
||||
<div className="m-8">
|
||||
<SearchDiv >
|
||||
<div className='w-4/5 grid grid-cols-12 gap-1 mx-4'>
|
||||
|
||||
@@ -50,7 +50,7 @@ export type TableUpperProps = {
|
||||
};
|
||||
|
||||
|
||||
type rainRuseBd={
|
||||
export type rainRuseBd={
|
||||
bdstRuseFcltPk: number, // 건축물 재이용시설 기본키
|
||||
bdstInfoFk: number, // 건축물 정보 외부키
|
||||
operMngCd:number|null, // 운영관리 코드 tb_wr_bdst_ruse_fclt 삭제 요망
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
import { z } from "zod";
|
||||
|
||||
|
||||
const rainZod = {
|
||||
instlCmptnDt: z.date(),
|
||||
instlCst: z.number(),
|
||||
pntfColKnd: z.string(),
|
||||
pntfColArea: z.number(),
|
||||
filtrTrtmfctPrs: z.string(),
|
||||
filtrTrtmfctYn: z.string(),
|
||||
filtrTrtmfctCpct: z.string(),
|
||||
instlCstSprtYn: z.string(),
|
||||
instlCstSprtAmt: z.string(),
|
||||
grntchCstSprtYn: z.string(),
|
||||
grntchCstSprtCst: z.string(),
|
||||
grntchBdstCertYn: z.string(),
|
||||
grntchBdstCertYr: z.string(),
|
||||
grntchBdstCertNo: z.string(),
|
||||
grntchBdstCertGrd: z.string(),
|
||||
}
|
||||
|
||||
|
||||
const rainDefZod= {
|
||||
instlCmptnDt: new Date(),
|
||||
instlCst: 0,
|
||||
pntfColKnd: "",
|
||||
pntfColArea: 0,
|
||||
filtrTrtmfctYn: "N",
|
||||
filtrTrtmfctCpct: "",
|
||||
filtrTrtmfctPrs: "",
|
||||
instlCstSprtYn: "",
|
||||
instlCstSprtAmt: "",
|
||||
grntchCstSprtYn: "",
|
||||
grntchCstSprtCst: "",
|
||||
grntchBdstCertYn: "",
|
||||
grntchBdstCertYr: "",
|
||||
grntchBdstCertNo: "",
|
||||
grntchBdstCertGrd: "",
|
||||
}
|
||||
const bdstZod ={
|
||||
ctpvCd: z.string(), // 시도
|
||||
sggCd: z.string(), // 시군구
|
||||
daddr: z.string(), // 위치
|
||||
bdstUsgCd: z.string(), // 건축물용도
|
||||
frstArchPrmsnDt: z.string(), // 최초건축허가일
|
||||
archArea: z.string(), // 건축면적
|
||||
lawTrgtYn: z.string(), // 법적의무대상여부
|
||||
archChgPrmsnDt: z.string(), // 건축변경 허가일시
|
||||
archChgArea: z.string(), // 변경 면적
|
||||
//bdstInfoPk: number;
|
||||
bdstNm: z.string(),
|
||||
}
|
||||
|
||||
const bdstDefZod={
|
||||
ctpvCd: '', // 시도
|
||||
sggCd: '', // 시군구
|
||||
daddr: '', // 위치
|
||||
bdstUsgCd: '', // 건축물용도
|
||||
frstArchPrmsnDt: '', // 최초건축허가일
|
||||
archArea: '', // 건축면적
|
||||
lawTrgtYn: '', // 법적의무대상여부
|
||||
archChgPrmsnDt: '', // 건축변경 허가일시
|
||||
archChgArea: '', // 변경 면적
|
||||
//bdstInfoPk: number;
|
||||
bdstNm: '',
|
||||
}
|
||||
|
||||
export const rainForm = z.object({
|
||||
...rainZod,
|
||||
...bdstZod
|
||||
});
|
||||
export const rainDefault= {...rainDefZod,bdstDefZod};
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
'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 <bdstType[]> ();
|
||||
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>건축물조회</h2> < h2/>
|
||||
<div className="grid grid-cols-12 gap-2">
|
||||
|
||||
<SelectBox className='col-span-3' label={''} selectClass={selectClass} selectArray={code.cityCd} onSelectValue={getCity } > </SelectBox>
|
||||
<SelectBox className='col-span-3' label={""} selectClass={selectClass} selectArray={code.sggCd} onSelectValue={getSgg }> </SelectBox>
|
||||
<Input className='col-span-3'></Input>
|
||||
<Button className='col-span-1'> 조회</Button>
|
||||
</div>
|
||||
<div>
|
||||
<UiTable tableData={bdstTable || []} headlist={rain.upHeadList} pageSize={-10} total={-1} headName={undefined} cellClick={cellClick}>
|
||||
{nodeList}
|
||||
</UiTable>
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
import { FormField, FormUi } from "@common/business_components";
|
||||
import { Input } from "@common/components";
|
||||
|
||||
|
||||
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
|
||||
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] : ""}
|
||||
/>
|
||||
</FormUi>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
@@ -7,63 +7,48 @@ import { useForm } from "react-hook-form";
|
||||
import { z } from "zod";
|
||||
import { FormUi } from "@common/business_components";
|
||||
import { useWrStore } from "@/app/store";
|
||||
import { selectClass, type rainRuseType } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import { selectClass, type rainRuseBd, } from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import { useEffect } from "react";
|
||||
import { rainDefault, rainForm } from "@/components/lib/type/zod/fcltReg/controlZod";
|
||||
|
||||
const formSchema = z
|
||||
.object({
|
||||
instlCmptnDt: z.date(),
|
||||
instlCst: z.number(),
|
||||
pntfColKnd: z.string(),
|
||||
pntfColArea: z.number(),
|
||||
filtrTrtmfctPrs: z.string(),
|
||||
filtrTrtmfctYn: z.string(),
|
||||
filtrTrtmfctCpct: z.string(),
|
||||
instlCstSprtYn: z.string(),
|
||||
instlCstSprtAmt: z.string(),
|
||||
grntchCstSprtYn: z.string(),
|
||||
grntchCstSprtCst: z.string(),
|
||||
grntchBdstCertYn: z.string(),
|
||||
grntchBdstCertYr: z.string(),
|
||||
grntchBdstCertNo: z.string(),
|
||||
grntchBdstCertGrd: z.string(),
|
||||
})
|
||||
const formSchema = rainForm;
|
||||
|
||||
export function RainRegForm({data}:{data:rainRuseType[]} ) {
|
||||
console.log(formSchema)
|
||||
export function RainRegForm({data}:{data:rainRuseBd[]} ) {
|
||||
const { rain ,code} = useWrStore((state) => state);
|
||||
const {rainFcltCd } = code
|
||||
useEffect(() => {
|
||||
console.log("form data:", data);
|
||||
if (data && data.length > 0) {
|
||||
console.log(data)
|
||||
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, rainFcltCd]);
|
||||
|
||||
const form = useForm<z.infer<typeof formSchema>>({
|
||||
resolver: zodResolver(formSchema),
|
||||
defaultValues: {
|
||||
instlCmptnDt: new Date(),
|
||||
instlCst: 0,
|
||||
pntfColKnd: "",
|
||||
pntfColArea: 0,
|
||||
filtrTrtmfctYn: "N",
|
||||
filtrTrtmfctCpct: "",
|
||||
filtrTrtmfctPrs: "",
|
||||
instlCstSprtYn: "",
|
||||
instlCstSprtAmt: "",
|
||||
grntchCstSprtYn: "",
|
||||
grntchCstSprtCst: "",
|
||||
grntchBdstCertYn: "",
|
||||
grntchBdstCertYr: "",
|
||||
grntchBdstCertNo: "",
|
||||
grntchBdstCertGrd: "",
|
||||
},
|
||||
defaultValues: rainDefault
|
||||
// {
|
||||
// instlCmptnDt: new Date(),
|
||||
// instlCst: 0,
|
||||
// pntfColKnd: "",
|
||||
// pntfColArea: 0,
|
||||
// filtrTrtmfctYn: "N",
|
||||
// filtrTrtmfctCpct: "",
|
||||
// filtrTrtmfctPrs: "",
|
||||
// instlCstSprtYn: "",
|
||||
// instlCstSprtAmt: "",
|
||||
// grntchCstSprtYn: "",
|
||||
// grntchCstSprtCst: "",
|
||||
// grntchBdstCertYn: "",
|
||||
// grntchBdstCertYr: "",
|
||||
// grntchBdstCertNo: "",
|
||||
// grntchBdstCertGrd: "",
|
||||
// },
|
||||
});
|
||||
|
||||
// form 값이 변경될 때마다 로그 출력
|
||||
|
||||
@@ -1,33 +1,70 @@
|
||||
import { Button, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger } from "@common/components";
|
||||
'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 { ScrollArea, SelectBox, UiTable } from "@common/business_components";
|
||||
import { Button, Input } from "@common/components";
|
||||
import { useEffect, useState } from "react";
|
||||
import { RainRegForm } from "../../form/fcltReg/rainReg/component";
|
||||
|
||||
export function BdstReg(){
|
||||
|
||||
type ModalType={
|
||||
bodyClass:string
|
||||
butNm:string
|
||||
title:string
|
||||
body:React.ReactNode
|
||||
}
|
||||
export function BdstRegModal({bodyClass,butNm,title ,body}:ModalType ) {
|
||||
return (
|
||||
<>
|
||||
<Dialog >
|
||||
<DialogTrigger asChild>
|
||||
<Button className="mr-4 rounded-lg">{butNm}</Button>
|
||||
</DialogTrigger>
|
||||
<DialogContent className="sm:max-w-7xl">
|
||||
<DialogHeader>
|
||||
<DialogTitle>{title}</DialogTitle>
|
||||
<DialogDescription>
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
{body}
|
||||
const { rain, code,init } = useWrStore((state) => {
|
||||
return state
|
||||
});
|
||||
|
||||
|
||||
<DialogFooter className="sm:justify-start">
|
||||
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
</>
|
||||
);
|
||||
}
|
||||
const[bdstTable, setbdstTable] = useState <bdstType[]> ();
|
||||
const [rainBdstForm, setRainBdstForm] = 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>건축물조회</h2> < h2/>
|
||||
<div className="grid grid-cols-12 gap-2">
|
||||
|
||||
<SelectBox className='col-span-3' label={''} selectClass={selectClass} selectArray={code.cityCd} onSelectValue={getCity } > </SelectBox>
|
||||
<SelectBox className='col-span-3' label={""} selectClass={selectClass} selectArray={code.sggCd} onSelectValue={getSgg }> </SelectBox>
|
||||
<Input className='col-span-3'></Input>
|
||||
<Button className='col-span-1'> 조회</Button>
|
||||
</div>
|
||||
<div>
|
||||
<UiTable tableData={bdstTable || []} headlist={rain.upHeadList} pageSize={-10} total={-1} headName={undefined} cellClick={cellClick}>
|
||||
{nodeList}
|
||||
</UiTable>
|
||||
</div>
|
||||
<div>
|
||||
<ScrollArea>
|
||||
<RainRegForm data={rainBdstForm || []} ></RainRegForm>
|
||||
</ScrollArea>
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user