fix(测试跟踪): 用例审批中导出依赖关系JPG格式,但导出的是PNG格式

--bug=1025873 --user=白奇 【测试跟踪】用例审批中导出依赖关系JPG格式,但导出的是PNG格式 https://www.tapd.cn/55049933/s/1368138
This commit is contained in:
baiqi 2023-05-04 10:39:23 +08:00 committed by fit2-zhao
parent 0967768aff
commit 7046725e64
3 changed files with 5 additions and 4 deletions

1
.gitignore vendored
View File

@ -7,6 +7,7 @@ node/
# local env files
.env.local
.env.*.local
.history/
# Log files
npm-debug.log*

View File

@ -87,10 +87,10 @@ export default {
exportCharts(fileName, type) {
if (document.getElementsByClassName('ms-chart')) {
let chartsCanvas = document.getElementsByClassName('ms-chart')[0].querySelectorAll('canvas')[0];
let mime = 'image/png';
let mime = `image/${type?.toLowerCase() || 'png'}`;
if (chartsCanvas) {
// toDataURL()canvascanvasbase64
let imageUrl = chartsCanvas && chartsCanvas.toDataURL("image/png");
let imageUrl = chartsCanvas.toDataURL(mime);
if (navigator.userAgent.indexOf('Trident') > -1) {
// IE11
let arr = imageUrl.split(',');

View File

@ -19,7 +19,7 @@
{{ $t('commons.export') }}
</span>
<el-dropdown-menu slot="dropdown" class="drawer-header">
<el-dropdown-item @click.native.stop="exportJPG">JPG</el-dropdown-item>
<el-dropdown-item @click.native.stop="exportJPG">JPEG</el-dropdown-item>
<el-dropdown-item @click.native.stop="exportPNG">PNG</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
@ -44,7 +44,7 @@ export default {
},
methods: {
exportJPG() {
this.$emit("export","JPG")
this.$emit("export","JPEG")
},
exportPNG() {
this.$emit("export","PNG")