From e72555785d8ea31ca9c9855f8ecd22e78f24f64b Mon Sep 17 00:00:00 2001 From: wisonic-s <shaochuan.wu@fit2cloud.com> Date: Wed, 28 Jun 2023 18:21:33 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E8=A7=86=E5=9B=BE-Excel=E5=AF=BC=E5=87=BA)?= =?UTF-8?q?:=20=E4=BF=AE=E5=A4=8D=E5=AF=BC=E5=87=BA=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E5=8F=8A=E9=A2=84=E8=A7=88=E7=95=8C=E9=9D=A2=E5=AF=BC=E5=87=BA?= =?UTF-8?q?=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../canvas/components/editor/ComponentWrapper.vue | 13 +++++++++---- .../components/canvas/components/editor/EditBar.vue | 2 +- frontend/src/components/canvas/utils/utils.js | 3 +++ frontend/src/icons/svg/file-excel.svg | 1 + 4 files changed, 14 insertions(+), 5 deletions(-) create mode 100644 frontend/src/icons/svg/file-excel.svg diff --git a/frontend/src/components/canvas/components/editor/ComponentWrapper.vue b/frontend/src/components/canvas/components/editor/ComponentWrapper.vue index 7f444018a5..b6111656ef 100644 --- a/frontend/src/components/canvas/components/editor/ComponentWrapper.vue +++ b/frontend/src/components/canvas/components/editor/ComponentWrapper.vue @@ -151,13 +151,18 @@ export default { data() { return { previewVisible: false, - chart: null, seriesIdMap: { id: '' } } }, computed: { + chart() { + if (this.config.propValue?.viewId) { + return JSON.parse(this.panelViewDetailsInfo[this.config.propValue.viewId]) + } + return null + }, componentCanvasId() { if (this.config.type === 'view') { return 'user-view-' + this.config.propValue.viewId @@ -216,7 +221,8 @@ export default { 'mobileLayoutStatus', 'curComponent', 'previewCanvasScale', - 'componentGap' + 'componentGap', + 'panelViewDetailsInfo' ]) }, mounted() { @@ -286,8 +292,7 @@ export default { } } else { return { - ... - getStyle(style, ['top', 'left', 'width', 'height', 'rotate']), + ...getStyle(style, ['top', 'left', 'width', 'height', 'rotate']), position: 'relative' } } diff --git a/frontend/src/components/canvas/components/editor/EditBar.vue b/frontend/src/components/canvas/components/editor/EditBar.vue index eddb002f73..a185a38f08 100644 --- a/frontend/src/components/canvas/components/editor/EditBar.vue +++ b/frontend/src/components/canvas/components/editor/EditBar.vue @@ -294,7 +294,7 @@ export default { return this.curComponent.type === 'view' && this.terminal === 'pc' && this.curComponent.propValue.innerType && this.curComponent.propValue.innerType !== 'richTextView' }, exportExcelShow() { - return this.detailsShow && hasDataPermission('export', this.$store.state.panel.panelInfo.privileges) + return this.detailsShow && hasDataPermission('export', this.$store.state.panel.panelInfo.privileges) && this.chart }, enlargeShow() { return this.curComponent.type === 'view' && this.curComponent.propValue.innerType && this.curComponent.propValue.innerType !== 'richTextView' && !this.curComponent.propValue.innerType.includes('table') diff --git a/frontend/src/components/canvas/utils/utils.js b/frontend/src/components/canvas/utils/utils.js index 84157b5295..bd262fc4d1 100644 --- a/frontend/src/components/canvas/utils/utils.js +++ b/frontend/src/components/canvas/utils/utils.js @@ -429,6 +429,9 @@ export function getCacheTree(treeName) { } export function exportExcelDownload(chart, snapshot, width, height, loadingWrapper, callBack) { + if (!chart.data?.data?.length) { + return + } const fields = JSON.parse(JSON.stringify(chart.data.fields)) const tableRow = JSON.parse(JSON.stringify(chart.data.tableRow)) const excelHeader = fields.map(item => item.name) diff --git a/frontend/src/icons/svg/file-excel.svg b/frontend/src/icons/svg/file-excel.svg new file mode 100644 index 0000000000..253306726f --- /dev/null +++ b/frontend/src/icons/svg/file-excel.svg @@ -0,0 +1 @@ +<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1687676106978" filter="currentColor" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3283" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326z m1.8 562H232V136h302v216a42 42 0 0 0 42 42h216v494zM514.1 580.1l-61.8-102.4c-2.2-3.6-6.1-5.8-10.3-5.8h-38.4c-2.3 0-4.5 0.6-6.4 1.9-5.6 3.5-7.3 10.9-3.7 16.6l82.3 130.4-83.4 132.8a12.04 12.04 0 0 0 10.2 18.4h34.5c4.2 0 8-2.2 10.2-5.7L510 664.8l62.3 101.4c2.2 3.6 6.1 5.7 10.2 5.7H620c2.3 0 4.5-0.7 6.5-1.9 5.6-3.6 7.2-11 3.6-16.6l-84-130.4 85.3-132.5a12.04 12.04 0 0 0-10.1-18.5h-35.7c-4.2 0-8.1 2.2-10.3 5.8l-61.2 102.3z" p-id="3284"></path></svg>