feat: add readable category rule workbench and safe draft trials
This commit is contained in:
1 parent
e2d66eb7c7
commit
fbe39c8267
32 files changed
+485
-65
No files matched your search
@@ -1,5 +1,6 @@
|
||||
'use strict';
|
||||
const {extractTitle}=require('./title.cjs');
|
||||
const {matchesScope,scopesFor}=require('./scopes.cjs');
|
||||
|
||||
const labels = {
|
||||
orderNo: '订单号', appDate: '申请日期', customer: '客户', productLine: '产品线',
|
||||
@@ -31,9 +32,7 @@ function previewMatch(rules, adapters, input) {
|
||||
for (const key of ['processName', 'processVersion', 'nodeName']) {
|
||||
check('流程信息', nonblank(sample[key]), `${key}:${nonblank(sample[key]) ? sample[key] : '缺失'}`);
|
||||
}
|
||||
const matches = (Array.isArray(rules) ? rules : []).filter(rule =>
|
||||
Array.isArray(rule.processNames) && rule.processNames.includes(sample.processName)
|
||||
&& Array.isArray(rule.nodeNames) && rule.nodeNames.includes(sample.nodeName));
|
||||
const matches = (Array.isArray(rules) ? rules : []).filter(rule => matchesScope(rule,sample));
|
||||
check('分类命中', matches.length === 1, matches.length === 1 ? `唯一命中:${matches[0].name}` : matches.length ? `同时命中 ${matches.length} 条规则,须消除冲突` : '没有流程名称和节点名称均精确匹配的规则');
|
||||
const rule = matches.length === 1 ? matches[0] : null;
|
||||
const available = rule ? (Array.isArray(adapters) ? adapters : []).filter(adapter =>
|
||||
@@ -86,7 +85,7 @@ function previewMatch(rules, adapters, input) {
|
||||
|
||||
function describeRule(rule) {
|
||||
const date = { appDate: '申请日期', receivedAt: '接收日期', archiveDate: '归档日期' }[rule.filenameDate] || '待选择的日期';
|
||||
return `${rule.name}:流程“${(rule.processNames || []).join('、')}”到达节点“${(rule.nodeNames || []).join('、')}”时归入本类别。本时段内同类别订单合并一封,通知与更改分别汇总,更早历史不补发。正常工作日首封只取当天零点到首个时点,第二封取两个时点之间;周一首封从上个工作日最后时点起算。${rule.attachPdf ? '附电子流 PDF;' : ''}文件以订单号、${date}、流水编号命名。BPM 节点由人工办理。`;
|
||||
return `${rule.name}:满足任一流程节点配对(${scopesFor(rule).map(row=>`“${row.processName}” → “${row.nodeName}”`).join(';')||'待选择'})时归入本类别。本时段内同类别订单合并一封,通知与更改分别汇总,更早历史不补发。正常工作日首封只取当天零点到首个时点,第二封取两个时点之间;周一首封从上个工作日最后时点起算。${rule.attachPdf ? '附电子流 PDF;' : ''}文件以订单号、${date}、流水编号命名。BPM 节点由人工办理。`;
|
||||
}
|
||||
|
||||
module.exports = { previewMatch, describeRule };
|
||||
Reference in new issue
Block a user