From 501cbf9e1e712ea24a7c6258fd76824867a7ec51 Mon Sep 17 00:00:00 2001 From: yuqei Date: Tue, 6 Oct 2026 14:16:33 +0800 Subject: [PATCH] fix(web): order conditional SaaS questions --- .../apps/contract-web/src/lib/guided-drafting.ts | 4 ++++ .../apps/contract-web/src/lib/template-input-state.test.mjs | 3 +++ 2 files changed, 7 insertions(+) diff --git a/yuqei-contract-platform/apps/contract-web/src/lib/guided-drafting.ts b/yuqei-contract-platform/apps/contract-web/src/lib/guided-drafting.ts index f60d561a..51317118 100644 --- a/yuqei-contract-platform/apps/contract-web/src/lib/guided-drafting.ts +++ b/yuqei-contract-platform/apps/contract-web/src/lib/guided-drafting.ts @@ -44,6 +44,10 @@ export function buildGuidedRequiredPages( preferredNames = ["披露方名称", "接收方名称", "保密方向", "合作事项", "保密信息范围", "使用目的", "保密期限"]; } else if (templateId === "TPL-LEASE-HOUSE-001" && variables.some((item) => item.name === "租金计价单位")) { preferredNames = ["出租方名称", "承租方名称", "房屋地址", "租赁用途", "租赁起止日期", "租金标准", "租金计价单位"]; + } else if (templateId === "TPL-SOFTWARE-SAAS-001" && variables.some((item) => item.name === "个人信息处理")) { + // Ask every branch controller before any dependent fact can be inserted + // into an already-completed page of the progressive wizard. + preferredNames = ["甲方名称", "乙方名称", "续费方式", "SLA约定", "个人信息处理", "服务名称", "服务期限"]; } const byName = new Map(variables.map((variable) => [variable.name, variable])); const preferred = preferredNames.flatMap((name) => { diff --git a/yuqei-contract-platform/apps/contract-web/src/lib/template-input-state.test.mjs b/yuqei-contract-platform/apps/contract-web/src/lib/template-input-state.test.mjs index ee61d643..d30fdada 100644 --- a/yuqei-contract-platform/apps/contract-web/src/lib/template-input-state.test.mjs +++ b/yuqei-contract-platform/apps/contract-web/src/lib/template-input-state.test.mjs @@ -49,6 +49,9 @@ test("labor probation, open term and special hours drive their actual dependent test("SaaS conditions and NDA reciprocal branch have no silently inserted default facts", () => { const saas = template("software-saas", "TPL-SOFTWARE-SAAS-001"); + const initial = getTemplateInputState(saas, {}); + const firstPage = buildGuidedRequiredPages(saas.id, initial.required)[0].map((field) => field.name); + assert.ok(["续费方式", "SLA约定", "个人信息处理"].every((name) => firstPage.includes(name))); const names = getTemplateInputState(saas, { "续费方式": "自动续费", "SLA约定": "约定SLA", "个人信息处理": "不涉及个人信息" }).required.map((field) => field.name); assert.ok(names.includes("续费取消方式") && names.includes("服务可用性") && names.includes("SLA服务补偿")); assert.equal(names.includes("个人信息类型"), false);