신규등록 ui 완성 이벤트 추가 필요
This commit is contained in:
@@ -1,70 +1,100 @@
|
||||
'use client'
|
||||
"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 {
|
||||
selectClass,
|
||||
type bdstType,
|
||||
} from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import { ScrollArea, SearchInput, 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(){
|
||||
export function BdstReg() {
|
||||
const { rain, code, init } = useWrStore((state) => {
|
||||
return state;
|
||||
});
|
||||
|
||||
const { rain, code,init } = useWrStore((state) => {
|
||||
return state
|
||||
});
|
||||
const [bdstTable, setbdstTable] = useState<bdstType[]>();
|
||||
const [rainBdstForm, setRainBdstForm] = useState<[]>();
|
||||
const { bdstObj, rainRuseObj } = rain;
|
||||
const getCity = (val: string | number) => {
|
||||
console.log(val);
|
||||
};
|
||||
|
||||
const[bdstTable, setbdstTable] = useState <bdstType[]> ();
|
||||
const [rainBdstForm, setRainBdstForm] = useState<[]>()
|
||||
const {bdstObj, rainRuseObj } =rain
|
||||
const getCity =(val:string|number)=>{
|
||||
const getSgg = (val: string | number) => {
|
||||
console.log(val);
|
||||
};
|
||||
|
||||
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 getSgg =(val:string|number)=>{
|
||||
const cellClick = () => {};
|
||||
const nodeList = headMakeColSpan(rain.upHeadList);
|
||||
return (
|
||||
<>
|
||||
<div className="grid grid-cols-12 gap-4 pb-4">
|
||||
<SelectBox
|
||||
className="col-span-3 col-start-4"
|
||||
label={"시도"}
|
||||
selectClass={selectClass}
|
||||
selectArray={code.cityCd}
|
||||
onSelectValue={getCity}
|
||||
>
|
||||
{" "}
|
||||
</SelectBox>
|
||||
<SelectBox
|
||||
className="col-span-3"
|
||||
label={"시군구"}
|
||||
selectClass={selectClass}
|
||||
selectArray={code.sggCd}
|
||||
onSelectValue={getSgg}
|
||||
>
|
||||
{" "}
|
||||
</SelectBox>
|
||||
<SearchInput
|
||||
className="col-span-3 col-start-10"
|
||||
label="건물명"
|
||||
textValue={""}
|
||||
setText={function (val: string): void {
|
||||
throw new Error("Function not implemented.");
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<div className="h-auto">
|
||||
<div>
|
||||
<UiTable
|
||||
tableData={bdstTable || []}
|
||||
headlist={rain.upHeadList}
|
||||
pageSize={-10}
|
||||
total={-1}
|
||||
headName={undefined}
|
||||
cellClick={cellClick}
|
||||
>
|
||||
{nodeList}
|
||||
</UiTable>
|
||||
</div>
|
||||
<div >
|
||||
|
||||
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>
|
||||
<ScrollArea className="h-[60vh]">
|
||||
<div>
|
||||
<RainRegForm data={rainBdstForm || []} isModal={true}></RainRegForm>
|
||||
</div>
|
||||
</ScrollArea>
|
||||
</div>
|
||||
<div>
|
||||
<UiTable tableData={bdstTable || []} headlist={rain.upHeadList} pageSize={-10} total={-1} headName={undefined} cellClick={cellClick}>
|
||||
{nodeList}
|
||||
</UiTable>
|
||||
</div>
|
||||
<div>
|
||||
<ScrollArea>
|
||||
<RainRegForm data={rainBdstForm || []} isModal={true} ></RainRegForm>
|
||||
</ScrollArea>
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user