diff --git a/M01_MasterData/M01_MasterData_UI_LogicLab_Detail.ts b/M01_MasterData/M01_MasterData_UI_LogicLab_Detail.ts index cf558b31..0a4ae57b 100644 --- a/M01_MasterData/M01_MasterData_UI_LogicLab_Detail.ts +++ b/M01_MasterData/M01_MasterData_UI_LogicLab_Detail.ts @@ -87,6 +87,8 @@ interface Entry { qty: string; qtyTag: string; qtyFrag: Fragment[]; + /** 한 줄이 비목 몫으로 갈렸을 때 이 묶음의 몫 이름(예 「노무비」) */ + share?: string; price: string; amount: number | null; /** 덧줄이면 true */ @@ -188,7 +190,12 @@ function infoBox(ctx: DetailContext): HTMLElement { const spread = (e: Entry, line?: CalcLine): Entry[] => { const parts = Object.entries(line?.비목 ?? {}).filter(([, v]) => v !== 0); if (!parts.length) return [e]; - return parts.map(([k, v]) => ({ ...e, group: OF_COST[k] ?? "other", amount: v })); + return parts.map(([k, v]) => ({ + ...e, + group: OF_COST[k] ?? "other", + amount: v, + ...(parts.length > 1 ? { share: k } : {}), + })); }; function entries(ctx: DetailContext): Entry[] { @@ -275,6 +282,9 @@ function lineRow(e: Entry): HTMLElement { el("td", { children: [ el("div", { text: e.name }), + ...(e.share + ? [el("div", { className: "m01-logic__tag", text: `${e.share} ${tl("Share")}` })] + : []), ...(e.spec ? [el("div", { className: "m01-logic__muted", text: e.spec })] : []), ], }), diff --git a/M01_MasterData/M01_MasterData_UI_LogicLab_Text.ts b/M01_MasterData/M01_MasterData_UI_LogicLab_Text.ts index c4d691ec..9288970a 100644 --- a/M01_MasterData/M01_MasterData_UI_LogicLab_Text.ts +++ b/M01_MasterData/M01_MasterData_UI_LogicLab_Text.ts @@ -30,6 +30,7 @@ const TEXT = { G_other: ["그 밖 (인력·자재·경비 어디에도 안 맞는 줄)", "Other (fits none of the three)"], Tag_Table: ["표", "Table"], Subtotal: ["소계", "Subtotal"], + Share: ["몫", "Share"], Total: ["계", "Total"], Extra: ["덧줄", "Extra"], Col_Name: ["이름", "Name"], diff --git a/M01_MasterData/M01_MasterData_UI_Logic_Calc.ts b/M01_MasterData/M01_MasterData_UI_Logic_Calc.ts index 484592d7..6d1e84d0 100644 --- a/M01_MasterData/M01_MasterData_UI_Logic_Calc.ts +++ b/M01_MasterData/M01_MasterData_UI_Logic_Calc.ts @@ -139,7 +139,12 @@ export function buildCalc(host: HTMLElement, ctx: CalcContext): void { ctx.onText?.(answer); }); } - if (ctx.savedKey !== null && !autoAsked.has(ctx.values)) { + if (!fields.length && !autoAsked.has(ctx.values)) { + autoAsked.add(ctx.values); // 입력이 없으면 채울 것이 없음 — 열 때 한 번 바로 계산 + queueMicrotask(() => { + if (previewSeq === mySeqAtOpen) host.querySelector("button")?.click(); + }); + } else if (ctx.savedKey !== null && !autoAsked.has(ctx.values)) { autoAsked.add(ctx.values); void fetchAuto(ctx.savedKey).then((auto) => { const names = (ctx.row.입력 ?? [])