70 lines
2.4 KiB
TypeScript
70 lines
2.4 KiB
TypeScript
'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(){
|
|
|
|
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 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 || []} isModal={true} ></RainRegForm>
|
|
</ScrollArea>
|
|
</div>
|
|
</>
|
|
)
|
|
} |