Визуализатор: справочник ответственных, каноническая длительность, поддержка обеих схем
All checks were successful
ci / test (push) Successful in 18s
ci / deploy (push) Successful in 1m18s

Модель читает khbuild_responsible (колонки responsible, responsible2/3 =
ключ «роль - Имя»); если справочника нет (архив khnata) - прежние
responsible_role/responsible_name и khnata_roles. Длительность: 5d - календарные
дни, 5wd - рабочие, суффикс ? игнорируется при расчёте и выводится в Ганте и
ARIS. Тесты на обе схемы и откат на прежний справочник.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-14 19:58:57 +03:00
parent a4f338c5d1
commit f1971b8975
6 changed files with 246 additions and 25 deletions

View File

@@ -1,4 +1,4 @@
import type { ProcessModel, ProcessRow } from "./model.js";
import { describeResponsible, type ProcessModel, type ProcessRow } from "./model.js";
import type { Schedule } from "./schedule.js";
import { esc, svgDoc, tooltip, truncate, wrap } from "./svg.js";
@@ -191,7 +191,7 @@ export function renderAris(model: ProcessModel, schedule: Schedule, opts: ArisOp
// Узлы
for (const n of nodes) {
if (n.kind === "F" && n.row) out.push(fnSvg(n, n.row, roleName, sysName));
if (n.kind === "F" && n.row) out.push(fnSvg(n, n.row, roleName, sysName, model));
else if (n.kind === "E" && n.row) out.push(evSvg(n, n.row, schedule));
else if (n.kind === "D" && n.dataId) out.push(dataSvg(n, dataInfo.get(n.dataId), n.dataId, roleName));
}
@@ -203,14 +203,14 @@ export function renderAris(model: ProcessModel, schedule: Schedule, opts: ArisOp
return svgDoc(width, height, defs, out.join("\n"));
}
function fnSvg(n: Node, r: ProcessRow, roleName: Map<string, string>, sysName: Map<string, string>): string {
function fnSvg(n: Node, r: ProcessRow, roleName: Map<string, string>, sysName: Map<string, string>, model: ProcessModel): string {
const cp = isCp(r.id);
const c = cp ? C.fnCp : C.fn;
const title = wrap(r.actionName ?? r.description ?? "", 23, 2);
const tip = tooltip([
`${r.id} - ${r.actionName ?? ""}`,
r.description,
`Ответственный: ${[r.role ? roleName.get(r.role) ?? r.role : null, r.responsibleName].filter(Boolean).join(" / ") || "не указан"}`,
`Ответственный: ${describeResponsible(r, model)}`,
r.dateConstraint ? `Срок: ${r.dateConstraint}` : null,
r.duration ? `Длительность: ${r.duration}` : null,
r.dataIn.length ? `Вход: ${r.dataIn.join(", ")}` : null,
@@ -225,6 +225,7 @@ function fnSvg(n: Node, r: ProcessRow, roleName: Map<string, string>, sysName: M
const w = Math.min(n.w - 16, 12 + label.length * 6.2);
parts.push(`<rect x="${n.x + 8}" y="${n.y + n.h - 19}" width="${w}" height="14" rx="4" fill="${C.sys.fill}" stroke="${C.sys.stroke}"/><text x="${n.x + 14}" y="${n.y + n.h - 8}" font-size="10" fill="#10335a">${esc(label)}</text>`);
}
if (r.duration) parts.push(`<text x="${n.x + n.w - 8}" y="${n.y + n.h - 8}" text-anchor="end" font-size="10" font-weight="600" fill="#3d5a1f">${esc(r.duration)}</text>`);
if (r.questions) parts.push(`<circle cx="${n.x + n.w - 10}" cy="${n.y + 10}" r="5" fill="#e6a100"/>`);
parts.push("</g>");
return parts.join("");