wr: 시설부대경비 요율 수정
This commit is contained in:
@@ -8,30 +8,24 @@ import type {
|
||||
conCostFeeType,
|
||||
ContCostMap,
|
||||
} 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 ConstCostFeeTable() {
|
||||
const { coRvw, constCostRes } = useWrStore((state) => state);
|
||||
const { coRvw, constCostRes, getConstCostFeeRtn } = useWrStore((state) => state);
|
||||
|
||||
const [constCostData, setConstCostData] = useState<ContCostMap[]>([]);
|
||||
const 기준년도 = constCostRes?.[0]?.yr ?? "";
|
||||
const [selectedYear, setSelectedYear] = useState<string>(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 (
|
||||
<>
|
||||
{/* <ListDiv className="h-[calc(100vh-60vh)] overflow-auto"> */}
|
||||
<ListDiv className="overflow-visible">
|
||||
<h3 className="mt-4 ml-2 text-2xl font-medium text-label">
|
||||
<ListDiv className="min-w-[600px] h-[48vh] overflow-auto">
|
||||
<div className="p-4">
|
||||
<h3 className="text-2xl font-medium text-label">
|
||||
공사비 산정표 보기
|
||||
</h3>
|
||||
<hr />
|
||||
<hr className="mt-4 mb-4"/>
|
||||
<div className="col-span-5 flex items-center justify-between">
|
||||
<div className="flex items-center">
|
||||
<Label className="ml-2 mr-1 text-xl text-gray-600">기준년도</Label>
|
||||
<span>{기준년도}</span>
|
||||
<Label className="mr-1 text-xl text-gray-600">기준년도</Label>
|
||||
<SelectBox
|
||||
className="h-full w-32 text-2xl"
|
||||
label=""
|
||||
selectClass={""}
|
||||
selectArray={yearOptions}
|
||||
value={selectedYear}
|
||||
onSelectValue={(val) => setSelectedYear(String(val))
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
<span className="mr-2 text-xl text-gray-600">단위: 백만원</span>
|
||||
</div>
|
||||
@@ -91,7 +128,10 @@ export function ConstCostFeeTable() {
|
||||
cellClick={undefined}
|
||||
onPageChange={() => { }}
|
||||
/>
|
||||
</ListDiv>
|
||||
</>
|
||||
<div className="px-3 text-lg text-gray-700 leading-relaxed">
|
||||
시설용량 구간내 공사비는 직선보간법에 의하여 산출
|
||||
</div>
|
||||
</div>
|
||||
</ListDiv>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user