diff --git a/apps/wr/app/store/common/searchCode/index.ts b/apps/wr/app/store/common/searchCode/index.ts
index 5454c1b74..b572307f5 100644
--- a/apps/wr/app/store/common/searchCode/index.ts
+++ b/apps/wr/app/store/common/searchCode/index.ts
@@ -57,13 +57,15 @@ export type comFcltState = {
rateFeeRes:rateFeeType[],
};
- type comFcltActions = {
+type comFcltActions = {
getSwtrmtFcltNm: (searchNm: string) => void;
getDemandCompList: (searchNm: string, cnt: number) => void;
regDemandCompany: (data: DemandCompType) => Promise;
updateDemandCompany: (data: DemandCompType) => Promise;
getConstCostFee: (year: string) => void;
getRateFee: (year: string) => void;
+ getConstCostFeeRtn: (year: string) => conCostFeeType[];
+ getRateFeeRtn: (year: string) => rateFeeType[];
};
export const comFcltSearchAction: (set: any) => comFcltActions = (set: any) => {
@@ -168,6 +170,18 @@ export const comFcltSearchAction: (set: any) => comFcltActions = (set: any) => {
console.log(" error ", e);
}
},
+ // 요율정보 조회 : ONSEMIRO_NEW.EM_STD_COST_INC_EXP_RT 설치관리표준사업비 부대경비요율
+ // 팝업에서 연도 변경하여 볼 수 있도록 데이터를 return한다.
+ getRateFeeRtn: async (year: string) => {
+ try {
+ const url = `/prcsFclt/CstRt/${year}`;
+ const rateFeeRes = await getFetch(fetchType.COMMON, url);
+
+ return rateFeeRes;
+ } catch (e) {
+ console.log(" error ", e);
+ }
+ },
// 공사금액 (공사비 산정표) 조회 : ONSEMIRO_NEW.EM_STD_COST_REUSE 설치관리표준사업비 재이용시설 공사비
getConstCostFee: async (year: string) => {
try {
@@ -185,6 +199,17 @@ export const comFcltSearchAction: (set: any) => comFcltActions = (set: any) => {
console.log('getConstCostFee ', e)
}
+ },
+ // 공사금액 (공사비 산정표) 조회 : ONSEMIRO_NEW.EM_STD_COST_REUSE 설치관리표준사업비 재이용시설 공사비
+ getConstCostFeeRtn: async (year: string) => {
+ try {
+ const url = `/prcsFclt/CstRuse/${year}`;
+ const constCost = await getFetch(fetchType.COMMON, url);
+ return constCost;
+ } catch (e) {
+ console.log('getConstCostFee ', e)
+ }
+
}
};
};
diff --git a/apps/wr/components/ui/form/coMat/conCostForm/conCostForm.tsx b/apps/wr/components/ui/form/coMat/conCostForm/conCostForm.tsx
index 68ef09abf..85b2cfaf1 100644
--- a/apps/wr/components/ui/form/coMat/conCostForm/conCostForm.tsx
+++ b/apps/wr/components/ui/form/coMat/conCostForm/conCostForm.tsx
@@ -136,8 +136,7 @@ export default function ConCostForm({
String(useUsgCdWatch ?? "");
useEffect(() => {
- const calculatedTotalConstCost =
- Number(prcsFcltCpctCstrnCst) + Number(fcltSbsdCstrnCst);
+ const calculatedTotalConstCost = Number(prcsFcltCpctCstrnCst) + Number(fcltSbsdCstrnCst);
if ((totalConstCost ?? 0) !== calculatedTotalConstCost) {
activeForm.setValue("totalConstCost", calculatedTotalConstCost);
@@ -197,7 +196,7 @@ export default function ConCostForm({
const firstProc = getConstFctCode(usgPrcsProcs?.split("+")[0] || "") || ""; // 첫번째 공정
const secondProc = getConstFctCode(usgPrcsProcs?.split("+")[1] || "") || ""; // 두번째 공정
- // 첫번째 처리공정 코드에 해당하는 표준공사비 테이블이서 요구수량을 감싸는 하한/상한 구간을 찾는 부분이다.
+ // 첫번째 처리공정 코드에 해당하는 표준공사비 테이블에서 요구수량을 감싸는 하한/상한 구간을 찾는 부분이다.
const { lower: firstLower, upper: firstUpper } = findBounds(
constCostRes, // 표준공사비
firstProc || "",
@@ -559,7 +558,7 @@ export default function ConCostForm({
>
}
- bodyClassName={"w-fit max-w-[40vw]"}
+ bodyClassName={"w-fit max-w-[400] overflow-x-auto"}
>
>
}
- bodyClassName={"w-[22vw]"}
+ bodyClassName={"w-fit max-w-[100] overflow-x-auto"}
>
state);
+ const { coRvw, constCostRes, getConstCostFeeRtn } = useWrStore((state) => state);
const [constCostData, setConstCostData] = useState([]);
- const 기준년도 = constCostRes?.[0]?.yr ?? "";
+ const [selectedYear, setSelectedYear] = useState(String(new Date().getFullYear()));
+ // 연도 선택을 위한 옵션 생성 (예: 현재 연도부터 10년 전까지)
+ const yearOptions = Array.from({ length: 10 }, (_, i) => {
+ const year = new Date().getFullYear() - i;
+ return { val: String(year), text: String(year) };
+ });
- const getFctDescription = (fctCd: string) => {
- const fctMap: { [key: string]: string } = {
- "001": "총인처리시설",
- "002": "염소소독",
- "003": "UV소독",
- "004": "전처리시설",
- "005": "RO",
- };
-
- return fctMap[fctCd];
- }
- useEffect(() => {
+ const fetchData = async (constCostRes: conCostFeeType[]) => {
const tableData = constCostRes?.reduce(
(acc: ContCostMap[], cur: conCostFeeType) => {
const key = cur.fctCd;
@@ -64,21 +58,64 @@ export function ConstCostFeeTable() {
gubun: getFctDescription(item.gubun) || item.gubun,
};
});
- setConstCostData(formattedTableData);
+
+ return formattedTableData;
+ };
+
+ const getFctDescription = (fctCd: string) => {
+ const fctMap: { [key: string]: string } = {
+ "001": "총인처리시설",
+ "002": "염소소독",
+ "003": "UV소독",
+ "004": "전처리시설",
+ "005": "RO",
+ };
+
+ return fctMap[fctCd];
+ }
+
+ useEffect(() => {
+ const fetchConstCost = async () => {
+ const data = await fetchData(constCostRes);
+ setConstCostData(data);
+ };
+ fetchConstCost();
}, [constCostRes]);
+ useEffect(() => {
+ const fetchConstCost = async () => {
+ if (selectedYear) {
+ const result = await getConstCostFeeRtn(selectedYear);
+ if (result && result.length > 0) {
+ const data = await fetchData(result);
+ setConstCostData(data);
+ } else {
+ alert(selectedYear+'년 데이터가 없습니다.');
+ }
+ }
+ }
+ fetchConstCost();
+ }, [selectedYear]);
+
return (
- <>
- {/* */}
-
-
+
+
+
공사비 산정표 보기
-
+
-
- {기준년도}
+
+ setSelectedYear(String(val))
+ }
+ />
단위: 백만원
@@ -91,7 +128,10 @@ export function ConstCostFeeTable() {
cellClick={undefined}
onPageChange={() => { }}
/>
-
- >
+
+ 시설용량 구간내 공사비는 직선보간법에 의하여 산출
+
+
+
);
}
diff --git a/apps/wr/components/ui/modal/coMat/rateFeeModal.tsx b/apps/wr/components/ui/modal/coMat/rateFeeModal.tsx
index 9118f8127..5439d489c 100644
--- a/apps/wr/components/ui/modal/coMat/rateFeeModal.tsx
+++ b/apps/wr/components/ui/modal/coMat/rateFeeModal.tsx
@@ -2,15 +2,24 @@
import { useWrStore } from "@/app/store";
import type { rateFeeType } from "@/app/store/common/searchCode/type";
-import { UiTable } from "@common/business_components/ui";
+import { SelectBox, UiTable } from "@common/business_components/ui";
import ListDiv from "@common/business_components/ui/list_div";
import { Label } from "@common/components/ui";
import { useEffect, useState } from "react";
export function RateFeeTableModal() {
- const { coRvw, rateFeeRes } = useWrStore((state) => state);
- const [reateFeeTable, setRateFeeTable] = useState([]);
- const 기준년도 = rateFeeRes?.[0]?.yr ?? "";
+ const { coRvw, rateFeeRes, getRateFeeRtn } = useWrStore((state) => state);
+ const [rateFeeTable, setRateFeeTable] = useState([]);
+ const [selectedYear, setSelectedYear] = useState(String(new Date().getFullYear()));
+
+ // 연도 선택을 위한 옵션 생성 (예: 현재 연도부터 10년 전까지)
+ const yearOptions = Array.from({ length: 10 }, (_, i) => {
+ const year = new Date().getFullYear() - i;
+ return { val: String(year), text: String(year) };
+ });
+
+ // const 기준년도 = rateFeeRes?.[0]?.yr ?? selectedYear; // 실제 데이터의 기준년도 또는 선택된 연도
+ // setSelectedYear(rateFeeRes?.[0]?.yr ?? selectedYear);
const gubunLabelMap: Record = {
50: "5천만원까지",
@@ -32,6 +41,11 @@ export function RateFeeTableModal() {
500000: "5000억원까지",
};
+ /**
+ * rateFeeRes 데이터를 가공하여 테이블에 표시하기 적합한 형태로 변환합니다.
+ * - 'SS' 코드를 제외하고, stdCost 기준으로 그룹화하여 BD, SE, CE 요율을 컬럼으로 피벗합니다.
+ * - gubunLabelMap을 사용하여 stdCost에 해당하는 한글 라벨을 추가합니다.
+ */
const fetchData = async (rateFeeRes: rateFeeType[]) => {
const data = await rateFeeRes
?.filter((item: rateFeeType) => {
@@ -65,40 +79,68 @@ export function RateFeeTableModal() {
useEffect(() => {
if (rateFeeRes?.length >= 0) {
+ setSelectedYear(rateFeeRes?.[0]?.yr ?? selectedYear);
fetchData(rateFeeRes).then((data) => {
setRateFeeTable(data);
});
}
}, [rateFeeRes]);
- return (
- <>
-
-
-
- 요율표 보기
-
-
+ // 컴포넌트 마운트 시 또는 선택된 연도가 변경될 때 데이터 조회
+ useEffect(() => {
+ const fetchRateFee = async () => {
+ if (selectedYear) {
+ const result = await getRateFeeRtn(selectedYear);
+ if (result && result.length > 0) {
+ const data = await fetchData(result);
+ setRateFeeTable(data);
+ } else {
+ alert(selectedYear+'년 데이터가 없습니다.');
+ }
+ }
+ }
+ fetchRateFee();
+ }, [selectedYear]);
-
-
- {기준년도}
-
-
- {}}
- pageSize={0}
- total={0}
- cellClick={undefined}
- />
-
+ return (
+
+
+
+ 시설부대경비 요율(%)
+
+
+
+
+
+ setSelectedYear(String(val))
+ }
+ />
-
- >
+
+ {}}
+ pageSize={0}
+ total={0}
+ cellClick={undefined}
+ />
+
+
+ 출처 : 하수도분야 보조금 편성 및 실무요령
+
+ 시설부대경비 및 감리비 요율적용시 공사비가 요율표의 중간에 있을 때는 직선보간법에 의하여 산출
+
+
+
);
}
diff --git a/packages/common/business_components/src/ui/popover_ui/index.tsx b/packages/common/business_components/src/ui/popover_ui/index.tsx
index 39094bc24..bc7cb0b76 100644
--- a/packages/common/business_components/src/ui/popover_ui/index.tsx
+++ b/packages/common/business_components/src/ui/popover_ui/index.tsx
@@ -13,7 +13,7 @@ export default function PopoverUi({
<>
{childrenTriger}
-
+ e.preventDefault()}>
{childrenBody}