diff --git a/frontend/src/views/test-plan/report/detail/component/viewReport.vue b/frontend/src/views/test-plan/report/detail/component/viewReport.vue index e19d42727a..d1de70c682 100644 --- a/frontend/src/views/test-plan/report/detail/component/viewReport.vue +++ b/frontend/src/views/test-plan/report/detail/component/viewReport.vue @@ -174,11 +174,7 @@ /> (false); + watchEffect(() => { if (props.detailInfo) { detail.value = cloneDeep(props.detailInfo); - richText.value.summary = detail.value.summary; - reportForm.value.reportName = detail.value.name; + const { defaultLayout, id, name, summary } = detail.value; + isDefaultLayout.value = defaultLayout; + richText.value.summary = summary; + reportForm.value.reportName = name; initOptionsData(); if (props.isPreview) { - if (!detail.value.defaultLayout && detail.value.id) { + if (!defaultLayout && id) { getDefaultLayout(); } else { innerCardList.value = props.isGroup ? cloneDeep(defaultGroupConfig) : cloneDeep(defaultSingleConfig); @@ -496,6 +496,22 @@ } }); + // 获取内容详情 + function getContent(item: configItem): customValueForm { + if (isDefaultLayout.value) { + return { + content: richText.value.summary || '', + label: t(item.label), + richTextTmpFileIds: [], + }; + } + return { + content: item.content || '', + label: t(item.label), + richTextTmpFileIds: item.richTextTmpFileIds, + }; + } + onMounted(async () => { nextTick(() => { const editorContent = document.querySelector('.editor-content'); @@ -516,7 +532,11 @@ } function handleSummary(content: string, cardItem: configItem) { - cardItem.content = content; + if (isDefaultLayout.value) { + richText.value.summary = content; + } else { + cardItem.content = content; + } } const currentMode = ref('drawer');