fix: ConditionBuilder从 query 中获取初始值时值类型错误问题

This commit is contained in:
lurunze1226 2023-08-28 15:39:47 +08:00
parent 3c87ba1e8b
commit f1e1c12732

View File

@ -132,7 +132,16 @@ const FormulaInput: React.FC<FormulaInputProps> = props => {
); );
}; };
const cmptValue = pipInValue(value ?? inputSettings.defaultValue); let cmptValue = pipInValue(value ?? inputSettings.defaultValue);
/** 数据来源可能是从 query中下发的CRUD查询表头导致数字或者布尔值被转为 string 格式,这里预处理一下 */
if (schemaType === 'number') {
cmptValue = isNaN(+cmptValue) ? cmptValue : +cmptValue;
} else if (schemaType === 'boolean') {
cmptValue =
cmptValue === 'true' ? true : cmptValue === 'false' ? false : cmptValue;
}
const targetVariable = const targetVariable =
variables && cmptValue != null && typeof cmptValue === 'string' variables && cmptValue != null && typeof cmptValue === 'string'
? findTree(variables, item => { ? findTree(variables, item => {