feat(flow-editor): 多出口审批实时校验(非空唯一/数量上限/泳道递归)

This commit is contained in:
chenxing
2026-10-03 14:06:19 +08:00
parent 2dd7135753
commit 16717a0867
@@ -55,6 +55,26 @@ export function validateModel(model: EditorModel, depts: DeptOption[], routers:
} else if (!a.userIds.length) {
push(item.uid, "error", path, "指定用户不能为空");
}
if (item.outlets && item.outlets.length >= 2) {
if (item.outlets.length > MAX_BRANCHES) {
push(item.uid, "error", path, `出口数最多 ${MAX_BRANCHES} 个`);
}
item.outlets.forEach((o, i) => {
if (!o.trim()) {
push(item.uid, "error", path, `第 ${i + 1} 个出口的按钮文案不能为空`);
} else if (item.outlets!.indexOf(o) !== i) {
push(item.uid, "error", path, `出口文案重复:「${o}」(按钮文案必须唯一)`);
}
});
(item.branches || []).forEach((branch, i) => {
const p = `${path}·出口「${item.outlets![i] || i + 1}」`;
if (!branch.length) {
push(item.uid, "error", p, "出口泳道为空,请添加节点");
return;
}
rec(branch, p);
});
}
return;
}