feat: 测试计划报告入口

This commit is contained in:
chenjianxing 2021-08-24 16:00:08 +08:00 committed by jianxing
parent 5868d06069
commit 1610c32f24
4 changed files with 116 additions and 31 deletions

View File

@ -1550,8 +1550,9 @@ public class TestPlanService {
BufferedReader bufferedReader = new BufferedReader(isr);
String line = null;
while (null != (line = bufferedReader.readLine())) {
line = line.replace("\"#report\"", JSONObject.toJSONString(report));
// line = line.replace("\"#preview\"", JSONObject.toJSONString(previews));
if (line.contains("\"#report\"")) {
line = line.replace("\"#report\"", JSONObject.toJSONString(report));
}
line += "\n";
byte[] lineBytes = line.getBytes(StandardCharsets.UTF_8);
int start = 0;

View File

@ -42,16 +42,16 @@ export default {
component: () => import('@/business/components/settings/workspace/template/IssuesTemplateList'),
meta: {workspaceTemplate: true, title: 'workspace.issue_template_manage', permissions: ['WORKSPACE_TEMPLATE:READ+ISSUE_TEMPLATE']},
},
{
path: 'workspace/template/report',
name: 'testCaseReportTemplate',
component: () => import('@/business/components/settings/workspace/template/TestCaseReportTemplate'),
meta: {
workspaceTemplate: true,
title: 'test_track.plan_view.report_template',
permissions: ['WORKSPACE_TEMPLATE:READ+REPORT_TEMPLATE']
}
},
// {
// path: 'workspace/template/report',
// name: 'testCaseReportTemplate',
// component: () => import('@/business/components/settings/workspace/template/TestCaseReportTemplate'),
// meta: {
// workspaceTemplate: true,
// title: 'test_track.plan_view.report_template',
// permissions: ['WORKSPACE_TEMPLATE:READ+REPORT_TEMPLATE']
// }
// },
{
path: 'testresourcepool',
component: () => import('@/business/components/settings/system/TestResourcePool'),

View File

@ -195,13 +195,8 @@
<ms-table-operator-button :tip="$t('commons.copy')" icon="el-icon-copy-document"
@exec="handleCopy(scope.row)" v-permission="['PROJECT_TRACK_PLAN:READ+COPY']"/>
<ms-table-operator-button v-permission="['PROJECT_TRACK_PLAN:READ+EDIT']"
v-if="!scope.row.reportId"
:tip="$t('test_track.plan_view.create_report')" icon="el-icon-s-data"
@exec="openTestReportTemplate(scope.row)"/>
<ms-table-operator-button v-if="scope.row.reportId"
v-permission="['PROJECT_TRACK_PLAN:READ+EDIT']"
:tip="$t('test_track.plan_view.view_report')" icon="el-icon-s-data"
@exec="openReport(scope.row.id, scope.row.reportId)"/>
@exec="openReport(scope.row)"/>
</template>
</ms-table-operator>
<el-dropdown @command="handleCommand($event, scope.row)" class="scenario-ext-btn">
@ -227,14 +222,13 @@
<ms-table-pagination :change="initTableData" :current-page.sync="currentPage" :page-size.sync="pageSize"
:total="total"/>
<test-report-template-list @openReport="openReport" ref="testReportTemplateList"/>
<test-case-report-view @refresh="initTableData" ref="testCaseReportView"/>
<ms-delete-confirm :title="$t('test_track.plan.plan_delete')" @delete="_handleDelete" ref="deleteConfirm"
:with-tip="enableDeleteTip">
{{ $t('test_track.plan.plan_delete_tip') }}
</ms-delete-confirm>
<ms-test-plan-schedule-maintain ref="scheduleMaintain" @refreshTable="initTableData"/>
<plan-run-mode-with-env @handleRunBatch="_handleRun" ref="runMode" :plan-case-ids="[]" :type="'plan'" :plan-id="currentPlanId"/>
<test-plan-report-review ref="testCaseReportView"/>
</el-card>
</template>
@ -247,8 +241,6 @@ import MsTableOperatorButton from "../../../common/components/MsTableOperatorBut
import MsTableOperator from "../../../common/components/MsTableOperator";
import PlanStatusTableItem from "../../common/tableItems/plan/PlanStatusTableItem";
import PlanStageTableItem from "../../common/tableItems/plan/PlanStageTableItem";
import TestReportTemplateList from "../view/comonents/TestReportTemplateList";
import TestCaseReportView from "../view/comonents/report/TestCaseReportView";
import MsDeleteConfirm from "../../../common/components/MsDeleteConfirm";
import {TEST_PLAN_CONFIGS} from "../../../common/components/search/search-components";
import {
@ -267,16 +259,16 @@ import MsTag from "@/business/components/common/components/MsTag";
import MsTestPlanScheduleMaintain from "@/business/components/track/plan/components/ScheduleMaintain";
import {getCurrentProjectID, getCurrentUserId, hasPermission} from "@/common/js/utils";
import PlanRunModeWithEnv from "@/business/components/track/plan/common/PlanRunModeWithEnv";
import TestPlanReportReview from "@/business/components/track/report/components/TestPlanReportReview";
export default {
name: "TestPlanList",
components: {
TestPlanReportReview,
MsTag,
HeaderLabelOperate,
HeaderCustom,
MsDeleteConfirm,
TestCaseReportView,
TestReportTemplateList,
PlanStageTableItem,
PlanStatusTableItem,
MsTestPlanScheduleMaintain,
@ -446,13 +438,8 @@ export default {
this.saveSortField(this.tableHeaderKey,this.condition.orders);
this.initTableData();
},
openTestReportTemplate(data) {
this.$refs.testReportTemplateList.open(data.id);
},
openReport(planId, reportId) {
if (reportId) {
this.$refs.testCaseReportView.open(planId, reportId);
}
openReport(plan) {
this.$refs.testCaseReportView.open(plan);
},
scheduleTask(row) {
row.redirectFrom = "testPlan";

View File

@ -0,0 +1,97 @@
<template>
<el-drawer
:visible.sync="showDialog"
:with-header="false"
:modal-append-to-body="false"
size="100%"
ref="drawer"
v-loading="result.loading">
<template v-slot:default="scope">
<el-row type="flex" class="head-bar">
<el-col :span="12">
<div class="name-edit">
<el-button plain size="mini" icon="el-icon-back" @click="handleClose">{{$t('test_track.return')}}
</el-button>&nbsp;
<span class="title">{{plan.name}}</span>
</div>
</el-col>
<el-col :span="12" class="head-right">
<!-- <el-button v-permission="['PROJECT_TRACK_REPORT:READ+EXPORT']" :disabled="!isTestManagerOrTestUser" plain size="mini" @click="handleExport(report.name)">-->
<!-- {{$t('test_track.plan_view.export_report')}}-->
<!-- </el-button>-->
</el-col>
</el-row>
<el-scrollbar>
<div class="container">
<test-plan-report-content :plan-id="plan.id"/>
</div>
</el-scrollbar>
</template>
</el-drawer>
</template>
<script>
import TestPlanReportContent from "@/business/components/track/plan/view/comonents/report/detail/TestPlanReportContent";
export default {
name: "TestPlanReportReview",
components: {
TestPlanReportContent
},
data() {
return {
result: {},
showDialog: false,
plan: {},
isTestManagerOrTestUser: false
}
},
mounted() {
this.isTestManagerOrTestUser = true;
},
methods: {
listenGoBack() {
//
if (window.history && window.history.pushState) {
history.pushState(null, null, document.URL);
window.addEventListener('popstate', this.goBack, false);
}
},
goBack() {
this.handleClose();
},
open(plan) {
this.plan = plan;
this.showDialog = true;
this.listenGoBack();
},
handleClose() {
window.removeEventListener('popstate', this.goBack, false);
this.$emit('refresh');
this.showDialog = false;
},
}
}
</script>
<style scoped>
.head-bar {
background: white;
height: 45px;
line-height: 45px;
padding: 0 10px;
border: 1px solid #EBEEF5;
box-shadow: 0 0 2px 0 rgba(31, 31, 31, 0.15), 0 1px 2px 0 rgba(31, 31, 31, 0.15);
}
.container {
height: 100vh;
background: #F5F5F5;
}
.head-right {
text-align: right;
}
</style>