Merge branch 'iipbs/wr/stats_page' into iipbs/wr/stats

This commit is contained in:
truthwing
2025-06-19 11:37:17 +09:00
3 changed files with 72 additions and 76 deletions
+7 -3
View File
@@ -1,6 +1,7 @@
"use client";
import { useWrStore } from "@/app/store";
import type { RainStatProps } from "@/app/store/stats/rainStat";
import { yearOptions } from "@/components/lib/func/commom";
import {
ContentsDiv,
@@ -14,7 +15,9 @@ import { Button } from "@common/components/ui";
import { useEffect, useState } from "react";
export default function RainStat() {
const { rainStat, searchRainStatList } = useWrStore((state) => state)
const { rainStat, searchRainStatList } = useWrStore((state) => state);
const { rainStatHeadList, rainStatList } = rainStat;
const [ pageNation, setPageNation] = useState(1);
const [searchYear, setSearchYear] = useState<string>(
String(new Date().getFullYear())
@@ -22,6 +25,7 @@ export default function RainStat() {
useEffect(() => {
searchRainStatList(searchYear);
console.log("rainStatList", rainStatList)
}, [searchRainStatList, searchYear])
return (
@@ -66,11 +70,11 @@ export default function RainStat() {
<ListDiv className="min-h-0">
{/* <ScrollArea className="h-[60vh]"> */}
<UiTable
tableData={[]}
tableData={rainStatList || []}
headlist={rainStat.rainStatHeadList}
pageSize={20}
total={10000}
headName={"건축물 목록"}
headName={""}
cellClick={(val, headId) => {}}
onPageChange={setPageNation}
></UiTable>
+19 -13
View File
@@ -2,72 +2,78 @@ import type { TableUpperProps } from "../../common/type/header";
export const rainStatHeadListExport: TableUpperProps[] = [
{
id: "시도",
id: "ctpvCd",
title: "시도",
row:0,
rowSpan:2
},
{
id: "개소",
id: "tmp",
title: "개소",
row:0,
rowSpan:2
},
{
id: "설치비",
id: "instlCst",
title: "설치비(백만원)",
row:0,
rowSpan:2
},
{
id: "저류조용량",
id: "dtfcltCpct",
title: "저류조용량(m³/년)",
row:0,
rowSpan:2
},
{
id: "이용용도",
id: "wtrUsqty",
title: "연간사용량(㎥/년)",
row:0,
rowSpan:2
},
{
id: "a",
title: "이용용도",
row:0,
colSpan:7
},
{
id: "조경용수",
id: "lndwtr",
title: "조경용수",
row:1,
},
{
id: "청소화장실용수",
id: "cleanToilUswtr",
title: "청소화장실용수",
row:1,
},
{
id:"세척살수용수",
id:"resn",
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
+46 -60
View File
@@ -3,47 +3,54 @@ import type { TableUpperProps } from "../../common/type/header";
import { rainStatHeadListExport } from "./headList";
export type RainStatProps = {
ctpvCd : string //시도
sggCd : string //시군구
areaNm : string //행정구역명
bdstNm : string //시설명
bdstUsgCd : string //건축물용도코드
daddr : string //주소
lawTrgtYn : string //법적의무대상여부
instlCmptnDt : string //설치완료일자
instlCst : number //설치비용
pntfColKnd : string //접수면종류
filtrTrtmfctYn : string //여과등처리시설유무
archArea : number //건축연면적
dtfcltCpct : number //처리용량(저류조용량)
wtrUsqty : number //연간사용량
utztnUsgCd : string //이용용도코드
anlOperCst : number //연간운영비
annRnwtQty : number //물사용량
jungsudo : number //중수도​이용량
dachae : number //대체수​이용량
way1 : number //방법1
way2 : number //방법2
way3 : number //방법3
way4 : number //방법4
way5 : number //방법5
way6 : number //방법6
way7 : number //방법7
ctpvCd: string //시도
sggCd: string //시군구
areaNm: string //행정구역명
bdstNm: string //시설명
bdstUsgCd: string //건축물용도코드
daddr: string //주소
lawTrgtYn: string //법적의무대상여부
instlCmptnDt: string //설치완료일자
instlCst: number //설치비용
pntfColKnd: string //접수면종류
filtrTrtmfctYn: string //여과등처리시설유무
archArea: number //건축연면적
dtfcltCpct: number //처리용량(저류조용량)
wtrUsqty: number //연간사용량
utztnUsgCd: string //이용용도코드
anlOperCst: number //연간운영비
annRnwtQty: number //물사용량
jungsudo: number //중수도​이용량
dachae: number //대체수​이용량
lndwtr: number //조경용수
cleanToilUswtr: number //청소화장실용수
resn: number //세척살수용수
farmUswtr: number //농업용수
indstUswtr: number //공업용수
hydUswtr: number //친수용수
ithlEtcUswtr: number //기타
tmp: number //개소
guideStats: GuideStatProps[]
}
const fetchRainStatList = async (year:string) => {
const res = await getFetch(fetchType.WR,`/reuseChk/rainy/stat/${year}`)
export type GuideStatProps = {
utztnUsgCd: string
ruseFcltUtztnQnt: number
}
const fetchRainStatList = async (year: string) => {
const res = await getFetch(fetchType.WR, `/reuseChk/rainy/stat/${year}`)
return res;
}
type rainStatActions = {
searchRainStatList : (year:string) => void
searchRainStatList: (year: string) => void
}
export type rainStatState = {
rainStat: {
rainStatHeadList:TableUpperProps[],
rainStatList : RainStatProps[]
rainStatHeadList: TableUpperProps[],
rainStatList: RainStatProps[]
}
}
@@ -51,38 +58,16 @@ export type rainStatType = rainStatState & rainStatActions;
export const rainStatExport: rainStatState = {
rainStat: {
rainStatHeadList:rainStatHeadListExport,
rainStatList : []
rainStatHeadList: rainStatHeadListExport,
rainStatList: []
}
}
export const rainStatActionsExport = (
set: (fn: (state: rainStatState) => rainStatState) => void
) => {
return {
searchRainStatList : async (year:string) => {
searchRainStatList: async (year: string) => {
const res = await fetchRainStatList(year);
<<<<<<< Updated upstream
const rainStatList: never[] = [];
/* const rainStatHeadList = data.map((item:RainStatProps) => ({
...item,
ctpvCd:item.ctpvCd,
sggCd:item.sggCd,
areaNm:item.areaNm,
archArea:item.archArea,
dtfcltCpct:item.dtfcltCpct,
annRnwtQty:item.annRnwtQty,
jungsudo:item.jungsudo,
dachae:item.dachae,
way1:item.way1,
way2:item.way2,
way3:item.way3,
way4:item.way4,
way5:item.way5,
way6:item.way6,
way7:item.way7,
yearMoney:item.yearMoney,
})) */
=======
let cityArr: any[] = [];
res.forEach((item: RainStatProps) => {
@@ -116,21 +101,22 @@ export const rainStatActionsExport = (
if (headItem.title == guide.utztnUsgCd) {
if (!obj[headItem.id] || typeof obj[headItem.id] !== "number") obj[headItem.id] = 0;
if (typeof obj[headItem.id] === "number") {
obj[headItem.id] += guide.ruseFcltUtztnQnt;
console.log("obj", obj)
}
}
});
})
}
})
>>>>>>> Stashed changes
set((state: rainStatState) => ({
rainStat: {
...state.rainStat,
rainStatList: rainStatList,
rainStatList: cityArr,
}
}));
}
}
}
}