diff --git a/backend/src/main/java/io/metersphere/xpack b/backend/src/main/java/io/metersphere/xpack index cf6b065263..141ee64787 160000 --- a/backend/src/main/java/io/metersphere/xpack +++ b/backend/src/main/java/io/metersphere/xpack @@ -1 +1 @@ -Subproject commit cf6b06526324326a563d933e07118fac014a63b4 +Subproject commit 141ee64787b4a28ef108c5fa4dde90446de01887 diff --git a/frontend/src/business/components/api/report/ApiReportExport.vue b/frontend/src/business/components/api/report/ApiReportExport.vue index 5e1ace1bcd..c011bf3747 100644 --- a/frontend/src/business/components/api/report/ApiReportExport.vue +++ b/frontend/src/business/components/api/report/ApiReportExport.vue @@ -1,30 +1,35 @@ - {{$t('commons.save')}} +
+ {{ $t('commons.save') }} +
@@ -82,177 +84,177 @@ diff --git a/frontend/src/business/components/common/router/router.js b/frontend/src/business/components/common/router/router.js index 7ac9c4607e..da7d79e786 100644 --- a/frontend/src/business/components/common/router/router.js +++ b/frontend/src/business/components/common/router/router.js @@ -26,6 +26,9 @@ const router = new VueRouter({ }); router.beforeEach((to, from, next) => { + + redirectLoginPath(to.fullPath); + //解决localStorage清空,cookie没失效导致的卡死问题 if (!localStorage.getItem('Admin-Token')) { axios.get("/signout"); @@ -38,4 +41,17 @@ router.beforeEach((to, from, next) => { } }); +// 登入后跳转至原路径 +function redirectLoginPath(originPath) { + let redirectUrl = sessionStorage.getItem('redirectUrl'); + let loginSuccess = sessionStorage.getItem('loginSuccess'); + sessionStorage.setItem('redirectUrl', originPath); + if (redirectUrl && loginSuccess) { + sessionStorage.removeItem('loginSuccess'); + router.push(redirectUrl); + } + sessionStorage.removeItem('loginSuccess'); +} + + export default router diff --git a/frontend/src/business/components/performance/report/PerformanceReportExport.vue b/frontend/src/business/components/performance/report/PerformanceReportExport.vue new file mode 100644 index 0000000000..1a3079bfc9 --- /dev/null +++ b/frontend/src/business/components/performance/report/PerformanceReportExport.vue @@ -0,0 +1,54 @@ + + + + + diff --git a/frontend/src/business/components/performance/report/PerformanceReportView.vue b/frontend/src/business/components/performance/report/PerformanceReportView.vue index 0bbfaf8df5..69204d29dd 100644 --- a/frontend/src/business/components/performance/report/PerformanceReportView.vue +++ b/frontend/src/business/components/performance/report/PerformanceReportView.vue @@ -22,8 +22,8 @@ @click="rerun(testId)"> {{ $t('report.test_execute_again') }} - - {{$t('report.export')}} + + {{$t('test_track.plan_view.export_report')}} @@ -65,26 +65,7 @@ -
- - - - - - - - - - - - -
+ @@ -113,11 +94,13 @@ import MsMainContainer from "../../common/components/MsMainContainer"; import {checkoutTestManagerOrTestUser} from "@/common/js/utils"; import {exportPdf} from "../../../../common/js/utils"; import html2canvas from 'html2canvas'; +import MsPerformanceReportExport from "./PerformanceReportExport"; export default { name: "PerformanceReportView", components: { + MsPerformanceReportExport, MsReportErrorLog, MsReportLogDetails, MsReportRequestStatistics, @@ -147,7 +130,6 @@ export default { websocket: null, dialogFormVisible: false, reportExportVisible: false, - isShow: true, testPlan: {testResourcePoolId: null} } }, @@ -273,41 +255,25 @@ export default { this.initReportTimeInfo(); window.console.log("socket closed."); }, - exportReport(name) { - this.result = {loading: true}; - let result = this.result; - result.loading = true; + handleExport(name) { + this.result.loading = true; this.reportExportVisible = true; - let promises = []; - let canvasList = new Array(3); let reset = this.exportReportReset; + this.$nextTick(function () { setTimeout(() => { - promises.push(this.getCanvasPromise('testOverview', 0, canvasList)); - promises.push(this.getCanvasPromise('requestStatistics', 1, canvasList)); - promises.push(this.getCanvasPromise('errorLog', 2, canvasList)); - - Promise.all(promises).then(function (info) { - exportPdf(name, canvasList); - result.loading = false; + html2canvas(document.getElementById('performanceReportExport'), { + scale: 2 + }).then(function(canvas) { + exportPdf(name, [canvas]); reset(); }); }, 1000); - }) + }); }, exportReportReset() { this.reportExportVisible = false; - this.isShow = true; - }, - getCanvasPromise(id, index, canvasList) { - return new Promise(function(resolve, reject) { - html2canvas(document.getElementById(id), { - scale: 2 - }).then(function(canvas) { - canvasList[index] = canvas; - resolve('success'); - }); - }); + this.result.loading = false; }, }, created() { diff --git a/frontend/src/business/components/settings/SettingMenuBackup.vue b/frontend/src/business/components/settings/SettingMenuBackup.vue deleted file mode 100644 index f161626a7f..0000000000 --- a/frontend/src/business/components/settings/SettingMenuBackup.vue +++ /dev/null @@ -1,96 +0,0 @@ - - - - - diff --git a/frontend/src/business/components/track/case/components/TestCaseImport.vue b/frontend/src/business/components/track/case/components/TestCaseImport.vue index 0c41e97d6e..16c2f0f723 100644 --- a/frontend/src/business/components/track/case/components/TestCaseImport.vue +++ b/frontend/src/business/components/track/case/components/TestCaseImport.vue @@ -113,6 +113,7 @@ import MsTableButton from '../../../../components/common/components/MsTableButton'; import {listenGoBack, removeGoBackListener} from "../../../../../common/js/utils"; import {TokenKey, WORKSPACE_ID} from '../../../../../common/js/constants'; + import axios from "axios"; export default { name: "TestCaseImport", @@ -188,7 +189,14 @@ this.$fileDownload('/test/case/export/template'); }, downloadXmindTemplate() { - this.$fileDownload('/test/case/export/xmindTemplate'); + axios.get('/test/case/export/xmindTemplate', {responseType: 'blob'}) + .then(response => { + let fileName = window.decodeURI(response.headers['content-disposition'].split('=')[1]); + let link = document.createElement("a"); + link.href = window.URL.createObjectURL(new Blob([response.data])); + link.download = fileName; + link.click(); + }); }, upload(file) { this.isLoading = false; diff --git a/frontend/src/business/components/track/plan/view/comonents/report/TestCaseReportView.vue b/frontend/src/business/components/track/plan/view/comonents/report/TestCaseReportView.vue index 4127ae8ac3..c9f84d3782 100644 --- a/frontend/src/business/components/track/plan/view/comonents/report/TestCaseReportView.vue +++ b/frontend/src/business/components/track/plan/view/comonents/report/TestCaseReportView.vue @@ -33,8 +33,11 @@
-
- +
+ +
+ +
@@ -52,10 +55,13 @@ import RichTextComponent from "./TemplateComponent/RichTextComponent"; import TestCaseReportTemplateEdit from "./TestCaseReportTemplateEdit"; import TemplateComponent from "./TemplateComponent/TemplateComponent"; + import html2canvas from "html2canvas"; + import MsReportTitle from "../../../../../common/components/MsReportTitle"; export default { name: "TestCaseReportView", components: { + MsReportTitle, TemplateComponent, TestCaseReportTemplateEdit, RichTextComponent, TestResultComponent, TestResultChartComponent, BaseInfoComponent @@ -70,6 +76,7 @@ reportId: '', metric: {}, planId: '', + reportExportVisible: false, componentMap: new Map( [ [1, {name: this.$t('test_track.plan_view.base_info'), id: 1, type: 'system'}], @@ -198,23 +205,26 @@ } }); }, - /*导出报告*/ handleExport(name) { + this.result.loading = true; + this.reportExportVisible = true; + let reset = this.exportReportReset; - let result = this.result; - result.loading = true; - - let promises = []; - let canvasList = new Array(this.previews.length); - - for (let item of this.$refs.templateComponent) { - promises.push(item.getCanvas(canvasList)); - } - - Promise.all(promises).then(function (info) { - exportPdf(name, canvasList); - result.loading = false; + this.$nextTick(function () { + setTimeout(() => { + html2canvas(document.getElementById('reportViewpp'), { + scale: 2 + }).then(function(canvas) { + exportPdf(name, [canvas]); + reset(); + }); + }, 1000); }); + + }, + exportReportReset() { + this.reportExportVisible = false; + this.result.loading = false; }, } } @@ -250,4 +260,14 @@ text-align: right; } + .report-export { + padding: 20px 30px; + background: white; + } + + .report-export >>> .template-component { + width: 100%; + margin-top: 20px; + } + diff --git a/frontend/src/business/components/track/review/view/components/TestReviewTestCaseEdit.vue b/frontend/src/business/components/track/review/view/components/TestReviewTestCaseEdit.vue index 8c49aa1e55..5b777316a9 100644 --- a/frontend/src/business/components/track/review/view/components/TestReviewTestCaseEdit.vue +++ b/frontend/src/business/components/track/review/view/components/TestReviewTestCaseEdit.vue @@ -29,17 +29,6 @@ - - {{ $t('test_track.plan_view.pre_case') }} : {{ - testCases[index - 1] ? testCases[index - 1].name : '' - }} - - - {{ $t('test_track.plan_view.next_case') }} : {{ - testCases[index + 1] ? testCases[index + 1].name : '' - }} - - diff --git a/frontend/src/common/js/ajax.js b/frontend/src/common/js/ajax.js index 3dd6792e3e..0e500b68e9 100644 --- a/frontend/src/common/js/ajax.js +++ b/frontend/src/common/js/ajax.js @@ -136,7 +136,7 @@ export default { .then(response => { let fileName = window.decodeURI(response.headers['content-disposition'].split('=')[1]); let link = document.createElement("a"); - link.href = window.URL.createObjectURL(new Blob([response.data])); + link.href = window.URL.createObjectURL(new Blob([response.data], {type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8"})); link.download = fileName; link.click(); }); diff --git a/frontend/src/i18n/en-US.js b/frontend/src/i18n/en-US.js index 68b37d332f..1e0dae601f 100644 --- a/frontend/src/i18n/en-US.js +++ b/frontend/src/i18n/en-US.js @@ -142,6 +142,8 @@ export default { and: 'All', or: 'any one', operators: { + is_null: "Is null", + is_not_null: "Is not null", like: "Contains", not_like: "Not included", in: "Belong to", @@ -292,6 +294,9 @@ export default { add: 'Add Role', }, report: { + api_test_report: 'Api Test Report', + load_test_report: 'Load Test Report', + test_plan_report: 'Test Plan Report', recent: 'Recent Report', search_by_name: 'Search by Name', test_name: 'Test', diff --git a/frontend/src/i18n/zh-CN.js b/frontend/src/i18n/zh-CN.js index 1bb4ec48a3..c1b7040272 100644 --- a/frontend/src/i18n/zh-CN.js +++ b/frontend/src/i18n/zh-CN.js @@ -142,6 +142,8 @@ export default { and: '所有', or: '任意一个', operators: { + is_null: "空", + is_not_null: "非空", like: "包含", not_like: "不包含", in: "属于", @@ -292,6 +294,9 @@ export default { add: '添加角色', }, report: { + api_test_report: '接口测试报告', + load_test_report: '性能测试报告', + test_plan_report: '测试计划报告', recent: '最近的报告', search_by_name: '根据名称搜索', test_name: '所属测试', diff --git a/frontend/src/i18n/zh-TW.js b/frontend/src/i18n/zh-TW.js index c7f104ebed..999711a3d5 100644 --- a/frontend/src/i18n/zh-TW.js +++ b/frontend/src/i18n/zh-TW.js @@ -142,6 +142,8 @@ export default { and: '所有', or: '任意壹個', operators: { + is_null: "空", + is_not_null: "非空", like: "包含", not_like: "不包含", in: "屬於", @@ -292,6 +294,9 @@ export default { add: '添加角色', }, report: { + api_test_report: '接口測試報告', + load_test_report: '性能測試報告', + test_plan_report: '測試計劃報告', recent: '最近的報告', search_by_name: '根據名稱搜索', test_name: '所屬測試',