forked from github/dataease
fix(图表-样式): 修复提示指标下拉框数据,有可能存在缺失的问题
This commit is contained in:
parent
e88c2b10c5
commit
1716885dc4
@ -7,7 +7,7 @@ import cloneDeep from 'lodash-es/cloneDeep'
|
|||||||
import defaultsDeep from 'lodash-es/defaultsDeep'
|
import defaultsDeep from 'lodash-es/defaultsDeep'
|
||||||
import { formatterType, unitType } from '../../../js/formatter'
|
import { formatterType, unitType } from '../../../js/formatter'
|
||||||
import { fieldType } from '@/utils/attr'
|
import { fieldType } from '@/utils/attr'
|
||||||
import { partition } from 'lodash-es'
|
import { partition, uniqWith, isEqual } from 'lodash-es'
|
||||||
import chartViewManager from '../../../js/panel'
|
import chartViewManager from '../../../js/panel'
|
||||||
import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain'
|
import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain'
|
||||||
import { storeToRefs } from 'pinia'
|
import { storeToRefs } from 'pinia'
|
||||||
@ -255,6 +255,9 @@ const updateSeriesTooltipFormatter = (form: AxisEditForm) => {
|
|||||||
const addAxis = (form: AxisEditForm) => {
|
const addAxis = (form: AxisEditForm) => {
|
||||||
const { axis, axisType } = form
|
const { axis, axisType } = form
|
||||||
const axisMap = axis.reduce((pre, next) => {
|
const axisMap = axis.reduce((pre, next) => {
|
||||||
|
if (!next) {
|
||||||
|
return pre
|
||||||
|
}
|
||||||
next.axisType = axisType
|
next.axisType = axisType
|
||||||
next.seriesId = `${next.id}-${axisType}`
|
next.seriesId = `${next.id}-${axisType}`
|
||||||
pre[next.id] = next
|
pre[next.id] = next
|
||||||
@ -278,12 +281,15 @@ const addAxis = (form: AxisEditForm) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
const dupAxisDistinct = uniqWith(dupAxis, isEqual) || []
|
||||||
state.tooltipForm.seriesTooltipFormatter =
|
state.tooltipForm.seriesTooltipFormatter =
|
||||||
state.tooltipForm.seriesTooltipFormatter.concat(dupAxis)
|
state.tooltipForm.seriesTooltipFormatter.concat(dupAxisDistinct)
|
||||||
state.tooltipForm.seriesTooltipFormatter = partition(
|
state.tooltipForm.seriesTooltipFormatter = partition(
|
||||||
state.tooltipForm.seriesTooltipFormatter,
|
state.tooltipForm.seriesTooltipFormatter,
|
||||||
ele => quotaAxis.value.findIndex(item => item.id === ele.id) !== -1
|
ele => quotaAxis.value.findIndex(item => item.id === ele.id) !== -1
|
||||||
).flat()
|
).flat()
|
||||||
|
state.tooltipForm.seriesTooltipFormatter =
|
||||||
|
uniqWith(state.tooltipForm.seriesTooltipFormatter, isEqual) || []
|
||||||
}
|
}
|
||||||
const removeAxis = (form: AxisEditForm) => {
|
const removeAxis = (form: AxisEditForm) => {
|
||||||
const { axis, axisType } = form
|
const { axis, axisType } = form
|
||||||
|
Loading…
Reference in New Issue
Block a user