refactor: 测试计划报告样式优化

This commit is contained in:
chenjianxing 2021-09-02 11:32:44 +08:00 committed by jianxing
parent b3940f0a93
commit 58e4307461
11 changed files with 175 additions and 114 deletions

View File

@ -3,7 +3,7 @@
<ms-main-container>
<el-card>
<section class="report-container" v-if="this.report.testId">
<ms-api-report-view-header :is-template="isTemplate" :debug="debug" :report="report" @reportExport="handleExport" @reportSave="handleSave"/>
<ms-api-report-view-header :is-plan="isPlan" :is-template="isTemplate" :debug="debug" :report="report" @reportExport="handleExport" @reportSave="handleSave"/>
<main v-if="isNotRunning">
<ms-metric-chart :content="content" :totalTime="totalTime"/>
<div>
@ -80,7 +80,8 @@ export default {
isTemplate: Boolean,
templateReport: Object,
isShare: Boolean,
shareId: String
shareId: String,
isPlan: Boolean
},
watch: {
reportId() {
@ -422,5 +423,4 @@ export default {
.scenario-result .icon.is-active {
transform: rotate(90deg);
}
</style>

View File

@ -21,7 +21,7 @@
<span style="margin-left: 10px">{{$t('report.test_end_time')}}</span>
<span class="time"> {{ report.endTime | timestampFormatDate }}</span>
</span>
<el-button v-if="(!debug || exportFlag) && !isTemplate" v-permission="['PROJECT_API_REPORT:READ+EXPORT']" :disabled="isReadOnly" class="export-button" plain type="primary" size="mini" @click="handleExport(report.name)" style="margin-right: 10px">
<el-button v-if="!isPlan && (!debug || exportFlag) && !isTemplate" v-permission="['PROJECT_API_REPORT:READ+EXPORT']" :disabled="isReadOnly" class="export-button" plain type="primary" size="mini" @click="handleExport(report.name)" style="margin-right: 10px">
{{ $t('test_track.plan_view.export_report') }}
</el-button>
@ -41,7 +41,8 @@ export default {
exportFlag: {
type: Boolean,
default: false,
}
},
isPlan: Boolean
},
computed: {
path() {

View File

@ -28,4 +28,8 @@
background: white;
}
@page {
margin-bottom: 30px;
margin-top: 30px;
}
</style>

View File

@ -10,7 +10,7 @@
</template>
<api-cases :is-db="isDb" :share-id="shareId" :is-share="isShare" :report="report" :is-template="isTemplate" :plan-id="planId" @setSize="setFailureSize"/>
</el-tab-pane>
<el-tab-pane style="min-height: 550px" name="third" v-if="allEnable">
<el-tab-pane style="min-height: 500px" name="third" v-if="allEnable">
<template v-slot:label>
<tab-pane-count title="所有用例" :count="allSize"/>
</template>

View File

@ -8,7 +8,7 @@
<template v-slot:label>
<tab-pane-count :title="'失败用例'" :count="failureSize"/>
</template>
<load-failure-result :share-id="shareId" :is-share="isShare" :is-template="isTemplate"
<load-failure-result class="container" :share-id="shareId" :is-share="isShare" :is-template="isTemplate"
:report="report" :plan-id="planId" @setSize="setFailureSize"/>
</el-tab-pane>
<el-tab-pane name="third" v-if="allEnable" style="min-height: 550px">

View File

@ -234,4 +234,8 @@ export default {
width: 100%;
padding: 40px;
}
/deep/ .padding-col {
padding: 5px;
}
</style>

View File

@ -1,8 +1,8 @@
<template>
<div>
<el-row class="scenario-info">
<el-col :span="7">
<el-col class="padding-col" :span="7">
<el-card>
<ms-table v-loading="result.loading"
:show-select-all="false"
:screen-height="null"
@ -47,8 +47,9 @@
</template>
</ms-table-column>
</ms-table>
</el-card>
</el-col>
<el-col :span="17" v-if="apiCases.length > 0">
<el-col class="padding-col" :span="17" v-if="apiCases.length > 0">
<el-card v-if="showResponse">
<ms-request-result-tail :response="response" ref="debugResult"/>
</el-card>

View File

@ -1,8 +1,7 @@
<template>
<div>
<el-row class="scenario-info">
<el-col :span="8">
<el-col class="padding-col" :span="8">
<el-card>
<ms-table v-loading="result.loading"
:show-select-all="false"
:screen-height="null"
@ -47,13 +46,13 @@
</template>
</ms-table-column>
</ms-table>
</el-card>
</el-col>
<el-col :span="16" v-if="scenarioCases && scenarioCases.length > 0">
<ms-api-report v-if="showResponse" :share-id="shareId" :is-share="isShare" :template-report="response" :is-template="isTemplate" :infoDb="true" :report-id="reportId"/>
<ms-api-report v-if="showResponse" :is-plan="true" :share-id="shareId" :is-share="isShare" :template-report="response" :is-template="isTemplate" :infoDb="true" :report-id="reportId"/>
<div class="empty" v-else>内容为空</div>
</el-col>
</el-row>
</div>
</template>
<script>
@ -152,4 +151,17 @@ export default {
</script>
<style scoped>
.padding-col {
padding-right: 0px;
}
.scenario-info {
height: 625px;
}
.ms-main-container {
height: 612px;
}
</style>

View File

@ -1,11 +1,12 @@
<template>
<div class="container">
<el-row class="scenario-info">
<el-col :span="7">
<el-col :span="7" class="padding-col">
<el-card>
<load-failure-result :is-db="isDb" @rowClick="getReport" :is-all="true" :share-id="shareId" :is-share="isShare" :is-template="isTemplate"
:report="report" :plan-id="planId" @setSize="setAllSize"/>
</el-card>
</el-col>
<el-col :span="17" >
<el-col :span="17" class="padding-col">
<el-card v-show="showResponse">
<load-case-report-view :is-plan-report="true" :share-id="shareId" :is-share="isShare"
:plan-report-template="response" :report-id="reportId" ref="loadCaseReportView"/>
@ -13,7 +14,6 @@
<div class="empty" v-show="!showResponse">内容为空</div>
</el-col>
</el-row>
</div>
</template>
<script>

View File

@ -1,5 +1,4 @@
<template>
<div class="container">
<el-table
row-key="id"
@row-click="rowClick"
@ -43,8 +42,6 @@
</el-table-column>
</el-table>
</div>
</template>
<script>

View File

@ -375,11 +375,53 @@ export function windowPrint(id, zoom) {
//把获取的 局部div内容赋给body标签, 相当于重置了 body里的内容
window.document.body.innerHTML = jubuData;
//调用打印功能
if (getUserAgent() == "IE") {
clearPageSetup();
}
window.print();
document.getElementsByTagName('body')[0].style.zoom = 1;
window.document.body.innerHTML = bdhtml;//重新给页面内容赋值;
return false;
}
// 打印时清除页眉页脚及打印链接
function clearPageSetup(){
let hkey_root,hkey_path,hkey_key;
hkey_root="HKEY_CURRENT_USER";
hkey_path="\\Software\\Microsoft\\Internet Explorer\\PageSetup\\";
try{
let RegWsh = new ActiveXObject("WScript.Shell");
hkey_key="header";
RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,"");
hkey_key="footer";
RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,"");
}catch(e){}
}
function getUserAgent() {
let explorer = window.navigator.userAgent ;
//ie
if (explorer.indexOf("MSIE") >= 0) {
return "IE";
}
//firefox
else if (explorer.indexOf("Firefox") >= 0) {
return "Firefox";
}
//Chrome
else if(explorer.indexOf("Chrome") >= 0){
return "Chrome";
}
//Opera
else if(explorer.indexOf("Opera") >= 0){
return "Opera";
}
//Safari
else if(explorer.indexOf("Safari") >= 0){
return "Safari";
}
}
export function getBodyUploadFiles(obj, runData) {
let bodyUploadFiles = [];
obj.bodyUploadIds = [];