fix(图表-样式): 修复提示中指标下拉框显示重复数据的问题
This commit is contained in:
parent
0b00da3199
commit
fad7f484e1
@ -12,6 +12,7 @@ import chartViewManager from '../../../js/panel'
|
||||
import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import { useEmitt } from '@/hooks/web/useEmitt'
|
||||
import { deepCopy } from '@/utils/utils'
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
@ -45,6 +46,11 @@ const initSeriesTooltip = () => {
|
||||
if (!showSeriesTooltipFormatter.value) {
|
||||
return
|
||||
}
|
||||
if (!props.chart.customAttr.tooltip.seriesTooltipFormatter.length) {
|
||||
state.tooltipForm.seriesTooltipFormatter = deepCopy(
|
||||
props.chart.customAttr.tooltip.seriesTooltipFormatter
|
||||
)
|
||||
}
|
||||
const formatter = state.tooltipForm.seriesTooltipFormatter
|
||||
const seriesAxisMap = formatter.reduce((pre, next) => {
|
||||
next.seriesId = next.seriesId ?? next.id
|
||||
@ -158,9 +164,6 @@ watch(
|
||||
watch(
|
||||
[quotaData, () => props.chart.type],
|
||||
newVal => {
|
||||
if (!newVal?.[0]?.length) {
|
||||
return
|
||||
}
|
||||
initSeriesTooltip()
|
||||
},
|
||||
{ deep: false }
|
||||
@ -198,6 +201,11 @@ const init = () => {
|
||||
if (customAttr.tooltip) {
|
||||
state.tooltipForm = defaultsDeep(customAttr.tooltip, cloneDeep(DEFAULT_TOOLTIP))
|
||||
formatterSelector.value?.blur()
|
||||
if (!props.chart.customAttr.tooltip.seriesTooltipFormatter.length) {
|
||||
state.tooltipForm.seriesTooltipFormatter = deepCopy(
|
||||
props.chart.customAttr.tooltip.seriesTooltipFormatter
|
||||
)
|
||||
}
|
||||
// 新增图表
|
||||
const formatter = state.tooltipForm.seriesTooltipFormatter
|
||||
if (!formatter.length) {
|
||||
@ -537,7 +545,7 @@ onMounted(() => {
|
||||
</template>
|
||||
<el-option
|
||||
class="series-select-option"
|
||||
:key="item.id"
|
||||
:key="item.seriesId"
|
||||
:value="item"
|
||||
:label="`${item.name}${
|
||||
item.summary !== '' ? '(' + t('chart.' + item.summary) + ')' : ''
|
||||
|
||||
Loading…
Reference in New Issue
Block a user