feat(est-test): 단가산출 전역변수·새내역서 파일로저장·산출서 삽입과 선택 삭제

- 전역변수:  표지 대입 변수를 호표 넘어 유지, 지정·해제, 목록·이동
- 새내역서 파일로저장: 당초값·신규 표시·당초 사본 지운 새 작업 따로 저장
- 수량산출서 삽입(공종명칭·규격)·선택공종 삭제

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-12 13:43:43 +09:00
co-authored by Claude Opus 5.5
parent 0f353f8606
commit b97ecf47de
9 changed files with 261 additions and 9 deletions
+50 -1
View File
@@ -129,7 +129,7 @@ const EstQuantitySheets = (() => {
`<option value="${esc(sheet.Code)}" ${state.quantitySheet === sheet.Code ? "selected" : ""}>${esc(sheet.Name || sheet.Code)}</option>`,
)
.join("");
return `<div class="business-tools"><label>수량산출서 <select id="quantity-sheet-choice"><option value="manual">수식표 직접 작성</option>${options}</select></label><input data-quantity-query value="${esc(state.quantityQuery || "")}" placeholder="명칭·규격" aria-label="산출서 검색"><button data-action="quantity-sheet-search">검색</button><button data-action="quantity-sheet-all">전체보기</button><button data-quantity-new>새 산출서</button><button data-quantity-excel>Excel 셀 수량 연결</button><button data-quantity-excel-links>Excel 연결 관리</button></div>`;
return `<div class="business-tools"><label>수량산출서 <select id="quantity-sheet-choice"><option value="manual">수식표 직접 작성</option>${options}</select></label><input data-quantity-query value="${esc(state.quantityQuery || "")}" placeholder="명칭·규격" aria-label="산출서 검색"><button data-action="quantity-sheet-search">검색</button><button data-action="quantity-sheet-all">전체보기</button><button data-quantity-new>새 산출서</button><button data-action="quantity-sheet-insert">삽입</button><button data-action="quantity-sheet-multi-delete">선택공종 삭제</button><button data-quantity-excel>Excel 셀 수량 연결</button><button data-quantity-excel-links>Excel 연결 관리</button></div>`;
}
function handle(name, state, node) {
@@ -153,6 +153,55 @@ const EstQuantitySheets = (() => {
state.quantitySheet = first.Code;
return true;
}
if (name === "quantity-sheet-insert") {
// 삽입(TFRMMULLANG btnInsert): 현재 산출서 앞에 새 산출서, 공종명칭(품명·규격) 입력
const title = prompt("공종명칭", "새 수량산출서");
if (title == null) return true;
const size = prompt("규격", "") ?? "";
EstApp.change((project) => {
const sheets = (project.quantitySheets ||= []),
at = Math.max(
0,
sheets.findIndex((s) => s.Code === code),
),
next = `Q${EstApp.uid()}`;
sheets.splice(at, 0, {
Code: next,
Name: title.trim() || "새 수량산출서",
Size: size.trim(),
rows: [],
items: [],
options: { digits: 2, roundMode: 2 },
});
state.quantitySheet = next;
}, false);
return true;
}
if (name === "quantity-sheet-multi-delete") {
// 선택공종 삭제(btnSelectDel): 고른 산출서들을 한 번에 지움
const { esc } = EstApp;
EstApp.showDialog(
"선택공종 삭제",
`<div style="max-height:360px;overflow:auto">${(state.project.quantitySheets || []).map((s) => `<label style="display:block"><input type="checkbox" name="qd-sheet" value="${esc(s.Code)}">${esc(s.Name || s.Code)} ${esc(s.Size || "")}</label>`).join("")}</div><button data-action="quantity-sheet-multi-delete-ok">삭제</button>`,
);
return true;
}
if (name === "quantity-sheet-multi-delete-ok") {
const codes = new Set(
[...document.querySelectorAll('#dialog-content [name="qd-sheet"]:checked')].map(
(n) => n.value,
),
);
if (!codes.size) throw Error("지울 산출서를 고르세요.");
if (!confirm(`산출서 ${codes.size}개를 삭제하시겠습니까?`)) return true;
EstApp.byId("dialog").close();
EstApp.change((project) => {
project.quantitySheets = project.quantitySheets.filter((s) => !codes.has(s.Code));
if (codes.has(state.quantitySheet))
state.quantitySheet = project.quantitySheets[0]?.Code || "manual";
}, false);
return true;
}
if (name === "quantity-sheet-copy") {
EstApp.change((project) => {
state.quantitySheet = copy(project, code, EstApp.uid());