feat: 침입수분석결과, RDII 분석결과 파일 다운로드 시 헤더명 영어 -> 한글 변경

This commit is contained in:
swcho
2025-06-26 10:47:39 +09:00
parent 1ec052cdc7
commit d4c58a19df
2 changed files with 28 additions and 10 deletions
@@ -1,6 +1,6 @@
'use client'
import { deleteData, getData } from '@/components/lib/api'
import { UiTable, downloadExcel } from '@common/business_components/ui'
import { UiTable, downloadExcelWithKoreanHeaders } from '@common/business_components/ui'
import { zodResolver } from '@hookform/resolvers/zod'
import { useState } from 'react'
import { useForm } from 'react-hook-form'
@@ -138,14 +138,23 @@ const Result = () => {
// 선택된 행 데이터를 Excel 다운로드 형식으로 변환
const excelData = data.content; // 배열로 감싸서 전달
// 파일명 생성 (분석번호 기반)
const fileName = `RDII분석결과_${selectedRowData.rainInfwtAnlsSn}_${selectedRowData.aplcnYm}`;
// 헤더 매핑 정의
const headerMapping: { [key: string]: string } = {
'rainInfwtAnlsSn': 'RDII분석\n일련번호',
'pplMngNo': '관로\n관리번호',
'anlsTm': '분석시각',
'predcOilq': '예측유량'
};
downloadExcel({
// 파일명 생성 (분석번호 기반)
const fileName = `RDII분석결과_${selectedRowData.swageTmplntNm}_${selectedRowData.aplcnYm}_${selectedRowData.rainInfwtAnlsSn}`;
await downloadExcelWithKoreanHeaders({
data: excelData as JSON[],
fileName: fileName,
sheetNameArray: ["RDII 분석결과"],
headerRange: "A1:D1" // 테이블 컬럼 수에 맞춰 조정
headerRange: "A1:D1",
headerMapping: headerMapping
});
setIsLoadingResult(false);
} catch (error) {
@@ -1,6 +1,6 @@
'use client'
import { deleteData, getData } from '@/components/lib/api'
import { UiTable, downloadExcel } from '@common/business_components/ui'
import { UiTable, downloadExcelWithKoreanHeaders } from '@common/business_components/ui'
import { zodResolver } from '@hookform/resolvers/zod'
import { useState } from 'react'
import { useForm } from 'react-hook-form'
@@ -137,14 +137,23 @@ const Result = () => {
// 선택된 행 데이터를 Excel 다운로드 형식으로 변환
const excelData = data.content; // 배열로 감싸서 전달
// 파일명 생성 (분석번호 기반)
const fileName = `침입수분석결과_${selectedRowData.inftwtAnlsSn}_${selectedRowData.aplcnYm}`;
// 헤더 매핑 정의
const headerMapping: { [key: string]: string } = {
'inftwtAnlsSn': '침입수분석\n일련번호',
'pplMngNo': '관로\n관리번호',
'anlsTm': '분석시각',
'predcOilq': '예측유량'
};
downloadExcel({
// 파일명 생성 (분석번호 기반)
const fileName = `침입수분석결과_${selectedRowData.swageTmplntNm}_${selectedRowData.aplcnYm}_${selectedRowData.inftwtAnlsSn}`;
await downloadExcelWithKoreanHeaders({
data: excelData as JSON[],
fileName: fileName,
sheetNameArray: ["침입수 분석결과"],
headerRange: "A1:D1" // 테이블 컬럼 수에 맞춰 조정
headerRange: "A1:D1",
headerMapping: headerMapping
});
setIsLoadingResult(false);
} catch (error) {