fix(M01-로직판): Steps 다른 일위대가 결과를 로직 이름으로 보임 - 못 찾으면 다른 일위대가
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01D2nUMUMTsqm93PbQtipo6c
This commit is contained in:
@@ -6,7 +6,12 @@
|
||||
* ========================================================================== */
|
||||
|
||||
import { createButton, el, showToast } from "@ui/ui_template_elements";
|
||||
import type { CalcAnswer, CalcLine, LogicInput } from "../M01_MasterData_UI_Logic_Api";
|
||||
import {
|
||||
fetchLogics,
|
||||
type CalcAnswer,
|
||||
type CalcLine,
|
||||
type LogicInput,
|
||||
} from "../M01_MasterData_UI_Logic_Api";
|
||||
import { formatMoney } from "../M01_MasterData_UI_Logic_Money";
|
||||
import {
|
||||
addCard,
|
||||
@@ -23,6 +28,7 @@ import { setCond, type LbLogic, type LbLookup, type LbRef } from "./M01_LB_Block
|
||||
import { calcBody, calcView } from "./M01_LB_Steps_Calc";
|
||||
import {
|
||||
chip,
|
||||
logicNames,
|
||||
lookupValue,
|
||||
note,
|
||||
numBox,
|
||||
@@ -42,6 +48,7 @@ import "./M01_LB_Steps.css";
|
||||
type Kind = "person" | "material" | "machine" | "logic" | "percent" | "locked";
|
||||
|
||||
let picking = false;
|
||||
let namesLoading = false;
|
||||
|
||||
/* ------------------------------ ① 입력값 ------------------------------ */
|
||||
|
||||
@@ -367,4 +374,19 @@ export function renderSteps(
|
||||
),
|
||||
section(tx("S5"), [el("li", { className: "m01-lbsteps-row", children: [resultView(ctx)] })]),
|
||||
);
|
||||
// 다른 일위대가 이름 — 목록을 한 번 받은 뒤 다시 그림
|
||||
if (
|
||||
!logicNames.size &&
|
||||
!namesLoading &&
|
||||
JSON.stringify([lb.calcs, lb.lookups]).includes('"k":"logic"')
|
||||
) {
|
||||
namesLoading = true;
|
||||
fetchLogics()
|
||||
.then((all) => {
|
||||
for (const l of all) logicNames.set(l.키, l.이름);
|
||||
renderSteps(host, lb, ans, on);
|
||||
})
|
||||
.catch(() => undefined)
|
||||
.finally(() => (namesLoading = false));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ export const TEXT = {
|
||||
SrcCalc: ["계산 · ", "calc · "],
|
||||
SrcFixed: ["고정값", "fixed value"],
|
||||
SrcAny: ["무관(조건에서 뺌)", "any (remove condition)"],
|
||||
Other: ["다른 일위대가 결과", "Other unit price result"],
|
||||
Other: ["다른 일위대가", "Other unit price"],
|
||||
Hard: ["이 화면에서 못 고치는 값", "Value not editable here"],
|
||||
Mul: ["×", "×"],
|
||||
Div: ["÷", "÷"],
|
||||
@@ -197,6 +197,9 @@ export const isRef = (r: Ref, k: "lookup", id: string): boolean => r.k === k &&
|
||||
export const lookupNo = (ctx: Ctx, id: string): number =>
|
||||
ctx.lb.lookups.findIndex((l) => l.id === id) + 1;
|
||||
|
||||
/** 로직 이름 — 목록을 한 번 받아 채움(키 → 이름) · 못 받으면 「다른 일위대가」 */
|
||||
export const logicNames = new Map<string, string>();
|
||||
|
||||
export function refText(ctx: Ctx, r: Ref): string {
|
||||
switch (r.k) {
|
||||
case "input":
|
||||
@@ -210,7 +213,7 @@ export function refText(ctx: Ctx, r: Ref): string {
|
||||
return `${tx("LkNum")}${lookupNo(ctx, r.id)}${lk ? ` · ${lk.col}` : ""}`;
|
||||
}
|
||||
case "logic":
|
||||
return `${tx("Other")} ${r.key}${r.field ? ` · ${r.field}` : ""}`;
|
||||
return `${logicNames.get(r.key) ?? tx("Other")}${r.field ? ` · ${r.field}` : ""}`;
|
||||
case "cost":
|
||||
return tx(`Base_${r.name}`);
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user