测试报告列表

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()) ) { if ( StringUtils.isNotBlank(request.getWorkspaceId()) ) {
example.createCriteria().andWorkspaceIdEqualTo(request.getWorkspaceId()); example.createCriteria().andWorkspaceIdEqualTo(request.getWorkspaceId());
} }
example.or(example.createCriteria().andWorkspaceIdIsNull());
return testCaseReportTemplateMapper.selectByExample(example); return testCaseReportTemplateMapper.selectByExample(example);
} }

View File

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

View File

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

View File

@ -3,7 +3,7 @@
<div v-loading="result.loading"> <div v-loading="result.loading">
<el-card> <el-card>
<template v-slot:header> <template v-slot:header>
<ms-table-header :condition.sync="condition" @search="initTableData" <ms-table-header :condition.sync="condition" @search="initData"
:title="'测试报告模版'" :title="'测试报告模版'"
:create-tip="'新建模版'" @create="templateEdit"> :create-tip="'新建模版'" @create="templateEdit">
@ -11,7 +11,8 @@
</template> </template>
<el-main> <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> </el-main>
<test-case-report-template-edit ref="templateEdit"/> <test-case-report-template-edit ref="templateEdit"/>
@ -27,33 +28,40 @@
import MsTableHeader from "../../common/components/MsTableHeader"; import MsTableHeader from "../../common/components/MsTableHeader";
import TestCaseReportTemplateEdit from "./components/TestCaseReportTemplateEdit"; import TestCaseReportTemplateEdit from "./components/TestCaseReportTemplateEdit";
import TestcaseTemplateItem from "./components/TestcaseTemplateItem"; import TestcaseTemplateItem from "./components/TestcaseTemplateItem";
import {WORKSPACE_ID} from '../../../../common/js/constants';
export default { export default {
name: "TestCaseReportTemplate", name: "TestCaseReportTemplate",
components: {TestcaseTemplateItem, TestCaseReportTemplateEdit, MsTableHeader}, components: {TestcaseTemplateItem, TestCaseReportTemplateEdit, MsTableHeader},
data() { data() {
return { return {
result: {}, 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: {}, condition: {},
templates: []
}
},
mounted() {
this.initData();
},
watch: {
'$route'(to) {
if (to.path.indexOf("setting/testcase/report/template") >= 0) {
this.initData();
}
} }
}, },
methods: { methods: {
initData() { initData() {
this.condition.workspaceId = localStorage.getItem(WORKSPACE_ID);
// this.$get() this.result = this.$post('/case/report/template/list', this.condition, response => {
this.templates = response.data;
});
}, },
templateCreate() { templateCreate() {
}, },
templateEdit() { templateEdit(template) {
this.$refs.templateEdit.open(); 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"> <div class="container">
<el-scrollbar>
<div class="template-content">
<el-aside> <el-aside>
@ -48,20 +45,12 @@
:group="{ name: 'people', pull: 'clone', put: false }" :group="{ name: 'people', pull: 'clone', put: false }"
:clone="cloneDog" :clone="cloneDog"
@change="log"> @change="log">
<el-button class="template-component" v-for="item in components" :key="item.id"> <template-component-bar v-for="item in components" :key="item.id" :component="item"/>
<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>
</draggable> </draggable>
</el-aside> </el-aside>
<el-main> <el-main>
<el-row>
<el-col>
<draggable <draggable
class="preview-group" class="preview-group"
:list="previews" :list="previews"
@ -83,16 +72,10 @@
</el-card> </el-card>
</draggable> </draggable>
</el-col>
</el-row>
</el-main> </el-main>
</div> </div>
</el-scrollbar>
</div>
</template> </template>
@ -107,11 +90,13 @@
import BaseInfoComponent from "./TemplateComponent/BaseInfoComponent"; import BaseInfoComponent from "./TemplateComponent/BaseInfoComponent";
import TestResultComponent from "./TemplateComponent/TestResultComponent"; import TestResultComponent from "./TemplateComponent/TestResultComponent";
import TestResultChartComponent from "./TemplateComponent/TestResultChartComponent"; import TestResultChartComponent from "./TemplateComponent/TestResultChartComponent";
import TemplateComponentBar from "./TemplateComponentBar";
let idGlobal = 8; let idGlobal = 8;
export default { export default {
name: "TestCaseReportTemplateEdit", name: "TestCaseReportTemplateEdit",
components: { components: {
TemplateComponentBar,
TestResultChartComponent, TestResultChartComponent,
TestResultComponent, TestResultComponent,
BaseInfoComponent, BaseInfoComponent,
@ -205,40 +190,18 @@
} }
.el-main { .el-main {
height: 1000px; height: calc(100vh - 70px);
width: calc(100vw - 320px);
margin-left: 300px; margin-left: 300px;
margin-top: 0; margin-top: 0;
margin-bottom: 0; margin-bottom: 0;
} position: absolute;
.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;
} }
.el-card { .el-card {
margin: 5px auto; margin: 5px auto;
min-height: 300px; min-height: 300px;
width: 80%;
} }
.description > span { .description > span {
@ -255,16 +218,4 @@
background: #F5F5F5; background: #F5F5F5;
} }
.template-content {
}
.el-scrollbar {
height: 100%;
}
.template-component {
font-size: 16px;
}
</style> </style>

View File

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