검색까지 추가 경기도 만
This commit is contained in:
@@ -54,6 +54,8 @@ export default function Home() {
|
||||
const { rainRes } = rain;
|
||||
const [rainForm, setRainForm] = useState<RainyBuilding>();
|
||||
const [bdstTable, setbdstTable] = useState<RainyBuilding[]>();
|
||||
const [searchTxt , setSearchTxt] = useState<string>()
|
||||
|
||||
const nodeList = headMakeColSpan(rain.upHeadList);
|
||||
useEffect(() => {
|
||||
if (!rain.isInit) {
|
||||
@@ -65,10 +67,10 @@ export default function Home() {
|
||||
if (code.sggCd.length > 0) {
|
||||
const table = rainRes.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 };
|
||||
});
|
||||
@@ -95,14 +97,12 @@ export default function Home() {
|
||||
<SearchInput
|
||||
className="col-span-3 my-7"
|
||||
label="건물명"
|
||||
textValue={""}
|
||||
setText={function (): void {
|
||||
throw new Error("Function not implemented.");
|
||||
}}
|
||||
textValue={searchTxt || ""}
|
||||
setText={(e)=>{setSearchTxt(e)}}
|
||||
/>
|
||||
</SearchFormLeft>
|
||||
<SearchFormRight>
|
||||
<Button className="mr-4 rounded-lg">조회</Button>
|
||||
<Button className="mr-4 rounded-lg" onClick={(e)=>{init(searchTxt||"")} }>조회</Button>
|
||||
<UiModal
|
||||
butNm="신규등록"
|
||||
title="건축물 시설 등록(빗물이용시설)"
|
||||
|
||||
@@ -25,10 +25,10 @@ export const rainZod =
|
||||
instlCst: z.number(),
|
||||
instlCstSprtYn: z.string(),
|
||||
instlCstSprtAmt: z.number(),
|
||||
grntchBdstCertYn: z.string(),
|
||||
grntchBdstCertNo: z.string(),
|
||||
grntchBdstCertGrd: z.string(),
|
||||
grntchBdstCertYr: z.string(),
|
||||
grntchBdstCertYn: z.string().nullish(),
|
||||
grntchBdstCertNo: z.string().nullish(),
|
||||
grntchBdstCertGrd: z.string().nullish(),
|
||||
grntchBdstCertYr: z.string().nullish(),
|
||||
bdstReuseFcltFk:z.number().nullish(),
|
||||
pntfColKnd: z.string(),
|
||||
pntfColArea: z.number(),
|
||||
@@ -223,8 +223,8 @@ export type rainFacState = {
|
||||
};
|
||||
};
|
||||
type rainFacSActions = {
|
||||
init: () => void;
|
||||
dataInit: () => void;
|
||||
init: (txt:string|undefined) => void;
|
||||
rainSearTxt: (txt:string) => void;
|
||||
rainReg: (data: RainyBuilding) => void;
|
||||
rainUpdate: (data: RainyBuilding) => void;
|
||||
};
|
||||
@@ -247,17 +247,17 @@ const findBdstInfo = async(sggCd:string, searchTxt:string)=>{
|
||||
}
|
||||
|
||||
|
||||
const initFetch = async () => {
|
||||
return await getFectch("wr", "/reuseFc/rainyInfoList/1/20/41");
|
||||
const initFetch = async (txt:string|undefined) => {
|
||||
return await getFectch("wr", `/reuseFc/rainyInfoList/1/20/41` +(txt? `/${txt}`:''));
|
||||
};
|
||||
export const rainFacActionsExport: (set: any) => rainFacSActions = (
|
||||
set: any
|
||||
) => {
|
||||
return {
|
||||
init: async () => {
|
||||
init: async (txt:string|undefined) => {
|
||||
try {
|
||||
// 파라이터 수정 통합관리자 =0, 시관리자=시코드, 시군구 관리자= 시군구 코드 를 세번째 파라미터로 지정 / 건축물 서치가 있을경우 4번째 파라미터로 던지기 즉 1/20/42(서울시)/영현빌딩 이런식으로)
|
||||
const rainRes = await initFetch();
|
||||
const rainRes = await initFetch(txt);
|
||||
// 여기서 상태 업데이트
|
||||
return set((state: rainFacState) => ({
|
||||
...state,
|
||||
@@ -273,20 +273,30 @@ export const rainFacActionsExport: (set: any) => rainFacSActions = (
|
||||
console.log("finally");
|
||||
}
|
||||
},
|
||||
dataInit: () =>
|
||||
set((state: rainFacState) => {
|
||||
console.log(" state ", state.rain);
|
||||
return {
|
||||
rain: {
|
||||
...state.rain,
|
||||
isInit: false,
|
||||
},
|
||||
};
|
||||
}),
|
||||
rainSearTxt: async(txt:string) =>{
|
||||
try{
|
||||
|
||||
const rainRes = await getFectch('wr' , `/reuseFc/rainyInfoList/1/20/41` +(txt? `/${txt}`:''))
|
||||
set((state: rainFacState) => {
|
||||
return {
|
||||
rain: {
|
||||
...state.rain,
|
||||
rainRes: rainRes,
|
||||
isInit: false,
|
||||
},
|
||||
};
|
||||
})}
|
||||
catch(erTxt){
|
||||
console.log("error", erTxt)
|
||||
}
|
||||
},
|
||||
rainReg: async (data: RainyBuilding) => {
|
||||
try {
|
||||
const res = await postFectch("/reuseFc/rainyInfo", data);
|
||||
const rainRes = await initFetch();
|
||||
if(res.ok){
|
||||
alert(" 등록이 완료되었습니다.")
|
||||
}
|
||||
const rainRes = await initFetch(undefined);
|
||||
set((state: rainFacState) => ({
|
||||
...state,
|
||||
rain: {
|
||||
@@ -311,7 +321,7 @@ export const rainFacActionsExport: (set: any) => rainFacSActions = (
|
||||
alert(" 수정이 완료되었습니다.")
|
||||
}
|
||||
|
||||
const rainRes = await initFetch();
|
||||
const rainRes = await initFetch(undefined);
|
||||
set((state: rainFacState) => ({
|
||||
...state,
|
||||
rain: {
|
||||
|
||||
@@ -19,7 +19,7 @@ export type objSearchType = {
|
||||
|
||||
|
||||
export function BdstReg() {
|
||||
const { rain, code, bdst,findBdst } = useWrStore((state) => {
|
||||
const { rain, code, bdst,init } = useWrStore((state) => {
|
||||
return state;
|
||||
});
|
||||
|
||||
@@ -112,10 +112,11 @@ export function BdstReg() {
|
||||
setText={ setSearchTxt}
|
||||
|
||||
/> */}
|
||||
<Button className="rounded-lg" onClick={()=>{searchBdst()}}>조회</Button>
|
||||
<Button className="rounded-lg" onClick={()=>{init(searchTxt)}}>조회</Button>
|
||||
</div>
|
||||
<div className="border-t border-gray-300 my-4"></div>
|
||||
<div className="h-auto">
|
||||
<ScrollArea className="h-[20vh]">
|
||||
<div>
|
||||
<UiTable
|
||||
tableData={bdstTable || []}
|
||||
@@ -128,6 +129,7 @@ export function BdstReg() {
|
||||
{nodeList}
|
||||
</UiTable>
|
||||
</div>
|
||||
</ScrollArea>
|
||||
<div className="border-t border-gray-300 my-4"></div>
|
||||
<ScrollArea className="h-[60vh]">
|
||||
<div>
|
||||
|
||||
Reference in New Issue
Block a user