84 lines
2.0 KiB
TypeScript
84 lines
2.0 KiB
TypeScript
"use client";
|
|
|
|
import { useWrStore } from "@/app/store";
|
|
import type { rateFeeType } from "@/app/store/common/searchCode/type";
|
|
import { coModalHeadListExport } from "@/app/store/matDmd/coMatRvw/headList";
|
|
import { yearOptions } from "@/components/lib/func/commom";
|
|
import { SelectBox, UiTable } from "@common/business_components/ui";
|
|
import { Label } from "@common/components/ui";
|
|
import { useEffect, useState } from "react";
|
|
|
|
export function RateFeeTableModal({ setReturnData}: { setReturnData: (data: any) => void }) {
|
|
const [year, setYear] = useState<string>(String(new Date().getFullYear()));
|
|
|
|
const { rateFeeRes,getRateFee } = useWrStore((state) => state);
|
|
|
|
useEffect(() => {
|
|
|
|
|
|
getRateFee(year)
|
|
},[year,getRateFee])
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
let tableData = []
|
|
const data = rateFeeRes.reduce((acc: any,cur:rateFeeType) =>{
|
|
const key = cur.stdCost;
|
|
|
|
|
|
let target = acc.find((item: any) => item.stdCost === key);
|
|
|
|
if(!target){
|
|
target={
|
|
gubun: cur.stdCost,
|
|
BD: 0,
|
|
WD: 0,
|
|
SE: 0,
|
|
CE: 0,
|
|
}
|
|
acc.push(target);
|
|
}
|
|
|
|
target[cur.incExpCd] = cur.rt;
|
|
|
|
return acc
|
|
},[])
|
|
|
|
console.log('data : ', data);
|
|
|
|
},[rateFeeRes])
|
|
|
|
|
|
|
|
return (
|
|
<>
|
|
<div className="sticky top-0 z-10 bg-white pb-4">
|
|
<h3 className="text-2xl font-medium text-label">요율표 보기</h3>
|
|
<hr />
|
|
<div className="flex items-center">
|
|
<Label className="text-xl text-gray-600">기준년도</Label>
|
|
<SelectBox
|
|
className="h-full text-2xl"
|
|
label=""
|
|
selectClass={"ml-4"}
|
|
selectArray={yearOptions}
|
|
value={year}
|
|
onSelectValue={(val: string | number) => setYear(String(val))}
|
|
/>
|
|
</div>
|
|
<UiTable
|
|
headName={""}
|
|
tableData={[]}
|
|
headlist={coModalHeadListExport}
|
|
onPageChange={() => {}}
|
|
pageSize={0}
|
|
total={0}
|
|
cellClick={undefined}
|
|
/>
|
|
</div>
|
|
</>
|
|
);
|
|
}
|