mirror of
https://github.com/nocobase/nocobase.git
synced 2026-09-24 16:02:20 +08:00
fix(linkageRules): support empty condiction (#1496)
* fix: condiction suport empty * fix: condiction suport empty * fix: condiction suport empty * fix: condiction suport empty
This commit is contained in:
@@ -49,8 +49,15 @@ export const conditionAnalyse = (rules, values) => {
|
||||
const operator = jsonlogic.operator;
|
||||
const value = getValue(jsonlogic.value, values);
|
||||
const targetField = Object.keys(flat(c))[0]?.replace?.(`.${operator}`, '');
|
||||
const result = jsonLogic.apply({ [operator]: [flat(values)?.[targetField], value] });
|
||||
return result;
|
||||
if (!operator) {
|
||||
return true;
|
||||
}
|
||||
try {
|
||||
const result = jsonLogic.apply({ [operator]: [flat(values)?.[targetField], value] });
|
||||
return result;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
});
|
||||
if (type === '$and') {
|
||||
return every(results, (v) => v);
|
||||
|
||||
Reference in New Issue
Block a user