|
@@ -217,16 +217,20 @@
|
|
|
|
|
|
|
|
return boardCfg.items.map(item => {
|
|
return boardCfg.items.map(item => {
|
|
|
const valueStr = String(item.value || '');
|
|
const valueStr = String(item.value || '');
|
|
|
|
|
+ // 匹配 ${...} 格式
|
|
|
const match = valueStr.match(/\$\{(.+?)\}/);
|
|
const match = valueStr.match(/\$\{(.+?)\}/);
|
|
|
|
|
|
|
|
let newValue = item.value;
|
|
let newValue = item.value;
|
|
|
if (match && match[1]) {
|
|
if (match && match[1]) {
|
|
|
- const fieldKey = match[1];
|
|
|
|
|
|
|
+ const fieldKey = match[1]; // 例如: "fireAlarm.alarmName"
|
|
|
const resolvedValue = get(rowData, fieldKey);
|
|
const resolvedValue = get(rowData, fieldKey);
|
|
|
|
|
|
|
|
- // 如果解析出的值不为 undefined/null,则使用解析后的值,否则保留原模板字符串或默认值
|
|
|
|
|
|
|
+ // 如果为 null/undefined,则使用默认值
|
|
|
if (!isNil(resolvedValue)) {
|
|
if (!isNil(resolvedValue)) {
|
|
|
newValue = resolvedValue;
|
|
newValue = resolvedValue;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 当值为 null/undefined 时,使用默认值 '-'
|
|
|
|
|
+ newValue = props.defaultValue;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|