refactor(权限管理): 报告页面的权限

This commit is contained in:
Captain.B 2021-05-24 14:47:33 +08:00 committed by 刘瑞斌
parent d0896a541a
commit 5fe673238e
1 changed files with 6 additions and 15 deletions

View File

@ -16,25 +16,25 @@
</el-breadcrumb> </el-breadcrumb>
</el-row> </el-row>
<el-row class="ms-report-view-btns"> <el-row class="ms-report-view-btns">
<el-button :disabled="isReadOnly || report.status !== 'Running' || testDeleted" type="primary" plain <el-button :disabled="report.status !== 'Running' || testDeleted" type="primary" plain
size="mini" size="mini"
@click="dialogFormVisible=true"> @click="dialogFormVisible=true">
{{ $t('report.test_stop_now') }} {{ $t('report.test_stop_now') }}
</el-button> </el-button>
<el-button :disabled="isReadOnly || report.status !== 'Completed' || testDeleted" type="success" plain <el-button :disabled="report.status !== 'Completed' || testDeleted" type="success" plain
size="mini" size="mini"
@click="rerun(testId)"> @click="rerun(testId)">
{{ $t('report.test_execute_again') }} {{ $t('report.test_execute_again') }}
</el-button> </el-button>
<el-button :disabled="isReadOnly" type="info" plain size="mini" @click="handleExport(reportName)"> <el-button type="info" plain size="mini" @click="handleExport(reportName)">
{{ $t('test_track.plan_view.export_report') }} {{ $t('test_track.plan_view.export_report') }}
</el-button> </el-button>
<el-button :disabled="isReadOnly || report.status !== 'Completed'" type="default" plain <el-button :disabled="report.status !== 'Completed'" type="default" plain
size="mini" size="mini"
@click="compareReports()"> @click="compareReports()">
{{ $t('report.compare') }} {{ $t('report.compare') }}
</el-button> </el-button>
<el-button :disabled="isReadOnly" type="warning" plain size="mini" @click="downloadJtl()"> <el-button type="warning" plain size="mini" @click="downloadJtl()">
{{ $t('report.downloadJtl') }} {{ $t('report.downloadJtl') }}
</el-button> </el-button>
</el-row> </el-row>
@ -127,7 +127,7 @@ import MsPerformancePressureConfig from "./components/PerformancePressureConfig"
import MsContainer from "../../common/components/MsContainer"; import MsContainer from "../../common/components/MsContainer";
import MsMainContainer from "../../common/components/MsMainContainer"; import MsMainContainer from "../../common/components/MsMainContainer";
import {checkoutTestManagerOrTestUser, exportPdf} from "@/common/js/utils"; import {exportPdf} from "@/common/js/utils";
import html2canvas from 'html2canvas'; import html2canvas from 'html2canvas';
import MsPerformanceReportExport from "./PerformanceReportExport"; import MsPerformanceReportExport from "./PerformanceReportExport";
import {Message} from "element-ui"; import {Message} from "element-ui";
@ -167,7 +167,6 @@ export default {
seconds: '0', seconds: '0',
title: 'Logging', title: 'Logging',
report: {}, report: {},
isReadOnly: false,
websocket: null, websocket: null,
dialogFormVisible: false, dialogFormVisible: false,
reportExportVisible: false, reportExportVisible: false,
@ -414,10 +413,6 @@ export default {
} }
}, },
created() { created() {
this.isReadOnly = false;
if (!checkoutTestManagerOrTestUser()) {
this.isReadOnly = true;
}
this.reportId = this.$route.path.split('/')[4]; this.reportId = this.$route.path.split('/')[4];
this.getReport(this.reportId); this.getReport(this.reportId);
this.getPoolType(this.reportId); this.getPoolType(this.reportId);
@ -425,10 +420,6 @@ export default {
watch: { watch: {
'$route'(to) { '$route'(to) {
if (to.name === "perReportView") { if (to.name === "perReportView") {
this.isReadOnly = false;
if (!checkoutTestManagerOrTestUser()) {
this.isReadOnly = true;
}
this.reportId = to.path.split('/')[4]; this.reportId = to.path.split('/')[4];
this.getReport(this.reportId); this.getReport(this.reportId);
this.initBreadcrumb((response) => { this.initBreadcrumb((response) => {