优化测试报告预览

This commit is contained in:
chenjianxing 2020-05-14 14:35:21 +08:00
parent 4a470e4d86
commit b24825a8a4
4 changed files with 24 additions and 11 deletions

View File

@ -3,11 +3,13 @@
<common-component>
<template v-slot:header>
<el-input v-model="preview.title"></el-input>
<el-input v-if="!isReportView" v-model="preview.title"></el-input>
<span v-if="isReportView" class="title">{{preview.title}}</span>
</template>
<template>
<ckeditor :editor="editor" v-model="preview.content" :config="editorConfig"></ckeditor>
<ckeditor v-if="!isReportView" :editor="editor" v-model="preview.content" :config="editorConfig"></ckeditor>
<div v-if="isReportView" v-html="preview.content"></div>
</template>
</common-component>
@ -31,12 +33,19 @@
}
},
props: {
preview: Object,
default() {
return {
title: '',
content: '<p>Content of the editor.</p>'
preview: {
type: Object,
default() {
return {
title: '',
content: '<p>Content of the editor.</p>'
}
}
},
isReportView:
{
type: Boolean,
default: false
}
}
}

View File

@ -14,7 +14,7 @@
<base-info-component :report-info="metric" v-if="preview.id == 1"/>
<test-result-component :test-results="metric.moduleExecuteResult" v-if="preview.id == 2"/>
<test-result-chart-component :execute-result="metric.executeResult" v-if="preview.id == 3"/>
<rich-text-component :preview="preview" v-if="preview.type != 'system'"/>
<rich-text-component :is-report-view="isReportView" :preview="preview" v-if="preview.type != 'system'"/>
</div>
</div>
@ -38,7 +38,11 @@
isReport: {
type: Boolean,
default: true
}
},
isReportView: {
type: Boolean,
default: true
},
}
}
</script>

View File

@ -37,7 +37,7 @@
group="component">
<transition-group>
<div class="preview" v-for="item in previews" :key="item.id">
<template-component :is-report="isReport" :metric="metric" :preview="item"/>
<template-component :is-report-view="false" :is-report="isReport" :metric="metric" :preview="item"/>
<i class="el-icon-error" @click="handleDelete(item)"/>
</div>
</transition-group>

View File

@ -28,7 +28,7 @@
<div class="container">
<el-main>
<div class="preview" v-for="item in previews" :key="item.id">
<template-component :metric="metric" :preview="item"/>
<template-component :isReportView="true" :metric="metric" :preview="item"/>
</div>
</el-main>
</div>