101 lines
2.8 KiB
TypeScript
101 lines
2.8 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, 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() {
|
|
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 (
|
|
<>
|
|
<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 >
|
|
|
|
<ScrollArea className="h-[60vh]">
|
|
<div>
|
|
<RainRegForm data={rainBdstForm || []} isModal={true}></RainRegForm>
|
|
</div>
|
|
</ScrollArea>
|
|
</div>
|
|
</div>
|
|
</>
|
|
);
|
|
}
|