diff --git a/packages/common/business_components/src/ui/search_base_form/index.tsx b/packages/common/business_components/src/ui/search_base_form/index.tsx index 372a52695..93de69169 100644 --- a/packages/common/business_components/src/ui/search_base_form/index.tsx +++ b/packages/common/business_components/src/ui/search_base_form/index.tsx @@ -15,6 +15,7 @@ type SearchBaseType = { queryClick:(returnType:ReturnType) => void; excelClick:(returnType:ReturnType) => void; btnClass:string; + ref:React.RefObject; } export type ReturnType = { partValue: string; @@ -40,7 +41,8 @@ function SearchBaseForm ({ selectEnvPartData, btnClass, queryClick, - excelClick + excelClick, + ref }: SearchBaseType) { const [partValue, setPartValue] = useState("0"); const [sidoValue, setSidoValue] = useState("0"); @@ -74,9 +76,7 @@ function SearchBaseForm ({ setResetTrigger(false); } }, [resetTrigger]); - const excelDownload = useCallback(() => { - console.log("엑셀다운로드 클릭"); - console.log(partValue, sidoValue, sigunValue, regionValue, untitWaterShedValue, middleRegionValue, envPartValue, envPartSidoValue, envPartSigunValue); + const excelDownload = () => { excelClick({ partValue: partValue, sidoValue: sidoValue, @@ -88,20 +88,21 @@ function SearchBaseForm ({ envPartSidoValue: envPartSidoValue, envPartSigunValue: envPartSigunValue, }) + }; + useEffect(() => { + if (ref && ref.current) { + const customRef = ref.current as HTMLDivElement & ReturnType; + customRef.partValue = partValue; + customRef.sidoValue = sidoValue; + customRef.sigunValue = sigunValue; + customRef.regionValue = regionValue; + customRef.unitWaterShedValue = untitWaterShedValue; + customRef.middleRegionValue = middleRegionValue; + customRef.envPartValue = envPartValue; + customRef.envPartSidoValue = envPartSidoValue; + customRef.envPartSigunValue = envPartSigunValue; + } }, [partValue, sidoValue, sigunValue, regionValue, untitWaterShedValue, middleRegionValue, envPartValue, envPartSidoValue, envPartSigunValue]); - // useEffect(() => { - // if (ref && ref.current) { - // ref.current.partValue = partValue; - // ref.current.sidoValue = sidoValue; - // ref.current.sigunValue = sigunValue; - // ref.current.regionValue = regionValue; - // ref.current.unitWaterShedValue = untitWaterShedValue; - // ref.current.middleRegionValue = middleRegionValue; - // ref.current.envPartValue = envPartValue; - // ref.current.envPartSidoValue = envPartSidoValue; - // ref.current.envPartSigunValue = envPartSigunValue; - // } - // }, [partValue, sidoValue, sigunValue, regionValue, untitWaterShedValue, middleRegionValue, envPartValue, envPartSidoValue, envPartSigunValue]); return (