SearchBaseForm ref 연결 완료.
This commit is contained in:
@@ -15,6 +15,7 @@ type SearchBaseType = {
|
|||||||
queryClick:(returnType:ReturnType) => void;
|
queryClick:(returnType:ReturnType) => void;
|
||||||
excelClick:(returnType:ReturnType) => void;
|
excelClick:(returnType:ReturnType) => void;
|
||||||
btnClass:string;
|
btnClass:string;
|
||||||
|
ref:React.RefObject<HTMLDivElement>;
|
||||||
}
|
}
|
||||||
export type ReturnType = {
|
export type ReturnType = {
|
||||||
partValue: string;
|
partValue: string;
|
||||||
@@ -40,7 +41,8 @@ function SearchBaseForm ({
|
|||||||
selectEnvPartData,
|
selectEnvPartData,
|
||||||
btnClass,
|
btnClass,
|
||||||
queryClick,
|
queryClick,
|
||||||
excelClick
|
excelClick,
|
||||||
|
ref
|
||||||
}: SearchBaseType) {
|
}: SearchBaseType) {
|
||||||
const [partValue, setPartValue] = useState<string>("0");
|
const [partValue, setPartValue] = useState<string>("0");
|
||||||
const [sidoValue, setSidoValue] = useState<string>("0");
|
const [sidoValue, setSidoValue] = useState<string>("0");
|
||||||
@@ -74,9 +76,7 @@ function SearchBaseForm ({
|
|||||||
setResetTrigger(false);
|
setResetTrigger(false);
|
||||||
}
|
}
|
||||||
}, [resetTrigger]);
|
}, [resetTrigger]);
|
||||||
const excelDownload = useCallback(() => {
|
const excelDownload = () => {
|
||||||
console.log("엑셀다운로드 클릭");
|
|
||||||
console.log(partValue, sidoValue, sigunValue, regionValue, untitWaterShedValue, middleRegionValue, envPartValue, envPartSidoValue, envPartSigunValue);
|
|
||||||
excelClick({
|
excelClick({
|
||||||
partValue: partValue,
|
partValue: partValue,
|
||||||
sidoValue: sidoValue,
|
sidoValue: sidoValue,
|
||||||
@@ -88,20 +88,21 @@ function SearchBaseForm ({
|
|||||||
envPartSidoValue: envPartSidoValue,
|
envPartSidoValue: envPartSidoValue,
|
||||||
envPartSigunValue: envPartSigunValue,
|
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]);
|
}, [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 (
|
return (
|
||||||
<div className="flex card card-border !mt-6">
|
<div className="flex card card-border !mt-6">
|
||||||
<SearchFormLeft isShowPart={true}
|
<SearchFormLeft isShowPart={true}
|
||||||
|
|||||||
Reference in New Issue
Block a user