From 4060d0ea72aad1e42f13ce14cc67905886405132 Mon Sep 17 00:00:00 2001 From: umsangdon Date: Tue, 17 Nov 2026 12:30:14 +0900 Subject: [PATCH] =?UTF-8?q?refactor(853-1):=20M01=20=ED=92=88=EC=85=88?= =?UTF-8?q?=EC=9E=AC=EB=A3=8C(MP)=20=ED=99=94=EB=A9=B4=20=EA=B0=80?= =?UTF-8?q?=EC=A7=80=20=EA=B1=B7=EC=9D=8C=20=E2=80=94=20=EB=AC=B6=EC=9D=8C?= =?UTF-8?q?=20=E2=91=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 확인: 재료_품셈재료.json 은 old/ 에만 있음 · 왼쪽 목록은 첫 층 파일만 보여 화면에서 닿지 않음 - Rows: LINKED 파일 · 연결 칸(linkedCell) · 「못 이은 줄만」 단추 · 머리 칸 걷음(fetchRows 의 unlinked 자리는 false — 다른 부르는 곳과 같은 꼴) - UI_Pick: 「후보 조건으로 연결」 칸(cond · Cond) 걷음 — 모달 자체는 인력 「준용 직종」 고르기가 써서 남김 - Side 재료 차례에서 품셈재료 뺌 · CSS .m01-procure__cond 걷음 - 남김: Store._REF_FILE 의 MP · rows 의 unlinked(M02 Logic_Lib_Read 가 자리 인자로 넘김) · master_material · master_formula · check_master 의 MP 가지(옛 엔진 = 다음 걸음 몫) · 공용 글 사전 M01_PriceCond* · M01_OnlyUnlinked · M01_PriceCol(sub2 몫) Co-Authored-By: Claude Opus 5.5 --- M01_MasterData/M01_MasterData_UI_Pick.ts | 27 +--------- M01_MasterData/M01_MasterData_UI_Rows.ts | 59 ++-------------------- M01_MasterData/M01_MasterData_UI_Side.ts | 2 +- M01_MasterData/M01_MasterData_UI_Style.css | 6 --- 4 files changed, 6 insertions(+), 88 deletions(-) diff --git a/M01_MasterData/M01_MasterData_UI_Pick.ts b/M01_MasterData/M01_MasterData_UI_Pick.ts index e73b4784c..855520a55 100644 --- a/M01_MasterData/M01_MasterData_UI_Pick.ts +++ b/M01_MasterData/M01_MasterData_UI_Pick.ts @@ -1,6 +1,6 @@ /* ============================================================================= * M01_MasterData_UI_Pick.ts - * 고르기 모달 — 가격 연결(자재품목) · 준용 직종을 이름·규격으로 찾아 고르면 ref 를 돌려줌 + * 고르기 모달 — 준용 직종(가격 연결 자재품목도 같은 꼴)을 이름·규격으로 찾아 고르면 ref 를 돌려줌 * ========================================================================== */ import { createButton, createInputField, el, showToast } from "@ui/ui_template_elements"; @@ -11,13 +11,6 @@ import { t as L } from "@ui/ui_template_locale"; import { fetchPick, placeNote, type PickItem, type PickKind } from "./M01_MasterData_Api_Fetch"; import { show } from "./M01_MasterData_UI_Cells"; -/** 지역이 갈리는 재료 — 이름·규격만 적어 두고 지역은 계산 때 입력. */ -export interface Cond { - 이름: string; - 규격: string; - 지역: "입력"; -} - export interface PickOptions { kind: PickKind; title: string; @@ -27,8 +20,6 @@ export interface PickOptions { seed: string; /** 고르면 ref · 연결 끊기 = null. */ onPick: (ref: string | null, name?: string, value?: unknown) => void; - /** 있으면 「후보 조건으로 연결」 칸이 뜸. */ - cond?: { 이름: string; 규격: string; onCond: (c: Cond) => void }; } const button = (label: string): HTMLButtonElement => createButton({ label, variant: "ghost" }); @@ -47,20 +38,6 @@ export function openPickModal(opt: PickOptions): void { close(); }); - const condRow: HTMLElement[] = []; - if (opt.cond) { - const { onCond } = opt.cond; - const name = field(opt.cond.이름, L("M01_PriceCondName")).input; - const spec = field(opt.cond.규격, L("M01_PriceCondSpec")).input; - const go = button(L("M01_PriceCond")); - go.addEventListener("click", () => { - if (!name.value.trim()) return; - onCond({ 이름: name.value.trim(), 규격: spec.value.trim(), 지역: "입력" }); - close(); - }); - condRow.push(el("div", { className: "m01-procure__cond", children: [name, spec, go] })); - } - // 모달 부품 — 제목줄 [닫기] · 바깥 누르기 · Esc · 위 고정(공용 꼴) · [연결 끊기] 는 머리 단추 자리 const { close } = openModal({ title: opt.title, @@ -68,7 +45,7 @@ export function openPickModal(opt: PickOptions): void { width: "40rem", dialogClass: "m01-procure__box", actions: [cut], - mount: (body) => body.append(createText(opt.current), searchField.root, list, ...condRow), + mount: (body) => body.append(createText(opt.current), searchField.root, list), }); const paint = (items: PickItem[], total: number): void => { diff --git a/M01_MasterData/M01_MasterData_UI_Rows.ts b/M01_MasterData/M01_MasterData_UI_Rows.ts index a8b6ef7f4..5a34eec32 100644 --- a/M01_MasterData/M01_MasterData_UI_Rows.ts +++ b/M01_MasterData/M01_MasterData_UI_Rows.ts @@ -35,7 +35,6 @@ import { guessRows, pageKeepFirst, watchFit } from "@ui/ui_template_pager"; /** 표 칸 위에 오는 도구줄(단추 줄 + 간격) 높이 — 첫 줄 수 어림에만 씀 */ const BAR_H = 52; const MARKET = "재료_자재품목.json"; -const LINKED = "재료_품셈재료.json"; const JOB = ["인력.json"]; const NOTE = "비고"; // 끝 열(인력은 준용 앞) · 줄에 없으면 빈 칸 · 눌러 적음 // 별칭(815-2 · 요구 764) = 비고 앞 한 열 · 콤마로 여러 개 · 빈 글이면 칸을 지움 · 이 넷만 @@ -96,7 +95,6 @@ function withNote(row: Row, text: string, col = NOTE): Row { /** 요소별 전용 칸으로 그리는 칸 · 접어 두는 칸 — 일반 칸에서 뺌. */ function hidden(file: string, col: string): boolean { if (file === MARKET) return col.split(SEP)[0] === "면수"; // 면수는 접어 둠 - if (file === LINKED) return col.startsWith("연결"); return JOB.includes(file) && col === "준용"; } @@ -106,15 +104,9 @@ const fixed = (file: string, col: string): boolean => (JOB.includes(file) && ["구분", "상세구분", "상태", "옛이름"].includes(col.split(SEP)[0])); const HEADS: Record = { - [LINKED]: ["M01_PriceCol"], [JOB[0]]: ["M01_JobCol"], }; -const linkText = (link: unknown): string => - link && typeof link === "object" - ? `${L("M01_PriceCondUsed")}: ${(link as Row)["이름"]} ${(link as Row)["규격"] ?? ""}`.trim() - : String(link ?? ""); - /** 키 → 이름(서버가 준 것 + 방금 고른 것) — 참조 칸에 키 옆에 같이 보임 */ const names = new Map(); const KEY = /[A-Z]{2}\d{6}/; @@ -143,7 +135,6 @@ export function renderRows( : (pick.view?.page ?? 1); let scrolled = false; let data: RowsPage | null = null; - let unlinked = false; let ticket = 0; // 늦게 온 옛 응답이 새 목록을 덮지 않게(829-1) const paint = (): void => { @@ -158,7 +149,7 @@ export function renderRows( } const aliased = ALIASED.includes(file); const heads = (HEADS[file] ?? []).map((h) => - el("th", { text: h.startsWith("M01_") ? L(h as "M01_PriceCol") : h }), + el("th", { text: h.startsWith("M01_") ? L(h as "M01_JobCol") : h }), ); const head = el("tr", { children: [ @@ -227,7 +218,6 @@ export function renderRows( const put = deleted ? undefined : (next: Row): void => editRow(file, d.version, key, row, next); - if (file === LINKED) tr.append(linkedCell(row, cur, put)); for (const col of aliased ? [ALIAS, NOTE] : [NOTE]) tr.append( buildCell(show(cur[col]), { @@ -242,20 +232,6 @@ export function renderRows( body.append(tr); } - const only = - file === LINKED - ? [ - createButton({ - label: L("M01_OnlyUnlinked"), - variant: unlinked ? "filled" : "ghost", - onClick: () => { - unlinked = !unlinked; - page = 1; - void load(); - }, - }), - ] - : []; const add = createButton({ label: L("M01_RowAdd"), variant: "ghost" }); add.addEventListener("click", () => { const fresh = blank(d.rows[0] ?? FALLBACK); @@ -268,7 +244,7 @@ export function renderRows( host.replaceChildren( el("div", { className: "ui-toolbar m01-master__bar", - children: [add, ...only], + children: [add], }), el("div", { className: "ui-table-wrap m01-master__grid-wrap", @@ -309,7 +285,7 @@ export function renderRows( const load = async (): Promise => { const mine = ++ticket; try { - const got = await fetchRows(file, page, size, q, unlinked, sub, detail, state); + const got = await fetchRows(file, page, size, q, false, sub, detail, state); if (mine !== ticket) return; data = got; for (const [key, name] of Object.entries(data.refs ?? {})) names.set(key, name); @@ -348,35 +324,6 @@ type Put = (row: Row) => void; const rowBtn = (label: string): HTMLButtonElement => createButton({ label, variant: "ghost", size: "sm" }); -/** 품셈재료 — 가격 연결(자재품목 키 · 후보 조건 · 없음) · 고르기 모달. */ -function linkedCell(row: Row, cur: Row, put?: Put): HTMLTableCellElement { - const link = cur["연결"]; - const td = buildCell(named(linkText(link)), { - changed: JSON.stringify(link ?? null) !== JSON.stringify(row["연결"] ?? null), - }); - if (put) { - const cond = link && typeof link === "object" ? (link as Row) : null; - const name = String(cond?.["이름"] ?? cur["이름"] ?? ""); - const spec = String(cond?.["규격"] ?? cur["규격"] ?? ""); - const btn = rowBtn(L("M01_PriceFind")); - btn.addEventListener("click", () => - openPickModal({ - kind: "price", - title: `${L("M01_PriceTitle")} · ${cur["이름"] ?? ""}`, - current: linkText(link), - seed: `${name} ${spec}`.trim(), - onPick: (ref, name) => { - remember(ref, name); - put(withCell(cur, "연결", ref)); - }, - cond: { 이름: name, 규격: spec, onCond: (c) => put(withCell(cur, "연결", c)) }, - }), - ); - td.append(btn); - } - return td; -} - /** 인력 줄의 준용 = 관리자가 고르는 공표 직종 키(값이 있어도 돌릴 수 있음). */ function wageCell(row: Row, cur: Row, put?: Put): HTMLTableCellElement { const text = show(cur["준용"]); diff --git a/M01_MasterData/M01_MasterData_UI_Side.ts b/M01_MasterData/M01_MasterData_UI_Side.ts index 4f9f8ffcb..13789912e 100644 --- a/M01_MasterData/M01_MasterData_UI_Side.ts +++ b/M01_MasterData/M01_MasterData_UI_Side.ts @@ -144,7 +144,7 @@ const FUEL_GROUP = "유가 · 전력"; const FUEL_TITLE = ["유가 · 전력", "Fuel · power"] as const; const MATERIAL = "자재품목"; /** 재료 컨테이너 차례 — 여기 없는 파일은 뒤에 */ -const MATERIAL_ORDER = ["자재품목", "품셈재료"]; +const MATERIAL_ORDER = ["자재품목"]; /** 파일 이름 → 목록 글자 — 「소요량_건설품셈_10장_창호…」 → 「건설품셈_10장_창호…」 */ export const fileLabel = (file: string): string => diff --git a/M01_MasterData/M01_MasterData_UI_Style.css b/M01_MasterData/M01_MasterData_UI_Style.css index 71f77c7ae..06488f1db 100644 --- a/M01_MasterData/M01_MasterData_UI_Style.css +++ b/M01_MasterData/M01_MasterData_UI_Style.css @@ -158,12 +158,6 @@ table.m01-master__grid { padding-block: var(--spacing-4); } -.m01-procure__cond { - display: flex; - flex-wrap: wrap; - gap: var(--spacing-8); -} - .m01-side__filter { display: flex; flex-direction: column;