feat(est-test): 엑셀물량 파일목록(추가·삭제·열기), 셀 연결에서 목록 파일 쓰기

- 공사에 엑셀 물량 파일 담기(같은 이름 거부), 삭제, 내려받기
- 셀 수량 연결 창에서 목록 파일 고르기, 새 파일 연결 때 목록 등록

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-12 19:36:53 +09:00
co-authored by Claude Opus 5.5
parent b1c7d3dbc3
commit 3879de8b34
9 changed files with 156 additions and 7 deletions
+20 -7
View File
@@ -255,7 +255,7 @@ const EstQuantity = (() => {
const rows = state.project.tables.EstMainDat;
showDialog(
"Excel 셀 수량 반영",
`<div class="form-fields"><label>Excel 파일 <input type="file" accept=".xlsx" id="quantity-excel-file"></label><label>시트 이름 <input id="quantity-excel-sheet"></label><label>셀 주소 <input id="quantity-excel-cell" placeholder="B12"></label><label>내역 행 <select id="quantity-excel-target"><option value="">내역 행 선택</option>${rows.map((row, index) => (excelTarget(row) ? `<option value="${index}">${esc(row.Code || "코드 없음")} · ${esc(row.Name || "내역")} · ${index + 1}행</option>` : "")).join("")}</select></label><button data-quantity-excel-apply>연결 및 수량 반영</button><span id="quantity-excel-error" role="alert"></span></div><p>파일명·시트·셀 연결은 작업 JSON에 저장합니다. 저장된 숫자 값을 사용하므로 Excel 파일이 바뀌면 연결 관리에서 다시 선택하세요.</p>`,
`<div class="form-fields"><label>Excel 파일 <input type="file" accept=".xlsx" id="quantity-excel-file"></label><label>또는 엑셀물량 파일목록 <select id="quantity-excel-stored"><option value="">(고르지 않음)</option>${(state.project.excelFiles || []).map((f) => `<option>${esc(f.FileName)}</option>`).join("")}</select></label><label>시트 이름 <input id="quantity-excel-sheet"></label><label>셀 주소 <input id="quantity-excel-cell" placeholder="B12"></label><label>내역 행 <select id="quantity-excel-target"><option value="">내역 행 선택</option>${rows.map((row, index) => (excelTarget(row) ? `<option value="${index}">${esc(row.Code || "코드 없음")} · ${esc(row.Name || "내역")} · ${index + 1}행</option>` : "")).join("")}</select></label><button data-quantity-excel-apply>연결 및 수량 반영</button><span id="quantity-excel-error" role="alert"></span></div><p>파일명·시트·셀 연결은 작업 JSON에 저장합니다. 저장된 숫자 값을 사용하므로 Excel 파일이 바뀌면 연결 관리에서 다시 선택하세요.</p>`,
);
}
function excelUpdates(project, filename, files) {
@@ -486,7 +486,16 @@ const EstQuantity = (() => {
const project = state.project,
revision = state.revision,
fileInput = document.getElementById("quantity-excel-file"),
file = fileInput.files[0],
uploaded = fileInput.files[0] || null,
stored = (project.excelFiles || []).find(
(f) => f.FileName === document.getElementById("quantity-excel-stored")?.value,
),
file =
fileInput.files[0] ||
(stored && {
name: stored.FileName,
arrayBuffer: async () => EstExcelFiles.toBuffer(stored.data),
}),
name = document.getElementById("quantity-excel-sheet").value.trim(),
address = document.getElementById("quantity-excel-cell").value,
selected = document.getElementById("quantity-excel-target").value,
@@ -498,16 +507,14 @@ const EstQuantity = (() => {
project.tables.EstMainDat.filter((item) => item.PkID === row.PkID).length !== 1
)
throw Error("내역 행 식별자가 없거나 중복되어 연결할 수 없습니다.");
const files = await EstApp.api("/api/import-xlsx", {
method: "POST",
body: await file.arrayBuffer(),
}),
const bytes = await file.arrayBuffer(),
files = await EstApp.api("/api/import-xlsx", { method: "POST", body: bytes }),
value = excelCell(files, name, address);
if (
state.project !== project ||
state.revision !== revision ||
document.getElementById("quantity-excel-file") !== fileInput ||
fileInput.files[0] !== file ||
(fileInput.files[0] || null) !== uploaded ||
document.getElementById("quantity-excel-sheet")?.value.trim() !== name ||
document.getElementById("quantity-excel-cell")?.value !== address ||
document.getElementById("quantity-excel-target")?.value !== selected ||
@@ -526,6 +533,12 @@ const EstQuantity = (() => {
sheet: name,
cell: address.trim().toUpperCase(),
});
// 셀 연결 때 엑셀물량 파일목록에 없으면 등록(0xc7328c)
if (
typeof EstExcelFiles !== "undefined" &&
!(project.excelFiles || []).some((f) => f.FileName === file.name)
)
EstExcelFiles.add(project, file.name, EstExcelFiles.toBase64(bytes));
});
document.getElementById("dialog").close();
})().catch((error) => {