wr: 빗물사용시설 excel 천단위 처리

This commit is contained in:
dongsilove
2026-03-03 23:23:00 +09:00
parent 9cf73141df
commit aa05cb5d73
3 changed files with 204 additions and 115 deletions
@@ -9,10 +9,11 @@ import type {
} from "@/app/store/ruseFcltMng/fcltReg/rainReg";
import { rainSttnSize } from "@/app/store/ruseFcltMng/fcltSttn/rainSttn";
import {
excelDownload,
excelDownloadStyle,
getCity,
tableData,
} from "@/components/lib/func/commom";
import { type SheetParameter } from "@common/business_components/ui";
import type { objSearchType } from "@/components/ui/modal/fcltReg/bdstRegModal/bdstRegModal";
import HeadChModal from "@/components/ui/modal/sttn/headChModal/headChModal";
import SttnDetailModal from "@/components/ui/modal/sttn/sttnDetailModal/sttnDetailModal";
@@ -158,11 +159,19 @@ export default function RainSttn() {
return;
}
if (rainSttn.excelList.length > 0) {
excelDownload(
rainSttn.excelList,
const sheetArray: SheetParameter[] = [{
data: rainSttn.excelList,
headerNum: 3,
headerRange: "A1:W3",
sheetName: 'sheet1',
writeLine: 4,
startCol: 'A',
decimalArray0: [6,10,12,14,16]
}];
excelDownloadStyle(
"빗물이용시설 현황",
"sample_rainSttn.xlsx",
"A1:W3"
"sample_rainSttn.xlsx", // public 폴더에 있는 template 파일 경로
sheetArray
);
} else {
toast.error(t("excelDownErrMsg"));
+23
View File
@@ -2,11 +2,14 @@ import { lwCds, type comCodeState } from "@/app/store/common/code";
import {
filePickedBlob,
filePickedBlobArray,
filePickedBlobArrayFormat,
filePickedBlobNumStyle,
type ReturnType,
type SelectDataType,
type SheetParameter,
} from "@common/business_components/ui";
import { Button } from "@common/components/ui";
import { write } from "fs";
import moment from "moment";
import type { RefObject } from "react";
import toast from "react-hot-toast";
@@ -100,6 +103,26 @@ export const excelDownload = (
});
};
export const excelDownloadStyle = (
// excelList: [][],
fileNm: string,
sampleFile: string,
sheetArray: SheetParameter[]
) => {
// if (excelList.length === 0) return;
fetch(`/${sampleFile}`, {}).then(async (response) => {
if (!response.ok) {
throw Error(response.statusText);
}
// 받은 파일 바인너리 처리
const blobRet = await response.arrayBuffer();
// 버퍼에 있는 엑셀데이터 전달 후 json으로 변환
// await filePickedBlob(blobRet, excelList, fileNm, writeLine, headerRange);
await filePickedBlobNumStyle(blobRet, fileNm, sheetArray);
});
};
export const excelArrayDownload = (
fileNm: string,
sampleFile: string,