From 4eb5dd1e6ed2b09ee3518e638f4a7de25ab30471 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Mon, 20 Jan 2025 16:10:19 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E9=83=A8=E5=88=86?= =?UTF-8?q?=E6=A8=A1=E7=89=88=E5=AF=BC=E5=85=A5=E5=AF=8C=E6=96=87=E6=9C=AC?= =?UTF-8?q?=E4=B8=8D=E8=83=BD=E8=AF=86=E5=88=AB=E9=80=A0=E6=88=90=E7=9A=84?= =?UTF-8?q?=E5=AF=BC=E5=85=A5=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../rich-text/DeRichTextView.vue | 56 ++++++++++--------- core/core-frontend/src/utils/canvasUtils.ts | 2 +- 2 files changed, 31 insertions(+), 27 deletions(-) diff --git a/core/core-frontend/src/custom-component/rich-text/DeRichTextView.vue b/core/core-frontend/src/custom-component/rich-text/DeRichTextView.vue index 2724613e11..80d96654d3 100644 --- a/core/core-frontend/src/custom-component/rich-text/DeRichTextView.vue +++ b/core/core-frontend/src/custom-component/rich-text/DeRichTextView.vue @@ -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 = `${targetValue}` + 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 = `${targetValue}` + } + 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 => { diff --git a/core/core-frontend/src/utils/canvasUtils.ts b/core/core-frontend/src/utils/canvasUtils.ts index fba260aea4..155503036d 100644 --- a/core/core-frontend/src/utils/canvasUtils.ts +++ b/core/core-frontend/src/utils/canvasUtils.ts @@ -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)