mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-05 13:39:24 +08:00
fix: rule with 'any' condition does not take effect when condition li… (#6628)
* fix: rule with 'any' condition does not take effect when condition list is empty * fix: bug
This commit is contained in:
parent
46227c877f
commit
aa59e0131f
@ -96,7 +96,6 @@ export const conditionAnalyses = async (
|
|||||||
) => {
|
) => {
|
||||||
const type = Object.keys(ruleGroup)[0] || '$and';
|
const type = Object.keys(ruleGroup)[0] || '$and';
|
||||||
const conditions = ruleGroup[type];
|
const conditions = ruleGroup[type];
|
||||||
|
|
||||||
let results = conditions.map(async (condition) => {
|
let results = conditions.map(async (condition) => {
|
||||||
if ('$and' in condition || '$or' in condition) {
|
if ('$and' in condition || '$or' in condition) {
|
||||||
return await conditionAnalyses({ ruleGroup: condition, variables, localVariables }, jsonLogic);
|
return await conditionAnalyses({ ruleGroup: condition, variables, localVariables }, jsonLogic);
|
||||||
@ -147,8 +146,11 @@ export const conditionAnalyses = async (
|
|||||||
if (type === '$and') {
|
if (type === '$and') {
|
||||||
return every(results, (v) => v);
|
return every(results, (v) => v);
|
||||||
} else {
|
} else {
|
||||||
|
if (results.length) {
|
||||||
return some(results, (v) => v);
|
return some(results, (v) => v);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user