refactor(856-3): 일위대가 단가산출 줄 누름 = 줄 쌓기 한 길 — 프로젝트 사본은 굳힌 SK 문서 보기만 · M01 로직 줄 창 걷음

- 프로젝트 사본(구조물 고르기 카드 · B08 카드) 단가산출 줄 누름 = 사본 참조사본의 굳힌 SK 문서째 줄 쌓기 보기만(memory · 고침 칸 잠김 · 저장 없음 · 층 파일 읽기 0) · 사본에 없으면 알림
- 셈 주입 원본 층 카드 = 그 층 SK 줄 쌓기 읽기만(옛 「프로젝트 사본 줄」 안내 대신)
- M01 로직을 바로 담은 줄(저장본 0) = 창 없이 안내 한 줄 · 프로젝트 · 셈 주입 표(늘 보기만)의 [로직 추가] M01 바로 담기 갈래 지움(서버 from-logic 은 project 층 안 받음 · 서버 고침 0)
- Labor_RowModal = 자재 모달만 · Labor_LogicMats 고침 손잡이 · setLogicMark · 안 쓰는 글 키 지움
- 시험: 856-0 가짜 DOM 에 사본 보기 · 원본 층 읽기만 · 로직 줄 안내 덧 · 소스 글자 시험(175 · 222-1 · 742-1 · 806-1 둘 · logic_mats) 지움 · 811-1 · mat_marks 는 글자 줄만 지우고 700 줄 · 날 단추 · 서버 ↔ 화면 허용 값 짝 남김

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-18 05:32:35 +09:00
co-authored by Claude Opus 5.5
parent 605ca0cbed
commit 482ef981c0
20 changed files with 146 additions and 374 deletions
+4
View File
@@ -22,6 +22,7 @@ import { showToast } from "@ui/ui_template_elements";
import { PART_OF, projectItems, withCopyValues } from "@ui/ui_template_item_picker_project";
import type { EditView } from "@ui/ui_template_item_picker_edit";
import type { LaborDoc } from "../M02_MasterTemplete/M02_MasterTemplete_Labor_Api";
import { lineId } from "../M02_MasterTemplete/M02_MasterTemplete_Labor_Calc";
import type { ValueDoc } from "../M02_MasterTemplete/M02_Labor_Values_Model";
import type { EditKind, ItemCardsHandle } from "../M02_MasterTemplete/M02_MasterTemplete_ItemCards";
import type { ItemSource } from "../M02_MasterTemplete/M02_MasterTemplete_ItemSource";
@@ -79,6 +80,9 @@ function sourceOf(projectId: string, folder: string): ItemSource {
return { 문서: withCopyValues(labor.줄, values, picks) };
},
calc: () => items.calcLabor(folder),
// 856-3 단가산출 줄 = 사본의 굳힌 SK 문서(`참조사본`) — 줄 쌓기 보기만
sk: async (ref) =>
((await items.read(folder, "일위대가")) as { 참조사본?: Record<string, Record<string, unknown>> } | null)?.참조사본?.[lineId({ 참조: ref }) ?? ""] ?? null, // prettier-ignore
},
};
}
@@ -333,6 +333,7 @@ export function createItemCards(opts: ItemCardsOptions): ItemCardsHandle {
? {
calc: (doc, 수량) => via.calc(at, doc, 수량),
readArea: () => src.read("area", at),
...(via.sk ? { skCopy: via.sk } : {}), // 856-3 사본 단가산출 줄 = 보기만
}
: {}),
onChanged: (dirty) => laborCard.saver.mark(dirty && laborWritable()),
@@ -12,7 +12,7 @@ import {
type Layer,
} from "./M02_MasterTemplete_Api_Fetch";
import type { LaborDoc } from "./M02_MasterTemplete_Labor_Api";
import type { LaborCalc } from "./M02_MasterTemplete_Labor_Calc";
import type { LaborCalc, LaborRef } from "./M02_MasterTemplete_Labor_Calc";
/** 집계표 열 하나에 딸린 문서 — 구조물 도면 · 면적산출 */
export type ItemPart = "structure" | "area";
@@ -34,6 +34,8 @@ export interface ItemSource {
doc: LaborDoc,
수량?: Record<string, number>,
) => Promise<LaborCalc & { 알약: unknown[] }>;
/** 프로젝트 사본(856-3) — 단가산출 줄의 굳힌 SK 문서(`참조사본`) · 줄 누름 = 줄 쌓기 보기만 */
sk?: (ref: LaborRef) => Promise<Record<string, unknown> | null>;
};
}
@@ -12,6 +12,7 @@
import type { DataColumn } from "@ui/ui_template_data_table";
import type { Layer } from "./M02_MasterTemplete_Api_Fetch";
import type { LaborCalc, LaborDoc } from "./M02_MasterTemplete_Labor_Api";
import type { LaborRef } from "./M02_MasterTemplete_Labor_Calc";
import { mountLaborTable } from "./M02_MasterTemplete_Labor_Table";
export interface LaborDetailOptions {
@@ -32,6 +33,8 @@ export interface LaborDetailOptions {
/** 셈 · 면적 자리 주입(142-1 · 고르기 모달 = 프로젝트 복사본) — 없으면 층 길 */
calc?: (doc: LaborDoc, 수량?: Record<string, number>) => Promise<LaborCalc & { 알약: unknown[] }>;
readArea?: () => Promise<{ 문서: unknown; 판?: string | null }>;
/** 프로젝트 사본(856-3) — 단가산출 줄의 굳힌 SK 문서 · 있으면 그 줄 누름 = 줄 쌓기 보기만 */
skCopy?: (ref: LaborRef) => Promise<Record<string, unknown> | null>;
}
/** 덧칸 — `cell(n, 열)` = 문서 줄 n 의 값 · `onRow(n)` 참 = 기본 줄 모달 안 엶 */
@@ -2,34 +2,19 @@
* M02_MasterTemplete_Labor_LogicMats.ts
* 자재목록 표의 로직 자재 줄(103-1) — 담은 로직 맨 위 층 재료 줄(서버 calc `줄[].재료`) · 사용자 자재 줄과 같은 칸
* (코드 · 이름 · 규격 · 수량 · 단위 · 가격 다섯 · 단가 / 금액) · 사용자 자재 앞.
* · 삭제 없음 · [바꾸기] = M01 자재품목 표에서 고름(문서 `담은로직[].고름` · 엔진 `choosing`) · 바꾼 줄만 [기본](고름 풂)
* · 금액은 로직 단가 안이라 합에 다시 안 더함(보기만) · 수량은 로직 것(누름 · 알약 없음)
* · 하위 로직 안 재료는 안 보임(엔진이 맨 위 층만 고름)
* · 줄 누름(148-1) = 그 로직 줄 [옵션] 모달(읽기만이면 보기) · [바꾸기] · [기본]은 고칠 때만
* · 보기만(856-3 — 로직 줄 창 · [바꾸기] · [기본] · 세 칸 고침 걷음 · 일위대가 면적 보기 `Labor_View` 가 씀)
* · 금액은 로직 단가 안이라 합에 다시 안 더함 · 수량은 로직 것 · 하위 로직 안 재료는 안 보임(엔진이 맨 위 층만 고름)
* ========================================================================== */
import { createButton, el } from "@ui/ui_template_elements";
import { el } from "@ui/ui_template_elements";
import { formatMoney } from "../common_util/common_util_money";
import { openPickTable } from "../M01_MasterData/M01_MasterData_UI_Logic_PickTable";
import { headWord } from "../M01_MasterData/M01_MasterData_UI_LogicLab_Modal";
import type { LaborCalc, LaborRow, MatMarkKey } from "./M02_MasterTemplete_Labor_Api";
import type { LaborCalc, LaborRow } from "./M02_MasterTemplete_Labor_Api";
import { lineId } from "./M02_MasterTemplete_Labor_Calc";
import { markCells } from "./M02_MasterTemplete_Labor_MatMarks";
import { moneyCell, PRICE_SLOTS } from "./M02_MasterTemplete_Labor_Rows";
import { tc } from "./M02_MasterTemplete_Labor_Text";
import type { LogicMat } from "./M02_Labor_LogicMats_Model";
export interface LogicMatHandlers {
/** 줄 누름(148-1) = 그 자재를 낸 로직 줄 [옵션] 모달 — `row` = 담은 로직 차례 */
open: (row: number) => void;
/** [바꾸기]로 고른 품목 키 — `row` = 담은 로직 차례 · `at` = 호표 차례 · 없으면(읽기만) 단추 칸 없음 */
swap?: (row: number, at: number, key: string) => void;
/** [기본] — 그 줄 고름 풂 */
reset?: (row: number, at: number) => void;
/** 세 칸(148-4) — 로직 줄 `자재표시` · 없으면 글만 */
mark?: (row: number, at: number, key: MatMarkKey, v: string) => void;
}
const num = (v: number | null): string =>
v === null
? "—"
@@ -40,21 +25,14 @@ export function logicMatRows(
rows: LaborRow[],
calc: LaborCalc | null,
wait: boolean,
on?: LogicMatHandlers,
): HTMLElement[] {
return rows.flatMap((row, r) => {
return rows.flatMap((row) => {
const line = row.참조 ? undefined : calc?.줄.find((l) => lineId(l) === lineId(row));
return (line?.재료 ?? []).map((mat) => matRow(row, r, mat, wait, on));
return (line?.재료 ?? []).map((mat) => matRow(row, mat, wait));
});
}
function matRow(
row: LaborRow,
r: number,
mat: LogicMat,
wait: boolean,
on?: LogicMatHandlers,
): HTMLElement {
function matRow(row: LaborRow, mat: LogicMat, wait: boolean): HTMLElement {
const item = mat.품목;
const name = item?.이름 ?? mat.이름;
const owner = `${row.별칭 ?? row.로직} · ${mat.이름}`;
@@ -69,51 +47,8 @@ function matRow(
};
const money = moneyCell(mat.단가, mat.금액, wait, tc("Labor_AppliedSum"));
money.title = tc("LogicMat_Inside");
const swap = on?.swap;
const reset = on?.reset;
const tools = swap
? [
el("td", {
className: "m02-labrow__move",
children: [
el("div", {
className: "ui-btn-group",
children: [
createButton({
label: tc("LogicMat_Swap"),
variant: "ghost",
onClick: (e) => {
e.stopPropagation();
openPickTable({
kind: "재료",
title: `${tc("LogicMat_PickTitle")} · ${mat.이름}`,
seed: headWord(name),
alt: [headWord(mat.이름)],
isCurrent: (x) => String(x["키"]) === item?.키,
onPick: (x) => swap(r, mat.차례, String(x["키"])),
});
},
}),
...(mat.고름 && reset
? [
createButton({
label: tc("LogicMat_Reset"),
variant: "ghost",
onClick: (e) => {
e.stopPropagation();
reset(r, mat.차례);
},
}),
]
: []),
],
}),
],
}),
]
: [];
const tr = el("tr", {
className: `m02-labrow__row m02-labrow__logic-mat${mat.고름 ? " is-picked-mat" : ""}${on ? " is-open" : ""}`,
return el("tr", {
className: `m02-labrow__row m02-labrow__logic-mat${mat.고름 ? " is-picked-mat" : ""}`,
attrs: { "data-labor-logic-mat": `${row.로직}|${mat.차례}` },
children: [
el("td", { className: "m02-labrow__code", text: item?.키 ?? "—" }),
@@ -146,15 +81,9 @@ function matRow(
text: mat.단위,
attrs: { "data-label": tc("Labor_Unit") },
}),
...markCells(
row.자재표시?.[String(mat.차례)] ?? {},
on?.mark ? (k, v) => on.mark?.(r, mat.차례, k, v) : undefined,
),
...markCells(row.자재표시?.[String(mat.차례)] ?? {}),
...PRICE_SLOTS.map(priceCell),
money,
...tools,
],
});
if (on) tr.addEventListener("click", () => on.open(r));
return tr;
}
@@ -10,7 +10,6 @@ import { createSelectField, el } from "@ui/ui_template_elements";
import {
MAT_MARK_DEFAULT,
MAT_MARKS,
type LaborRow,
type MatMarkKey,
type MatMarks,
} from "./M02_MasterTemplete_Labor_Api";
@@ -60,12 +59,3 @@ export function setMark(target: MatMarks, key: MatMarkKey, v: string): void {
if (v) (target as Record<string, string>)[key] = v;
else delete target[key];
}
/** 로직 줄 `자재표시` 한 차례 한 칸 — 빈 차례 · 빈 묶음은 뺌 */
export function setLogicMark(row: LaborRow, at: number, key: MatMarkKey, v: string): void {
const all = (row.자재표시 ??= {});
const one = (all[String(at)] ??= {});
setMark(one, key, v);
if (!Object.keys(one).length) delete all[String(at)];
if (!Object.keys(all).length) delete row.자재표시;
}
@@ -1,134 +1,20 @@
/* =============================================================================
* M02_MasterTemplete_Labor_RowModal.ts
* 일위대가표 줄 누름 모달(PLAN 723-2 · 요구서_내역16 2장 4 · 5 · 856-1) — 일위대가표에서 빠진 줄 동작을 모달 안으로.
* · 로직 줄(단가산출 문서 없음) · 셈 주입 줄(프로젝트 사본) = 머리(이름 · 「1 ㎡ 당」 · 옵션 값 · 메모) + 안내 한 줄
* (856-1 — 옛 단가산출 상세 몸 · [적용] 걷음 · 고침 = 단가산출 줄 쌓기 · 856-3 에서 줄 쌓기 보기로) ·
* 로직 자재(바꾸기 · 기본 · 세 칸 · `Labor_LogicMats`)
* · 사용자 자재 줄 = 자재 모달(세 칸 · `Labor_MatTable` 한 줄)
* 일위대가표 사용자 자재 줄 누름 모달(PLAN 723-2 · 요구서_내역16 2장 4 · 5) — 세 칸(`Labor_MatTable` 한 줄) · 가격 다섯 보기.
* · 고침 = 그 줄 화면 캐시(저장은 [저장]) · 금액은 표가 다시 셈 → `watch` 로 받아 다시 그림
* · 단가산출(SK) 줄 = `Labor_SkEdit`(프로젝트 사본 = 보기만) · M01 로직 줄 창은 걷음(856-3)
* ========================================================================== */
import { createBanner } from "@ui/ui_template_banner";
import { el, showToast } from "@ui/ui_template_elements";
import { el } from "@ui/ui_template_elements";
import { openModal } from "@ui/ui_template_modal";
import { createText } from "@ui/ui_template_text";
import type { ItemLogic } from "./M02_MasterTemplete_Api_Fetch";
import type { LaborCalc, LaborMat, LaborRow, MatMarkKey } from "./M02_MasterTemplete_Labor_Api";
import { logicMatRows } from "./M02_MasterTemplete_Labor_LogicMats";
import { setLogicMark, setMark } from "./M02_MasterTemplete_Labor_MatMarks";
import type { LaborCalc, LaborMat } from "./M02_MasterTemplete_Labor_Api";
import { setMark } from "./M02_MasterTemplete_Labor_MatMarks";
import { matTable } from "./M02_MasterTemplete_Labor_MatTable";
import { tc } from "./M02_MasterTemplete_Labor_Text";
import { valueLine } from "./M02_Labor_Values_Model";
/** 표가 다시 센 답을 받음 — 돌려준 함수 = 그만 받음 */
export type CalcWatch = (fn: (calc: LaborCalc | null) => void) => () => void;
export interface RowModalOptions {
row: LaborRow;
logic: ItemLogic | null;
title: string;
/** 일위대가 머리(이름 · 「1 ㎡ 당」) */
head: string;
readOnly: boolean;
/** 셈 주입(프로젝트 복사본) — 안내 글이 다름 */
inject: boolean;
/** 사용자 자재 코드 — 로직 자재 [바꾸기]로 같은 품목 막음 */
userMats: string[];
watch: CalcWatch;
/** 고침 뒤 — `again` = 서버 다시 셈(입력 · 고름 · 별도계상) · 아니면 화면만 */
done: (again: boolean) => void;
}
const TEXT = {
NoDoc: [
"M01 로직을 바로 담은 줄 — 단가산출 화면 없음 · 고침은 단가산출로 담아(일위대가 [로직 추가]) 그 줄에서",
"Uses the M01 logic directly — add it as a build-up to edit",
],
FromSk: [
"단가산출 「{k}」 에서 담아 온 줄 — 고침은 그 단가산출에서 고쳐 다시 담음",
"Copied from build-up 「{k}」 — edit it there and re-add",
],
Inject: [
"프로젝트 사본 줄 — 단가산출 화면 없음 · 수식 고침은 M02 단가산출에서 고쳐 [재생성]",
"Project copy line — edit the build-up in M02 and regenerate",
],
} as const;
const t = (k: keyof typeof TEXT): string => TEXT[k][0];
export function openRowModal(o: RowModalOptions): void {
const row = o.row;
const edit = !o.readOnly;
const info = el("div", { attrs: { "data-row-head": "" } });
const mats = el("div", { attrs: { "data-row-mats": "" } });
let calc: LaborCalc | null = null;
const draw = (): void => {
const values = valueLine(o.logic?.입력 ?? [], row.입력값);
info.replaceChildren(
createText(o.head, "muted", 14),
...(values.text ? [createText(values.text)] : []),
...(values.empty
? [createText(tc("Labor_Empty").replace("{n}", String(values.empty)), "error")]
: []),
...(row.켜쌓기율 != null
? [createText(tc("Labor_Layer").replace("{n}", String(row.켜쌓기율)), "muted")]
: []),
...(row.메모 ? [createText(row.메모, "muted")] : []),
);
const lead = row.참조
? []
: logicMatRows([row], calc, !calc, {
open: () => undefined,
...(edit
? {
swap: (_r: number, at: number, key: string) => {
if (o.userMats.includes(key))
return showToast(tc("Labor_AlreadyMat").replace("{value}", key), "error");
row.고름 = { ...row.고름, [String(at)]: key };
o.done(true);
},
reset: (_r: number, at: number) => {
if (!row.고름) return;
delete row.고름[String(at)];
if (!Object.keys(row.고름).length) delete row.고름;
o.done(true);
},
mark: (_r: number, at: number, key: MatMarkKey, v: string) => {
setLogicMark(row, at, key, v);
o.done(key === "별도계상");
draw();
},
}
: {}),
});
mats.replaceChildren(
...(lead.length
? [el("h4", { text: tc("Labor_Mats") }), matTable({ mats: [], calc, lead })]
: []),
);
};
// 안내 한 줄(856-1) — 로직 줄 = 온 단가산출(`본뜬`) · 셈 주입 = 프로젝트 사본
const from = row.본뜬 && typeof row.본뜬.이름 === "string" ? row.본뜬.이름 : "";
const note = createBanner({
tone: "info",
text: o.inject ? t("Inject") : from ? t("FromSk").replace("{k}", from) : t("NoDoc"),
});
const stop = o.watch((c) => {
calc = c;
draw();
});
openModal({
title: o.title,
closeLabel: tc("In_Close"),
width: "1100px",
wide: true,
beforeClose: () => (stop(), true),
mount: (body) => body.append(info, note, mats),
});
draw();
}
export interface MatModalOptions {
mat: LaborMat;
watch: CalcWatch;
@@ -5,6 +5,8 @@
* · [저장] = 수식 저장(`flush`) → 그 SK 문서 저장(`saveTemplate` · 그 층 · 그 주인) → 닫음 → 부르는 쪽이 일위대가 금액을 다시 셈
* · 그 층을 못 고치면(위 층 · 남의 주인) 읽기만 · [저장] 없음 · 고친 것 있이 닫으면 물음(버리면 수식 캐시도 비움)
* · 머리(808-1 · 요구 701-4 · 5) = 단가산출 페이지 머리와 같음 — 보기 고르기 · [단가 갱신] · [재생성] · [저장] · [닫기]
* · 프로젝트 사본(856-3 · `copy`) = 사본의 굳힌 SK 문서째 줄 쌓기 보기만(`memory` · 파일 안 읽음 · 저장 없음) ·
* 고침은 M02 단가산출에서 고쳐 [재생성](요구 898 ①)
* 짝 모달 = `Labor_RefEdit`(일위조합 SC 줄).
* ========================================================================== */
@@ -23,6 +25,8 @@ export interface SkEditOptions {
/** 일위대가 머리(이름 · 「1 ㎡ 당」) */
head: string;
readOnly: boolean;
/** 프로젝트 사본(856-3) — 그 사본의 굳힌 SK 문서(있으면 보기만 · 파일 안 읽음) */
copy?: Record<string, unknown>;
/** 닫힘 — `saved` = 그 SK 문서를 저장함(부르는 쪽이 금액을 다시 셈) */
closed: (saved: boolean) => void;
}
@@ -39,12 +43,16 @@ export async function openSkEdit(opt: SkEditOptions): Promise<void> {
const at = `${layer}/${opt.ref.주인 ?? ""}/${opt.ref.키}`;
if (opened.has(at)) return;
opened.add(at);
let doc: unknown;
let version: string;
const copy = !!opt.copy;
const readOnly = copy || opt.readOnly;
let doc: unknown = opt.copy;
let version = "";
try {
const got = await readTemplate(layer, "sangeun", opt.ref.키, null, opt.ref.주인);
doc = got.문서;
version = got.판 ?? "";
if (!copy) {
const got = await readTemplate(layer, "sangeun", opt.ref.키, null, opt.ref.주인);
doc = got.문서;
version = got.판 ?? "";
}
} catch (error) {
opened.delete(at);
return void showToast(error instanceof Error ? error.message : tc("Load_Failed"), "error");
@@ -72,12 +80,13 @@ export async function openSkEdit(opt: SkEditOptions): Promise<void> {
const host = el("div", { attrs: { "data-labor-sk": opt.ref.키 } });
const slot = el("span", { className: "m02-main__tools" }); // 보기 고르기 · [단가 갱신] · [재생성](808-1 · 페이지 머리와 같음)
handle = mountSangeunDetail(host, doc, {
layer,
owner: opt.ref.주인,
readOnly: opt.readOnly,
onChanged: (d) => (dirty = d && !opt.readOnly),
// 사본 = 층 읽기 길(굳힌 문서째 셈 · 주인 층 권한 없이)
layer: copy ? "system" : layer,
owner: copy ? null : opt.ref.주인,
readOnly,
onChanged: (d) => (dirty = d && !readOnly),
onVersion: (v) => (version = v), // 수식 저장이 파일 판을 바꿈 — 문서 저장이 이어 받음
mode: "page", // 페이지와 같은 길 — 수식 저장 단추는 이 [저장] 한 번에 모임
mode: copy ? "memory" : "page", // 페이지와 같은 길 — 수식 저장 단추는 이 [저장] 한 번에 모임
slot,
});
const ok = createButton({
@@ -110,13 +119,17 @@ export async function openSkEdit(opt: SkEditOptions): Promise<void> {
body.append(
createText(opt.head, "muted", 14),
createText(
opt.readOnly ? `${tc("Ref_Shared")} · ${tc("Ref_ReadOnly")}` : tc("Ref_Shared"),
copy
? tc("Ref_Copy")
: opt.readOnly
? `${tc("Ref_Shared")} · ${tc("Ref_ReadOnly")}`
: tc("Ref_Shared"),
"hint",
),
host,
);
head.append(slot);
if (!opt.readOnly) head.append(ok); // [저장] = 머리 [닫기] 왼쪽
if (!readOnly) head.append(ok); // [저장] = 머리 [닫기] 왼쪽
},
});
}
@@ -7,15 +7,16 @@
* 금액 빠짐) → 그 줄 금액 · 합계 바로(짝 셈 `Labor_Calc.settle`) · 구조물 조합 · 공사 알약이 이어지면 그 값이 앞섬
* · 합계 열 = 「기준단위 단가」(줄 1 단위) · 「수량 반영 금액」(× 수량)
* · 머리 단추 = [항목 추가](736-1 · 자재는 찾기 창에서 고름 → 자재 목록) · 줄 우클릭 · 줄 끝 ⋯ = 위로 · 아래로 · 별칭 · 삭제
* · 줄 누름 = 줄 모달(`Labor_RowModal` — 옵션 · 메모 · 켜쌓기율 · 로직 자재 바꾸기 · 세 칸 · 안내 한 줄 · 856-1) ·
* 사전조합 참조 줄 = 서고 원본 모달(`Labor_RefEdit`) · 사용자 자재 줄 = 자재 모달(세 칸)
* · 줄 누름 = 단가산출 줄 = 줄 쌓기(`Labor_SkEdit` · 프로젝트 사본 = 굳힌 문서 보기만 · 856-3) ·
* 사전조합 참조 줄 = 서고 원본 모달(`Labor_RefEdit`) · 사용자 자재 줄 = 자재 모달(세 칸) ·
* M01 로직을 바로 담은 줄 = 안내 한 줄(창 없음 · 새로 안 생김)
* · 금액 = 서버 calc(최신 응답만 · 저장 안 함) · [저장]은 UI_Main(서버가 다시 셈)
* · 안 이은 고정 줄(729-3) = 격자 위 띠 · [연결](`Labor_Unlinked` — 이음만 · 저장은 [저장])
* 구조물 조합 일위대가(카드 · 열 상세 · PLAN 806-1)도 이 한 부품 — `mode` 없음 = 조합 갈래: 정보 칸(이름 · 구분)
* 없음 · 수량 칸 = 수량산출 모달(`Labor_Combo` — 면적산출 잇기) · 규격 열 줄(`Labor_Spec`) · 다이어그램(열 상세) ·
* 새 줄 수량 = 면적을 따름(빈 값). 단가산출(SK) 참조 줄 누름 = 그 단가산출 문서 모달(`Labor_SkEdit` — 수식 탭 · 저장 = 그 SK).
* 811-1(요구 707-1) — 단가산출 줄 = SK 참조 한 행(저장 때 안 펼침) · [로직 추가] M01 기초 = 이 층 SK 사본 · 다른 층 SK =
* 이 층 사본 뒤 참조(`Labor_SkPick`) · 프로젝트 · 셈 주입 = 옛 로직 줄.
* 이 층 사본 뒤 참조(`Labor_SkPick`) · 프로젝트 · 셈 주입 표 = 늘 보기만이라 [로직 추가] 없음(856-3).
* ========================================================================== */
import { createButton, createInputField, el, showToast } from "@ui/ui_template_elements";
@@ -49,7 +50,7 @@ import { unlinkedBar } from "./M02_MasterTemplete_Labor_Unlinked";
import { pasteInto } from "./M02_MasterTemplete_Labor_Paste";
import { openLogicPicker, withSangeun } from "./M02_MasterTemplete_Labor_Pick";
import { openRefEdit } from "./M02_MasterTemplete_Labor_RefEdit";
import { openMatModal, openRowModal } from "./M02_MasterTemplete_Labor_RowModal";
import { openMatModal } from "./M02_MasterTemplete_Labor_RowModal";
import { tc } from "./M02_MasterTemplete_Labor_Text";
import { insideKeys } from "./M02_Labor_LogicMats_Model";
import { valueLine } from "./M02_Labor_Values_Model";
@@ -333,26 +334,23 @@ export function mountLaborTable(
closed: () => alive && recalc(),
});
if (row.고정) return; // 고정 줄 = 숫자 그대로(이름 · 별칭은 우클릭)
// 단가산출(SK) 줄 = 그 단가산출 문서 모달(수식 탭 · 806-1) — 셈 주입(프로젝트 복사본)엔 줄 모달(안내 · 856-3 까지)
if (isSkRef(row.참조) && !opt.calc)
return void openSkEdit({
ref: row.참조,
title: nameOf(row),
head: head(),
readOnly: !edit || row.참조.층 !== opt.layer,
closed: (done) => alive && done && recalc(), // 저장했으면 금액을 다시 셈
});
openRowModal({
row,
logic: logics.get(row.로직) ?? null,
if (!isSkRef(row.참조)) return showToast(tc("Logic_Direct"), "info"); // M01 로직 줄 — 창 없음(856-3)
const ref = row.참조;
const sk = {
ref,
title: nameOf(row),
head: head(),
watch,
readOnly: !edit,
inject: !!opt.calc,
userMats: cur.자재.map((m) => m.코드),
done: (again) => changed(!again),
});
readOnly: !edit || ref.층 !== opt.layer,
closed: (done: boolean) => alive && done && recalc(), // 저장했으면 금액을 다시 셈
};
// 단가산출(SK) 줄 = 그 단가산출 문서 줄 쌓기(806-1) · 프로젝트 사본 = 굳힌 문서 보기만(856-3)
if (!opt.skCopy) return void openSkEdit(sk);
void opt
.skCopy(ref)
.then(
(copy) => (copy ? void openSkEdit({ ...sk, copy }) : showToast(tc("Sk_NoCopy"), "error")),
failed,
);
}
function openMat(i: number): void {
const mat = cur.자재[i];
@@ -456,7 +454,7 @@ export function mountLaborTable(
changed();
},
};
/** SK 사본 길(811-1) — M02 층 일위대가 · 조합만(프로젝트 · 셈 주입 = 옛 로직 줄) */
/** SK 사본 길(811-1) — M02 층 일위대가 · 조합만(프로젝트 · 셈 주입 = 늘 보기만 · [로직 추가] 없음 · 856-3) */
const own: SkPickScope | null =
opt.layer !== "project" && !opt.calc ? { layer: opt.layer, owner: library.owner } : null;
const addLogic = createButton({
@@ -464,16 +462,12 @@ export function mountLaborTable(
variant: "filled",
onClick: () =>
openLogicPicker((x) => {
// 811-1 — M01 기초 = 이 층 SK 사본 참조 한 행(펼치지 않음)
if (own)
// 811-1 — M01 기초 = 이 층 SK 사본 참조 한 행(펼치지 않음)
return void skFromLogic(own, x.키).then(
void skFromLogic(own, x.키).then(
(r) => r && alive && addRef(r, x.이름 || x.키, null),
failed,
);
if (cur.담은로직.some((r) => r.로직 === x.키))
return showToast(tc("Labor_Already").replace("{value}", `${x.키} ${x.이름}`), "error");
cur.담은로직.push({ 로직: x.키, 별칭: null, 메모: null, 입력값: {}, 수량: fresh() });
void loadLogics().then(() => changed());
}, withSangeun(library)),
});
@@ -538,7 +532,7 @@ export function mountLaborTable(
className: "m01-logic__section-head",
children: [
el("h3", { text: tc("Grid_Title") }),
...(edit && !(combo && opt.card)
...(edit && own && !(combo && opt.card)
? [el("div", { className: "ui-btn-group", children: [addLogic] })]
: []),
],
@@ -42,6 +42,15 @@ const TEXT = {
"Edits the library original — every structure using it follows",
],
Ref_ReadOnly: ["이 층은 고칠 수 없음 — 읽기만", "Read-only layer"],
Ref_Copy: [
"프로젝트 사본 — 보기만 · 고침은 M02 단가산출에서 고쳐 [재생성]",
"Project copy — view only · edit the build-up in M02 and regenerate",
],
Sk_NoCopy: ["사본에 이 단가산출 문서가 없음", "This copy has no build-up document"],
Logic_Direct: [
"M01 로직을 바로 담은 줄 — 단가산출 화면 없음 · 단가산출로 담아 쓰세요(일위대가 [로직 추가])",
"Uses the M01 logic directly — add it as a build-up to view or edit",
],
Lib_SaveFailed: ["저장 못 함", "Save failed"],
Ref_Discard: ["저장 안 한 고침을 버리고 닫음?", "Discard unsaved edits?"],
Labor_Source: ["원문", "Source"],
@@ -109,13 +118,9 @@ const TEXT = {
],
Labor_Code: ["코드", "Code"],
Labor_Spec: ["규격", "Spec"],
Labor_Already: ["이미 담은 단가산출 기초 — {value}", "Already added — {value}"],
Labor_AlreadyMat: ["이미 담은 자재 — {value}", "Already added — {value}"],
// 로직 자재(103-1)
Labor_InLogicMat: ["로직 자재에 있는 품목 — {value}", "Already a logic material — {value}"],
LogicMat_Swap: ["바꾸기", "Change"],
LogicMat_Reset: ["기본", "Default"],
LogicMat_PickTitle: ["로직 자재 바꾸기", "Change logic material"],
LogicMat_Inside: [
"로직 단가 안 금액 — 합계에 다시 안 더함",
"Inside the logic price — not added again",
+28 -7
View File
@@ -90,12 +90,13 @@ const input = (o = {}) => {
return { root: box("label", { "data-input": o.label ?? "" }, ""), input: i, setError() {} };
};
const modals = []; // 열린 모달 — 제목 · 몸
const toasts = []; // 알림 글(856-3 M01 로직 줄 안내)
const ui = {
ui_template_elements: {
el,
createButton: button,
createInputField: input,
showToast() {},
showToast: (text, kind) => toasts.push([kind, text]),
showConfirmDialog: async () => true,
},
ui_template_button: { createButton: button },
@@ -112,7 +113,7 @@ const ui = {
const head = box("div");
const close = () => {};
o.mount?.(body, close, head);
modals.push({ title: o.title, body, head, actions: o.actions ?? [] });
modals.push({ title: o.title, body, head, actions: o.actions ?? [], shut: o.beforeClose });
return { close };
},
askConfirm: async () => true,
@@ -158,6 +159,7 @@ const screen = {
// 서버 부름 — 길 · 몸을 적고 견본 답
const calls = [];
const files = { reads: 0, saves: 0 }; // 층 파일 읽기 · 저장 수
const api = {
call: async (p, init) => {
calls.push({ path: p, body: init?.body ? JSON.parse(init.body) : null });
@@ -166,8 +168,11 @@ const api = {
return { items: [{ ref: "X1", 이름: "견본", 단위: "EA", 값: 1 }] }; // 찾아 넣기(⑤)
return {};
},
readTemplate: async (_l, _k, key) => ({ 문서: { 키: key, 이름: "견본", 단위: "㎡" }, 판: "1" }),
saveTemplate: async () => ({}),
readTemplate: async (_l, _k, key) => (
files.reads++,
{ 문서: { 키: key, 이름: "견본", 단위: "㎡" }, 판: "1" }
),
saveTemplate: async () => (files.saves++, {}),
getActiveLayer: () => "system",
getActiveOwner: () => null,
};
@@ -366,7 +371,7 @@ async function openSk(doc, opt = {}) {
);
out.bands_fail = await bandCase({ doc: null, answer: null, fail: "서버 못 닿음" }, "SK-000004");
// ② 일위대가 표 줄 누름 — SK 참조 줄 · M01 로직 줄 · 셈 주입(프로젝트 사본) SK 줄
// ② 일위대가 표 줄 누름 — SK 참조 줄 · M01 로직 줄 · 셈 주입(원본 층 카드) · 프로젝트 사본(856-3 굳힌 SK 문서)
const { mountLaborTable } = M("M02_MasterTemplete/M02_MasterTemplete_Labor_Table.ts");
const rows = [
{
@@ -377,7 +382,9 @@ async function openSk(doc, opt = {}) {
},
{ 로직: "GC001109", 별칭: null, 메모: null, 입력값: {}, 수량: { 손: 1 } },
];
const click = async (calc) => {
const copyDoc = { 키: "SK-000010", 이름: "사본", 단위: "㎡", 수식: { 따로: true, 굳힘: true } };
const asked = [];
const click = async (calc, copy) => {
const res = [];
for (let i = 0; i < rows.length; i++) {
const t = mountLaborTable(
@@ -387,16 +394,21 @@ async function openSk(doc, opt = {}) {
mode: "precombo",
layer: "system",
column: "공통",
readOnly: false,
readOnly: !!calc && !copy, // 셈 주입 카드 = 보기만 · 사본은 표가 열려 있어도 줄 쌓기는 보기만인지 봄
owner: null,
onChanged() {},
...(calc ? { calc: async () => ({ 줄: [], 자재: [] }) } : {}),
...(copy
? { skCopy: async (ref) => (asked.push(ref.키), ref.키 === copy.키 ? copy : null) }
: {}),
},
);
await settle();
modals.length = 0;
stacks.length = 0;
calls.length = 0;
toasts.length = 0;
files.reads = files.saves = 0;
grid.onRowClick(i);
await settle();
const m = modals[0];
@@ -405,16 +417,25 @@ async function openSk(doc, opt = {}) {
modal: m ? m.title : null,
skModal: m ? all(m.body, (n) => "laborSk" in n.dataset).length : 0, // 그 SK 문서 모달(806-1)
stack: s ? { shown: shown(s.root), draws: s.draws.map((d) => d.key) } : null,
memory: s ? s.draws.map((d) => d.memory) : [],
admin: s ? s.opt.admin : null, // 고침 칸(편집) 열림
save: m ? all(m.head, (n) => n.dataset.button === "Save").length : 0, // [저장] 단추
files: { ...files },
toasts: toasts.map((x) => x[0]),
body: m ? all(m.body, (n) => "skCover" in n.dataset && shown(n)).length : 0,
banners: m ? all(m.body, (n) => "banner" in n.dataset).map((n) => n.dataset.banner) : [],
calc: skCalls().length,
});
for (const one of modals) await one.shut?.(); // 닫기(같은 SK 다시 열 수 있게)
t.destroy?.();
}
return res;
};
out.labor = await click(false);
out.labor_inject = await click(true);
out.labor_copy = await click(true, copyDoc);
out.labor_copy_asked = asked.slice();
out.labor_copy_none = await click(true, { ...copyDoc, 키: "SK-999999" });
// ④ M01 로직 상세 그릇 — 기본정보 접힘 + 줄 쌓기
const { buildLabDetail } = M("M01_MasterData/M01_MasterData_UI_LogicLab_Detail.ts");
@@ -34,20 +34,6 @@ def _save(folder, doc):
return key, json.loads((folder / "precombo" / f"{key}.json").read_bytes())
def test_화면_서고_모드도_자재목록_세_칸_자재_저장(world): # noqa: F811
"""723-2 — 서고 = 일위대가표만(`Labor_Table`) · [항목 추가] 머리(736-1 · 자재 추가 단추 걷음) · 세 칸 = 줄 모달(`Labor_RowModal`)."""
read = lambda name: open(os.path.join(SRC, name), encoding="utf-8").read() # noqa: E731
detail, lib = (
read("M02_MasterTemplete_Labor_Detail.ts"),
read("M02_MasterTemplete_Labor_Table.ts"),
)
modal = read("M02_MasterTemplete_Labor_RowModal.ts")
assert "return mountLaborTable(host, doc, opt);" in detail # 806-1 — 조합도 같은 부품
assert 'className: "ui-btn-group", children: [addLogic]' in lib and "addMat" not in lib
assert "setLogicMark(row, at, key, v);" in modal and "setMark(o.mat, key, v);" in modal
assert "delete out.자재" not in lib and "delete out.열" in lib
def test_저장_왕복_고름_자재표시_자재_남음(world): # noqa: F811
line = {"로직": NET, "고름": {"4": NET_ITEM}, "자재표시": {"3": {"자재구분": "관급"}}}
mats = [
-7
View File
@@ -130,13 +130,6 @@ def test_사전조합_안_줄도_별도계상_뺌():
assert got["기준"]["계"] == _kept(raw)["계"]
def test_화면_별도계상_바꾸면_다시_셈():
# 806-1 — 조합 · 서고 모두 일위대가표 부품 · 세 칸은 줄 모달(`Labor_RowModal`)
modal = open(os.path.join(SRC, "M02_MasterTemplete_Labor_RowModal.ts"), encoding="utf-8").read()
assert 'o.done(key === "별도계상");' in modal # 사용자 자재 · 로직 자재 모두 별도계상만 다시 셈
assert modal.count('o.done(key === "별도계상");') == 2
# ── ③ 원문 여럿 ──────────────────────────────────────────────────────
def test_원문_출처는_같은_책_절_모두():
src = inputs.sources(_whole().logic(MIX))
@@ -110,17 +110,3 @@ def test_B09_옛_사본_null_은_그대로_빈_줄():
def _src(name: str) -> str:
return open(os.path.join(SRC, name), encoding="utf-8").read()
def test_화면_수량_칸_저장_새_줄_1_두_칸():
table = _src("M02_MasterTemplete_Labor_Table.ts")
assert "const temp = new Map" not in table and "withTemp" not in table # 휘발 칸 걷음
assert "row.수량 = raw ? { 손: v } : null;" in table and "changed(true);" in table
assert (
table.count("수량: fresh()") == 4
) # 기초 · 참조 · 고정 · 자재 새 줄 = 서고 1 · 조합 면적 따름(806-1)
assert "const fresh = (): LaborRow" in table and "{ ...ONE }" in table
assert 'BasePrice: ["기준단위 단가"' in table and 'QtyAmount: ["수량 반영 금액"' in table
assert 'sum_price: t("BasePrice"), sum: t("QtyAmount")' in table
assert 'NeedQty: ["수량 입력"' in table
assert 'if (!edit || key !== "qty" || n === null) return false;' in table # 읽기 층 못 고침
-34
View File
@@ -45,25 +45,6 @@ def test_조합_상세_카드_서고_한_부품():
assert "openQtyModal({" in combo and "linkAreaCell(" in combo and "saveTemplate(" in combo
def test_단가산출_줄은_SK_문서_모달_저장은_그_SK():
table = _src("M02_MasterTemplete_Labor_Table.ts")
modal = _src("M02_MasterTemplete_Labor_SkEdit.ts")
assert 'ref.키.startsWith("SK-")' in modal # SK 참조 줄만
assert "if (isSkRef(row.참조) && !opt.calc)" in table # 셈 주입(프로젝트 복사본)엔 옛 줄 모달
assert "readOnly: !edit || row.참조.층 !== opt.layer," in table # 위 층 SK = 읽기만
assert re.search(r'readTemplate\(layer, "sangeun", opt\.ref\.키, null, opt\.ref\.주인\)', modal)
assert re.search(
r'saveTemplate\(\s*layer,\s*"sangeun",\s*opt\.ref\.키', modal
) # 저장 = 그 SK 문서
assert (
"mountSangeunDetail(host, doc," in modal and 'mode: "page"' in modal
) # 수식 탭 부품 그대로
assert "await handle.flush();" in modal # 수식 저장 먼저 → 문서 저장
assert "if (!opt.readOnly) head.append(ok);" in modal # 읽기만 = [저장] 없음
assert "if (opened.has(at)) return;" in modal # 빨리 두 번 눌러도 하나
assert "closed: (done) => alive && done && recalc()," in table # 저장했으면 금액 다시 셈
def test_부품상자만_700줄_명사형():
for name in (
"M02_MasterTemplete_Labor_Table.ts",
@@ -119,18 +100,3 @@ def test_옛_판_저장_409(world):
with pytest.raises(store.StoreError) as why:
store.write("sangeun", key, got["판"], got["문서"])
assert why.value.status == 409
def test_808_1_모달_머리_일원화():
"""808-1(요구 701-4 · 5) — 단가산출 줄 모달 머리 = 페이지 머리(보기 고르기 · [단가 갱신] · [재생성]) ·
로직 줄 모달(저장된 일위대가 줄 = 펼친 로직 줄 · 740-1) = 옛 [옵션] · [단가산출로도 저장] · [항목 추가] · [율 줄 추가] 없음 ·
보기 고르기 없이 상세만 + 안내(온 단가산출) · 줄 문서 키 SK-000000 = 수식 문서 안 읽음(404 없음)."""
sk = _src("M02_MasterTemplete_Labor_SkEdit.ts")
assert "slot,\n" in sk and "head.append(slot);" in sk
row = _src("M02_MasterTemplete_Labor_RowModal.ts")
for gone in ("AlsoSk", "createCheckbox", "openLaborInput", "saveAsSk", "Labor_Option"):
assert gone not in row, gone
assert 't("FromSk")' in row
detail = _src("M02_MasterTemplete_Sangeun_Detail.ts")
assert "...(opt.slot ? [] : [" in detail # 머리 칸 있으면 머리 줄 없음
assert "children: [tabs.tools]" in detail and "tabs.picker" not in detail
-10
View File
@@ -122,16 +122,6 @@ def test_마스터_층_단가산출_로직_줄_0():
def test_화면_줄_넣기_SK_사본_참조_부품():
table = _src("M02_MasterTemplete_Labor_Table.ts")
pick = _src("M02_MasterTemplete_Labor_SkPick.ts")
assert 'opt.layer !== "project" && !opt.calc ? { layer: opt.layer' in table # 프로젝트 = 옛 길
assert "return void skFromLogic(own, x.키).then(" in table # M01 기초 = SK 사본
assert "own && isSkRef(ref)" in table and "void ownSk(own, ref)" in table # 다른 층 = 사본
assert "if (isSkRef(row.참조) && !opt.calc)" in table # 줄 누름 = SK 수식 모달
assert "/sangeun/from-logic" in pick and "{ 본뜬 }" in pick and "withSameAsk(" in pick
assert (
"fetchSessionUser()" in pick
) # 주인 null = 자기 층 → 서버 참조 꼴(같은 층 SK 를 사본으로 안 만듦)
combo = _src("M02_MasterTemplete_Labor_Combo.ts")
assert "...refCards(doc, calc)" in combo and "key: r.참조.키," in combo # 다이어그램 참조 카드
for text in (table, pick):
assert len(text.splitlines()) <= 700
assert not re.search(r"""\bel\(\s*["'](button|input|select)["']""", text)
+26 -9
View File
@@ -2,7 +2,7 @@
"""PLAN 856-0 — 단가산출 화면 지킴(가짜 DOM · 진짜 코드 · `helper_856_0_sk_screen.cjs`).
① 단가산출 화면을 열 때 서버 `/sangeun/calc` 부름 0(856-2) · 숨은 상세 몸 DOM · 줄 쌓기 그림
② 일위대가 표 줄 누름 — 단가산출(SK) 참조 줄 = 그 SK 줄 쌓기 · M01 로직 줄 · 셈 주입(프로젝트 사본) 줄
② 일위대가 표 줄 누름 — 단가산출(SK) 참조 줄 = 그 SK 줄 쌓기 · M01 로직 줄 = 안내 · 프로젝트 사본 = 보기만(856-3)
③ 머리 띠(까닭 · M01 개정 · 빠진 줄)가 뜨는 경우 — 줄 쌓기 셈 답 · 사본 표지 견본(856-2 · 짝 잃음 = 덮개 없음)
④ M01 로직 상세 그릇 = 기본정보 접힘 + 줄 쌓기
⑤ 줄 쌓기 [+ 줄] 찾아 넣기 — 빈 낱말로 열어도 종류마다 서버 찾기 · 목록이 그려짐(856-F)
@@ -44,20 +44,37 @@ def test_sk_page_open_calls_and_hidden_body() -> None:
def test_labor_row_click() -> None:
sk, logic = _run()["labor"]
# 단가산출 참조 줄 = 그 SK 문서 모달 · 줄 쌓기가 그 키로 보임
# 단가산출 참조 줄 = 그 SK 문서 모달 · 줄 쌓기가 그 키로 보임 · 고칠 수 있음([저장] 있음)
assert sk["skModal"] == 1 and sk["stack"]["shown"] is True
assert sk["stack"]["draws"] == ["SK-000010"] and sk["calc"] == 0
# M01 로직 줄 = 줄 모달(안내 한 줄) · 상세 몸 · 줄 쌓기 · 셈 없음(856-1)
assert logic["skModal"] == 0 and logic["stack"] is None
assert logic["body"] == 0 and logic["banners"] == ["info"] and logic["calc"] == 0
assert sk["admin"] is True and sk["save"] == 1 and sk["files"] == {"reads": 1, "saves": 0}
# M01 로직 줄 = 창 없음 · 안내 알림 한 줄(856-3) · 셈 없음
assert logic["modal"] is None and logic["stack"] is None
assert logic["toasts"] == ["info"] and logic["calc"] == 0
def test_labor_row_click_inject() -> None:
sk, logic = _run()["labor_inject"]
# 셈 주입(프로젝트 사본) = 줄 모달 · 안내 한 줄(856-3 까지) · 셈 없음
for row in (sk, logic):
assert row["modal"] and row["stack"] is None
assert row["body"] == 0 and row["banners"] == ["info"] and row["calc"] == 0
# 셈 주입 원본 층 카드(보기만 표) = 그 층 SK 줄 쌓기 읽기만 · [저장] 없음
assert sk["skModal"] == 1 and sk["stack"]["draws"] == ["SK-000010"]
assert sk["admin"] is False and sk["save"] == 0 and sk["files"]["saves"] == 0
assert logic["modal"] is None and logic["toasts"] == ["info"]
def test_labor_row_click_project_copy() -> None:
got = _run()
sk, logic = got["labor_copy"]
# 856-3 프로젝트 사본 = 그 사본의 굳힌 SK 문서째 줄 쌓기 보기만 — 빈 키 + 문서째(memory) ·
# 고침 칸 잠김 · [저장] 없음 · 층 파일 읽기 · 저장 0 · 서버 셈 길 0
assert sk["skModal"] == 1 and sk["stack"]["shown"] is True
assert sk["stack"]["draws"] == [""] and sk["memory"] == [True]
assert sk["admin"] is False and sk["save"] == 0
assert sk["files"] == {"reads": 0, "saves": 0} and sk["calc"] == 0
assert got["labor_copy_asked"] == ["SK-000010"]
assert logic["modal"] is None and logic["toasts"] == ["info"]
# 사본에 그 문서가 없음 = 창 없음 · 알림(error)
none = got["labor_copy_none"][0]
assert none["modal"] is None and none["toasts"] == ["error"]
def test_head_bands() -> None:
@@ -142,16 +142,3 @@ def test_입력이_바뀌면_걸린_고름만_풂_화면_짝():
def _src(name):
with open(os.path.join(HERE, "..", "..", "M02_MasterTemplete", name), encoding="utf-8") as f:
return f.read()
def test_로직_자재_줄_누름은_그_로직_옵션_모달_사용자_줄은_그대로():
"""148-1 — 고칠 때 · 읽기만 둘 다 `open: openRow` · 바꾸기 단추 칸은 swap 있을 때만 · 사용자 줄 = openMat."""
# 806-1 — 조합 · 서고 모두 일위대가표 부품 — 로직 자재 바꾸기 · 세 칸은 줄 모달(`Labor_RowModal`) 안
modal = _src("M02_MasterTemplete_Labor_RowModal.ts")
assert (
"open: () => undefined," in modal and "swap: (_r: number, at: number, key: string)" in modal
)
mats = _src("M02_MasterTemplete_Labor_LogicMats.ts")
assert "const tools = swap" in mats
assert 'tr.addEventListener("click", () => on.open(r))' in mats
assert '${on ? " is-open" : ""}' in mats
@@ -118,15 +118,6 @@ def _src(name):
def test_화면_칸_부품_사용자_줄_로직_줄_같은_칸():
marks = _src("M02_MasterTemplete_Labor_MatMarks.ts")
assert '"—"' not in marks # 「—」 항목 없음(162-1)
assert "e.stopPropagation()" in marks # 줄 누름과 따로
rows = _src("M02_MasterTemplete_Labor_MatTable.ts") # 717-3 자재목록 표 나눔
assert "...markCells(mat, on?.mark" in rows and "...markHeads()," in rows
assert "...markCells(" in _src("M02_MasterTemplete_Labor_LogicMats.ts")
modal = _src("M02_MasterTemplete_Labor_RowModal.ts") # 806-1 — 조합 · 서고 모두 줄 모달 안
assert "mark: (_r: number, at: number, key: MatMarkKey, v: string)" in modal
assert "mark: (_i, key, v) =>" in modal
# 서버 허용 값 = 화면 허용 값
api = _src("M02_MasterTemplete_Labor_Api.ts")
for key, allowed in labor.MARKS.items():
@@ -18,6 +18,7 @@ import { readTemplate } from "../M02_MasterTemplete/M02_MasterTemplete_Api_Fetch
import { formatMoney } from "../common_util/common_util_money";
import { dateText } from "../common_util/common_util_time";
import { calcLabor, type LaborDoc } from "../M02_MasterTemplete/M02_MasterTemplete_Labor_Api";
import { lineId } from "../M02_MasterTemplete/M02_MasterTemplete_Labor_Calc";
import type { EditKind, ItemCardsHandle } from "../M02_MasterTemplete/M02_MasterTemplete_ItemCards";
import type { ItemSource } from "../M02_MasterTemplete/M02_MasterTemplete_ItemSource";
import type { ValueDoc } from "../M02_MasterTemplete/M02_Labor_Values_Model";
@@ -193,6 +194,13 @@ export function createItemDetail(opts: ItemDetailOptions): ItemDetail {
return { 문서: labor?.줄 ? withCopyValues(labor.줄, values, picks) : {} };
},
calc: () => calcCopy(at),
// 856-3 단가산출 줄 = 사본의 굳힌 SK 문서(`참조사본`) — 줄 쌓기 보기만
sk: async (ref) => {
const labor = (await readCopy(at, "일위대가")) as {
참조사본?: Record<string, Record<string, unknown>>;
} | null;
return labor?.참조사본?.[lineId({ 참조: ref }) ?? ""] ?? null;
},
},
};
}