Визуализатор: справочник ответственных, каноническая длительность, поддержка обеих схем
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, Timing } from "./schedule.js";
import { esc, svgDoc, tooltip, truncate } from "./svg.js";
@@ -266,7 +266,7 @@ export function renderGantt(model: ProcessModel, schedule: Schedule, opts: Gantt
const tip = tooltip([
`${row.id} - ${row.actionName ?? ""}${row.isMilestone ? " (веха)" : ""}`,
row.description,
`Ответственный: ${[row.role ? roleName.get(row.role) ?? row.role : null, row.responsibleName].filter(Boolean).join(" / ") || "не указан"}`,
`Ответственный: ${describeResponsible(row, model)}`,
row.systemToBe ? `Система: ${row.systemToBe}` : null,
row.dateConstraint ? `Срок: ${row.dateConstraint}` : `Срок выведен из зависимостей: день ${t.start}${t.end !== t.start ? "–" + t.end : ""}`,
row.duration ? `Длительность: ${row.duration}` : null,
@@ -284,7 +284,7 @@ export function renderGantt(model: ProcessModel, schedule: Schedule, opts: Gantt
const dash = t.approx ? ' stroke-dasharray="4 2"' : "";
const textW = name.length * CHAR_W;
const idText = (tx: number, anchor: "start" | "end") =>
out.push(`<text x="${tx}" y="${top + ROW - 3}" text-anchor="${anchor}" font-size="9" letter-spacing="0.5" fill="#777">${esc(row.id)}</text>`);
out.push(`<text x="${tx}" y="${top + ROW - 3}" text-anchor="${anchor}" font-size="9" letter-spacing="0.5" fill="#777">${esc(row.id)}${row.duration ? ` · ${esc(row.duration)}` : ""}</text>`);
if (t.kind === "recurring") {
const w = Math.max(2, (t.end - t.start) * px);
out.push(`<rect x="${x(t.start)}" y="${cy - 4}" width="${w}" height="8" rx="3" fill="${c.stroke}" fill-opacity="0.35" stroke="${c.stroke}" stroke-width="0.8"/>`);
@@ -335,7 +335,14 @@ export function renderGantt(model: ProcessModel, schedule: Schedule, opts: Gantt
]);
// зона клика: левая колонка и сама полоса
out.push(`<g data-toggle="${esc(g.stage)}" style="cursor:pointer">${tip}<rect x="0" y="${g.top}" width="${GANTT_LEFT - 24}" height="${g.headH}" fill="#000" fill-opacity="0"/>`);
const people = [...new Set(g.rows.map(({ row }) => (row.role ? roleName.get(row.role) ?? row.role : null)).filter((v): v is string => !!v))];
const personOf = new Map(model.responsible.map((r) => [r.id, r.person ?? r.id]));
const people = [
...new Set(
g.rows
.flatMap(({ row }) => (row.responsible.length ? row.responsible.map((id) => personOf.get(id) ?? id) : [row.role ? roleName.get(row.role) ?? row.role : null]))
.filter((v): v is string => !!v),
),
];
out.push(`<text x="14" y="${g.top + 19}" font-size="13" fill="${c.stroke}">${g.collapsed ? "▸" : "▾"}</text>`);
out.push(`<text x="32" y="${g.top + 19}" font-size="14" font-weight="700" fill="#222">${esc(truncate(g.stage, 30))}<tspan dx="6" font-size="11" font-weight="400" fill="#667085">(${g.rows.length})</tspan></text>`);
if (people.length) out.push(`<text x="32" y="${g.top + 34}" font-size="11" fill="#667085">${esc(truncate(people.join(" · "), 44))}</text>`);