지도점검 현황 작업중

This commit is contained in:
leedj312
2025-05-19 09:47:23 +09:00
parent 1466e04638
commit 7da488dbbf
19 changed files with 735 additions and 416 deletions
@@ -97,6 +97,10 @@ export default function ChkgdExcel({ type }: { type: string }) {
};
}
});
console.log("total data ", totalData)
console.log("polutionData data ", polutionData)
const guideKey = new Set(guideData.map(keyGenerator));
const onlypolution = polutionData.filter(
@@ -107,8 +111,7 @@ export default function ChkgdExcel({ type }: { type: string }) {
...totalData,
...onlypolution
]
setExcelRswtData(listTotalData);
setExcelRswtData(listTotalData);
}
});
}
@@ -10,9 +10,8 @@ import type { z } from "zod";
import React from "react";
export default function ChkgdModal({ type, obj }: { type: string; obj: any }) {
const { rainChkgdn, rainChkGuidUpdate ,rwstUpdatePolAndGuide } = useWrStore(
(state) => state
);
const { rainChkgdn, rswtChkgdn, rainChkGuidUpdate, rwstPolAndGuideUpdate } =
useWrStore((state) => state);
const [guidData, setGuidData] = useState<splRuseWaterType[]>();
const [polutionData, setPolutionData] = useState<Record<string, any[]>>({
@@ -28,12 +27,6 @@ export default function ChkgdModal({ type, obj }: { type: string; obj: any }) {
"4": [] as z.infer<typeof rswtrPolutionsZode>[],
});
const rswtnodeList = headMakeprfmnc(
rainChkgdn?.rswtDetailHeadList,
rainChkgdn?.rainHeadNm
);
const { rainChk, ruseHeadList, splHeadList } = rainChkgdn;
const [updateData, setUpdateData] = useState<splRuseWaterType[]>();
@@ -79,17 +72,19 @@ export default function ChkgdModal({ type, obj }: { type: string; obj: any }) {
}, []);
setGuidData(result);
if (obj.rswtrPollution) {
if (obj.rswtrPollutions) {
const resultPolution: Record<string, any[]> = {
"1": [],
"2": [],
"3": [],
"4": [],
};
obj.rswtrPollution.forEach((item: z.infer<typeof rswtrPolutionsZode>) => {
const nodeKey = String(item.node);
resultPolution[nodeKey]?.push(item);
});
obj.rswtrPollutions.forEach(
(item: z.infer<typeof rswtrPolutionsZode>) => {
const nodeKey = String(item.node);
resultPolution[nodeKey]?.push(item);
}
);
// 각 노드에 대해 합계/평균 추가
Object.entries(resultPolution).forEach(([nodeKey, items]) => {
@@ -135,7 +130,6 @@ export default function ChkgdModal({ type, obj }: { type: string; obj: any }) {
}
}, [obj]);
const setChGuidData = (data: splRuseWaterType[]) => {
if (data.length > 0) {
setUpdateData(data);
@@ -152,10 +146,6 @@ export default function ChkgdModal({ type, obj }: { type: string; obj: any }) {
);
const month = item.ym?.slice(4);
if (month === undefined || month === null) {
console.log("month ", month);
}
if (findObj) {
const ruseMonthKey = `ruse${month}` as keyof splRuseWaterType;
const splMonthKey = `spl${month}` as keyof splRuseWaterType;
@@ -172,39 +162,25 @@ export default function ChkgdModal({ type, obj }: { type: string; obj: any }) {
}
});
obj.guideDetails = realGuideDetail;
if(type ==='RNB'){
if (type === "RNB") {
rainChkGuidUpdate(obj);
}else{
const polution = Object.values(upPolutionData).flat() ;
obj.rswtrPollution = polution;
console.log("obj ", obj)
rwstUpdatePolAndGuide([obj]);
} else {
const polution = Object.values(upPolutionData)
.flat()
.filter((item) => item.utztnUsgCd !== "평균");
obj.rswtrPollutions = polution;
rwstPolAndGuideUpdate([obj]);
}
};
const getPolutionData = (data: z.infer<typeof rswtrPolutionsZode>[]) => {
console.log("data " ,data)
const getNode = Number(data[0]?.node)
const getPolutionData = (data: z.infer<typeof rswtrPolutionsZode>[]) => {
const getNode = Number(data[0]?.node);
setUpPolutionData((prevPolutionData) => ({
...prevPolutionData,
[getNode]: data,
}));
};
useEffect(() =>{
console.log('upPolutionData ', upPolutionData)
},[upPolutionData])
return (
<>
<div>
@@ -219,12 +195,15 @@ export default function ChkgdModal({ type, obj }: { type: string; obj: any }) {
</div>
<div className="flex justify-between">
<h3 className="text-2xl font-bold text-gray-900">
{"○" + "" + `(${"11"})`}
{"○" + "" + `(${obj.bdstNm})`}
</h3>
<Button className="" onClick={allDataUpdate}>
저장
</Button>
{!rainChkgdn.isSttn ? (
<Button className="" onClick={allDataUpdate}>
저장
</Button>
) : (
<></>
)}
</div>
<ScrollArea className="h-[60vh]">
@@ -269,7 +248,7 @@ export default function ChkgdModal({ type, obj }: { type: string; obj: any }) {
</div>
<GuideDetailsTable
chgRes={value}
headList={rainChkgdn?.rswtDetailHeadList}
headList={rswtChkgdn?.rswtDetailHeadList}
type={""}
setChGuidData={(data) => {
getPolutionData(data);
@@ -9,8 +9,9 @@ import type { customHtdflBdst } from "@/app/store/ruseFcltMng/fcltReg/htdflReg";
import { useWrStore } from "@/app/store";
import { useEffect, useState } from "react";
import type { CommonTableProps } from "@/app/store/common/type/headder";
import { rainChkTableData } from "@/components/lib/func/TableData";
import { rainChkTableData, rswtChkTableData } from "@/components/lib/func/TableData";
import { HeadMakeColSpan } from "@common/business_components/ui/table/HeadMakeColSpan";
import type { rswtChkZodType } from "@/app/store/prfmncReg/chkgdnReg/rswrtChkgdn";
export default function SttnDetailModal({
type,
@@ -19,7 +20,7 @@ export default function SttnDetailModal({
type: string;
formObj: any;
}) {
const { code, rainSttn, rswtSttn, rainSttnChkSearch } = useWrStore(
const { code, rainSttn, rswtSttn, rainSttnChkSearch,rswtChkPolAndGuide } = useWrStore(
(state) => state
);
const [detailData, setDetailData] = useState({
@@ -33,6 +34,7 @@ export default function SttnDetailModal({
rainSttnChkSearch(formObj.reuseBuilding[0].bdstRuseFcltPk);
} else if (type === "RST") {
// rswtChkPolAndGuide(formObj.reuseBuilding[0].bdstRuseFcltPk)
}
}, [type, formObj]);
@@ -62,7 +64,16 @@ export default function SttnDetailModal({
node:rainSttn.rainSttnDetailNodeList,
data: data,
});
} else if (type === "RST") {
} else if (type === "RST" && rswtSttn.rswtSttnRes) {
// const tableTotalData = rswtChkTableData(rswtSttn.rswtSttnRes as unknown as rswtChkZodType[]);
// setDetailData({
// head: rswtSttn.rswtSttHeadList,
// node:rswtSttn.rswtSttNodeList,
// // data: tableTotalData,
// });
}
}, [rainSttn.rainChkRes]);