fix: align case-file rule filters with business types

This commit is contained in:
wren
2026-05-06 18:18:49 +08:00
parent c7bbe59882
commit 2d8bab2c91
6 changed files with 52 additions and 27 deletions
+10
View File
@@ -53,6 +53,14 @@ function getMessage(payload: unknown, fallback: string): string {
}
function mapApiPackToRuleYamlPack(item: RuleConfigPackApi): RuleYamlPack {
const ruleTypeCode = String(item.ruleType || '').trim();
const businessType = (() => {
const segments = ruleTypeCode.split('.').map(segment => segment.trim()).filter(Boolean);
if (segments.length >= 2) {
return segments[1];
}
return item.mainType || item.documentType || '';
})();
const yamlSource = (item.yamlText || '').trim() ? String(item.yamlText) : EMPTY_RULE_YAML;
const sourceStatus = item.sourceStatus || ((item.yamlText || '').trim() ? 'ready' : 'empty');
@@ -64,6 +72,8 @@ function mapApiPackToRuleYamlPack(item: RuleConfigPackApi): RuleYamlPack {
moduleType: item.moduleType || (item.documentType ? `${item.documentType}评查` : '规则配置'),
mainType: item.mainType || item.documentType || '',
subtype: item.subtype || '通用',
businessType,
ruleTypeCode,
},
yamlSource,
sourceStatus,