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 <Summary
v-else-if="item.value === ReportCardTypeEnum.SUMMARY" v-else-if="item.value === ReportCardTypeEnum.SUMMARY"
:rich-text="{ :rich-text="getContent(item)"
content: item.content || '',
label: t(item.label),
richTextTmpFileIds: [],
}"
:share-id="shareId" :share-id="shareId"
:is-preview="props.isPreview" :is-preview="props.isPreview"
:can-edit="item.enableEdit" :can-edit="item.enableEdit"
@ -480,14 +476,18 @@
} }
} }
const isDefaultLayout = ref<boolean>(false);
watchEffect(() => { watchEffect(() => {
if (props.detailInfo) { if (props.detailInfo) {
detail.value = cloneDeep(props.detailInfo); detail.value = cloneDeep(props.detailInfo);
richText.value.summary = detail.value.summary; const { defaultLayout, id, name, summary } = detail.value;
reportForm.value.reportName = detail.value.name; isDefaultLayout.value = defaultLayout;
richText.value.summary = summary;
reportForm.value.reportName = name;
initOptionsData(); initOptionsData();
if (props.isPreview) { if (props.isPreview) {
if (!detail.value.defaultLayout && detail.value.id) { if (!defaultLayout && id) {
getDefaultLayout(); getDefaultLayout();
} else { } else {
innerCardList.value = props.isGroup ? cloneDeep(defaultGroupConfig) : cloneDeep(defaultSingleConfig); 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 () => { onMounted(async () => {
nextTick(() => { nextTick(() => {
const editorContent = document.querySelector('.editor-content'); const editorContent = document.querySelector('.editor-content');
@ -516,7 +532,11 @@
} }
function handleSummary(content: string, cardItem: configItem) { function handleSummary(content: string, cardItem: configItem) {
cardItem.content = content; if (isDefaultLayout.value) {
richText.value.summary = content;
} else {
cardItem.content = content;
}
} }
const currentMode = ref<string>('drawer'); const currentMode = ref<string>('drawer');