fix(495-2 M02 파일 업로드): 도면 상세 · 도면 양식 [파일 업로드] 지움 — DWG = CAD [삽입 → DWG 불러오기] 한 길

- M02_MasterTemplete_Drawing.ts — importDrawingFile · noImport · [파일 업로드] 덩이 지움
- DrawingCard · AreaDrawing — noImport 곁값 지움 · CardHelp 글 = CAD [삽입] DWG 불러오기
- 서버 /api/m02/drawing-import = 부르는 곳 0 · 남김
- 시험 test_m02_card_shell 두 개 고쳐 씀 · ui_checks 47-1 기대 detailImport = 0

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-20 19:41:35 +09:00
co-authored by Claude Opus 5.5
parent 5392680ec1
commit 08a9bc2e46
7 changed files with 25 additions and 87 deletions
@@ -160,7 +160,6 @@ export function createAreaDrawing(
originMarker: true,
noArea: true,
frame: true,
noImport: true,
pickTabs: true,
});
frame = stage.querySelector("iframe");
@@ -40,7 +40,7 @@ export const CARD_HELP: Record<"structure" | "labor" | "area", CardHelp> = {
features: [
SAVE,
take("도면"),
["수정", "도면 상세(전체 편집 화면)를 엶 — 파일 업로드(DXF · DWG)는 여기"],
["수정", "도면 상세(전체 편집 화면)를 엶 — DWG 불러오기(CAD [삽입])는 여기"],
clear("도면"),
FOLD,
],
@@ -98,7 +98,7 @@ export const CARD_HELP: Record<"structure" | "labor" | "area", CardHelp> = {
/** 상세에만 있는 단추 줄(49-7) — 카드 도움말 글 한 벌 뒤에 더함 */
const DETAIL_ONLY: Record<keyof typeof CARD_HELP, [string, string][]> = {
structure: [["파일 업로드", "DXF · DWG 파일을 도면으로 불러옴(상세 머리 [파일 업로드])"]],
structure: [["DWG 불러오기", "DWG · DXF 파일을 지금 도면에 더함(CAD 리본 [삽입])"]],
labor: [],
area: [["도면으로 보내기", "고른 범위를 도면 표로 보냄(상세 머리)"]],
};
@@ -67,13 +67,6 @@
gap: var(--spacing-8);
}
.m02-drawing__actions {
display: flex;
gap: var(--spacing-8);
margin-left: auto;
white-space: nowrap;
}
.m02-pop {
display: block;
background-color: transparent; /* 단추 아래 뜨는 작은 창 — 뒤를 가리지 않음 */
@@ -39,7 +39,7 @@ export interface DrawingTemplateOptions {
projectId?: string | null;
/** 저장 안 한 고침이 생기면 true — CAD 편집 · 작도 영역 값 바꿈. */
onChanged?: (dirty: boolean) => void;
/** 페이지 제목 줄 안의 빈 칸 — 있으면 작도 영역 칸 · [파일 업로드]를 거기 한 줄로 놓는다. */
/** 페이지 제목 줄 안의 빈 칸 — 있으면 작도 영역 칸을 거기 한 줄로 놓는다. */
headerSlot?: HTMLElement;
/** CAD 좌측 패널(특성 · 도면층)을 접힌 채로 연다 — 누르면 펼침(구조물 도면 미리보기). */
panelsCollapsed?: boolean;
@@ -51,8 +51,6 @@ export interface DrawingTemplateOptions {
noArea?: boolean;
/** B07 도각을 외곽 좌하단 (0,0) 에 얹음 — 잠금 층 · 보여주기만(돌려줄 때 뺌 · 저장 안 됨). */
frame?: boolean;
/** [파일 업로드] 단추를 안 둠 — 집계표 카드 미리보기(불러오기는 도면 상세에서만). */
noImport?: boolean;
/** 장id(82-1) — 자동백업 칸을 장마다 나눔(1장 = 빈 값 · 옛 칸 그대로) */
sheet?: string;
/** 장 도번(82-2) — 얹은 도각 `{{도면번호}}` 자리 */
@@ -142,25 +140,6 @@ function withoutFrame(drawing: DrawingTemplateDoc): DrawingTemplateDoc {
};
}
async function importDrawingFile(
file: File,
): Promise<{ drawing: DrawingTemplateDoc; entity_count: number }> {
const form = new FormData();
form.append("file", file);
const response = await fetch(`${API_BASE_URL}/m02/drawing-import`, {
method: "POST",
credentials: "include",
body: form,
});
const payload = (await response.json()) as {
drawing: DrawingTemplateDoc;
entity_count: number;
message?: string;
};
if (!response.ok) throw new Error(payload.message ?? `HTTP ${response.status}`);
return payload;
}
export function mountDrawingTemplate(
container: HTMLElement,
doc: DrawingTemplateDoc,
@@ -292,45 +271,6 @@ export function mountDrawingTemplate(
after?.();
};
const actions = document.createElement("div");
actions.className = "m02-drawing__actions";
const canImport = !readOnly && options.noImport !== true;
if (canImport) {
const fileInput = document.createElement("input");
fileInput.type = "file";
fileInput.accept = ".dxf,.dwg";
fileInput.hidden = true;
fileInput.addEventListener("change", () => {
const file = fileInput.files?.[0];
fileInput.value = "";
if (!file) return;
importButton.disabled = true;
importDrawingFile(file)
.then((response) => {
// 불러온 도각은 아직 저장하지 않는다 — 자리표를 놓고 [저장]을 눌러야 양식이 된다.
void load(response.drawing);
options.onChanged?.(true); // 불러온 것은 아직 저장 전 — 떠날 때 묻게 함
showToast(`도형 ${response.entity_count}개를 불러왔습니다.`, "success");
})
.catch((error) =>
showToast(
error instanceof Error ? error.message : "도각 파일을 불러오지 못했습니다.",
"error",
),
)
.finally(() => (importButton.disabled = false));
});
const importButton = createButton({
label: "파일 업로드",
variant: "filled",
onClick: () => fileInput.click(),
});
// 구조물 조합 층 단추([마스터])와 같은 꼴 — 실무자료 [파일 업로드]와 같은 종류(362-2)
importButton.classList.add("m02-layers__btn");
importButton.title = importButton.ariaLabel = "파일 업로드 (DXF · DWG)";
actions.append(importButton, fileInput);
}
const getDoc = async (): Promise<DrawingTemplateDoc> => {
const { drawing: saved } = await cad.requestSave();
const drawing = options.frame ? withoutFrame(saved) : saved;
@@ -345,13 +285,14 @@ export function mountDrawingTemplate(
};
// 한 줄 — 페이지가 머리 칸(headerSlot)을 주면 거기, 아니면 그림 칸 위에 작게.
toolbar.append(...(noArea ? [] : [areaButton]), actions);
// DWG · DXF 불러오기 = CAD 리본 [삽입 → DWG 불러오기] · 끌어다 놓기 한 길(495-2)
toolbar.append(...(noArea ? [] : [areaButton]));
const tabs = options.tabs ? [options.tabs] : [];
if (options.headerSlot) {
toolbar.classList.add("m02-drawing__toolbar--slot");
options.headerSlot.append(toolbar);
root.append(...tabs, cad.element);
} else root.append(...(noArea && !canImport ? [] : [toolbar]), ...tabs, cad.element);
} else root.append(...(noArea ? [] : [toolbar]), ...tabs, cad.element);
container.append(root);
void load(doc);
@@ -85,7 +85,6 @@ function mountStructure(
originMarker: true, // 좌표 0,0 기준점 십자
noArea: true, // 작도 영역 칸 없음
frame: true, // 도각 = 보여주기만 · 외곽 좌하단 (0,0)(56장)
noImport: true, // 파일 업로드는 도면 상세에서만(47-2)
pickTabs: true,
...hooks,
});