Merge pull request #5174 from dataease/pr@dev@feat_calc

feat: 透视表数据行维度字段支持同环比
This commit is contained in:
Junjun 2023-05-10 12:12:34 +08:00 committed by GitHub
commit 611e187888
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 0 deletions

View File

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

View File

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