feat: 设置表格默认值为空,避免显示null和undefined

This commit is contained in:
augushong
2025-03-21 14:13:17 +08:00
parent d85f98a869
commit 7baa427038

View File

@@ -1118,9 +1118,11 @@
if (val.sort === undefined) {
cols[i][index]['sort'] = true;
}
if (val.defaultValue === undefined) {
cols[i][index]['defaultValue'] = '';
}
// 判断是否包含初始化数据
if (val.init === undefined) {
@@ -1477,20 +1479,25 @@
return '';
}
var option = data.LAY_COL;
field = field || option.field;
defaultValue = defaultValue || option.defaultValue;
var valueParser = option.valueParser;
var value = defaultValue;
var value = undefined;
try {
value = eval("data." + field);
} catch (e) {
value = undefined;
}
}
if (typeof valueParser == 'function') {
value = valueParser(value, data);
}
if(value === null || value === undefined) {
value = defaultValue
}
return value;
},
listenTableSearch: function (tableId) {