refactor(仪表板): 导出应用增加存在模板视图提示

This commit is contained in:
wangjiahao 2024-01-30 19:35:19 +08:00
parent 8d474630e5
commit e6293fe1dc
7 changed files with 29 additions and 8 deletions

View File

@ -46,5 +46,4 @@ public class ChartViewDTO extends ChartViewWithBLOBs {
private long totalItems;
private int datasetMode;
private String datasourceType;
private Boolean aggregate;
}

View File

@ -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)

View File

@ -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',

View File

@ -2052,6 +2052,7 @@ export default {
back_parent: '返回上一級'
},
panel: {
app_export_tips: '當前儀表板中[{0}]屬於模板視圖,無法導出,請先設置數據集!',
required_tips: '必填項不能爲空!',
filter_no_select: '過濾組件無需選擇',
first_item: '首項',

View File

@ -2055,6 +2055,7 @@ export default {
back_parent: '返回上一级'
},
panel: {
app_export_tips: '当前仪表板中[{0}]属于模版视图,无法导出,请先设置数据集!',
required_tips: '必填项不能为空!',
filter_no_select: '过滤组件无需选择',
first_item: '首项',

View File

@ -841,6 +841,9 @@ const data = {
customAttr: {}
}
},
initPanelViewDetailsInfo(state) {
state.panelViewDetailsInfo = {}
},
initCanvas(state) {
this.commit('initCanvasBase')
state.isInEditor = true

View File

@ -649,6 +649,10 @@ export default {
}
},
downLoadToAppPre() {
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,
@ -657,6 +661,17 @@ export default {
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