빗물재이용통계 데이터 나타내기 완료
This commit is contained in:
@@ -32,43 +32,43 @@ export const rainStatHeadListExport: TableUpperProps[] = [
|
||||
rowSpan:2
|
||||
},
|
||||
{
|
||||
id: "이용용도",
|
||||
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,
|
||||
},
|
||||
|
||||
@@ -3,37 +3,43 @@ 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
|
||||
tmp : number //개소
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -62,74 +68,56 @@ export const rainStatActionsExport = (
|
||||
return {
|
||||
searchRainStatList: async (year: string) => {
|
||||
const res = await fetchRainStatList(year);
|
||||
const rainStatList: RainStatProps[] = [];
|
||||
|
||||
const grouped = Object.groupBy(res, (item: RainStatProps) => item.ctpvCd);
|
||||
console.log("grouped", grouped);
|
||||
|
||||
Object.values(grouped).forEach((item) => {
|
||||
if (!item) return;
|
||||
let ctpvCd = "";
|
||||
let instlCst = 0;
|
||||
let tmp = 0; //개소
|
||||
let dtfcltCpct = 0; //설치비용
|
||||
let wtrUsqty = 0; //연간사용량
|
||||
let anlOperCst = 0; //연간운영비
|
||||
let way1 = 0;
|
||||
let way2 = 0;
|
||||
let way3 = 0;
|
||||
let way4 = 0;
|
||||
let way5 = 0;
|
||||
let way6 = 0;
|
||||
let way7 = 0;
|
||||
|
||||
item.forEach((element) => {
|
||||
ctpvCd = element.ctpvCd;
|
||||
instlCst += element.instlCst;
|
||||
tmp += 1;
|
||||
dtfcltCpct += element.dtfcltCpct;
|
||||
wtrUsqty += element.wtrUsqty;
|
||||
anlOperCst += element.anlOperCst;
|
||||
way1 += element.way1;
|
||||
way2 += element.way2;
|
||||
way3 += element.way3;
|
||||
way4 += element.way4;
|
||||
way5 += element.way5;
|
||||
way6 += element.way6;
|
||||
way7 += element.way7;
|
||||
|
||||
})
|
||||
let cityArr: any[] = [];
|
||||
res.forEach((item: RainStatProps) => {
|
||||
|
||||
rainStatList.push({
|
||||
instlCst,
|
||||
tmp,
|
||||
dtfcltCpct,
|
||||
wtrUsqty,
|
||||
anlOperCst,
|
||||
way1,
|
||||
way2,
|
||||
way3,
|
||||
way4,
|
||||
way5,
|
||||
way6,
|
||||
way7,
|
||||
ctpvCd,
|
||||
// sggCd: "",
|
||||
// areaNm: "",
|
||||
// bdstNm: "",
|
||||
// archArea: 0,
|
||||
// annRnwtQty: 0,
|
||||
// jungsudo: 0,
|
||||
// dachae: 0
|
||||
let obj = cityArr.find((e) => {
|
||||
return e.ctpvCd == item.ctpvCd
|
||||
})
|
||||
|
||||
if (obj) {
|
||||
obj.instlCst += item.instlCst
|
||||
obj.dtfcltCpct += item.dtfcltCpct
|
||||
obj.wtrUsqty += item.wtrUsqty
|
||||
obj.anlOperCst += item.anlOperCst
|
||||
obj.tmp += 1
|
||||
} else {
|
||||
obj = {};
|
||||
obj.ctpvCd = item.ctpvCd
|
||||
obj.instlCst = item.instlCst
|
||||
obj.tmp = 1
|
||||
obj.dtfcltCpct = item.dtfcltCpct
|
||||
obj.wtrUsqty = item.wtrUsqty
|
||||
obj.anlOperCst = item.anlOperCst
|
||||
|
||||
cityArr.push(obj)
|
||||
}
|
||||
|
||||
if (item.guideStats && item.guideStats.length > 0) {
|
||||
item.guideStats.forEach((guide: GuideStatProps) => {
|
||||
rainStatHeadListExport.forEach((headItem: TableUpperProps) => {
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
set((state: rainStatState) => ({
|
||||
rainStat: {
|
||||
...state.rainStat,
|
||||
rainStatList: rainStatList,
|
||||
rainStatList: cityArr,
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user