fix(项目报告): 修复项目报告发送邮件失败的问题
--bug=1018499 --user=宋天阳 【报表管理】发送报告提示异常 https://www.tapd.cn/55049933/s/1269178
This commit is contained in:
parent
53aa0fe219
commit
271b375b43
|
@ -11,10 +11,8 @@ public class EnterpriseReportContentStep implements Serializable {
|
|||
private String type;
|
||||
//type为report
|
||||
private String reportRecordId;
|
||||
// @JsonProperty("reportRecordData")
|
||||
private Map<String, String> reportRecordData;
|
||||
private Map<String, Object> reportRecordData;
|
||||
private String recordImageContent;
|
||||
// @JsonProperty("tableData")
|
||||
private Map<String, String> tableData;
|
||||
//type为txt
|
||||
private String previewContext;
|
||||
|
|
|
@ -3,8 +3,8 @@ package io.metersphere.reportstatistics.service;
|
|||
import io.metersphere.base.domain.*;
|
||||
import io.metersphere.base.mapper.EnterpriseTestReportMapper;
|
||||
import io.metersphere.base.mapper.EnterpriseTestReportSendRecordMapper;
|
||||
import io.metersphere.base.mapper.ext.ExtEnterpriseTestReportMapper;
|
||||
import io.metersphere.base.mapper.ext.BaseUserGroupMapper;
|
||||
import io.metersphere.base.mapper.ext.ExtEnterpriseTestReportMapper;
|
||||
import io.metersphere.commons.constants.ScheduleGroup;
|
||||
import io.metersphere.commons.constants.ScheduleStatus;
|
||||
import io.metersphere.commons.constants.ScheduleType;
|
||||
|
@ -408,7 +408,8 @@ public class EnterpriseTestReportService {
|
|||
StringBuffer tableBuffer = new StringBuffer();
|
||||
tableBuffer.append("<table cellspacing=\"0\" cellpadding=\"0\" style=\"width: 100%;border: 1px\">");
|
||||
try {
|
||||
TestCaseCountTableDataDTO showTable = JSON.parseObject(step.getReportRecordData().get("showTable"), TestCaseCountTableDataDTO.class);
|
||||
String showTableJsonStr = JSON.toJSONString(step.getReportRecordData().get("showTable"));
|
||||
TestCaseCountTableDataDTO showTable = JSON.parseObject(showTableJsonStr, TestCaseCountTableDataDTO.class);
|
||||
tableBuffer.append("<tr style=\"font-size: 14px;font-weight: 700;color: #909399;text-align: left;\">");
|
||||
for (TestCaseCountTableItemDataDTO itemData : showTable.getHeads()) {
|
||||
String tableHeadValue = itemData.getValue();
|
||||
|
@ -454,6 +455,7 @@ public class EnterpriseTestReportService {
|
|||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LogUtil.error("解析表格数据出错!", e);
|
||||
}
|
||||
tableBuffer.append("</table>");
|
||||
returnReportContentBuffer.append(tableBuffer);
|
||||
|
|
|
@ -36,7 +36,7 @@ export default {
|
|||
placeholder: {
|
||||
type: String,
|
||||
},
|
||||
errorInfor: String,
|
||||
errorInfo: String,
|
||||
addTagOnKeys: {
|
||||
type: Array,
|
||||
default: () => [13, 188, 9]
|
||||
|
@ -119,8 +119,8 @@ export default {
|
|||
this.innerTags.push(tag)
|
||||
return true
|
||||
} else {
|
||||
if (tag !== "" && this.errorInfor) {
|
||||
this.$error(this.errorInfor);
|
||||
if (tag !== "" && this.errorInfo) {
|
||||
this.$error(this.errorInfo);
|
||||
}
|
||||
}
|
||||
return false
|
||||
|
|
|
@ -245,16 +245,16 @@ export default {
|
|||
if (command === 'jpg') {
|
||||
imageType = 'image/jpg';
|
||||
}
|
||||
let returnImageDatas = "";
|
||||
let returnImageData = "";
|
||||
if (document.getElementById(this.reportId)) {
|
||||
let chartsCanvas = document.getElementById(this.reportId).querySelectorAll('canvas')[0];
|
||||
if (chartsCanvas) {
|
||||
// toDataURL()是canvas对象的一种方法,用于将canvas对象转换为base64位编码
|
||||
returnImageDatas = chartsCanvas && chartsCanvas.toDataURL(imageType);
|
||||
returnImageData = chartsCanvas && chartsCanvas.toDataURL(imageType);
|
||||
}
|
||||
}
|
||||
this.$emit("getImage", returnImageDatas);
|
||||
return returnImageDatas;
|
||||
this.$emit("getImage", returnImageData);
|
||||
return returnImageData;
|
||||
},
|
||||
exportCommand(command) {
|
||||
let fileName = 'report_pic.' + command;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<div v-loading="loading" class="ms-div">
|
||||
<el-card>
|
||||
<el-row style="padding-top: 10px">
|
||||
<p class="tip"><span style="margin-left: 5px"></span>{{$t('commons.report_statistics.excel')}} </p>
|
||||
<p class="tip"><span style="margin-left: 5px"></span>{{ $t('commons.report_statistics.excel') }} </p>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-table
|
||||
|
@ -21,28 +21,28 @@
|
|||
:label="$t('commons.report_statistics.count')">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="testCaseCount"
|
||||
:label="$t('api_test.home_page.failed_case_list.table_value.case_type.functional')"
|
||||
v-if="isShowColumn('testCase')"
|
||||
>
|
||||
prop="testCaseCount"
|
||||
:label="$t('api_test.home_page.failed_case_list.table_value.case_type.functional')"
|
||||
v-if="isShowColumn('testCase')"
|
||||
>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="apiCaseCount"
|
||||
:label="$t('api_test.home_page.failed_case_list.table_value.case_type.api')"
|
||||
v-if="isShowColumn('apiCase')"
|
||||
>
|
||||
prop="apiCaseCount"
|
||||
:label="$t('api_test.home_page.failed_case_list.table_value.case_type.api')"
|
||||
v-if="isShowColumn('apiCase')"
|
||||
>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="scenarioCaseCount"
|
||||
:label="$t('api_test.home_page.failed_case_list.table_value.case_type.scene')"
|
||||
v-if="isShowColumn('scenarioCase')"
|
||||
>
|
||||
prop="scenarioCaseCount"
|
||||
:label="$t('api_test.home_page.failed_case_list.table_value.case_type.scene')"
|
||||
v-if="isShowColumn('scenarioCase')"
|
||||
>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="loadCaseCount"
|
||||
:label="$t('api_test.home_page.failed_case_list.table_value.case_type.load')"
|
||||
v-if="isShowColumn('loadCase')"
|
||||
>
|
||||
prop="loadCaseCount"
|
||||
:label="$t('api_test.home_page.failed_case_list.table_value.case_type.load')"
|
||||
v-if="isShowColumn('loadCase')"
|
||||
>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-row>
|
||||
|
@ -51,72 +51,72 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "ReportTable",
|
||||
components: {},
|
||||
props: {
|
||||
tableData: Array,
|
||||
groupName: String,
|
||||
showColoums: Array,
|
||||
fullScreen: {
|
||||
type: Boolean,
|
||||
default(){
|
||||
return false;
|
||||
}
|
||||
export default {
|
||||
name: "ReportTable",
|
||||
components: {},
|
||||
props: {
|
||||
tableData: Array,
|
||||
groupName: String,
|
||||
showColumns: Array,
|
||||
fullScreen: {
|
||||
type: Boolean,
|
||||
default() {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tableHeight : "100px",
|
||||
w: document.documentElement.clientWidth - 760,
|
||||
loading: false,
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tableHeight: "100px",
|
||||
w: document.documentElement.clientWidth - 760,
|
||||
loading: false,
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getTableHeight();
|
||||
if (this.fullScreen) {
|
||||
this.w = document.documentElement.clientWidth;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
isShowColumn(type) {
|
||||
if (this.showColumns) {
|
||||
return this.showColumns.findIndex(item => item === type) >= 0;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getTableHeight();
|
||||
if(this.fullScreen){
|
||||
this.w = document.documentElement.clientWidth;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
isShowColumn(type){
|
||||
if(this.showColoums){
|
||||
return this.showColoums.findIndex(item => item=== type) >= 0;
|
||||
}else {
|
||||
return false;
|
||||
}
|
||||
|
||||
},
|
||||
getTableHeight(){
|
||||
let countNumber = document.documentElement.clientHeight * 0.4 /1 - 140;
|
||||
countNumber = Math.ceil(countNumber);
|
||||
this.tableHeight = countNumber + 'px';
|
||||
}
|
||||
},
|
||||
}
|
||||
getTableHeight() {
|
||||
let countNumber = document.documentElement.clientHeight * 0.4 / 1 - 140;
|
||||
countNumber = Math.ceil(countNumber);
|
||||
this.tableHeight = countNumber + 'px';
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
.tip {
|
||||
float: left;
|
||||
font-size: 14px;
|
||||
border-radius: 2px;
|
||||
border-left: 2px solid #783887;
|
||||
margin: 0px 20px 0px;
|
||||
}
|
||||
.tip {
|
||||
float: left;
|
||||
font-size: 14px;
|
||||
border-radius: 2px;
|
||||
border-left: 2px solid #783887;
|
||||
margin: 0px 20px 0px;
|
||||
}
|
||||
|
||||
.ms-div {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.ms-div {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.ms-table {
|
||||
width: 95%;
|
||||
margin: 20px;
|
||||
}
|
||||
.ms-table {
|
||||
width: 95%;
|
||||
margin: 20px;
|
||||
}
|
||||
|
||||
:deep(.el-card__body) {
|
||||
padding: 0px;
|
||||
}
|
||||
:deep(.el-card__body) {
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
|
|
@ -32,7 +32,7 @@ export default {
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
initDatas() {
|
||||
initData() {
|
||||
if (this.$refs.reportItemPic && this.$refs.reportItemPic.length > 0) {
|
||||
this.$refs.reportItemPic.forEach(item => {
|
||||
item.initData();
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
ref="analysisChart" :load-option="loadOption" :pie-option="pieOption"/>
|
||||
</div>
|
||||
<div class="ms-row">
|
||||
<report-table :full-screen="false" :group-name="options.xaxis" :show-coloums="options.yaxis"
|
||||
<report-table :full-screen="false" :group-name="options.xaxis" :show-columns="options.yaxis"
|
||||
:tableData="tableData"/>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -71,7 +71,7 @@ export default {
|
|||
deleteDetail() {
|
||||
this.$emit("deleteDetail", this.reportDetail);
|
||||
},
|
||||
editAttachDataName(comman) {
|
||||
editAttachDataName(common) {
|
||||
this.reportDetail.nameIsEdit = !this.reportDetail.nameIsEdit;
|
||||
},
|
||||
initPic() {
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
:label-width="formLabelWidth"
|
||||
prop="addressee">
|
||||
<ms-input-tag :currentScenario="form" prop="addressee"
|
||||
:error-infor="$t('commons.report_statistics.alert.mail_is_exist')"
|
||||
:error-info="$t('commons.report_statistics.alert.mail_is_exist')"
|
||||
:placeholder="$t('mail.enter_mail_addressee')"
|
||||
@onblur="validateForm">
|
||||
</ms-input-tag>
|
||||
|
@ -72,7 +72,7 @@
|
|||
:label-width="formLabelWidth"
|
||||
prop="duplicated">
|
||||
<ms-input-tag :currentScenario="form" prop="duplicated"
|
||||
:error-infor="$t('commons.report_statistics.alert.mail_is_exist')"
|
||||
:error-info="$t('commons.report_statistics.alert.mail_is_exist')"
|
||||
:placeholder="$t('mail.enter_mail_duplicate')"
|
||||
@onblur="validateForm"/>
|
||||
</el-form-item>
|
||||
|
@ -126,7 +126,7 @@
|
|||
</el-popover>
|
||||
|
||||
</ms-form-divider>
|
||||
<email-compnent :read-only="false" :data.sync="form.reportContent" ref="emailCompnent"/>
|
||||
<email-component :read-only="false" :data.sync="form.reportContent" ref="emailComponent"/>
|
||||
</el-form>
|
||||
|
||||
<template v-slot:footer>
|
||||
|
@ -168,7 +168,7 @@ import {getUUID, listenGoBack, removeGoBackListener} from "metersphere-frontend/
|
|||
import {getCurrentProjectID, getCurrentUserId} from "metersphere-frontend/src/utils/token";
|
||||
import MsInputTag from "@/business/compnent/form/MsInputTag";
|
||||
import MsFormDivider from "metersphere-frontend/src/components/MsFormDivider";
|
||||
import EmailCompnent from "@/business/enterprisereport/components/container/EmailComponent";
|
||||
import EmailComponent from "@/business/enterprisereport/components/container/EmailComponent";
|
||||
import ReportStatisticsDialog from "@/business/enterprisereport/components/dialog/SelectReportStatisticsDialog";
|
||||
import EmailPreviewDialog from "@/business/enterprisereport/components/dialog/EmailPreviewDialog";
|
||||
import {getUesrGroup} from "@/api/user";
|
||||
|
@ -177,7 +177,7 @@ import {createEnterpriseReport, updateEnterpriseReport} from "@/api/enterprise-r
|
|||
|
||||
export default {
|
||||
name: "ProjectReportEditDialog",
|
||||
components: {MsFormDivider, MsInputTag, EmailCompnent, ReportStatisticsDialog, EmailPreviewDialog},
|
||||
components: {MsFormDivider, MsInputTag, EmailComponent, ReportStatisticsDialog, EmailPreviewDialog},
|
||||
data() {
|
||||
var checkEmail = (rule, value, callback) => {
|
||||
if (value.length === 0) {
|
||||
|
@ -371,8 +371,8 @@ export default {
|
|||
//检查是否符合邮件规范
|
||||
this.$refs['planFrom'].validate((valid) => {
|
||||
if (valid) {
|
||||
if (this.$refs.emailCompnent) {
|
||||
this.$refs.emailCompnent.initDatas();
|
||||
if (this.$refs.emailComponent) {
|
||||
this.$refs.emailComponent.initData();
|
||||
}
|
||||
|
||||
let param = JSON.parse(JSON.stringify(this.form));
|
||||
|
@ -440,8 +440,8 @@ export default {
|
|||
this.form = JSON.parse(JSON.stringify(this.baseForm));
|
||||
},
|
||||
previewReport() {
|
||||
if (this.$refs.emailCompnent) {
|
||||
this.$refs.emailCompnent.initDatas();
|
||||
if (this.$refs.emailComponent) {
|
||||
this.$refs.emailComponent.initData();
|
||||
}
|
||||
this.$refs.emailPreviewDialog.open(this.form)
|
||||
},
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
:chart-width="chartWidth" :load-option="loadOption" :pie-option="pieOption"/>
|
||||
</div>
|
||||
<div class="ms-row" v-if="!isHide">
|
||||
<test-case-count-table :group-name="getGroupNameStr(options.xaxis)" :show-coloums="options.yaxis"
|
||||
<test-case-count-table :group-name="getGroupNameStr(options.xaxis)" :show-columns="options.yaxis"
|
||||
:tableData="tableData"/>
|
||||
</div>
|
||||
</el-main>
|
||||
|
|
|
@ -163,16 +163,16 @@ export default {
|
|||
if (command === 'jpg') {
|
||||
imageType = 'image/jpg';
|
||||
}
|
||||
let returnImageDatas = "";
|
||||
let returnImageData = "";
|
||||
if (document.getElementById('picChart')) {
|
||||
let chartsCanvas = document.getElementById('picChart').querySelectorAll('canvas')[0];
|
||||
if (chartsCanvas) {
|
||||
// toDataURL()是canvas对象的一种方法,用于将canvas对象转换为base64位编码
|
||||
returnImageDatas = chartsCanvas && chartsCanvas.toDataURL(imageType);
|
||||
returnImageData = chartsCanvas && chartsCanvas.toDataURL(imageType);
|
||||
}
|
||||
}
|
||||
this.$emit("getImage", returnImageDatas);
|
||||
return returnImageDatas;
|
||||
this.$emit("getImage", returnImageData);
|
||||
return returnImageData;
|
||||
},
|
||||
exportCommand(command) {
|
||||
let fileName = 'report_pic.' + command;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<div v-loading="loading" class="ms-div">
|
||||
<el-card :style="{ width: w+'px'}">
|
||||
<el-row style="padding-top: 10px">
|
||||
<p class="tip"><span style="margin-left: 5px"></span>{{$t('commons.report_statistics.excel')}} </p>
|
||||
<p class="tip"><span style="margin-left: 5px"></span>{{ $t('commons.report_statistics.excel') }} </p>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-table
|
||||
|
@ -21,28 +21,28 @@
|
|||
:label="$t('commons.report_statistics.count')">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="testCaseCount"
|
||||
:label="$t('api_test.home_page.failed_case_list.table_value.case_type.functional')"
|
||||
v-if="isShowColumn('testCase')"
|
||||
>
|
||||
prop="testCaseCount"
|
||||
:label="$t('api_test.home_page.failed_case_list.table_value.case_type.functional')"
|
||||
v-if="isShowColumn('testCase')"
|
||||
>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="apiCaseCount"
|
||||
:label="$t('api_test.home_page.failed_case_list.table_value.case_type.api')"
|
||||
v-if="isShowColumn('apiCase')"
|
||||
>
|
||||
prop="apiCaseCount"
|
||||
:label="$t('api_test.home_page.failed_case_list.table_value.case_type.api')"
|
||||
v-if="isShowColumn('apiCase')"
|
||||
>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="scenarioCaseCount"
|
||||
:label="$t('api_test.home_page.failed_case_list.table_value.case_type.scene')"
|
||||
v-if="isShowColumn('scenarioCase')"
|
||||
>
|
||||
prop="scenarioCaseCount"
|
||||
:label="$t('api_test.home_page.failed_case_list.table_value.case_type.scene')"
|
||||
v-if="isShowColumn('scenarioCase')"
|
||||
>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="loadCaseCount"
|
||||
:label="$t('api_test.home_page.failed_case_list.table_value.case_type.load')"
|
||||
v-if="isShowColumn('loadCase')"
|
||||
>
|
||||
prop="loadCaseCount"
|
||||
:label="$t('api_test.home_page.failed_case_list.table_value.case_type.load')"
|
||||
v-if="isShowColumn('loadCase')"
|
||||
>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-row>
|
||||
|
@ -51,72 +51,72 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "TestAnalysisTable",
|
||||
components: {},
|
||||
props: {
|
||||
tableData: Array,
|
||||
groupName: String,
|
||||
showColoums: Array,
|
||||
fullScreen: {
|
||||
type: Boolean,
|
||||
default(){
|
||||
return false;
|
||||
}
|
||||
export default {
|
||||
name: "TestAnalysisTable",
|
||||
components: {},
|
||||
props: {
|
||||
tableData: Array,
|
||||
groupName: String,
|
||||
showColumns: Array,
|
||||
fullScreen: {
|
||||
type: Boolean,
|
||||
default() {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tableHeight : "100px",
|
||||
w: document.documentElement.clientWidth - 760,
|
||||
loading: false,
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tableHeight: "100px",
|
||||
w: document.documentElement.clientWidth - 760,
|
||||
loading: false,
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getTableHeight();
|
||||
if (this.fullScreen) {
|
||||
this.w = document.documentElement.clientWidth;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
isShowColumn(type) {
|
||||
if (this.showColumns) {
|
||||
return this.showColumns.findIndex(item => item === type) >= 0;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getTableHeight();
|
||||
if(this.fullScreen){
|
||||
this.w = document.documentElement.clientWidth;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
isShowColumn(type){
|
||||
if(this.showColoums){
|
||||
return this.showColoums.findIndex(item => item=== type) >= 0;
|
||||
}else {
|
||||
return false;
|
||||
}
|
||||
|
||||
},
|
||||
getTableHeight(){
|
||||
let countNumber = document.documentElement.clientHeight * 0.4 /1 - 140;
|
||||
countNumber = Math.ceil(countNumber);
|
||||
this.tableHeight = countNumber + 'px';
|
||||
}
|
||||
},
|
||||
}
|
||||
getTableHeight() {
|
||||
let countNumber = document.documentElement.clientHeight * 0.4 / 1 - 140;
|
||||
countNumber = Math.ceil(countNumber);
|
||||
this.tableHeight = countNumber + 'px';
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
.tip {
|
||||
float: left;
|
||||
font-size: 14px;
|
||||
border-radius: 2px;
|
||||
border-left: 2px solid #783887;
|
||||
margin: 0px 20px 0px;
|
||||
}
|
||||
.tip {
|
||||
float: left;
|
||||
font-size: 14px;
|
||||
border-radius: 2px;
|
||||
border-left: 2px solid #783887;
|
||||
margin: 0px 20px 0px;
|
||||
}
|
||||
|
||||
.ms-div {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.ms-div {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.ms-table {
|
||||
width: 95%;
|
||||
margin: 20px;
|
||||
}
|
||||
.ms-table {
|
||||
width: 95%;
|
||||
margin: 20px;
|
||||
}
|
||||
|
||||
:deep( .el-card__body ) {
|
||||
padding: 0px;
|
||||
}
|
||||
:deep( .el-card__body ) {
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
|
Loading…
Reference in New Issue