178 lines
5.9 KiB
JavaScript
178 lines
5.9 KiB
JavaScript
// generate-team-ppt.js
|
||
const pptxgenjs = require("C:/nvm4w/nodejs/node_modules/pptxgenjs");
|
||
|
||
// ── 颜色常量 ──────────────────────────────────────────────
|
||
const C = {
|
||
accent: "E20074",
|
||
accentDk: "BE0060",
|
||
bg: "F7F7FA",
|
||
bgCard: "FFFFFF",
|
||
bgHover: "F0F0F5",
|
||
border: "E0E0EA",
|
||
text: "1A1A2E",
|
||
text2: "4A4A6A",
|
||
text3: "8888AA",
|
||
green: "00896A",
|
||
orange: "CC6200",
|
||
blue: "2A68C8",
|
||
purple: "5A46B4",
|
||
red: "C0392B",
|
||
darkBg: "1A1A2E",
|
||
};
|
||
|
||
// ── 辅助函数 ─────────────────────────────────────────────
|
||
function makeShadow() {
|
||
return { type: "outer", color: "000000", opacity: 0.08, blur: 6, offset: 2, angle: 45 };
|
||
}
|
||
|
||
function topBar(slide) {
|
||
slide.addShape("rect", {
|
||
x: 0, y: 0, w: "100%", h: 0.04,
|
||
fill: { type: "grad", stops: [{ position: 0, color: C.accent }, { position: 100, color: C.accentDk }] },
|
||
line: { color: C.accent, width: 0 },
|
||
});
|
||
}
|
||
|
||
|
||
function sectionLabel(slide, text, x, y) {
|
||
slide.addText(text, {
|
||
x, y, w: 9, h: 0.25,
|
||
fontSize: 9, bold: true, color: C.accent,
|
||
charSpacing: 3, fontFace: "Calibri",
|
||
});
|
||
}
|
||
|
||
function sectionTitle(slide, text, x, y) {
|
||
slide.addText(text, {
|
||
x, y, w: 9, h: 0.5,
|
||
fontSize: 26, bold: true, color: C.text, fontFace: "Calibri",
|
||
});
|
||
}
|
||
|
||
function sectionSub(slide, text, x, y) {
|
||
slide.addText(text, {
|
||
x, y, w: 10, h: 0.3,
|
||
fontSize: 12, color: C.text3, fontFace: "Calibri",
|
||
});
|
||
}
|
||
|
||
function slideNum(slide, n, total) {
|
||
slide.addText(`${n} / ${total}`, {
|
||
x: 12, y: 7.1, w: 1.2, h: 0.25,
|
||
fontSize: 9, color: C.text3, align: "right", fontFace: "Calibri Light",
|
||
});
|
||
}
|
||
|
||
// ── 初始化 PPT ───────────────────────────────────────────
|
||
const prs = new pptxgenjs();
|
||
prs.layout = "LAYOUT_WIDE";
|
||
prs.defineLayout({ name: "LAYOUT_WIDE", width: 13.33, height: 7.5 });
|
||
|
||
// ════════════════════════════════════════════════════════
|
||
// Slide 1 — 封面
|
||
// ════════════════════════════════════════════════════════
|
||
{
|
||
const sl = prs.addSlide();
|
||
// 浅色背景
|
||
sl.addShape("rect", {
|
||
x: 0, y: 0, w: "100%", h: "100%",
|
||
fill: { color: C.bg }, line: { color: C.bg, width: 0 },
|
||
});
|
||
|
||
// 左侧品牌色竖栏 3.2"
|
||
sl.addShape("rect", {
|
||
x: 0, y: 0, w: 3.2, h: 7.5,
|
||
fill: { type: "grad", stops: [{ position: 0, color: "B0005A" }, { position: 100, color: C.accent }] },
|
||
line: { color: C.accent, width: 0 },
|
||
});
|
||
|
||
// 左栏:英文副标题
|
||
sl.addText("EMS & EHS Compliance\nIntelligence Hub", {
|
||
x: 0.3, y: 1.8, w: 2.6, h: 0.7,
|
||
fontSize: 11, italic: true, color: "FFFFFF",
|
||
fontFace: "Calibri Light", align: "center",
|
||
});
|
||
|
||
// 左栏:项目大标题
|
||
sl.addText("AI + 合规\n智能中枢", {
|
||
x: 0.2, y: 2.6, w: 2.8, h: 1.2,
|
||
fontSize: 24, bold: true, color: "FFFFFF",
|
||
fontFace: "Calibri", align: "center",
|
||
});
|
||
|
||
// 左栏:分隔线
|
||
sl.addShape("rect", {
|
||
x: 0.6, y: 3.9, w: 2.0, h: 0.02,
|
||
fill: { color: "FFFFFF", transparency: 60 },
|
||
line: { color: "FFFFFF", width: 0 },
|
||
});
|
||
|
||
// 左栏:团队 + 日期
|
||
sl.addText("T-Systems · AI 合规项目组", {
|
||
x: 0.2, y: 4.0, w: 2.8, h: 0.28,
|
||
fontSize: 10, color: "FFFFFF", fontFace: "Calibri Light", align: "center",
|
||
});
|
||
sl.addText("2026 年 05 月", {
|
||
x: 0.2, y: 4.3, w: 2.8, h: 0.28,
|
||
fontSize: 10, color: "FFFFFF", fontFace: "Calibri Light", align: "center",
|
||
});
|
||
|
||
// 右侧:标签
|
||
sl.addText("TEAM PROGRESS REPORT", {
|
||
x: 3.6, y: 1.2, w: 6, h: 0.25,
|
||
fontSize: 9, bold: true, color: C.accent,
|
||
charSpacing: 3, fontFace: "Calibri",
|
||
});
|
||
|
||
// 右侧:汇报标题
|
||
sl.addText("团队阶段性汇报", {
|
||
x: 3.6, y: 1.5, w: 9, h: 0.65,
|
||
fontSize: 34, bold: true, color: C.text, fontFace: "Calibri",
|
||
});
|
||
|
||
// 右侧:说明文字
|
||
sl.addText("基于 Agent 协同的多模块法规合规智能平台\n多团队协作 · 阶段成果汇报 · 分工与规划", {
|
||
x: 3.6, y: 2.25, w: 9, h: 0.6,
|
||
fontSize: 12, color: C.text2, fontFace: "Calibri Light",
|
||
});
|
||
|
||
// 右侧:3个数字指标卡
|
||
const stats = [
|
||
{ num: "5", label: "功能模块\n已完成/开发中", color: C.accent },
|
||
{ num: "17+", label: "REST API 接口\n已设计并文档化", color: C.green },
|
||
{ num: "6+", label: "法规来源\n接入覆盖", color: C.orange },
|
||
];
|
||
stats.forEach((s, i) => {
|
||
const sx = 3.6 + i * 2.8;
|
||
sl.addShape("rect", {
|
||
x: sx, y: 3.1, w: 2.5, h: 1.4,
|
||
fill: { color: C.bgCard }, line: { color: C.border, width: 0.5 },
|
||
shadow: makeShadow(),
|
||
});
|
||
sl.addShape("rect", {
|
||
x: sx, y: 3.1, w: 2.5, h: 0.05,
|
||
fill: { color: s.color }, line: { color: s.color, width: 0 },
|
||
});
|
||
sl.addText(s.num, {
|
||
x: sx + 0.15, y: 3.2, w: 2.2, h: 0.65,
|
||
fontSize: 40, bold: true, color: s.color, fontFace: "Calibri",
|
||
});
|
||
sl.addText(s.label, {
|
||
x: sx + 0.15, y: 3.85, w: 2.2, h: 0.55,
|
||
fontSize: 10, color: C.text3, fontFace: "Calibri Light",
|
||
});
|
||
});
|
||
|
||
// 底部机密标注
|
||
sl.addText("INTERNAL · CONFIDENTIAL", {
|
||
x: 3.6, y: 7.1, w: 6, h: 0.25,
|
||
fontSize: 9, color: C.text3, fontFace: "Calibri",
|
||
});
|
||
}
|
||
|
||
// ── 保存 ────────────────────────────────────────────────
|
||
const OUT = "C:/Projects/AIProjects/AIRegulations/AIRegulation-DocAnalysis-Demo/team-report.pptx";
|
||
prs.writeFile({ fileName: OUT })
|
||
.then(() => console.log("✅ 生成完成:", OUT))
|
||
.catch(e => { console.error("❌ 生成失败:", e); process.exit(1); });
|