diff --git a/frontend/src/components/canvas/custom-component/UserView.vue b/frontend/src/components/canvas/custom-component/UserView.vue index bb6b9fd515..53fc6f05ff 100644 --- a/frontend/src/components/canvas/custom-component/UserView.vue +++ b/frontend/src/components/canvas/custom-component/UserView.vue @@ -545,14 +545,7 @@ export default { // 将视图传入echart组件 if (response.success) { this.chart = response.data - if (this.isEdit) { - this.componentViewsData[this.chart.id] = { - 'title': this.chart.title, - 'render': this.chart.render, - 'type': this.chart.type, - 'isPlugin': this.chart.isPlugin - } - } + this.getDataOnly(response.data) this.chart['position'] = this.inTab ? 'tab' : 'panel' // 记录当前数据 this.panelViewDetailsInfo[id] = JSON.stringify(this.chart) @@ -609,7 +602,6 @@ export default { tableChart.customStyle = JSON.stringify(tableChart.customStyle) eventBus.$emit('openChartDetailsDialog', { chart: this.chart, tableChart: tableChart }) }, - chartClick(param) { if (this.drillClickDimensionList.length < this.chart.drillFields.length - 1) { (this.chart.type === 'map' || this.chart.type === 'buddle-map') && this.sendToChildren(param) @@ -863,6 +855,21 @@ export default { } this.mergeScale() } + }, + getDataOnly(sourceResponseData) { + if (this.isEdit) { + if ((this.filter.filter && this.filter.filter.length) || (this.filter.linkageFilters && this.filter.linkageFilters.length)) { + viewData(this.chart.id, this.panelInfo.id, { + filter: [], + drill: [], + queryFrom: 'panel' + }).then(response => { + this.componentViewsData[this.chart.id] = response.data + }) + } else { + this.componentViewsData[this.chart.id] = sourceResponseData + } + } } } } diff --git a/frontend/src/views/chart/view/ChartEdit.vue b/frontend/src/views/chart/view/ChartEdit.vue index 4874cd3f03..4ca7b6734e 100644 --- a/frontend/src/views/chart/view/ChartEdit.vue +++ b/frontend/src/views/chart/view/ChartEdit.vue @@ -1191,7 +1191,7 @@ export default { return this.chartConfig ? this.chartConfig.propertyInner : null }, chartType() { - return this.chart.type + return this.chart ? this.chart.type : null }, panelInfo() { return this.$store.state.panel.panelInfo @@ -1199,7 +1199,8 @@ export default { ...mapState([ 'curComponent', 'panelViewEditInfo', - 'allViewRender' + 'allViewRender', + 'componentViewsData' ]) /* pluginRenderOptions() { const plugins = localStorage.getItem('plugin-views') && JSON.parse(localStorage.getItem('plugin-views')) || [] @@ -1238,6 +1239,9 @@ export default { } }, created() { + this.bindPluginEvent() + this.initFromPanel() + this.chartInit() const plugins = localStorage.getItem('plugin-views') && JSON.parse(localStorage.getItem('plugin-views')) if (plugins) { this.loadPluginType() @@ -1253,9 +1257,6 @@ export default { } }, mounted() { - this.bindPluginEvent() - this.initFromPanel() - this.chartInit() }, activated() { }, @@ -1282,7 +1283,9 @@ export default { this.resetDrill() this.initFromPanel() this.getChart(this.param.id) - this.getData(this.param.id) + if (this.componentViewsData[this.param.id]) { + this.chart = this.componentViewsData[this.param.id] + } }, bindPluginEvent() { bus.$on('show-dimension-edit-filter', this.showDimensionEditFilter) @@ -1599,7 +1602,7 @@ export default { const view = this.buildParam(true, 'chart', false, switchType) if (!view) return viewEditSave(this.panelInfo.id, view).then(() => { - this.getData(this.param.id) + // this.getData(this.param.id) bus.$emit('view-in-cache', { type: 'propChange', viewId: this.param.id }) }) },