测试报告列表

This commit is contained in:
chenjianxing 2020-04-29 19:00:58 +08:00
parent b87fa51440
commit 1bd57e5186
7 changed files with 108 additions and 78 deletions

View File

@ -26,6 +26,7 @@ public class TestCaseReportTemplateService {
if ( StringUtils.isNotBlank(request.getWorkspaceId()) ) {
example.createCriteria().andWorkspaceIdEqualTo(request.getWorkspaceId());
}
example.or(example.createCriteria().andWorkspaceIdIsNull());
return testCaseReportTemplateMapper.selectByExample(example);
}

View File

@ -82,6 +82,7 @@ const router = new VueRouter({
},
{
path: 'testcase/report/template',
name: 'testCaseReportTemplate',
component: TestCaseReportTemplate
}
]

View File

@ -7,7 +7,9 @@
<ms-setting-menu/>
</div>
<div class="container">
<router-view class="main-content"/>
<keep-alive>
<router-view class="main-content"/>
</keep-alive>
</div>
</el-row>
</template>

View File

@ -3,7 +3,7 @@
<div v-loading="result.loading">
<el-card>
<template v-slot:header>
<ms-table-header :condition.sync="condition" @search="initTableData"
<ms-table-header :condition.sync="condition" @search="initData"
:title="'测试报告模版'"
:create-tip="'新建模版'" @create="templateEdit">
@ -11,7 +11,8 @@
</template>
<el-main>
<testcase-template-item v-for="fit in fits" :key="fit" :name="fit"/>
<testcase-template-item v-for="item in templates" :key="item.id"
:template="item" @templateEdit="templateEdit"/>
</el-main>
<test-case-report-template-edit ref="templateEdit"/>
@ -27,33 +28,40 @@
import MsTableHeader from "../../common/components/MsTableHeader";
import TestCaseReportTemplateEdit from "./components/TestCaseReportTemplateEdit";
import TestcaseTemplateItem from "./components/TestcaseTemplateItem";
import {WORKSPACE_ID} from '../../../../common/js/constants';
export default {
name: "TestCaseReportTemplate",
components: {TestcaseTemplateItem, TestCaseReportTemplateEdit, MsTableHeader},
data() {
return {
result: {},
fits: ['默认模版', 'congewtain', 'cogewver', 'nongwee', 'scale-downddddddddddd',
'faill', 'cdontain', 'codver', 'nodne', 'scalde-downddddddddddd',
'fill', 'cowntain', 'corwver',
'nonewbe',
'scalev-downddddddddddd',
'filelv', 'sontwain', 'cosgewver', 'nodegne', 'scale-dfownddddddddddd',
],
condition: {},
templates: []
}
},
mounted() {
this.initData();
},
watch: {
'$route'(to) {
if (to.path.indexOf("setting/testcase/report/template") >= 0) {
this.initData();
}
}
},
methods: {
initData() {
// this.$get()
this.condition.workspaceId = localStorage.getItem(WORKSPACE_ID);
this.result = this.$post('/case/report/template/list', this.condition, response => {
this.templates = response.data;
});
},
templateCreate() {
},
templateEdit() {
this.$refs.templateEdit.open();
templateEdit(template) {
this.$refs.templateEdit.open(template);
}
}
}

View File

@ -0,0 +1,55 @@
<template>
<el-button class="template-component">
<i class="el-icon-s-unfold"/>
<span>{{ component.name }}</span>
<el-tag v-if="component.type == 'system'" size="mini" type="success">系统</el-tag>
<el-tag v-if="component.type == 'custom'" size="mini">自定义</el-tag>
</el-button>
</template>
<script>
export default {
name: "TemplateComponentBar",
props: {
component: {
type: Object,
default() {
return {}
}
}
}
}
</script>
<style scoped>
.template-component i {
float: left;
height: 20px;
line-height: 20px;
}
.template-component .el-tag {
float: right;
height: 20px;
line-height: 20px;
}
.template-component span {
display: inline-block;
height: 20px;
line-height: 20px;
}
.template-component {
display: block;
margin-left: 10px;
width: 90%;
margin-bottom: 5px;
}
.template-component {
font-size: 16px;
}
</style>

View File

@ -31,9 +31,6 @@
<div class="container">
<el-scrollbar>
<div class="template-content">
<el-aside>
@ -48,20 +45,12 @@
:group="{ name: 'people', pull: 'clone', put: false }"
:clone="cloneDog"
@change="log">
<el-button class="template-component" v-for="item in components" :key="item.id">
<i class="el-icon-s-unfold"/>
<span>{{ item.name }}</span>
<el-tag v-if="item.type == 'system'" size="mini" type="success">系统</el-tag>
<el-tag v-if="item.type == 'custom'" size="mini">自定义</el-tag>
</el-button>
<template-component-bar v-for="item in components" :key="item.id" :component="item"/>
</draggable>
</el-aside>
<el-main>
<el-row>
<el-col>
<draggable
class="preview-group"
:list="previews"
@ -83,16 +72,10 @@
</el-card>
</draggable>
</el-col>
</el-row>
</el-main>
</div>
</el-scrollbar>
</div>
</template>
@ -107,11 +90,13 @@
import BaseInfoComponent from "./TemplateComponent/BaseInfoComponent";
import TestResultComponent from "./TemplateComponent/TestResultComponent";
import TestResultChartComponent from "./TemplateComponent/TestResultChartComponent";
import TemplateComponentBar from "./TemplateComponentBar";
let idGlobal = 8;
export default {
name: "TestCaseReportTemplateEdit",
components: {
TemplateComponentBar,
TestResultChartComponent,
TestResultComponent,
BaseInfoComponent,
@ -205,40 +190,18 @@
}
.el-main {
height: 1000px;
height: calc(100vh - 70px);
width: calc(100vw - 320px);
margin-left: 300px;
margin-top: 0;
margin-bottom: 0;
}
.template-component i {
float: left;
height: 20px;
line-height: 20px;
}
.template-component .el-tag {
float: right;
height: 20px;
line-height: 20px;
}
.template-component span {
display: inline-block;
height: 20px;
line-height: 20px;
}
.template-component {
display: block;
margin-left: 10px;
width: 90%;
margin-bottom: 5px;
position: absolute;
}
.el-card {
margin: 5px auto;
min-height: 300px;
width: 80%;
}
.description > span {
@ -255,16 +218,4 @@
background: #F5F5F5;
}
.template-content {
}
.el-scrollbar {
height: 100%;
}
.template-component {
font-size: 16px;
}
</style>

View File

@ -1,9 +1,9 @@
<template>
<div class="testcase-template">
<div class="template-img">
<i class="el-icon-error"/>
<div class="testcase-template" @click="templateEdit">
<div class="template-img" @click="templateDelete">
<i class="el-icon-error" v-if="template.workspaceId"/>
</div>
<span class="demonstration">{{ name }}</span>
<span class="demonstration">{{ template.name }}</span>
</div>
</template>
@ -11,9 +11,21 @@
export default {
name: "TestcaseTemplateItem",
props: {
name: {
type: String,
default: 'Template name'
template: {
type: Object,
default() {
return {}
}
}
},
methods: {
templateEdit() {
this.$emit('templateEdit', this.template);
},
templateDelete() {
this.post('/case/report/template/delete/' + this.template.id, () => {
this.$success('删除成功');
});
}
}
}