commit
85967c5f82
@ -173,33 +173,10 @@ const dsClick = (data: Tree) => {
|
|||||||
}
|
}
|
||||||
//选中赋值
|
//选中赋值
|
||||||
_modelValue.value = data.id
|
_modelValue.value = data.id
|
||||||
getFields(data.id, props.viewId)
|
|
||||||
//关闭弹窗
|
//关闭弹窗
|
||||||
datasetSelectorPopover.value?.hide()
|
datasetSelectorPopover.value?.hide()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const getFields = (id, chartId) => {
|
|
||||||
if (id && chartId) {
|
|
||||||
getFieldByDQ(id, chartId)
|
|
||||||
.then(res => {
|
|
||||||
state.value.dimension = (res.dimensionList as unknown as Field[]) || []
|
|
||||||
state.value.quota = (res.quotaList as unknown as Field[]) || []
|
|
||||||
state.value.dimensionData = JSON.parse(JSON.stringify(state.value.dimension))
|
|
||||||
state.value.quotaData = JSON.parse(JSON.stringify(state.value.quota))
|
|
||||||
})
|
|
||||||
.catch(() => {
|
|
||||||
state.value.dimension = []
|
|
||||||
state.value.quota = []
|
|
||||||
state.value.dimensionData = []
|
|
||||||
state.value.quotaData = []
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
state.value.dimension = []
|
|
||||||
state.value.quota = []
|
|
||||||
state.value.dimensionData = []
|
|
||||||
state.value.quotaData = []
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const _popoverShow = ref(false)
|
const _popoverShow = ref(false)
|
||||||
function onPopoverShow() {
|
function onPopoverShow() {
|
||||||
_popoverShow.value = true
|
_popoverShow.value = true
|
||||||
|
|||||||
@ -69,7 +69,7 @@ const initSeriesTooltip = () => {
|
|||||||
...next,
|
...next,
|
||||||
seriesId: next.seriesId ?? next.id,
|
seriesId: next.seriesId ?? next.id,
|
||||||
show: index <= quotaAxis.value.length - 1,
|
show: index <= quotaAxis.value.length - 1,
|
||||||
summary: 'sum'
|
summary: COUNT_DE_TYPE.includes(next.deType) ? 'count' : 'sum'
|
||||||
} as SeriesFormatter
|
} as SeriesFormatter
|
||||||
if (seriesAxisMap[tmp.seriesId]) {
|
if (seriesAxisMap[tmp.seriesId]) {
|
||||||
tmp = {
|
tmp = {
|
||||||
@ -136,6 +136,18 @@ const AGGREGATION_TYPE = [
|
|||||||
{ name: t('chart.count'), value: 'count' },
|
{ name: t('chart.count'), value: 'count' },
|
||||||
{ name: t('chart.count_distinct'), value: 'count_distinct' }
|
{ name: t('chart.count_distinct'), value: 'count_distinct' }
|
||||||
]
|
]
|
||||||
|
const COUNT_AGGREGATION_TYPE = [
|
||||||
|
{ name: t('chart.count'), value: 'count' },
|
||||||
|
{ name: t('chart.count_distinct'), value: 'count_distinct' }
|
||||||
|
]
|
||||||
|
const COUNT_DE_TYPE = [0, 1, 5]
|
||||||
|
|
||||||
|
const aggregationList = computed(() => {
|
||||||
|
if (COUNT_DE_TYPE.includes(curSeriesFormatter.value?.deType)) {
|
||||||
|
return COUNT_AGGREGATION_TYPE
|
||||||
|
}
|
||||||
|
return AGGREGATION_TYPE
|
||||||
|
})
|
||||||
watch(
|
watch(
|
||||||
[() => props.chart.customAttr.tooltip, () => props.chart.customAttr.tooltip.show],
|
[() => props.chart.customAttr.tooltip, () => props.chart.customAttr.tooltip.show],
|
||||||
() => {
|
() => {
|
||||||
@ -188,10 +200,8 @@ const init = () => {
|
|||||||
formatterSelector.value?.blur()
|
formatterSelector.value?.blur()
|
||||||
// 新增视图
|
// 新增视图
|
||||||
const formatter = state.tooltipForm.seriesTooltipFormatter
|
const formatter = state.tooltipForm.seriesTooltipFormatter
|
||||||
if (!quotaAxis.value?.length) {
|
if (!formatter.length) {
|
||||||
if (!formatter.length) {
|
quotaData.value?.forEach(i => formatter.push({ ...i, seriesId: i.id, show: false }))
|
||||||
quotaData.value?.forEach(i => formatter.push({ ...i, seriesId: i.id, show: false }))
|
|
||||||
}
|
|
||||||
curSeriesFormatter.value = {}
|
curSeriesFormatter.value = {}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -209,7 +219,13 @@ const init = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const showProperty = prop => props.propertyInner?.includes(prop)
|
const showProperty = prop => {
|
||||||
|
const instance = chartViewManager.getChartView(props.chart.render, props.chart.type)
|
||||||
|
if (instance) {
|
||||||
|
return instance.propertyInner['tooltip-selector'].includes(prop)
|
||||||
|
}
|
||||||
|
return props.propertyInner?.includes(prop)
|
||||||
|
}
|
||||||
const updateSeriesTooltipFormatter = (form: AxisEditForm) => {
|
const updateSeriesTooltipFormatter = (form: AxisEditForm) => {
|
||||||
const { axisType, editType } = form
|
const { axisType, editType } = form
|
||||||
if (
|
if (
|
||||||
@ -575,7 +591,7 @@ onMounted(() => {
|
|||||||
@change="changeTooltipAttr('seriesTooltipFormatter', true)"
|
@change="changeTooltipAttr('seriesTooltipFormatter', true)"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in AGGREGATION_TYPE"
|
v-for="item in aggregationList"
|
||||||
:label="item.name"
|
:label="item.name"
|
||||||
:value="item.value"
|
:value="item.value"
|
||||||
:key="item.value"
|
:key="item.value"
|
||||||
|
|||||||
@ -49,6 +49,7 @@ import chartViewManager from '@/views/chart/components/js/panel'
|
|||||||
import DatasetSelect from '@/views/chart/components/editor/dataset-select/DatasetSelect.vue'
|
import DatasetSelect from '@/views/chart/components/editor/dataset-select/DatasetSelect.vue'
|
||||||
import { useDraggable } from '@vueuse/core'
|
import { useDraggable } from '@vueuse/core'
|
||||||
import { set, concat, keys } from 'lodash-es'
|
import { set, concat, keys } from 'lodash-es'
|
||||||
|
import { Field, getFieldByDQ } from '@/api/chart'
|
||||||
|
|
||||||
const snapshotStore = snapshotStoreWithOut()
|
const snapshotStore = snapshotStoreWithOut()
|
||||||
const dvMainStore = dvMainStoreWithOut()
|
const dvMainStore = dvMainStoreWithOut()
|
||||||
@ -146,6 +147,7 @@ const state = reactive({
|
|||||||
watch(
|
watch(
|
||||||
[() => view.value['tableId']],
|
[() => view.value['tableId']],
|
||||||
() => {
|
() => {
|
||||||
|
getFields(props.view.tableId, props.view.id)
|
||||||
const nodeId = view.value['tableId']
|
const nodeId = view.value['tableId']
|
||||||
if (!!nodeId) {
|
if (!!nodeId) {
|
||||||
cacheId = nodeId as unknown as string
|
cacheId = nodeId as unknown as string
|
||||||
@ -157,7 +159,28 @@ watch(
|
|||||||
},
|
},
|
||||||
{ deep: true }
|
{ deep: true }
|
||||||
)
|
)
|
||||||
|
const getFields = (id, chartId) => {
|
||||||
|
if (id && chartId) {
|
||||||
|
getFieldByDQ(id, chartId)
|
||||||
|
.then(res => {
|
||||||
|
state.dimension = (res.dimensionList as unknown as Field[]) || []
|
||||||
|
state.quota = (res.quotaList as unknown as Field[]) || []
|
||||||
|
state.dimensionData = JSON.parse(JSON.stringify(state.dimension))
|
||||||
|
state.quotaData = JSON.parse(JSON.stringify(state.quota))
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
state.dimension = []
|
||||||
|
state.quota = []
|
||||||
|
state.dimensionData = []
|
||||||
|
state.quotaData = []
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
state.dimension = []
|
||||||
|
state.quota = []
|
||||||
|
state.dimensionData = []
|
||||||
|
state.quotaData = []
|
||||||
|
}
|
||||||
|
}
|
||||||
watch(
|
watch(
|
||||||
[() => state.searchField],
|
[() => state.searchField],
|
||||||
newVal => {
|
newVal => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user