feat(M01): 로직 개선 시험 「텍스트 수식」 컨테이너 — 서버 /text 가 준 줄(비목 묶음 · 소계 · 끝수 · 까닭 옅게)을 그대로 찍음
- `runText` API + 시험 계산 때 `/calc` 와 같은 몸으로 같이 부름 · 화면은 다시 계산하지 않음 - 멈추면 서버 까닭 한 줄 - ORCA 13-4-1 · 12-4 · 12-17-1 소계 합이 호표 계와 같음 · 모달 표 뜸 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WRFJmmhPi4exAzHgPZHMT
This commit is contained in:
@@ -7,8 +7,10 @@
|
||||
import { createButton, createSelectField, el, showToast } from "@ui/ui_template_elements";
|
||||
import {
|
||||
runCalc,
|
||||
runText,
|
||||
type CalcAnswer,
|
||||
type CalcLine,
|
||||
type TextAnswer,
|
||||
type LogicRow,
|
||||
} from "./M01_MasterData_UI_Logic_Api";
|
||||
import { formatNumber } from "./M01_MasterData_UI_Logic_Edit";
|
||||
@@ -23,6 +25,8 @@ export interface CalcContext {
|
||||
/** 로직마다 넣은 값 — 다시 그려도 남음 */
|
||||
values: Record<string, string>;
|
||||
onLines: (lines: CalcLine[] | null) => void;
|
||||
/** 읽는 식 줄(`/text`)도 같이 받고 싶을 때 — 호출이 `onLines` 보다 먼저 */
|
||||
onText?: (answer: TextAnswer) => void;
|
||||
}
|
||||
|
||||
const SUMS = ["노무비", "재료비", "경비", "계"];
|
||||
@@ -68,11 +72,13 @@ export function buildCalc(host: HTMLElement, ctx: CalcContext): void {
|
||||
}
|
||||
const draft = ctx.dirty() || ctx.savedKey === null;
|
||||
try {
|
||||
const answer = await runCalc({
|
||||
const body = {
|
||||
key: ctx.savedKey ?? ctx.row.키,
|
||||
inputs,
|
||||
...(draft ? { row: ctx.row, file: ctx.file } : {}),
|
||||
});
|
||||
};
|
||||
const answer = await runCalc(body);
|
||||
if (ctx.onText) ctx.onText(await runText(body));
|
||||
ctx.onLines(answer.ok ? (answer.lines ?? null) : null);
|
||||
out.replaceChildren(...answerView(answer, draft));
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user