Отчёты по сотрудникам: To-do report и Employee Activity, события JobTread в data_collector
Новый package employee_reports (порт 8091): To-do report перенесён идейно из khbuild_tests на зеркало Supabase (Stale Days, выбор снимка, Excel-выгрузка) и дополнен показателем «любая активность в инфополе»; Employee Activity - у каждого менеджера встроенный график по дням с цветом дня (зелёный - Daily Log, жёлтый - активность не меньше порога, тёмно-красный - меньше порога) и итоговый график зелёных и жёлтых людей внизу. data_collector: модуль events (jt_event, POST /events/sync) - загрузка ленты событий JobTread; миграция 009; методология docs/activity_methodology.md. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
28
packages/employee_reports/src/export.ts
Normal file
28
packages/employee_reports/src/export.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import ExcelJS from "exceljs";
|
||||
import type { TodoSourceRow } from "./repo.js";
|
||||
|
||||
const COLUMNS: Array<{ key: keyof TodoSourceRow; header: string; width: number }> = [
|
||||
{ key: "snapshot_ts", header: "snapshot_ts", width: 26 },
|
||||
{ key: "id", header: "id", width: 16 },
|
||||
{ key: "job_number", header: "job_number", width: 12 },
|
||||
{ key: "job_name", header: "job_name", width: 30 },
|
||||
{ key: "name", header: "name", width: 50 },
|
||||
{ key: "description", header: "description", width: 60 },
|
||||
{ key: "start_date", header: "start_date", width: 12 },
|
||||
{ key: "end_date", header: "end_date", width: 12 },
|
||||
{ key: "progress", header: "progress", width: 10 },
|
||||
{ key: "stale_days", header: "stale_days", width: 11 },
|
||||
{ key: "assignees", header: "assignees", width: 40 },
|
||||
{ key: "overdue_or_undated", header: "overdue_or_undated", width: 18 },
|
||||
];
|
||||
|
||||
/** Excel-выгрузка исходных данных выбранного снимка: все открытые to-do с ответственными и Stale Days. */
|
||||
export async function buildWorkbook(rows: TodoSourceRow[]): Promise<Buffer> {
|
||||
const wb = new ExcelJS.Workbook();
|
||||
const sheet = wb.addWorksheet("jobtread_todo");
|
||||
sheet.columns = COLUMNS.map((c) => ({ header: c.header, key: c.key, width: c.width }));
|
||||
sheet.getRow(1).font = { bold: true };
|
||||
sheet.views = [{ state: "frozen", ySplit: 1 }];
|
||||
for (const r of rows) sheet.addRow(r);
|
||||
return Buffer.from(await wb.xlsx.writeBuffer());
|
||||
}
|
||||
Reference in New Issue
Block a user