diff --git a/apps/wr/app/(with-layout)/stats/rswtStat/page.tsx b/apps/wr/app/(with-layout)/stats/rswtStat/page.tsx index 21ca5112a..de9bc86cf 100644 --- a/apps/wr/app/(with-layout)/stats/rswtStat/page.tsx +++ b/apps/wr/app/(with-layout)/stats/rswtStat/page.tsx @@ -27,7 +27,7 @@ export default function RswtStat() { const { t } = useTranslation('base'); useEffect(() => { - searchRswtStatList(searchYear, code.cityCd) + searchRswtStatList(searchYear, code.cityCd,code.rswtBdstType) }, [searchRswtStatList, code.cityCd]) const excelClick = () => { @@ -251,7 +251,7 @@ export default function RswtStat() { className="" size="sm" onClick={() => { - searchRswtStatList(searchYear, code.cityCd) + searchRswtStatList(searchYear, code.cityCd,code.rswtBdstType) }} > 조회 diff --git a/apps/wr/app/store/stats/rswtStat/excel.tsx b/apps/wr/app/store/stats/rswtStat/excel.tsx index 00935b8fb..4bd698ad0 100644 --- a/apps/wr/app/store/stats/rswtStat/excel.tsx +++ b/apps/wr/app/store/stats/rswtStat/excel.tsx @@ -1,7 +1,10 @@ -import type { RswtStatProps } from "."; -import { bdstUsgCd } from "../../common/code/basicCode"; +import type { SelectDataType } from "@common/business_components/ui"; +import type { RswtStatProps } from "."; -export const excelRswtStat = (excelList:RswtStatProps[]) : (string | number)[][] => { +export const excelRswtStat = (excelList: RswtStatProps[], rswtBdstType : SelectDataType[] ) : (string | number)[][] => { + + + console.log('bdstUsgCd ', rswtBdstType) const excelData: (string | number)[][] = []; excelList.forEach((item) => { excelData.push([ @@ -15,7 +18,7 @@ export const excelRswtStat = (excelList:RswtStatProps[]) : (string | number)[][] String(item.bdstNm) ?? "", //건축물용도코드(빈칸) //String(item.bdstUsgCd) ?? "", - bdstUsgCd.find((cd)=> cd.val === item.bdstUsgCd.toString())?.text ?? "", //건축물용도 + rswtBdstType?.find((cd)=> cd.val === item.bdstUsgCd.toString())?.text ?? "", //건축물용도 //주소 String(item.daddr) ?? "", //법적의무대상여부 diff --git a/apps/wr/app/store/stats/rswtStat/index.tsx b/apps/wr/app/store/stats/rswtStat/index.tsx index 89c4089c0..bd9a9c8e0 100644 --- a/apps/wr/app/store/stats/rswtStat/index.tsx +++ b/apps/wr/app/store/stats/rswtStat/index.tsx @@ -2,6 +2,7 @@ import { fetchType, getFetch } from "@/components/lib/api"; import type { TableUpperProps } from "../../common/type/header"; import { rswtStatHeadListExport } from "./headList"; import { excelRswtStat } from "./excel"; +import type { SelectDataType } from "@common/business_components/ui"; export type RswtStatProps = { cityText: string //시도명 @@ -38,7 +39,7 @@ export type GuideStatProps = { } type rswtStatActions = { - searchRswtStatList: (year: string, city: { val: string; text: string }[]) => void; + searchRswtStatList: (year: string, city: SelectDataType[],bdstUsgCd: SelectDataType[] ) => void; } export type ExcelType = { @@ -72,7 +73,7 @@ export const rswtStatActionsExport: (set: any) => rswtStatActions = ( set: any ) => { return { - searchRswtStatList: async (year: string, city: { val: string; text: string }[]) => { + searchRswtStatList: async (year: string, city: SelectDataType[] , rswtBdstType:SelectDataType[]) => { const res = await getFetch(fetchType.WR, `/reuseChk/reuseWater/stat/${year}`) const data = res.filter(item => { const code = item.ctpvCd.trim(); @@ -198,7 +199,7 @@ export const rswtStatActionsExport: (set: any) => rswtStatActions = ( utztnUsgCd: utztnUsgArray.join(', '), }) }); - const excelDetailData = excelRswtStat(rswtDetailList); + const excelDetailData = excelRswtStat(rswtDetailList,rswtBdstType); set((state: rswtStatState) => ({ rswtStat: { ...state.rswtStat,