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 # local env files
.env.local .env.local
.env.*.local .env.*.local
.history/
# Log files # Log files
npm-debug.log* npm-debug.log*

View File

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

View File

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