稽查加一个 替换字符 可以自定义拼接
continuous-integration/drone/push Build is passing Details

main
wangxiaoshuang 2025-07-17 10:37:40 +08:00
parent 71acbc5f78
commit 8c40241658
1 changed files with 45 additions and 0 deletions

View File

@ -818,6 +818,10 @@ export default {
}
return loop(ParentId)
},
extractBraces(str) {
const regex = /{{([\s\S]*?)}}/g; // [\s\S]
return Array.from(str.matchAll(regex), match => match[1]);
},
formatting(config, obj, upObj, parentRow, row, auditData) {
this.tableList = []
this.tableListData = []
@ -859,6 +863,47 @@ export default {
}
return
}
if (v.DataType === 'CombiningString') {
let arr = this.extractBraces(v.Code)
let o = null, up = null;
arr.forEach(key => {
if (!o) {
o = v.Code.replace(`{{${key}}}`, obj[key])
} else {
o = o.replace(`{{${key}}}`, obj[key])
}
if (!up) {
up = v.Code.replace(`{{${key}}}`, upObj[key])
} else {
up = up.replace(`{{${key}}}`, upObj[key])
}
})
if (row.OptType === 'Add' || row.OptType === 'Init') {
item = {
key: v.Code,
Enum: this.$i18n.locale === 'zh' ? v.ValueCN : v.Value,
newValue: o ? o : '--',
oldValue: ''
}
} else if (row.OptType === 'Delete') {
item = {
key: v.Code,
Enum: this.$i18n.locale === 'zh' ? v.ValueCN : v.Value,
oldValue: o ? o : '--',
newValue: '--'
}
} else {
item = {
key: v.Code,
Enum: this.$i18n.locale === 'zh' ? v.ValueCN : v.Value,
newValue: o ? o : '--',
oldValue: up ? up : '--',
}
}
item.DataType = v.DataType
this[auditData].push(item)
return
}
if (v.DataType === 'FileSize') {
if (obj[v.Code]) {
// obj[v.Code] = obj[v.Code].filter(s => s && s.trim())