From 0dd5744229f65aede814bd79505e153474a5cae2 Mon Sep 17 00:00:00 2001 From: leedj312 Date: Tue, 8 Jul 2025 19:31:43 +0900 Subject: [PATCH] =?UTF-8?q?=EA=B2=B0=ED=95=A8=20=EB=8C=80=EC=9E=A5=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wr/app/matMng/coMng/coSttn/page.tsx | 26 +- .../app/ruseFcltMng/fcltReg/htdflReg/page.tsx | 10 +- .../app/ruseFcltMng/fcltReg/rainReg/page.tsx | 39 +-- apps/wr/app/store/common/code/index.ts | 8 + apps/wr/app/store/matDmd/coSttn/excel.tsx | 1 - .../ruseFcltMng/fcltReg/htdflReg/index.tsx | 2 +- .../ruseFcltMng/fcltReg/pbnstReg/headList.tsx | 2 +- .../ruseFcltMng/fcltReg/rainReg/index.tsx | 5 +- .../ruseFcltMng/fcltReg/rainReg/type.tsx | 5 +- .../ruseFcltMng/fcltReg/rswtReg/index.tsx | 6 +- .../ui/form/fcltReg/bdstReg/bdstReg.tsx | 45 +++- .../ui/form/fcltReg/htdflReg/htdflRegForm.tsx | 2 +- .../ui/form/fcltReg/rainReg/rainRegForm.tsx | 2 +- .../ui/form/fcltReg/rswtrReg/rswtrRegForm.tsx | 4 +- .../fcltReg/bdstRegModal/bdstRegModal.tsx | 232 ++++++++++++------ 15 files changed, 255 insertions(+), 134 deletions(-) diff --git a/apps/wr/app/matMng/coMng/coSttn/page.tsx b/apps/wr/app/matMng/coMng/coSttn/page.tsx index 163ed1b40..d9fb09031 100644 --- a/apps/wr/app/matMng/coMng/coSttn/page.tsx +++ b/apps/wr/app/matMng/coMng/coSttn/page.tsx @@ -109,18 +109,18 @@ export default function CoSttn() { } }, [coSttnRes, code]); - useEffect(() => { - if (coSttn.excelList.length > 0) { - if (coSttn.excelList.length === 0) return; - excelDownload( - coSttn.excelList, - "수요처 관리", - "sample_coSttn.xlsx", - "A1:G1", - 2 - ); - } - }, [coSttn.excelList]); + // useEffect(() => { + // if (coSttn.excelList.length > 0) { + // if (coSttn.excelList.length === 0) return; + // excelDownload( + // coSttn.excelList, + // "수요처 관리", + // "sample_coSttn.xlsx", + // "A1:H1", + // 2 + // ); + // } + // }, [coSttn.excelList]); @@ -133,7 +133,7 @@ export default function CoSttn() { excelData as [], "수요처 관리", "sample_coSttn.xlsx", - "A1:F1", + "A1:G1", 2 ); } diff --git a/apps/wr/app/ruseFcltMng/fcltReg/htdflReg/page.tsx b/apps/wr/app/ruseFcltMng/fcltReg/htdflReg/page.tsx index 873ad85f3..c80d5b4b4 100644 --- a/apps/wr/app/ruseFcltMng/fcltReg/htdflReg/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltReg/htdflReg/page.tsx @@ -38,7 +38,7 @@ export default function Home() { chgBuilding: chgBuilding[]; }>({ isOpen: false, chgBuilding: [] }); - const { htdflRes } = htdfl; + const { htdflRes ,htdflResCount} = htdfl; useEffect(() => { if (!htdfl.isInit) { @@ -101,7 +101,7 @@ export default function Home() { { setSearchTxt(e); @@ -137,9 +137,9 @@ export default function Home() { { cellClick(val || undefined, headId); }} diff --git a/apps/wr/app/ruseFcltMng/fcltReg/rainReg/page.tsx b/apps/wr/app/ruseFcltMng/fcltReg/rainReg/page.tsx index 6c97f6c8c..5b358977b 100644 --- a/apps/wr/app/ruseFcltMng/fcltReg/rainReg/page.tsx +++ b/apps/wr/app/ruseFcltMng/fcltReg/rainReg/page.tsx @@ -29,7 +29,7 @@ export default function Home() { return state; } ); - const { rainRes,rainResCount } = rain; + const { rainRes, rainResCount } = rain; const [rainForm, setRainForm] = useState(); const [issNewReg, setIsNewReg] = useState(false); const [pageNation, setPageNation] = useState(1); @@ -48,26 +48,27 @@ export default function Home() { }, [rain.isInit, initRain]); useEffect(() => { - if (code.sggCd.length > 0) { + if (code.sggCd.length > 0) { + if (rainRes && rainRes.length > 0) { + const rainData = tableData(rainRes, { code }).map( + (item: customRainBdst) => { + let archArea = + item?.archArea.split(".")[0] !== "-1" + ? item?.archArea.split(".")[0] + : "확인불가"; + return { + ...item, + archArea: archArea, - if(rainRes&& rainRes.length>0){ + bdstChgYn: item.chgBuilding.length > 0 ? "Y" : "N", + }; + } + ); - const rainData = tableData(rainRes, { code }).map( - (item: customRainBdst) => { - let archArea = item?.archArea.split('.')[0]!=='-1'?item?.archArea.split('.')[0]:'확인불가' - return { - ...item, - archArea:archArea, - - bdstChgYn: item.chgBuilding.length > 0 ? "Y" : "N", - }; - } - ); - - setbdstTable(rainData); - }else{ - setbdstTable([]); - } + setbdstTable(rainData); + } else { + setbdstTable([]); + } } }, [code, rainRes]); const cellClick: (val: number | undefined, headId: string) => void = ( diff --git a/apps/wr/app/store/common/code/index.ts b/apps/wr/app/store/common/code/index.ts index b3cf48603..5eecb83c4 100644 --- a/apps/wr/app/store/common/code/index.ts +++ b/apps/wr/app/store/common/code/index.ts @@ -3,6 +3,11 @@ import type { EnvPartSelectDataType, SelectDataType } from "@common/business_com import { bdstFilterYn, bdstGrntchClass, bdstIncenYn, bdstUsgCd, chBuCd, dmdUszCd, erctUswtrPrcsMeth, htdPowerMthdCd, htdUtztnUsgCd, orgwtKndCd, pplLenght, pplQulity, rainFcltCd, rswtPrscCdMthdCd, ruseBizMthdCd, ruseMngMtd, rusePrcsMthdCd, ruseSeCd, yn } from "./basicCode"; export const btnClass = "p-4 m-2 text-white rounded-sm text-lg font-medium " + +const laeSecd = '41' +const ogdpSeCd = '0' + + export const buildingType = { RST:"RST", RNB:"RNB", @@ -167,6 +172,8 @@ export type comCodeState = { rswtPrscCdMthdCd:SelectDataType[]; htdPowerMthdCd:SelectDataType[] htdUtztnUsgCd:SelectDataType[] + userSiSggCd : string; + }; }; @@ -203,6 +210,7 @@ export const comCodeStateExport: comCodeState = { rswtPrscCdMthdCd:rswtPrscCdMthdCd, htdPowerMthdCd:htdPowerMthdCd, htdUtztnUsgCd:htdUtztnUsgCd, + userSiSggCd:laeSecd, }, }; diff --git a/apps/wr/app/store/matDmd/coSttn/excel.tsx b/apps/wr/app/store/matDmd/coSttn/excel.tsx index 05b45711a..3b6d73c8b 100644 --- a/apps/wr/app/store/matDmd/coSttn/excel.tsx +++ b/apps/wr/app/store/matDmd/coSttn/excel.tsx @@ -2,7 +2,6 @@ import moment from "moment"; export const excelCoSttnParsing = (data: any[]): string[][] => { const excelExportData: string[][] = []; - data.forEach((item) => { excelExportData.push([ String(item.cityText)??'', diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/htdflReg/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/htdflReg/index.tsx index feaefc03f..b241fe7f1 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/htdflReg/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/htdflReg/index.tsx @@ -177,7 +177,7 @@ export const htdflFacActionsExport: (set: any) => htdflFacSActions = ( if (res.status) { toast.success("온배수 건축물 수정이 완료되었습니다."); } - const htdflRes = await getFetch( + const htdflRes = await getFetchWithCount( "wr", `/drain/facilityList/1/10/${code}` ); diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/headList.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/headList.tsx index 46287aa2c..569fad381 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/headList.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/pbnstReg/headList.tsx @@ -7,7 +7,7 @@ export const pubFacHeadListExport: TableUpperProps[] = [ { id: "bscFctNm", title: "시설명" }, { id: "addr", title: "위치" }, { id: "efflWqltStndrdNm", title: "지역구분" }, - { id: "fctCpc", title: "시설용량" }, + { id: "fctCpc", title: "시설용량(m³/일)" }, { id: "ruse", title: "재이용여부" }, { id: "rswtrYn", title: "등록여부" }, ]; diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx index 67ea71cb6..b0ea5fd37 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/index.tsx @@ -28,8 +28,8 @@ const rainyObjSchema = z.object({ export const rainZod = z.object({ bdstInfoPk: z.number().optional(), - ctpvCd: z.number().default(0), - sggCd: z.number().default(0), + ctpvCd: z.number().optional(), + sggCd: z.number().optional(), daddr: z.string().default(""), bdstNm: z.string().default(""), frstArchPrmsnDt: z.date().default(() => new Date()), @@ -83,6 +83,7 @@ type rainFacSActions = { rainSearch: (txt:string,pageNation:number,code:string|number) => void; rainBdstReg: (data: customRainBdst, code:string|number) => void; rainBdstUpdate: (data: customRainBdst, code:string|number) => void; + }; export type rainFacType = rainFacState & rainFacSActions; diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/type.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/type.tsx index 2d17b4601..80811d7ce 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/type.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/rainReg/type.tsx @@ -11,7 +11,10 @@ export const baseReuseBuildingSchema = z.object({ bdstRuseFcltPk: z.number().nullish(), bdstInfoFk: z.number().nullish(), instlCmptnDt: z.coerce.date().default(() => new Date()), - instlCst: z.number().nullish(), + instlCst: z + .number() + .max(9_999_999, { message: "최대 9,999,999까지 입력 가능합니다." }) + .nullish(), operMngCd: z.string().optional().default(""), anlOperCst: z.number().default(0), instlCstSprtYn: z.string().default("Y"), diff --git a/apps/wr/app/store/ruseFcltMng/fcltReg/rswtReg/index.tsx b/apps/wr/app/store/ruseFcltMng/fcltReg/rswtReg/index.tsx index 475c1797d..8c3579a5d 100644 --- a/apps/wr/app/store/ruseFcltMng/fcltReg/rswtReg/index.tsx +++ b/apps/wr/app/store/ruseFcltMng/fcltReg/rswtReg/index.tsx @@ -30,8 +30,8 @@ import toast from "react-hot-toast"; export const rswtZod = z.object({ bdstInfoPk: z.number().nullish(), - ctpvCd: z.number().default(0), - sggCd: z.number().default(0), + ctpvCd: z.number(), + sggCd: z.number(), daddr: z.string().default(""), bdstNm: z.string().default(""), frstArchPrmsnDt: z.date().default(() => new Date()), @@ -182,7 +182,7 @@ export const rswtFacActionsExport: (set: any) => rswtFacSActions = ( const chData = await makeRstr(data); const res = await postFectch("/reuseFc/waterreuseFc", chData); if (res.status===200) { - if(data.chgBuilding.length > 0){ + if(data.chgBuilding ){ const chPK = res?.data?.bdstInfoPk const makeCh= res.data.chgBuilding.map((item: chgBuilding) => diff --git a/apps/wr/components/ui/form/fcltReg/bdstReg/bdstReg.tsx b/apps/wr/components/ui/form/fcltReg/bdstReg/bdstReg.tsx index 886dd2da9..bceee1a17 100644 --- a/apps/wr/components/ui/form/fcltReg/bdstReg/bdstReg.tsx +++ b/apps/wr/components/ui/form/fcltReg/bdstReg/bdstReg.tsx @@ -24,6 +24,10 @@ export default function BdstReg({ form, type }: { form: any; type?: string }) { return state; }); + const {userSiSggCd } =code + const [useCityCd, setUserCityCd] = useState([]) + const [useSggCd, setUserSggCd] = useState([]) + const { fields, append, remove } = useFieldArray({ name: "chgBuilding", control: form?.control, // Provide a fallback to avoid errors @@ -52,6 +56,33 @@ export default function BdstReg({ form, type }: { form: any; type?: string }) { city: "", }); + useEffect(() =>{ + if(userSiSggCd.length===2 && code.cityCd.length>0){ + const city = code.cityCd.filter((item) => item.val === userSiSggCd) + const sgg = code.sggCd.filter((item) => item.val.slice(0,2) === userSiSggCd ) + sgg.unshift({text:'전체' , val:'0'}) + setUserCityCd(city) // Fix: Ensure city is of type SelectDataType[] + setUserSggCd(sgg) + if (city[0]?.val) { + // 여기 중요 + queueMicrotask(() => { + form.setValue("ctpvCd", Number(city[0]?.val), { shouldDirty: true, shouldTouch: true, shouldValidate: true }); + }); + } + }else if(userSiSggCd.length===5 && code.cityCd.length>0 && code.sggCd.length>0) { + const city = code.cityCd.filter((item) => item.val === userSiSggCd.slice(0,2)) + const sgg = code.sggCd.filter((item) => item.val === userSiSggCd) + setUserSggCd(sgg) + setUserCityCd(city) + form.setValue('ctpvCd',Number(city[0]?.val) ) + form.setValue('sggCd',Number(sgg[0]?.val) ) + + } + },[form, userSiSggCd, code.cityCd, code.sggCd]) + + + + const getSelCity = (val: string) => { const data = getCity(val, code.sggCd); setSelectSgg(data); @@ -87,6 +118,12 @@ export default function BdstReg({ form, type }: { form: any; type?: string }) { ); }; + useEffect(() =>{ + + console.log('form.formState ', form.watch()) + + },[form.formState]) + return ( <>

{ type !== "HTB"?"건축물 기본 정보": '시설 기본 정보'}

@@ -101,12 +138,11 @@ export default function BdstReg({ form, type }: { form: any; type?: string }) { className="col-span-3" label={""} selectClass={selectClass} - selectArray={code.cityCd} + selectArray={useCityCd} onSelectValue={(val) => { - getSelCity(String(val)); field.onChange(Number(val)); }} - value={field.value} + value={typeof field.value !== "undefined" ? field.value : useCityCd[0]?.val} /> )} @@ -122,9 +158,8 @@ export default function BdstReg({ form, type }: { form: any; type?: string }) { className="col-span-3" label={""} selectClass={`w-full min-h-[2.9rem] ${selectClass}`} - selectArray={selectSgg ? selectSgg : code.sggCd || []} + selectArray={useSggCd} onSelectValue={(val) => { - getSgg(val); field.onChange(Number(val)); }} value={field.value} diff --git a/apps/wr/components/ui/form/fcltReg/htdflReg/htdflRegForm.tsx b/apps/wr/components/ui/form/fcltReg/htdflReg/htdflRegForm.tsx index edd5bb1b5..5e0786f8b 100644 --- a/apps/wr/components/ui/form/fcltReg/htdflReg/htdflRegForm.tsx +++ b/apps/wr/components/ui/form/fcltReg/htdflReg/htdflRegForm.tsx @@ -61,7 +61,7 @@ export default function HtdflRegForm({ if (setIsModal) setIsModal(false); } else { - htdflBdstUpdate(values, "41"); + htdflBdstUpdate(values, "0"); } }; diff --git a/apps/wr/components/ui/form/fcltReg/rainReg/rainRegForm.tsx b/apps/wr/components/ui/form/fcltReg/rainReg/rainRegForm.tsx index da8011efd..974d9269c 100644 --- a/apps/wr/components/ui/form/fcltReg/rainReg/rainRegForm.tsx +++ b/apps/wr/components/ui/form/fcltReg/rainReg/rainRegForm.tsx @@ -39,7 +39,7 @@ export default function RainRegForm({ const defaultValues: z.infer = rainZod.parse({}); const form = useForm>({ resolver: zodResolver(rainZod), - defaultValues: defaultValues, + // defaultValues: defaultValues, }); const instlCst = form.watch(`reuseBuilding.0.instlCst`); diff --git a/apps/wr/components/ui/form/fcltReg/rswtrReg/rswtrRegForm.tsx b/apps/wr/components/ui/form/fcltReg/rswtrReg/rswtrRegForm.tsx index 3c8af831d..f70f4548c 100644 --- a/apps/wr/components/ui/form/fcltReg/rswtrReg/rswtrRegForm.tsx +++ b/apps/wr/components/ui/form/fcltReg/rswtrReg/rswtrRegForm.tsx @@ -41,11 +41,11 @@ export default function RswtrRegForm({ (state) => state ); - const defaultValues: z.infer = rswtZod.parse({}); + // const defaultValues: z.infer = rswtZod.parse({}); const form = useForm>({ resolver: zodResolver(rswtZod), - defaultValues: defaultValues, + // defaultValues: defaultValues, }); const [grntchBdstCertYn, instlCstSprtYn, filtrTrtmfctProcs] = form.watch([ diff --git a/apps/wr/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal.tsx b/apps/wr/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal.tsx index 25e5ef976..a049772e8 100644 --- a/apps/wr/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal.tsx +++ b/apps/wr/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal.tsx @@ -4,7 +4,12 @@ import { selectClass, type customRainBdst, } from "@/app/store/ruseFcltMng/fcltReg/rainReg"; -import { ScrollArea, SelectBox, UiTable, type SelectDataType } from "@common/business_components"; +import { + ScrollArea, + SelectBox, + UiTable, + type SelectDataType, +} from "@common/business_components"; import { Button, Input, Label } from "@common/components"; import { useEffect, useState } from "react"; import { getCity, tableData } from "@/components/lib/func/commom"; @@ -15,83 +20,117 @@ import RswtrRegForm from "@/components/ui/form/fcltReg/rswtrReg/rswtrRegForm"; import HtdflRegForm from "@/components/ui/form/fcltReg/htdflReg/htdflRegForm"; export type objSearchType = { - sgg: string|number; - city: string|number; - }; + sgg: string | number; + city: string | number; +}; //RNB(빗물), RST(중수도), HTB(온배수) - type MoType = 'RNB' | 'RST' | 'HTB'; // 여기에 'htdf' 추가 +type MoType = "RNB" | "RST" | "HTB"; // 여기에 'htdf' 추가 - type BdstTypeMap = { +type BdstTypeMap = { RNB: customRainBdst; RST: customRswtBdst; - HTB: customRswtBdst; // 해야해// 아직 아노딤 + HTB: customRswtBdst; // 해야해// 아직 아노딤 }; - interface BdstRegProps { +interface BdstRegProps { moType: T; - isModal:boolean; + isModal: boolean; + siSggCode?: string; setIsModal?: (open: boolean) => void; } -export function BdstReg({ moType,setIsModal,isModal }: BdstRegProps) { - const { rain, code, bdst,findBdst } = useWrStore((state) => { +export function BdstReg({ + moType, + setIsModal, + siSggCode, + isModal, +}: BdstRegProps) { + const { rain, code, bdst, findBdst } = useWrStore((state) => { return state; }); + + const { userSiSggCd } = code; + const [bdstTable, setbdstTable] = useState(); - const [rainBdstForm, setRainBdstForm] = useState({} as BdstTypeMap[T]); - const [searchTxt, setSearchTxt] = useState() - const [selectSgg, setSelectSgg] = useState() - const [objSearch, setObjSearch] = useState({sgg:"",city:""}); + const [rainBdstForm, setRainBdstForm] = useState( + {} as BdstTypeMap[T] + ); + const [searchTxt, setSearchTxt] = useState(); + const [selectSgg, setSelectSgg] = useState(); + const [objSearch, setObjSearch] = useState({ + sgg: "", + city: "", + }); + const [useCityCd, setUserCityCd] = useState([]); + const [useSggCd, setUserSggCd] = useState([]); + const [dataCode, setDataCode] = useState(); - const getSelCity = (val: string | number) => { - const cityValue = String(val); // Ensure val is treated as a string - const data = getCity(cityValue, code.sggCd); + const searchBdst = (searchTxt: string | undefined) => { + let data = objSearch.city; - setSelectSgg(data); - // getSgg(data[0]?.val || ""); - setObjSearch({ city: cityValue, sgg: '' }); + if (objSearch.sgg !== "" && objSearch.sgg !== "0") { + data = objSearch.sgg; + } + //RNB(빗물), RST(중수도), HTB(온배수) + findBdst(String(data), searchTxt || "", moType); }; - const getSgg = (val: string | number) => { - setObjSearch({...objSearch,sgg: String(val)}) - }; - - const searchBdst=(searchTxt: string | undefined)=>{ - let data =objSearch.city; - if(objSearch.city==="" ){ - - data = String(code.cityCd[0]?.val) - } - if(objSearch.sgg !=="" ){ - data = objSearch.sgg - } - - //RNB(빗물), RST(중수도), HTB(온배수) - findBdst(String(data), searchTxt || "",moType ) - - } - useEffect(() => { if (code.sggCd.length > 0) { - - setbdstTable( tableData(bdst.bdstBase, { code })); - } - }, [ bdst]); + const bdstData = bdst.bdstBase.map((bdst) => { + let archArea = + bdst?.archArea.split(".")[0] !== "-1" + ? bdst?.archArea.split(".")[0] + : "확인불가"; + return { + ...bdst, + archArea: archArea, + }; + }); + setbdstTable(tableData(bdstData, { code })); + } + }, [bdst]); + useEffect(() => { + if (userSiSggCd.length === 2 && code.cityCd.length > 0) { + const city = code.cityCd.filter((item) => item.val === userSiSggCd); + const sgg = code.sggCd.filter( + (item) => item.val.slice(0, 2) === userSiSggCd + ); + sgg.unshift({ text: "전체", val: "0" }); + setUserCityCd(city); // Fix: Ensure city is of type SelectDataType[] + setObjSearch({ ...objSearch, city: String(city[0]?.val) }); + setUserSggCd(sgg); + } else if ( + userSiSggCd.length === 5 && + code.cityCd.length > 0 && + code.sggCd.length > 0 + ) { + const city = code.cityCd.filter( + (item) => item.val === userSiSggCd.slice(0, 2) + ); + setUserCityCd(city); + const sgg = code.sggCd.filter((item) => item.val === userSiSggCd); + setUserSggCd(sgg); + setObjSearch({ city: String(city[0]?.val), sgg: String(sgg[0]?.val) }); + } + }, [userSiSggCd, code.cityCd, code.sggCd]); - const tableClick: (val: number | undefined , headId:string) => void = (val ,headId) => { - - if(val!==undefined && bdst?.bdstBase.length>0){ - const data:BdstTypeMap[T] =bdst?.bdstBase[val] - if (data) { - setRainBdstForm(data); - } + const tableClick: (val: number | undefined, headId: string) => void = ( + val, + headId + ) => { + if (val !== undefined && bdst?.bdstBase.length > 0) { + const data: BdstTypeMap[T] = bdst?.bdstBase[val]; + if (data) { + setRainBdstForm(data); } - } + } + }; - useEffect(()=>{ - setbdstTable([]) // 초기화 작업 - },[]) + useEffect(() => { + setbdstTable([]); // 초기화 작업 + }, []); return ( <>
@@ -99,31 +138,50 @@ export function BdstReg({ moType,setIsModal,isModal }: BdstReg className="col-span-3 h-full" label={"시도"} selectClass={selectClass} - selectArray={code.cityCd || []} - onSelectValue={getSelCity} - > - {""} - + selectArray={useCityCd} + onSelectValue={(val) => { + setObjSearch({ ...objSearch, city: String(val) }); + }} + value={objSearch.city || useCityCd[0]?.val} + > { + if (val) setObjSearch({ ...objSearch, sgg: String(val) }); + }} + value={objSearch.sgg || useSggCd[0]?.val} > {" "} - - setSearchTxt(e.target.value)}/> - + + setSearchTxt(e.target.value)} + /> +

건축물 목록 - (유의 사항: 신규등록하려는 건축물이 목록에 없을 경우 하단 건축물 정보에 추가하여 주시기 바랍니다.) + (유의 사항: 신규등록하려는 건축물이 목록에 없을 경우 하단 건축물 + 정보에 추가하여 주시기 바랍니다.)

@@ -134,24 +192,40 @@ export function BdstReg({ moType,setIsModal,isModal }: BdstReg pageSize={-10} total={-1} headName={undefined} - cellClick={(idx, headId) => (tableClick(idx, headId || ""))} + cellClick={(idx, headId) => tableClick(idx, headId || "")} onPageChange={function (page: number): void { throw new Error("Function not implemented."); - }}> - + }} + >
{/* */} -
- { moType === 'RNB'? - - :moType==='RST' - ? {setIsModal && setIsModal(open)}}> - :{setIsModal && setIsModal(open)}}> - } - -
+
+ {moType === "RNB" ? ( + + ) : moType === "RST" ? ( + { + setIsModal && setIsModal(open); + }} + > + ) : ( + { + setIsModal && setIsModal(open); + }} + > + )} +
{/*
*/}