feat(报表统计): 修复报表统计中已创建的图标类型点击保存却另存为的缺陷
--bug=1014761 --user=宋天阳 [ 报表统计]github #15634报表统计-项目报表,已创建的报表更改图表类型后,点击保存失败,而是变成了另存为 https://www.tapd.cn/55049933/s/1198644
This commit is contained in:
parent
b459e4736c
commit
2f06d5b95a
|
@ -1,9 +1,7 @@
|
|||
package io.metersphere.reportstatistics.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import io.metersphere.base.domain.ReportStatistics;
|
||||
import io.metersphere.base.domain.ReportStatisticsWithBLOBs;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import io.metersphere.reportstatistics.dto.ReportStatisticsSaveRequest;
|
||||
import io.metersphere.reportstatistics.service.ReportStatisticsService;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
@ -32,13 +30,19 @@ public class HistoryReportController {
|
|||
}
|
||||
|
||||
@PostMapping("/saveReport")
|
||||
public ReportStatisticsWithBLOBs saveReport(@RequestBody ReportStatisticsSaveRequest request){
|
||||
public ReportStatisticsWithBLOBs saveReport(@RequestBody ReportStatisticsSaveRequest request) {
|
||||
ReportStatisticsWithBLOBs returnData = reportStatisticsService.saveByRequest(request);
|
||||
return returnData;
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public ReportStatisticsWithBLOBs update(@RequestBody ReportStatisticsSaveRequest request) {
|
||||
ReportStatisticsWithBLOBs returnData = reportStatisticsService.update(request);
|
||||
return returnData;
|
||||
}
|
||||
|
||||
@PostMapping("/updateReport")
|
||||
public ReportStatisticsWithBLOBs updateReport(@RequestBody ReportStatisticsSaveRequest request){
|
||||
public ReportStatisticsWithBLOBs updateReport(@RequestBody ReportStatisticsSaveRequest request) {
|
||||
ReportStatisticsWithBLOBs returnData = reportStatisticsService.updateByRequest(request);
|
||||
return returnData;
|
||||
}
|
||||
|
|
|
@ -65,6 +65,11 @@ public class ReportStatisticsService {
|
|||
return model;
|
||||
}
|
||||
|
||||
public ReportStatisticsWithBLOBs update(ReportStatisticsSaveRequest request) {
|
||||
reportStatisticsMapper.updateByPrimaryKeySelective(request);
|
||||
return request;
|
||||
}
|
||||
|
||||
public int deleteById(String id) {
|
||||
return reportStatisticsMapper.deleteByPrimaryKey(id);
|
||||
}
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
<template>
|
||||
<div class="ms-header">
|
||||
<el-row>
|
||||
<div class="ms-div">{{title}}</div>
|
||||
<div class="ms-div">{{ title }}</div>
|
||||
<div class="ms-header-right">
|
||||
<el-button type="primary" v-if="isSaveAsButtonShow" size="mini" @click="handleSaveAs" :disabled="readOnly">{{ $t('commons.save_as') }}<i class="el-icon-files el-icon--right"></i></el-button>
|
||||
<el-button type="primary" v-if="isSaveButtonShow" size="mini" @click="handleSave" :disabled="readOnly">{{ $t('commons.save') }}<i class="el-icon-files el-icon--right"></i></el-button>
|
||||
<el-button type="" size="mini" @click="handleExport" :disabled="readOnly">{{ $t('report.export') }}<i class="el-icon-download el-icon--right"></i></el-button>
|
||||
<el-button type="primary" v-if="isSaveAsButtonShow" size="mini" @click="handleSaveAs" :disabled="readOnly">
|
||||
{{ $t('commons.save_as') }}<i class="el-icon-files el-icon--right"></i></el-button>
|
||||
<el-button type="primary" v-if="isSaveButtonShow" size="mini" @click="handleSave" :disabled="readOnly">
|
||||
{{ $t('commons.save') }}<i class="el-icon-files el-icon--right"></i></el-button>
|
||||
<el-button type="" size="mini" @click="handleExport" :disabled="readOnly">{{ $t('report.export') }}<i
|
||||
class="el-icon-download el-icon--right"></i></el-button>
|
||||
<span class="ms-span">|</span>
|
||||
<i class="el-icon-close report-alt-ico" @click="close"/>
|
||||
</div>
|
||||
|
@ -15,101 +18,105 @@
|
|||
|
||||
<script>
|
||||
import {exportPdf, hasPermission} from "@/common/js/utils";
|
||||
import html2canvas from 'html2canvas';
|
||||
import html2canvas from 'html2canvas';
|
||||
|
||||
export default {
|
||||
name: "ReportHeader",
|
||||
components: {},
|
||||
data() {
|
||||
return {}
|
||||
export default {
|
||||
name: "ReportHeader",
|
||||
components: {},
|
||||
data() {
|
||||
return {}
|
||||
},
|
||||
props: {
|
||||
title: String,
|
||||
historyReportId: String,
|
||||
},
|
||||
created() {
|
||||
},
|
||||
computed: {
|
||||
readOnly() {
|
||||
return !hasPermission('PROJECT_REPORT_ANALYSIS:READ+EXPORT');
|
||||
},
|
||||
props:{
|
||||
title:String,
|
||||
historyReportId:String,
|
||||
},
|
||||
created() {
|
||||
},
|
||||
computed: {
|
||||
readOnly() {
|
||||
return !hasPermission('PROJECT_REPORT_ANALYSIS:READ+EXPORT');
|
||||
},
|
||||
isSaveAsButtonShow(){
|
||||
if(!this.historyReportId || this.historyReportId === null || this.historyReportId === ''){
|
||||
return false;
|
||||
}else {
|
||||
if(hasPermission('PROJECT_REPORT_ANALYSIS:READ+CREATE')){
|
||||
return true;
|
||||
}else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
},
|
||||
isSaveButtonShow(){
|
||||
if(hasPermission('PROJECT_REPORT_ANALYSIS:READ+UPDATE')){
|
||||
isSaveAsButtonShow() {
|
||||
if (!this.historyReportId || this.historyReportId === null || this.historyReportId === '') {
|
||||
return false;
|
||||
} else {
|
||||
if (hasPermission('PROJECT_REPORT_ANALYSIS:READ+CREATE')) {
|
||||
return true;
|
||||
}else {
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleExport() {
|
||||
let name = this.title;
|
||||
this.$nextTick(function () {
|
||||
setTimeout(() => {
|
||||
html2canvas(document.getElementById('reportAnalysis'), {
|
||||
scale: 2
|
||||
}).then(function (canvas) {
|
||||
exportPdf(name, [canvas]);
|
||||
});
|
||||
}, 1000);
|
||||
});
|
||||
},
|
||||
handleSave(){
|
||||
this.$emit("saveReport");
|
||||
},
|
||||
handleSaveAs(){
|
||||
this.$emit("selectAndSaveReport");
|
||||
},
|
||||
close() {
|
||||
this.$emit('closePage');
|
||||
},
|
||||
isSaveButtonShow() {
|
||||
if (hasPermission('PROJECT_REPORT_ANALYSIS:READ+UPDATE')) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleExport() {
|
||||
let name = this.title;
|
||||
this.$nextTick(function () {
|
||||
setTimeout(() => {
|
||||
html2canvas(document.getElementById('reportAnalysis'), {
|
||||
scale: 2
|
||||
}).then(function (canvas) {
|
||||
exportPdf(name, [canvas]);
|
||||
});
|
||||
}, 1000);
|
||||
});
|
||||
},
|
||||
}
|
||||
handleSave() {
|
||||
if (!this.historyReportId || this.historyReportId === null || this.historyReportId === '') {
|
||||
this.$emit("selectAndSaveReport");
|
||||
} else {
|
||||
this.$emit("updateReport");
|
||||
}
|
||||
},
|
||||
handleSaveAs() {
|
||||
this.$emit("selectAndSaveReport");
|
||||
},
|
||||
close() {
|
||||
this.$emit('closePage');
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.ms-header {
|
||||
border-bottom: 1px solid #E6E6E6;
|
||||
background-color: #FFF;
|
||||
}
|
||||
.ms-header {
|
||||
border-bottom: 1px solid #E6E6E6;
|
||||
background-color: #FFF;
|
||||
}
|
||||
|
||||
.ms-div {
|
||||
float: left;
|
||||
margin-left: 20px;
|
||||
margin-top: 12px;
|
||||
}
|
||||
.ms-div {
|
||||
float: left;
|
||||
margin-left: 20px;
|
||||
margin-top: 12px;
|
||||
}
|
||||
|
||||
.ms-span {
|
||||
margin: 0px 10px 10px;
|
||||
}
|
||||
.ms-span {
|
||||
margin: 0px 10px 10px;
|
||||
}
|
||||
|
||||
.ms-header-right {
|
||||
float: right;
|
||||
/*width: 320px;*/
|
||||
margin-bottom: 10px;
|
||||
margin-top: 10px;
|
||||
margin-right: 20px;
|
||||
}
|
||||
.ms-header-right {
|
||||
float: right;
|
||||
/*width: 320px;*/
|
||||
margin-bottom: 10px;
|
||||
margin-top: 10px;
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
||||
.report-alt-ico {
|
||||
font-size: 17px;
|
||||
top: auto;
|
||||
}
|
||||
.report-alt-ico {
|
||||
font-size: 17px;
|
||||
top: auto;
|
||||
}
|
||||
|
||||
.report-alt-ico:hover {
|
||||
color: black;
|
||||
cursor: pointer;
|
||||
font-size: 18px;
|
||||
}
|
||||
.report-alt-ico:hover {
|
||||
color: black;
|
||||
cursor: pointer;
|
||||
font-size: 18px;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<div>
|
||||
<el-row type="flex">
|
||||
<p class="tip">
|
||||
<span class="ms-span">{{$t('commons.report_statistics.name')}}</span>
|
||||
<span class="ms-span">{{ $t('commons.report_statistics.name') }}</span>
|
||||
<el-select v-model="reportType" class="ms-col-type" size="mini" style="width: 120px">
|
||||
<el-option :key="t.id" :value="t.id" :label="t.name" v-for="t in reportTypes"/>
|
||||
</el-select>
|
||||
|
@ -15,19 +15,24 @@
|
|||
</transition>
|
||||
|
||||
<!-- 测试用例趋势页面 -->
|
||||
<ms-drawer :visible="testCaseTrendDrawer" :size="100" @close="close" direction="right" :show-full-screen="false" :is-show-close="false" style="overflow: hidden">
|
||||
<ms-drawer :visible="testCaseTrendDrawer" :size="100" @close="close" direction="right" :show-full-screen="false"
|
||||
:is-show-close="false" style="overflow: hidden">
|
||||
<template v-slot:header>
|
||||
<report-header :title="$t('commons.report_statistics.test_case_analysis')" :history-report-id="historyReportId"
|
||||
@closePage="close" @saveReport="openSaveReportDialog('save')" @selectAndSaveReport="openSaveReportDialog('saveAs')"/>
|
||||
@closePage="close" @updateReport="updateReport"
|
||||
@selectAndSaveReport="openSaveReportDialog('saveAs')"/>
|
||||
</template>
|
||||
<test-analysis-container @initHistoryReportId="initHistoryReportId" ref="testAnalysisContainer"/>
|
||||
</ms-drawer>
|
||||
|
||||
<!-- 测试用例分析页面 -->
|
||||
<ms-drawer :visible="testCaseCountDrawer" :size="100" @close="close" direction="right" :show-full-screen="false" :is-show-close="false" style="overflow: hidden">
|
||||
<ms-drawer :visible="testCaseCountDrawer" :size="100" @close="close" direction="right" :show-full-screen="false"
|
||||
:is-show-close="false" style="overflow: hidden">
|
||||
<template v-slot:header>
|
||||
<report-header :title="$t('commons.report_statistics.test_case_count')" :history-report-id="historyReportId"
|
||||
@closePage="close" @saveReport="openSaveReportDialog('save')" @selectAndSaveReport="openSaveReportDialog('saveAs')"/>
|
||||
@closePage="close"
|
||||
@updateReport="updateReport"
|
||||
@selectAndSaveReport="openSaveReportDialog('saveAs')"/>
|
||||
</template>
|
||||
<test-case-count-container @initHistoryReportId="initHistoryReportId" ref="testCaseCountContainer"/>
|
||||
</ms-drawer>
|
||||
|
@ -44,97 +49,108 @@
|
|||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="saveReport">{{$t('commons.confirm')}}</el-button>
|
||||
<el-button type="primary" @click="saveReport">{{ $t('commons.confirm') }}</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import ReportCard from "@/business/components/reportstatistics/projectstatistics/ReportCard";
|
||||
import TestAnalysisContainer from "@/business/components/reportstatistics/projectstatistics/track/TestAnalysisContainer";
|
||||
import MsDrawer from "@/business/components/common/components/MsDrawer";
|
||||
import ReportHeader from "@/business/components/reportstatistics/base/ReportHeader";
|
||||
import TestCaseCountContainer from "@/business/components/reportstatistics/projectstatistics/casecount/TestCaseCountContainer";
|
||||
import ReportCard from "@/business/components/reportstatistics/projectstatistics/ReportCard";
|
||||
import TestAnalysisContainer
|
||||
from "@/business/components/reportstatistics/projectstatistics/track/TestAnalysisContainer";
|
||||
import MsDrawer from "@/business/components/common/components/MsDrawer";
|
||||
import ReportHeader from "@/business/components/reportstatistics/base/ReportHeader";
|
||||
import TestCaseCountContainer
|
||||
from "@/business/components/reportstatistics/projectstatistics/casecount/TestCaseCountContainer";
|
||||
|
||||
|
||||
export default {
|
||||
name: "ReportAnalysis",
|
||||
components: {ReportCard, TestAnalysisContainer, MsDrawer, ReportHeader, TestCaseCountContainer},
|
||||
data() {
|
||||
return {
|
||||
reportType: "track",
|
||||
testCaseTrendDrawer: false,
|
||||
testCaseCountDrawer: false,
|
||||
historyReportId:"",
|
||||
reportTypes: [{id: 'track', name: this.$t('test_track.test_track')}],
|
||||
dialogFormVisible: false,
|
||||
form: {
|
||||
reportName: "",
|
||||
saveType: "",
|
||||
},
|
||||
saveReportRules: {
|
||||
reportName: [
|
||||
{ required: true, message: this.$t('commons.input_name'), trigger: 'blur' },
|
||||
{ min: 1, max: 20, message: '长度不大于20个字符', trigger: 'blur' }
|
||||
],
|
||||
export default {
|
||||
name: "ReportAnalysis",
|
||||
components: {ReportCard, TestAnalysisContainer, MsDrawer, ReportHeader, TestCaseCountContainer},
|
||||
data() {
|
||||
return {
|
||||
reportType: "track",
|
||||
testCaseTrendDrawer: false,
|
||||
testCaseCountDrawer: false,
|
||||
historyReportId: "",
|
||||
reportTypes: [{id: 'track', name: this.$t('test_track.test_track')}],
|
||||
dialogFormVisible: false,
|
||||
form: {
|
||||
reportName: "",
|
||||
saveType: "",
|
||||
},
|
||||
saveReportRules: {
|
||||
reportName: [
|
||||
{required: true, message: this.$t('commons.input_name'), trigger: 'blur'},
|
||||
{min: 1, max: 20, message: '长度不大于20个字符', trigger: 'blur'}
|
||||
],
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
openCard(type) {
|
||||
if (type === 'trackTestCase') {
|
||||
this.testCaseTrendDrawer = true;
|
||||
} else if (type === 'countTestCase') {
|
||||
this.testCaseCountDrawer = true;
|
||||
}
|
||||
},
|
||||
close() {
|
||||
this.testCaseTrendDrawer = false;
|
||||
this.testCaseCountDrawer = false;
|
||||
},
|
||||
openSaveReportDialog(saveType) {
|
||||
this.form.saveType = saveType;
|
||||
this.dialogFormVisible = true;
|
||||
},
|
||||
updateReport() {
|
||||
if (this.historyReportId) {
|
||||
if (this.testCaseTrendDrawer) {
|
||||
this.$refs.testAnalysisContainer.updateReport(this.historyReportId);
|
||||
} else if (this.testCaseCountDrawer) {
|
||||
this.$refs.testCaseCountContainer.updateReport(this.historyReportId);
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
openCard(type) {
|
||||
if(type === 'trackTestCase'){
|
||||
this.testCaseTrendDrawer = true;
|
||||
}else if(type === 'countTestCase'){
|
||||
this.testCaseCountDrawer = true;
|
||||
}
|
||||
},
|
||||
close() {
|
||||
this.testCaseTrendDrawer = false;
|
||||
this.testCaseCountDrawer = false;
|
||||
},
|
||||
openSaveReportDialog(saveType){
|
||||
this.form.saveType = saveType;
|
||||
this.dialogFormVisible = true;
|
||||
},
|
||||
saveReport(){
|
||||
this.$refs['saveReportRuleForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
if(this.testCaseTrendDrawer){
|
||||
this.$refs.testAnalysisContainer.saveAndSaveAsReport(this.form.reportName,this.form.saveType);
|
||||
}else if(this.testCaseCountDrawer){
|
||||
this.$refs.testCaseCountContainer.saveAndSaveAsReport(this.form.reportName,this.form.saveType);
|
||||
}
|
||||
this.form.reportName = "";
|
||||
this.form.saveType = "";
|
||||
this.dialogFormVisible = false;
|
||||
} else {
|
||||
return false;
|
||||
saveReport() {
|
||||
this.$refs['saveReportRuleForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
if (this.testCaseTrendDrawer) {
|
||||
this.$refs.testAnalysisContainer.saveAndSaveAsReport(this.form.reportName, this.form.saveType);
|
||||
} else if (this.testCaseCountDrawer) {
|
||||
this.$refs.testCaseCountContainer.saveAndSaveAsReport(this.form.reportName, this.form.saveType);
|
||||
}
|
||||
});
|
||||
},
|
||||
initHistoryReportId(reportId){
|
||||
this.historyReportId = reportId;
|
||||
},
|
||||
handleCloseSaveReportDialog(){
|
||||
this.form.reportName = "";
|
||||
this.form.saveType = "";
|
||||
this.dialogFormVisible = false;
|
||||
}
|
||||
this.form.reportName = "";
|
||||
this.form.saveType = "";
|
||||
this.dialogFormVisible = false;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
}
|
||||
initHistoryReportId(reportId) {
|
||||
this.historyReportId = reportId;
|
||||
},
|
||||
handleCloseSaveReportDialog() {
|
||||
this.form.reportName = "";
|
||||
this.form.saveType = "";
|
||||
this.dialogFormVisible = false;
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.ms-span {
|
||||
margin: 10px 10px 0px
|
||||
}
|
||||
.ms-span {
|
||||
margin: 10px 10px 0px
|
||||
}
|
||||
|
||||
.tip {
|
||||
float: left;
|
||||
font-size: 14px;
|
||||
border-radius: 2px;
|
||||
border-left: 2px solid #783887;
|
||||
margin: 10px 20px 0px;
|
||||
}
|
||||
.tip {
|
||||
float: left;
|
||||
font-size: 14px;
|
||||
border-radius: 2px;
|
||||
border-left: 2px solid #783887;
|
||||
margin: 10px 20px 0px;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -132,7 +132,7 @@ export default {
|
|||
if (selectTableData) {
|
||||
this.tableData = selectTableData;
|
||||
}
|
||||
this.$refs.analysisChart.setPieOptionAndBarOption(this.loadOption,this.pieOption);
|
||||
this.$refs.analysisChart.setPieOptionAndBarOption(this.loadOption, this.pieOption);
|
||||
this.loading = false;
|
||||
this.$refs.analysisChart.generateOption(this.chartType);
|
||||
},
|
||||
|
@ -143,6 +143,24 @@ export default {
|
|||
this.options.order = order;
|
||||
this.filterCharts(this.options);
|
||||
},
|
||||
updateReport(reportId) {
|
||||
let obj = {};
|
||||
obj.id = reportId;
|
||||
obj.projectId = getCurrentProjectID();
|
||||
obj.selectOption = JSON.stringify(this.options);
|
||||
let dataOptionObj = {
|
||||
loadOption: this.loadOption,
|
||||
pieOption: this.pieOption,
|
||||
tableData: this.tableData,
|
||||
chartType: this.chartType,
|
||||
};
|
||||
obj.dataOption = JSON.stringify(dataOptionObj);
|
||||
obj.reportType = 'TEST_CASE_COUNT';
|
||||
this.$post("/history/report/update", obj, response => {
|
||||
this.$alert(this.$t('commons.save_success'));
|
||||
this.$refs.historyReport.initReportData();
|
||||
});
|
||||
},
|
||||
saveReport(reportName) {
|
||||
let obj = {};
|
||||
obj.name = reportName;
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
</el-aside>
|
||||
<el-main class="ms-main">
|
||||
<div>
|
||||
<test-analysis-chart @hidePage="hidePage" @orderCharts="orderCharts" ref="analysisChart" :load-option="loadOption"/>
|
||||
<test-analysis-chart @hidePage="hidePage" @orderCharts="orderCharts" ref="analysisChart"
|
||||
:load-option="loadOption"/>
|
||||
</div>
|
||||
<div class="ms-row" v-if="!isHide">
|
||||
<test-analysis-table :tableData="tableData"/>
|
||||
|
@ -24,153 +25,170 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import TestAnalysisChart from "./chart/TestAnalysisChart";
|
||||
import TestAnalysisTable from "./table/TestAnalysisTable";
|
||||
import TestAnalysisFilter from "./filter/TestAnalysisFilter";
|
||||
import {exportPdf, getCurrentProjectID} from "@/common/js/utils";
|
||||
import html2canvas from 'html2canvas';
|
||||
import HistoryReportData from "../../base/HistoryReportData";
|
||||
import TestAnalysisChart from "./chart/TestAnalysisChart";
|
||||
import TestAnalysisTable from "./table/TestAnalysisTable";
|
||||
import TestAnalysisFilter from "./filter/TestAnalysisFilter";
|
||||
import {exportPdf, getCurrentProjectID} from "@/common/js/utils";
|
||||
import html2canvas from 'html2canvas';
|
||||
import HistoryReportData from "../../base/HistoryReportData";
|
||||
|
||||
export default {
|
||||
name: "TestAnalysisContainer",
|
||||
components: {TestAnalysisChart, TestAnalysisTable, TestAnalysisFilter, HistoryReportData},
|
||||
data() {
|
||||
return {
|
||||
isHide: false,
|
||||
loading: false,
|
||||
options: {},
|
||||
loadOption: {
|
||||
legend: {},
|
||||
xAxis: {},
|
||||
yAxis: {},
|
||||
label: {},
|
||||
tooltip: {},
|
||||
series: []
|
||||
},
|
||||
tableData: [],
|
||||
h: document.documentElement.clientHeight - 40,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleExport() {
|
||||
let name = this.$t('commons.report_statistics.test_case_analysis');
|
||||
this.$nextTick(function () {
|
||||
setTimeout(() => {
|
||||
html2canvas(document.getElementById('reportAnalysis'), {
|
||||
scale: 2
|
||||
}).then(function (canvas) {
|
||||
exportPdf(name, [canvas]);
|
||||
});
|
||||
}, 1000);
|
||||
});
|
||||
export default {
|
||||
name: "TestAnalysisContainer",
|
||||
components: {TestAnalysisChart, TestAnalysisTable, TestAnalysisFilter, HistoryReportData},
|
||||
data() {
|
||||
return {
|
||||
isHide: false,
|
||||
loading: false,
|
||||
options: {},
|
||||
loadOption: {
|
||||
legend: {},
|
||||
xAxis: {},
|
||||
yAxis: {},
|
||||
label: {},
|
||||
tooltip: {},
|
||||
series: []
|
||||
},
|
||||
hidePage(isHide) {
|
||||
this.isHide = isHide;
|
||||
},
|
||||
close() {
|
||||
this.$emit('closePage');
|
||||
},
|
||||
init(opt) {
|
||||
this.loading = true;
|
||||
this.options = opt;
|
||||
this.$post(' /report/test/analysis/getReport', opt, response => {
|
||||
let data = response.data.chartDTO;
|
||||
let tableDTOs = response.data.tableDTOs;
|
||||
this.initPic(data,tableDTOs);
|
||||
});
|
||||
},
|
||||
filterCharts(opt) {
|
||||
this.init(opt);
|
||||
},
|
||||
orderCharts(order) {
|
||||
this.options.order = order;
|
||||
this.filterCharts(this.options);
|
||||
},
|
||||
saveReport(reportName) {
|
||||
let obj = {};
|
||||
obj.name = reportName;
|
||||
obj.projectId = getCurrentProjectID();
|
||||
obj.selectOption = JSON.stringify(this.options);
|
||||
let dataOptionObj = {
|
||||
loadOption: this.loadOption,
|
||||
pieOption: this.pieOption,
|
||||
tableData: this.tableData,
|
||||
};
|
||||
obj.dataOption = JSON.stringify(dataOptionObj);
|
||||
obj.reportType = 'TEST_CASE_ANALYSIS';
|
||||
this.$post("/history/report/saveReport", obj, response => {
|
||||
this.$alert(this.$t('commons.save_success'));
|
||||
this.$refs.historyReport.initReportData();
|
||||
});
|
||||
},
|
||||
initPic(loadOptionParam,tableData){
|
||||
this.loading = true;
|
||||
if (loadOptionParam) {
|
||||
this.loadOption.legend = loadOptionParam.legend;
|
||||
this.loadOption.xAxis = loadOptionParam.xaxis;
|
||||
this.loadOption.series = loadOptionParam.series;
|
||||
this.loadOption.grid = {
|
||||
bottom: '75px',//距离下边距
|
||||
}
|
||||
this.loadOption.series.forEach(item => {
|
||||
item.type = this.$refs.analysisChart.chartType;
|
||||
})
|
||||
}
|
||||
if (tableData) {
|
||||
this.tableData = tableData;
|
||||
}
|
||||
this.loading = false;
|
||||
},
|
||||
selectReport(selectId){
|
||||
if(selectId){
|
||||
this.loading = true;
|
||||
let paramObj = {
|
||||
id:selectId
|
||||
}
|
||||
this.$post('/history/report/selectById',paramObj, response => {
|
||||
let reportData = response.data;
|
||||
if(reportData){
|
||||
if(reportData.dataOption){
|
||||
let dataOptionObj = JSON.parse(reportData.dataOption);
|
||||
this.initPic(dataOptionObj.loadOption,dataOptionObj.pieOption,dataOptionObj.tableData);
|
||||
}
|
||||
if(reportData.selectOption){
|
||||
let selectOptionObj = JSON.parse(reportData.selectOption);
|
||||
this.$refs.analysisFilter.initSelectOption(selectOptionObj);
|
||||
}
|
||||
}
|
||||
this.loading = false;
|
||||
}, (error) => {
|
||||
this.loading = false;
|
||||
tableData: [],
|
||||
h: document.documentElement.clientHeight - 40,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleExport() {
|
||||
let name = this.$t('commons.report_statistics.test_case_analysis');
|
||||
this.$nextTick(function () {
|
||||
setTimeout(() => {
|
||||
html2canvas(document.getElementById('reportAnalysis'), {
|
||||
scale: 2
|
||||
}).then(function (canvas) {
|
||||
exportPdf(name, [canvas]);
|
||||
});
|
||||
this.$emit('initHistoryReportId',selectId);
|
||||
}, 1000);
|
||||
});
|
||||
},
|
||||
hidePage(isHide) {
|
||||
this.isHide = isHide;
|
||||
},
|
||||
close() {
|
||||
this.$emit('closePage');
|
||||
},
|
||||
init(opt) {
|
||||
this.loading = true;
|
||||
this.options = opt;
|
||||
this.$post(' /report/test/analysis/getReport', opt, response => {
|
||||
let data = response.data.chartDTO;
|
||||
let tableDTOs = response.data.tableDTOs;
|
||||
this.initPic(data, tableDTOs);
|
||||
});
|
||||
},
|
||||
filterCharts(opt) {
|
||||
this.init(opt);
|
||||
},
|
||||
orderCharts(order) {
|
||||
this.options.order = order;
|
||||
this.filterCharts(this.options);
|
||||
},
|
||||
updateReport(reportId) {
|
||||
let obj = {};
|
||||
obj.id = reportId;
|
||||
obj.projectId = getCurrentProjectID();
|
||||
obj.selectOption = JSON.stringify(this.options);
|
||||
let dataOptionObj = {
|
||||
loadOption: this.loadOption,
|
||||
pieOption: this.pieOption,
|
||||
tableData: this.tableData,
|
||||
};
|
||||
obj.dataOption = JSON.stringify(dataOptionObj);
|
||||
obj.reportType = 'TEST_CASE_ANALYSIS';
|
||||
this.$post("/history/report/update", obj, response => {
|
||||
this.$alert(this.$t('commons.save_success'));
|
||||
this.$refs.historyReport.initReportData();
|
||||
});
|
||||
},
|
||||
saveReport(reportName) {
|
||||
let obj = {};
|
||||
obj.name = reportName;
|
||||
obj.projectId = getCurrentProjectID();
|
||||
obj.selectOption = JSON.stringify(this.options);
|
||||
let dataOptionObj = {
|
||||
loadOption: this.loadOption,
|
||||
pieOption: this.pieOption,
|
||||
tableData: this.tableData,
|
||||
};
|
||||
obj.dataOption = JSON.stringify(dataOptionObj);
|
||||
obj.reportType = 'TEST_CASE_ANALYSIS';
|
||||
this.$post("/history/report/saveReport", obj, response => {
|
||||
this.$alert(this.$t('commons.save_success'));
|
||||
this.$refs.historyReport.initReportData();
|
||||
});
|
||||
},
|
||||
initPic(loadOptionParam, tableData) {
|
||||
this.loading = true;
|
||||
if (loadOptionParam) {
|
||||
this.loadOption.legend = loadOptionParam.legend;
|
||||
this.loadOption.xAxis = loadOptionParam.xaxis;
|
||||
this.loadOption.series = loadOptionParam.series;
|
||||
this.loadOption.grid = {
|
||||
bottom: '75px',//距离下边距
|
||||
}
|
||||
},
|
||||
removeHistoryReportId(){
|
||||
this.$emit('initHistoryReportId',"");
|
||||
},
|
||||
selectAndSaveReport(reportName){
|
||||
let opt = this.$refs.analysisFilter.getOption();
|
||||
this.options = opt;
|
||||
this.saveReport(reportName);
|
||||
},
|
||||
saveAndSaveAsReport(reportName,saveType){
|
||||
if(saveType === 'save'){
|
||||
this.saveReport(reportName);
|
||||
}else if(saveType === 'saveAs'){
|
||||
this.selectAndSaveReport(reportName);
|
||||
this.loadOption.series.forEach(item => {
|
||||
item.type = this.$refs.analysisChart.chartType;
|
||||
})
|
||||
}
|
||||
if (tableData) {
|
||||
this.tableData = tableData;
|
||||
}
|
||||
this.loading = false;
|
||||
},
|
||||
selectReport(selectId) {
|
||||
if (selectId) {
|
||||
this.loading = true;
|
||||
let paramObj = {
|
||||
id: selectId
|
||||
}
|
||||
this.$post('/history/report/selectById', paramObj, response => {
|
||||
let reportData = response.data;
|
||||
if (reportData) {
|
||||
if (reportData.dataOption) {
|
||||
let dataOptionObj = JSON.parse(reportData.dataOption);
|
||||
this.initPic(dataOptionObj.loadOption, dataOptionObj.pieOption, dataOptionObj.tableData);
|
||||
}
|
||||
if (reportData.selectOption) {
|
||||
let selectOptionObj = JSON.parse(reportData.selectOption);
|
||||
this.$refs.analysisFilter.initSelectOption(selectOptionObj);
|
||||
}
|
||||
}
|
||||
this.loading = false;
|
||||
}, (error) => {
|
||||
this.loading = false;
|
||||
});
|
||||
this.$emit('initHistoryReportId', selectId);
|
||||
}
|
||||
},
|
||||
}
|
||||
removeHistoryReportId() {
|
||||
this.$emit('initHistoryReportId', "");
|
||||
},
|
||||
selectAndSaveReport(reportName) {
|
||||
let opt = this.$refs.analysisFilter.getOption();
|
||||
this.options = opt;
|
||||
this.saveReport(reportName);
|
||||
},
|
||||
saveAndSaveAsReport(reportName, saveType) {
|
||||
if (saveType === 'save') {
|
||||
this.saveReport(reportName);
|
||||
} else if (saveType === 'saveAs') {
|
||||
this.selectAndSaveReport(reportName);
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.ms-row {
|
||||
padding-top: 10px;
|
||||
}
|
||||
.ms-row {
|
||||
padding-top: 10px;
|
||||
}
|
||||
|
||||
/deep/ .el-main {
|
||||
padding: 0px 20px 0px;
|
||||
}
|
||||
/deep/ .el-main {
|
||||
padding: 0px 20px 0px;
|
||||
}
|
||||
</style>
|
||||
|
|
Loading…
Reference in New Issue