중수도 정보 headlist에 키값 추가.

API 호출 부분 추가.
This commit is contained in:
truthwing
2025-06-19 13:38:57 +09:00
parent c830d836ca
commit b39969f7e6
3 changed files with 43 additions and 34 deletions
+14 -19
View File
@@ -1,33 +1,25 @@
'use client'
"use client";
import { useWrStore } from "@/app/store";
import { yearOptions } from "@/components/lib/func/commom";
import {
ContentsDiv,
SearchDiv,
SearchFormLeft,
SelectBox,
Title,
UiTable
import {
ContentsDiv,
SearchDiv,
SelectBox,
Title,
UiTable
} from "@common/business_components/ui";
import ListDiv from "@common/business_components/ui/list_div";
import { Button } from "@common/components/ui";
import { useState } from "react";
export default function RswtStat() {
const { code, rswtStat } = useWrStore((state) => state);
const { code, rswtStat, searchRswtStatList } = useWrStore((state) => state);
const [pageNation, setPageNation] = useState(1);
const [searchYear, setSearchYear] = useState<string>(
String(new Date().getFullYear())
);
const testData = [1,2,3]
testData.map((item) => {
console.log('test ',item);
})
return (
<>
return ( <>
<ContentsDiv>
<div className="grid grid-cols-4 gap-4">
<div className="col-span-4">
@@ -48,7 +40,10 @@ export default function RswtStat() {
<Button
className=""
size="sm"
onClick={() => {}}
onClick={() => {
console.log('searchYear', searchYear );
searchRswtStatList(searchYear)
}}
>
조회
</Button>
@@ -89,4 +84,4 @@ export default function RswtStat() {
</ContentsDiv>
</>
);
}
}
+14 -14
View File
@@ -2,13 +2,13 @@ import type { TableUpperProps } from "../../common/type/header";
export const rswtStatHeadListExport :TableUpperProps[]=[
{
id: "시도",
id: "ctpvCd",
title: "시도",
row:0,
rowSpan:2
},
{
id: "개소",
id: "ctpvCnt",
title: "개소",
row:0,
rowSpan:2
@@ -20,17 +20,17 @@ export const rswtStatHeadListExport :TableUpperProps[]=[
colSpan:2
},
{
id: "건축연면적(m³)",
id: "archArea",
title: "건축연면적(m³)",
row:1,
},
{
id: "처리용량",
id: "filtrTrtmfctCpct",
title: "처리용량(m³)",
row:1,
},
{
id: "물사용량",
id: "wtrUsqty",
title: "물사용량(m³/년)",
row:0,
rowSpan:2
@@ -42,13 +42,13 @@ export const rswtStatHeadListExport :TableUpperProps[]=[
rowSpan:2
},
{
id: "중수도이용량",
id: "rswtrUsqty",
title: "중수도이용량(m³/년)",
row:0,
rowSpan:2
},
{
id: "대체수이용량",
id: "altUswtrUtztnQnt",
title: "대체수이용량(m³/년)",
row:0,
rowSpan:2
@@ -61,37 +61,37 @@ export const rswtStatHeadListExport :TableUpperProps[]=[
colSpan:6
},
{
id: "조경용수",
id: "lndwtr",
title: "조경용수",
row:1,
},
{
id: "청소화장실용수",
id: "cleanToilUswtr",
title: "청소화장실용수",
row:1,
},
{
id: "농업용수",
id: "farmUswtr",
title: "농업용수",
row:1,
},
{
id: "공업용수",
id: "indstUswtr",
title: "공업용수",
row:1,
},
{
id: "친수용수",
id: "hydUswtr",
title: "친수용수",
row:1,
},
{
id: "기타",
id: "ithlEtcUswtr",
title: "기타",
row:1,
},
{
id: "연간운영비",
id: "anlOperCst",
title: "연간운영비(백만원/년)",
row:0,
rowSpan:2
+15 -1
View File
@@ -1,13 +1,16 @@
import { fetchType, getFetch } from "@/components/lib/api";
import type { TableUpperProps } from "../../common/type/header";
import { rswtStatHeadListExport } from "./headList";
type rswtStatActions = {
searchRswtStatList: (year: string) => void;
}
export type rswtStatState = {
rswtStat: {
rswtStatHeadList:TableUpperProps[]
rswtStatList: never[]; // Replace with actual type when available
}
}
@@ -23,6 +26,17 @@ export const rswtStatActionsExport: (set: any) => rswtStatActions = (
set: any
) => {
return {
searchRswtStatList: async (year: string) => {
const res = await getFetch(fetchType.WR,`/reuseChk/reuseWater/stat/${year}`)
console.log('res', res);
const rswtStatList: never[] = [];
set((state: rswtStatState) => ({
rswtStat: {
...state.rswtStat,
rswtStatList,
// rswtStatHeadList
}
}));
}
}
}