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:
parent
9d1b10d635
commit
e7e1436422
@ -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}`, '');
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user