fix: 修复部分模版导入富文本不能识别造成的导入失败

This commit is contained in:
wangjiahao
2025-01-20 16:10:19 +08:00
committed by fit2cloud-chenyw
parent d2cc4dd6b4
commit 4eb5dd1e6e
2 changed files with 31 additions and 27 deletions

View File

@@ -372,34 +372,38 @@ const jumpTargetAdaptor = () => {
}
const assignment = content => {
const on = content.match(/\[(.+?)\]/g)
if (on) {
const thresholdStyleInfo = conditionAdaptor(state.viewDataInfo)
on.forEach(itm => {
if (dataRowFiledName.value.includes(itm)) {
const ele = itm.slice(1, -1)
let value = dataRowNameSelect.value[ele] !== undefined ? dataRowNameSelect.value[ele] : null
let targetValue = !!value ? value : state.emptyValue
if (thresholdStyleInfo && thresholdStyleInfo[ele]) {
const thresholdStyle = thresholdStyleInfo[ele]
targetValue = `<span style="color:${thresholdStyle.color};background-color: ${thresholdStyle.backgroundColor}">${targetValue}</span>`
if (content) {
const on = content?.match(/\[(.+?)\]/g)
if (on) {
const thresholdStyleInfo = conditionAdaptor(state.viewDataInfo)
on.forEach(itm => {
if (dataRowFiledName.value.includes(itm)) {
const ele = itm.slice(1, -1)
let value =
dataRowNameSelect.value[ele] !== undefined ? dataRowNameSelect.value[ele] : null
let targetValue = !!value ? value : state.emptyValue
if (thresholdStyleInfo && thresholdStyleInfo[ele]) {
const thresholdStyle = thresholdStyleInfo[ele]
targetValue = `<span style="color:${thresholdStyle.color};background-color: ${thresholdStyle.backgroundColor}">${targetValue}</span>`
}
if (initReady.value) {
content = content.replace(itm, targetValue)
} else {
content = content.replace(itm, !!value ? targetValue : '[获取中...]')
}
}
if (initReady.value) {
content = content.replace(itm, targetValue)
} else {
content = content.replace(itm, !!value ? targetValue : '[获取中...]')
}
}
})
})
}
content = content.replace('class="base-selected"', '')
//De 本地跳转失效问题
content = content.replace(/href="#\//g, 'href="/#/')
content = content.replace(/href=\\"#\//g, 'href=\\"/#/')
content = content.replace(/href=\\"#\//g, 'href=\\"/#/')
resetSelect()
initFontFamily(content)
jumpTargetAdaptor()
}
content = content.replace('class="base-selected"', '')
//De 本地跳转失效问题
content = content.replace(/href="#\//g, 'href="/#/')
content = content.replace(/href=\\"#\//g, 'href=\\"/#/')
content = content.replace(/href=\\"#\//g, 'href=\\"/#/')
resetSelect()
initFontFamily(content)
jumpTargetAdaptor()
return content
}
const initFontFamily = htmlText => {

View File

@@ -622,7 +622,7 @@ export function setIdValueTrans(from, to, content, colList) {
pre[next[from]] = next[to]
return pre
}, {})
const on = content.match(/\[(.+?)\]/g)
const on = content?.match(/\[(.+?)\]/g)
if (on) {
on.forEach(itm => {
const ele = itm.slice(1, -1)