Merge pull request #7927 from dataease/pr@dev@refacto_app-export

refactor(仪表板): 导出应用增加存在模板视图提示
This commit is contained in:
王嘉豪 2024-01-30 19:52:33 +08:00 committed by GitHub
commit 71385c3f80
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 29 additions and 8 deletions

View File

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

View File

@ -85,6 +85,7 @@ export function panelInit(componentData, componentStyle) {
} }
export function panelDataPrepare(componentData, componentStyle, callback) { export function panelDataPrepare(componentData, componentStyle, callback) {
store.commit('initPanelViewDetailsInfo')
// style初始化 // style初始化
componentStyle.autoSizeAdaptor = (componentStyle.autoSizeAdaptor === undefined ? true : componentStyle.autoSizeAdaptor) componentStyle.autoSizeAdaptor = (componentStyle.autoSizeAdaptor === undefined ? true : componentStyle.autoSizeAdaptor)
componentStyle.refreshTime = (componentStyle.refreshTime || 5) componentStyle.refreshTime = (componentStyle.refreshTime || 5)

View File

@ -2061,6 +2061,7 @@ export default {
back_parent: 'Back to previous' back_parent: 'Back to previous'
}, },
panel: { 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!', required_tips: 'Cannot be empty!',
filter_no_select: 'Filter components do not need to be selected', filter_no_select: 'Filter components do not need to be selected',
first_item: 'First item', first_item: 'First item',

View File

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

View File

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

View File

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

View File

@ -649,14 +649,29 @@ export default {
} }
}, },
downLoadToAppPre() { downLoadToAppPre() {
this.$refs.appExportForm.init({ const result = this.checkTemplate()
appName: this.$store.state.panel.panelInfo.name, if (result && result.length > 0) {
icon: null, this.$message({ message: this.$t('panel.app_export_tips', [result]), type: 'warning', showClose: true })
version: '1.0', } else {
creator: this.$store.getters.user.nickName, this.$refs.appExportForm.init({
required: '1.16.0', appName: this.$store.state.panel.panelInfo.name,
description: null 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) { downLoadToApp(appAttachInfo) {
this.dataLoading = true this.dataLoading = true