Merge pull request #593 from dataease/pr@dev@feat_panel-drill-linkage
feat:仪表板支持视图下钻
This commit is contained in:
commit
7c5205dd6d
@ -16,7 +16,7 @@
|
||||
{{ $t('chart.chart_error_tips') }}
|
||||
</div>
|
||||
</div>
|
||||
<chart-component v-if="requestStatus==='success'&&chart.type && !chart.type.includes('table') && !chart.type.includes('text')" :ref="element.propValue.id" class="chart-class" :chart="chart" />
|
||||
<chart-component v-if="requestStatus==='success'&&chart.type && !chart.type.includes('table') && !chart.type.includes('text')" :ref="element.propValue.id" class="chart-class" :chart="chart" @onChartClick="chartClick" />
|
||||
<table-normal v-if="requestStatus==='success'&&chart.type && chart.type.includes('table')" :ref="element.propValue.id" :chart="chart" class="table-class" />
|
||||
<label-normal v-if="requestStatus==='success'&&chart.type && chart.type.includes('text')" :ref="element.propValue.id" :chart="chart" class="table-class" />
|
||||
</div>
|
||||
@ -37,6 +37,7 @@ import { BASE_CHART_STRING } from '@/views/chart/chart/chart'
|
||||
import eventBus from '@/components/canvas/utils/eventBus'
|
||||
import { deepCopy } from '@/components/canvas/utils/utils'
|
||||
import { getToken, getLinkToken } from '@/utils/auth'
|
||||
|
||||
export default {
|
||||
name: 'UserView',
|
||||
components: { ChartComponent, TableNormal, LabelNormal },
|
||||
@ -77,7 +78,8 @@ export default {
|
||||
refId: null,
|
||||
chart: BASE_CHART_STRING,
|
||||
requestStatus: 'waiting',
|
||||
message: null
|
||||
message: null,
|
||||
drillClickDimensionList: []
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@ -85,6 +87,7 @@ export default {
|
||||
const filter = {}
|
||||
filter.filter = this.element.filters
|
||||
filter.linkageFilters = this.element.linkageFilters
|
||||
filter.drill = this.drillClickDimensionList
|
||||
return filter
|
||||
},
|
||||
filters() {
|
||||
@ -191,6 +194,10 @@ export default {
|
||||
// 将视图传入echart组件
|
||||
if (response.success) {
|
||||
this.chart = response.data
|
||||
this.chart.drillFields = this.chart.drillFields ? JSON.parse(this.chart.drillFields) : []
|
||||
if (!response.data.drill) {
|
||||
this.drillClickDimensionList.splice(this.drillClickDimensionList.length - 1, 1)
|
||||
}
|
||||
this.requestStatus = 'merging'
|
||||
this.mergeStyle()
|
||||
this.requestStatus = 'success'
|
||||
@ -225,6 +232,22 @@ export default {
|
||||
tableChart.customAttr = JSON.stringify(tableChart.customAttr)
|
||||
tableChart.customStyle = JSON.stringify(tableChart.customStyle)
|
||||
eventBus.$emit('openChartDetailsDialog', { chart: this.chart, tableChart: tableChart })
|
||||
},
|
||||
|
||||
chartClick(param) {
|
||||
debugger
|
||||
if (this.drillClickDimensionList.length < this.chart.drillFields.length - 1) {
|
||||
this.drillClickDimensionList.push({ dimensionList: param.data.dimensionList })
|
||||
this.getData(this.element.propValue.viewId)
|
||||
}
|
||||
},
|
||||
|
||||
resetDrill() {
|
||||
this.drillClickDimensionList = []
|
||||
},
|
||||
drillJump(index) {
|
||||
this.drillClickDimensionList = this.drillClickDimensionList.slice(0, index)
|
||||
this.getData(this.element.propValue.viewId)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user