건축물 등록 페이지 개발중
This commit is contained in:
@@ -4,6 +4,7 @@ import { useWrStore } from "@/app/store";
|
||||
import {
|
||||
selectClass,
|
||||
type bdstType,
|
||||
type selectArray,
|
||||
} from "@/app/store/ruseFcltMng/fcltReg/rainReg";
|
||||
import { ScrollArea, SearchInput, SelectBox, UiTable } from "@common/business_components";
|
||||
import { Button, Input } from "@common/components";
|
||||
@@ -11,41 +12,69 @@ import { useEffect, useState } from "react";
|
||||
import { RainRegForm } from "../../form/fcltReg/rainReg/component";
|
||||
|
||||
export function BdstReg() {
|
||||
const { rain, code, init } = useWrStore((state) => {
|
||||
const { rain, code, bdst, findBdst } = useWrStore((state) => {
|
||||
return state;
|
||||
});
|
||||
|
||||
const [bdstTable, setbdstTable] = useState<bdstType[]>();
|
||||
const [rainBdstForm, setRainBdstForm] = useState<[]>();
|
||||
const [rainBdstForm, setRainBdstForm] = useState<bdstType[] | undefined>();
|
||||
const { bdstObj, rainRuseObj } = rain;
|
||||
const getCity = (val: string | number) => {
|
||||
console.log(val);
|
||||
const [selectSgg, setSelectSgg] = useState<selectArray[] | undefined>()
|
||||
const [searchTxt, setSearchTxt] = useState<string>()
|
||||
|
||||
const getCity = (val: string ) => {
|
||||
|
||||
|
||||
const data = code.sggCd
|
||||
.filter((item) => String(item.val).substring(0, 2) === val)
|
||||
.map((item) => ({ ...item, val: String(item.val) })); // Ensure 'val' is a string
|
||||
setSelectSgg(data);
|
||||
};
|
||||
|
||||
const getSgg = (val: string | number) => {
|
||||
console.log(val);
|
||||
};
|
||||
|
||||
|
||||
|
||||
useEffect(()=>{
|
||||
|
||||
// console.log("searchTxt ", searchTxt)
|
||||
findBdst(searchTxt)
|
||||
},[searchTxt])
|
||||
|
||||
useEffect(() => {
|
||||
if (code.sggCd.length > 0) {
|
||||
const table = bdstObj.map((item) => {
|
||||
const table = bdst?.bdstBase?.map((item) => {
|
||||
const sggText = code.sggCd.find(
|
||||
(cd) => cd.val.toString() === item.sggCd
|
||||
(cd) => cd.val === Number(item.sggCd)
|
||||
)?.text;
|
||||
const cityText = code.cityCd.find(
|
||||
(cd) => cd.val.toString() === item.ctpvCd
|
||||
(cd) => cd.val === Number(item.ctpvCd)
|
||||
)?.text;
|
||||
return { ...item, sggText: sggText, cityText: cityText };
|
||||
});
|
||||
|
||||
|
||||
setbdstTable(table);
|
||||
}
|
||||
}, [code, bdstObj]);
|
||||
}, [code, bdst]);
|
||||
|
||||
const cellClick = () => {};
|
||||
const nodeList = headMakeColSpan(rain.upHeadList);
|
||||
const tableClick: (val: number | undefined) => void = (val) => {
|
||||
|
||||
console.log("val , " ,val)
|
||||
console.log("bdst , " ,bdst?.bdstBase[val])
|
||||
if(val!==undefined && bdst?.bdstBase.length>0){
|
||||
const data =bdst?.bdstBase[val]
|
||||
console.log("data ", [data])
|
||||
setRainBdstForm([data]);
|
||||
}
|
||||
}
|
||||
|
||||
const nodeList = headMakeColSpan(bdst.moUpHeadList);
|
||||
return (
|
||||
<>
|
||||
<div className="grid grid-cols-12 gap-4 pb-4">
|
||||
<div className="grid grid-cols-12 gap-4">
|
||||
<SelectBox
|
||||
className="col-span-3 col-start-4"
|
||||
label={"시도"}
|
||||
@@ -59,7 +88,7 @@ export function BdstReg() {
|
||||
className="col-span-3"
|
||||
label={"시군구"}
|
||||
selectClass={selectClass}
|
||||
selectArray={code.sggCd}
|
||||
selectArray={selectSgg || []}
|
||||
onSelectValue={getSgg}
|
||||
>
|
||||
{" "}
|
||||
@@ -67,33 +96,31 @@ export function BdstReg() {
|
||||
<SearchInput
|
||||
className="col-span-3 col-start-10"
|
||||
label="건물명"
|
||||
textValue={""}
|
||||
setText={function (val: string): void {
|
||||
throw new Error("Function not implemented.");
|
||||
}}
|
||||
textValue={searchTxt}
|
||||
setText={ setSearchTxt}
|
||||
|
||||
/>
|
||||
</div>
|
||||
<div className="border-t border-gray-300 my-4"></div>
|
||||
<div className="h-auto">
|
||||
<div>
|
||||
<UiTable
|
||||
tableData={bdstTable || []}
|
||||
headlist={rain.upHeadList}
|
||||
headlist={bdst.moUpHeadList}
|
||||
pageSize={-10}
|
||||
total={-1}
|
||||
headName={undefined}
|
||||
cellClick={cellClick}
|
||||
cellClick={tableClick}
|
||||
>
|
||||
{nodeList}
|
||||
</UiTable>
|
||||
</div>
|
||||
<div >
|
||||
|
||||
<div className="border-t border-gray-300 my-4"></div>
|
||||
<ScrollArea className="h-[60vh]">
|
||||
<div>
|
||||
<RainRegForm data={rainBdstForm || []} isModal={true}></RainRegForm>
|
||||
</div>
|
||||
</ScrollArea>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user