forked from github/dataease
Merge pull request #5174 from dataease/pr@dev@feat_calc
feat: 透视表数据行维度字段支持同环比
This commit is contained in:
commit
611e187888
@ -56,6 +56,7 @@
|
||||
|
||||
<script>
|
||||
import { compareDayList, compareMonthList, compareYearList } from '@/views/chart/chart/compare'
|
||||
import { SUPPORT_Y_M } from '@/views/chart/chart/chart'
|
||||
|
||||
export default {
|
||||
name: 'CompareEdit',
|
||||
@ -95,6 +96,19 @@ export default {
|
||||
xAxis = JSON.parse(this.chart.xaxis)
|
||||
}
|
||||
const t1 = xAxis.filter(ele => { return ele.deType === 1 })
|
||||
|
||||
if (this.chart.type === 'table-pivot') {
|
||||
let xAxisExt = null
|
||||
if (Object.prototype.toString.call(this.chart.xaxisExt) === '[object Array]') {
|
||||
xAxisExt = JSON.parse(JSON.stringify(this.chart.xaxisExt))
|
||||
} else {
|
||||
xAxisExt = JSON.parse(this.chart.xaxisExt)
|
||||
}
|
||||
const t2 = xAxisExt.filter(ele => { return ele.deType === 1 })
|
||||
|
||||
t1.push(...t2)
|
||||
}
|
||||
|
||||
this.fieldList = t1
|
||||
// 如果没有选中字段,则默认选中第一个
|
||||
if ((!this.compareItem.compareCalc.field || this.compareItem.compareCalc.field === '') && this.fieldList.length > 0) {
|
||||
|
@ -324,6 +324,21 @@ export default {
|
||||
const t1 = xAxis.filter(ele => {
|
||||
return ele.deType === 1 && SUPPORT_Y_M.includes(ele.dateStyle)
|
||||
})
|
||||
|
||||
if (this.chart.type === 'table-pivot') {
|
||||
let xAxisExt = null
|
||||
if (Object.prototype.toString.call(this.chart.xaxisExt) === '[object Array]') {
|
||||
xAxisExt = JSON.parse(JSON.stringify(this.chart.xaxisExt))
|
||||
} else {
|
||||
xAxisExt = JSON.parse(this.chart.xaxisExt)
|
||||
}
|
||||
const t2 = xAxisExt.filter(ele => {
|
||||
return ele.deType === 1 && SUPPORT_Y_M.includes(ele.dateStyle)
|
||||
})
|
||||
|
||||
t1.push(...t2)
|
||||
}
|
||||
|
||||
// 暂时只支持类别轴/维度的时间类型字段
|
||||
if (t1.length > 0 && this.chart.type !== 'text' && this.chart.type !== 'label' && this.chart.type !== 'gauge' && this.chart.type !== 'liquid') {
|
||||
this.disableEditCompare = false
|
||||
|
Loading…
Reference in New Issue
Block a user