Гант: отрицательные дни, этапы До CP-0 / Договоры PreConstruction / Договор Construction, Пермит после договоров; предупреждение о сроке только при наличии зависимостей
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -47,11 +47,13 @@ export const clampPx = (px: number | undefined): number => {
|
||||
|
||||
/** Группы презентации «Pre-construction»: порядок сверху вниз и цвета (сплошная полоса / светлый тон для примерных сроков). */
|
||||
export const STAGE_STYLES: ReadonlyArray<{ stage: string; fill: string; stroke: string }> = [
|
||||
{ stage: "Договоры", stroke: "#7a808f", fill: "#dde0e6" },
|
||||
{ stage: "До CP-0", stroke: "#8a6bb5", fill: "#e5dcf1" },
|
||||
{ stage: "Договоры PreConstruction", stroke: "#7a808f", fill: "#dde0e6" },
|
||||
{ stage: "Пермит", stroke: "#d8622f", fill: "#f7d9cc" },
|
||||
{ stage: "Архитектура", stroke: "#3f9a78", fill: "#d4ece3" },
|
||||
{ stage: "Спецификации", stroke: "#3f7ea6", fill: "#d3e4ef" },
|
||||
{ stage: "Пермит", stroke: "#d8622f", fill: "#f7d9cc" },
|
||||
{ stage: "Финансы", stroke: "#d4982f", fill: "#f5e6c8" },
|
||||
{ stage: "Договор Construction", stroke: "#7a808f", fill: "#dde0e6" },
|
||||
{ stage: "Закупки", stroke: "#6f93ab", fill: "#dbe6ee" },
|
||||
{ stage: "Стройка", stroke: "#1f7a52", fill: "#cfe6da" },
|
||||
];
|
||||
@@ -168,7 +170,8 @@ export function renderGantt(model: ProcessModel, schedule: Schedule, opts: Gantt
|
||||
const roleName = new Map(model.roles.map((r) => [r.id, r.person ?? r.id]));
|
||||
const conflicts = new Map<string, string[]>();
|
||||
for (const w of schedule.warnings) conflicts.set(w.id, [...(conflicts.get(w.id) ?? []), w.message]);
|
||||
const x = (d: number) => GANTT_LEFT + d * px;
|
||||
const minDay = Math.min(0, ...[...schedule.timings.values()].filter((t) => t.kind !== "recurring").map((t) => t.start));
|
||||
const x = (d: number) => GANTT_LEFT + (d - minDay) * px;
|
||||
|
||||
// Группы: строки этапа по началу
|
||||
interface Group { stage: string; rows: Array<{ row: ProcessRow; t: Timing }>; summary: GroupSummary; collapsed: boolean; labels: PlacedLabel[]; levels: number; headH: number; top: number; bottom: number }
|
||||
@@ -207,7 +210,7 @@ export function renderGantt(model: ProcessModel, schedule: Schedule, opts: Gantt
|
||||
...groups.flatMap((g) => g.labels.map((l) => l.x + (l.text.length * CHAR_W) / 2)),
|
||||
...groups.flatMap((g) => (g.collapsed ? [] : g.rows.map(({ row, t }) => x(Math.max(t.start, t.end)) + 14 + (row.actionName ?? row.description ?? "").length * CHAR_W))),
|
||||
);
|
||||
const width = Math.round(Math.max(GANTT_LEFT + days * px + 30, labelRight + 16));
|
||||
const width = Math.round(Math.max(GANTT_LEFT + (days - minDay) * px + 30, labelRight + 16));
|
||||
|
||||
const out: string[] = [];
|
||||
out.push(`<text x="12" y="24" font-size="16" font-weight="600" fill="#222">Диаграмма Ганта процесса (${esc(model.set)}): дни от первой встречи с архитектором</text>`);
|
||||
@@ -216,10 +219,10 @@ export function renderGantt(model: ProcessModel, schedule: Schedule, opts: Gantt
|
||||
const steps = [1, 2, 5, 7, 14, 30, 60, 90, 180];
|
||||
const tick = steps.find((s) => s * px >= 64) ?? 180;
|
||||
const gridStep = steps.find((s) => s * px >= 8) ?? 7;
|
||||
for (let d = 0; d <= days; d += gridStep) {
|
||||
for (let d = Math.ceil(minDay / gridStep) * gridStep; d <= days; d += gridStep) {
|
||||
out.push(`<line x1="${x(d)}" y1="${HEAD - 4}" x2="${x(d)}" y2="${height - 30}" stroke="${d % tick === 0 ? "#c9c9c9" : "#eeeeee"}" stroke-width="1"/>`);
|
||||
}
|
||||
for (let d = 0; d <= days; d += tick) {
|
||||
for (let d = Math.ceil(minDay / tick) * tick; d <= days; d += tick) {
|
||||
out.push(`<line x1="${x(d)}" y1="${HEAD - 18}" x2="${x(d)}" y2="${height - 30}" stroke="#bdbdbd" stroke-width="1.2"/>`);
|
||||
out.push(`<text x="${x(d) + 3}" y="${HEAD - 38}" fill="#444" font-weight="600">день ${d}</text>`);
|
||||
const date = opts.kickoff ? addDays(opts.kickoff, d) : null;
|
||||
|
||||
Reference in New Issue
Block a user