fix(测试计划): 修复自动生成默认报告编辑报告总结失效

This commit is contained in:
xinxin.wu 2024-07-17 10:43:42 +08:00 committed by 刘瑞斌
parent ee53476ace
commit 711e25bb83
1 changed files with 29 additions and 9 deletions

View File

@ -174,11 +174,7 @@
/>
<Summary
v-else-if="item.value === ReportCardTypeEnum.SUMMARY"
:rich-text="{
content: item.content || '',
label: t(item.label),
richTextTmpFileIds: [],
}"
:rich-text="getContent(item)"
:share-id="shareId"
:is-preview="props.isPreview"
:can-edit="item.enableEdit"
@ -480,14 +476,18 @@
}
}
const isDefaultLayout = ref<boolean>(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,8 +532,12 @@
}
function handleSummary(content: string, cardItem: configItem) {
if (isDefaultLayout.value) {
richText.value.summary = content;
} else {
cardItem.content = content;
}
}
const currentMode = ref<string>('drawer');