From 0ed64cf896ad5b18dbee958aaa7fec17ffd9dfa9 Mon Sep 17 00:00:00 2001 From: joonhoekim <26rote@gmail.com> Date: Wed, 3 Sep 2025 01:37:09 +0000 Subject: (김준회) basic-info-client 에서 매출정보 컴포넌트 분리 적용 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/vendor-basic-info/basic-info-client.tsx | 248 ++-------------------------- 1 file changed, 11 insertions(+), 237 deletions(-) (limited to 'lib') diff --git a/lib/vendor-basic-info/basic-info-client.tsx b/lib/vendor-basic-info/basic-info-client.tsx index fbf19fe9..0ef9f940 100644 --- a/lib/vendor-basic-info/basic-info-client.tsx +++ b/lib/vendor-basic-info/basic-info-client.tsx @@ -29,14 +29,7 @@ import { fetchVendorRegistrationStatus } from "@/lib/vendor-regular-registration import { getVendorAttachmentsByType, getVendorPeriodicGrade, getVendorTypeInfo } from "@/lib/vendor-info/service"; import { useCreditIntegration } from "./use-credit-integration"; // downloadFile은 동적으로 import -import { - Table, - TableBody, - TableCell, - TableHead, - TableHeader, - TableRow, -} from "@/components/ui/table"; +import { SalesInfoTable } from "./sales-info-table"; interface BasicInfoClientProps { initialData: VendorData | null; @@ -337,9 +330,7 @@ export default function BasicInfoClient({ bestResult, getCurrentResult, handleCreditServiceChange, - transformCreditToSalesData, creditServices, - reload: reloadCreditData } = useCreditIntegration(vendorId); // 다이얼로그 상태 @@ -1224,235 +1215,18 @@ export default function BasicInfoClient({ {/* 매출정보 */} - {/* 신용평가사 선택 */} -
-
- 신용평가사 데이터 - {creditLoading && ( -
-
- 로딩 중... -
- )} -
- -
- - - {getCurrentResult() && ( -
- 선택됨: {getCurrentResult()?.name} - {selectedCreditService === 'auto' && bestResult && ( - ({bestResult.dataCount}개 항목으로 자동선택) - )} -
- )} - - {creditError && ( -
- {creditError} -
- )} - - {!creditLoading && !creditError && creditResults.length > 0 && !getCurrentResult()?.data && ( -
- 신용평가 데이터가 없습니다 -
- )} -
-
- - {/* 테이블 */} - - - - - 기준일 - - - 자산 구성 - - - 영업이익 -
- (백만원) -
- - 당기순이익 -
- (백만원) -
- - 부채비율 -
- (%) -
- - 차입금의존도 -
- (%) -
- - 영업이익률 -
- (%) -
- - 순이익률 -
- (%) -
- - 매출액증감 -
- (%) -
- - 유동비율 -
- (%) -
-
- - 총자산 - - 부채총계 - - - 자본총계 - - -
- - {(() => { - // 신용평가사 데이터 우선 사용, 없으면 기존 데이터 사용 - const currentResult = getCurrentResult(); - const creditTransformedData = currentResult?.data ? transformCreditToSalesData(currentResult.data) : null; - - const salesData = creditTransformedData?.salesInfo || initialData.salesInfo || {}; - const metricsData = creditTransformedData?.calculatedMetrics || initialData.calculatedMetrics || {}; - - // 실제 데이터에서 연도 추출 (고정 연도 사용하지 않음) - let years = Object.keys(salesData).sort().reverse().slice(0, 3); - - // 데이터가 없는 경우 빈 행 3개 생성 - if (years.length === 0) { - years = ["", "", ""]; - } - - // 3개 미만인 경우 빈 행으로 채우기 - while (years.length < 3) { - years.push(""); - } - - return years.map((dateKey, index) => { - const formattedDate = dateKey; // YYYYMMDD 형식으로 표시 (빈 문자열일 수 있음) - const yearSalesData = salesData[dateKey]; - const yearMetricsData = metricsData[dateKey]; - - return ( - - - {formattedDate} - - - {yearSalesData && yearSalesData.totalDebt && yearSalesData.totalEquity - ? ( - parseInt(yearSalesData.totalDebt.replace(/,/g, "")) + - parseInt(yearSalesData.totalEquity.replace(/,/g, "")) - ).toLocaleString() - : "-"} - - - {yearSalesData?.totalDebt || "-"} - - - {yearSalesData?.totalEquity || "-"} - - - {yearSalesData?.operatingProfit || "-"} - - - {yearSalesData?.netIncome || "-"} - - - {yearMetricsData?.debtRatio ? yearMetricsData.debtRatio.toFixed(1) : "-"} - - - {yearMetricsData?.borrowingDependency ? yearMetricsData.borrowingDependency.toFixed(1) : "-"} - - - {yearMetricsData?.operatingMargin ? yearMetricsData.operatingMargin.toFixed(1) : "-"} - - - {yearMetricsData?.netMargin ? yearMetricsData.netMargin.toFixed(1) : "-"} - - - {yearMetricsData?.salesGrowth ? yearMetricsData.salesGrowth.toFixed(1) : "-"} - - - {yearMetricsData?.currentRatio ? yearMetricsData.currentRatio.toFixed(1) : "-"} - - - ); - }); - })()} - -
- + } /> -- cgit v1.2.3