From e6293fe1dc902f9a829490b0b02511923010f51b Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Tue, 30 Jan 2024 19:35:19 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E4=BB=AA=E8=A1=A8=E6=9D=BF):=20?= =?UTF-8?q?=E5=AF=BC=E5=87=BA=E5=BA=94=E7=94=A8=E5=A2=9E=E5=8A=A0=E5=AD=98?= =?UTF-8?q?=E5=9C=A8=E6=A8=A1=E6=9D=BF=E8=A7=86=E5=9B=BE=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/dataease/dto/chart/ChartViewDTO.java | 1 - .../src/components/canvas/utils/utils.js | 1 + core/frontend/src/lang/en.js | 1 + core/frontend/src/lang/tw.js | 1 + core/frontend/src/lang/zh.js | 1 + core/frontend/src/store/index.js | 3 ++ .../src/views/panel/list/PanelViewShow.vue | 29 ++++++++++++++----- 7 files changed, 29 insertions(+), 8 deletions(-) diff --git a/core/backend/src/main/java/io/dataease/dto/chart/ChartViewDTO.java b/core/backend/src/main/java/io/dataease/dto/chart/ChartViewDTO.java index b0affa8cfd..635da3b188 100644 --- a/core/backend/src/main/java/io/dataease/dto/chart/ChartViewDTO.java +++ b/core/backend/src/main/java/io/dataease/dto/chart/ChartViewDTO.java @@ -46,5 +46,4 @@ public class ChartViewDTO extends ChartViewWithBLOBs { private long totalItems; private int datasetMode; private String datasourceType; - private Boolean aggregate; } diff --git a/core/frontend/src/components/canvas/utils/utils.js b/core/frontend/src/components/canvas/utils/utils.js index 148fb01374..4e6d3ce266 100644 --- a/core/frontend/src/components/canvas/utils/utils.js +++ b/core/frontend/src/components/canvas/utils/utils.js @@ -85,6 +85,7 @@ export function panelInit(componentData, componentStyle) { } export function panelDataPrepare(componentData, componentStyle, callback) { + store.commit('initPanelViewDetailsInfo') // style初始化 componentStyle.autoSizeAdaptor = (componentStyle.autoSizeAdaptor === undefined ? true : componentStyle.autoSizeAdaptor) componentStyle.refreshTime = (componentStyle.refreshTime || 5) diff --git a/core/frontend/src/lang/en.js b/core/frontend/src/lang/en.js index 48ed105419..e70749d294 100644 --- a/core/frontend/src/lang/en.js +++ b/core/frontend/src/lang/en.js @@ -2060,6 +2060,7 @@ export default { back_parent: 'Back to previous' }, panel: { + app_export_tips: 'In the current dashboard, [{0}] belongs to a template view and cannot be exported. Please set up the dataset first!', required_tips: 'Cannot be empty!', filter_no_select: 'Filter components do not need to be selected', first_item: 'First item', diff --git a/core/frontend/src/lang/tw.js b/core/frontend/src/lang/tw.js index 9b2f07573e..309e9f28bc 100644 --- a/core/frontend/src/lang/tw.js +++ b/core/frontend/src/lang/tw.js @@ -2052,6 +2052,7 @@ export default { back_parent: '返回上一級' }, panel: { + app_export_tips: '當前儀表板中[{0}]屬於模板視圖,無法導出,請先設置數據集!', required_tips: '必填項不能爲空!', filter_no_select: '過濾組件無需選擇', first_item: '首項', diff --git a/core/frontend/src/lang/zh.js b/core/frontend/src/lang/zh.js index d45d22fe36..c886171898 100644 --- a/core/frontend/src/lang/zh.js +++ b/core/frontend/src/lang/zh.js @@ -2055,6 +2055,7 @@ export default { back_parent: '返回上一级' }, panel: { + app_export_tips: '当前仪表板中[{0}]属于模版视图,无法导出,请先设置数据集!', required_tips: '必填项不能为空!', filter_no_select: '过滤组件无需选择', first_item: '首项', diff --git a/core/frontend/src/store/index.js b/core/frontend/src/store/index.js index d8ee5e643f..059f5b32f6 100644 --- a/core/frontend/src/store/index.js +++ b/core/frontend/src/store/index.js @@ -841,6 +841,9 @@ const data = { customAttr: {} } }, + initPanelViewDetailsInfo(state) { + state.panelViewDetailsInfo = {} + }, initCanvas(state) { this.commit('initCanvasBase') state.isInEditor = true diff --git a/core/frontend/src/views/panel/list/PanelViewShow.vue b/core/frontend/src/views/panel/list/PanelViewShow.vue index 8930c79faf..eb9ff7790d 100644 --- a/core/frontend/src/views/panel/list/PanelViewShow.vue +++ b/core/frontend/src/views/panel/list/PanelViewShow.vue @@ -649,14 +649,29 @@ export default { } }, downLoadToAppPre() { - this.$refs.appExportForm.init({ - appName: this.$store.state.panel.panelInfo.name, - icon: null, - version: '1.0', - creator: this.$store.getters.user.nickName, - required: '1.16.0', - description: null + const result = this.checkTemplate() + if (result && result.length > 0) { + this.$message({ message: this.$t('panel.app_export_tips', [result]), type: 'warning', showClose: true }) + } else { + this.$refs.appExportForm.init({ + appName: this.$store.state.panel.panelInfo.name, + icon: null, + version: '1.0', + creator: this.$store.getters.user.nickName, + required: '1.16.0', + description: null + }) + } + }, + checkTemplate() { + let templateViewNames = ',' + Object.keys(this.panelViewDetailsInfo).forEach(key => { + const viewInfo = JSON.parse(this.panelViewDetailsInfo[key]) + if (viewInfo.dataFrom === 'template') { + templateViewNames = templateViewNames + viewInfo.title + ',' + } }) + return templateViewNames.slice(1) }, downLoadToApp(appAttachInfo) { this.dataLoading = true