diff --git a/apps/st/src/components/module/SearchForm.tsx b/apps/st/src/components/module/SearchForm.tsx index b2a470360..530b3579b 100644 --- a/apps/st/src/components/module/SearchForm.tsx +++ b/apps/st/src/components/module/SearchForm.tsx @@ -40,10 +40,11 @@ const SearchForm = (props: SearchFormProps = {}) => { const [values, setValues] = useState({ sido: props.defaultValues?.sido || "", - gugun: props.defaultValues?.gugun || "", + gugun: props.defaultValues?.gugun || '', year: props.defaultValues?.year || String(defaultYear), - order: props.defaultValues?.order || "", - fctName: props.defaultValues?.fctName || "", + order: props.defaultValues?.order || '', + fctName: props.defaultValues?.fctName || '', + bsnmCd: props.defaultValues?.bsnmCd || '', }); const { data: sidoList } = useSWR>( @@ -98,16 +99,28 @@ const SearchForm = (props: SearchFormProps = {}) => { const handleReset = () => { const resetValues: SearchFormValues = { - sido: "", - gugun: "", + sido: '', + gugun: '', year: String(defaultYear), - order: "", - fctName: "", + order: '', + fctName: '', + bsnmCd: '', }; setValues(resetValues); props.onReset?.(); }; + const handleSidoChange = (value: string) => { + const selectedBsnm = sidoList?.data.find((v) => v.sido === value)?.bsnmCd || ''; + + setValues((prev) => ({ + ...prev, + sido: value, + gugun: '', + bsnmCd: selectedBsnm, + })); + }; + return (
@@ -117,7 +130,7 @@ const SearchForm = (props: SearchFormProps = {}) => { - diff --git a/apps/st/src/components/statistics/input/SeweragePenetrationRateInp.tsx b/apps/st/src/components/statistics/input/SeweragePenetrationRateInp.tsx index 047f241b8..b0069a82a 100644 --- a/apps/st/src/components/statistics/input/SeweragePenetrationRateInp.tsx +++ b/apps/st/src/components/statistics/input/SeweragePenetrationRateInp.tsx @@ -34,7 +34,7 @@ const SeweragePenetrationRateInp = () => { const response = await statisticsInputAPi.getSewerageSupplyRateList({ sido: values.sido, gugun: values.gugun === 'ALL' ? '' : values.gugun, - bsnmCd: '4139000000', + bsnmCd: values.bsnmCd, yr: values.year, demoYr: values.year, }); diff --git a/apps/st/src/components/type/SearchForm.type.ts b/apps/st/src/components/type/SearchForm.type.ts index 157c57ec3..689bee00f 100644 --- a/apps/st/src/components/type/SearchForm.type.ts +++ b/apps/st/src/components/type/SearchForm.type.ts @@ -4,6 +4,7 @@ export type SearchFormValues = { year?: string; order?: string; fctName?: string; + bsnmCd?: string; }; export type SearchFormProps = { diff --git a/apps/st/src/entities/statistics/model/statistics-interface.ts b/apps/st/src/entities/statistics/model/statistics-interface.ts index ee956bdd0..5ff8a5ed7 100644 --- a/apps/st/src/entities/statistics/model/statistics-interface.ts +++ b/apps/st/src/entities/statistics/model/statistics-interface.ts @@ -1,11 +1,13 @@ export interface Sido { adstDstrCd: string; sido: string; + bsnmCd: string; } export interface Sgg { adstDstrCd: string; gugun: string; + bsnmCd: string; } export interface ApiResponse {