refactor(图表): 去除部分图表的排序按钮

This commit is contained in:
wisonic-s
2025-04-09 18:22:29 +08:00
committed by GitHub
parent 6f3ac7b413
commit a3e9084479
2 changed files with 28 additions and 12 deletions

View File

@@ -192,17 +192,25 @@ const showCustomSort = item => {
}
return !item.chartId && (item.deType === 0 || item.deType === 5)
}
const showSort = () => {
const NOT_SUPPORT_SORT = ['word-cloud', 'stock-line', 'treemap', 'circle-packing']
const showSort = computed(() => {
const { type: chartType } = props.chart
const { type: propType } = props
const notShowSort = ['word-cloud', 'stock-line', 'treemap'].includes(chartType)
const notShowSort = NOT_SUPPORT_SORT.includes(chartType)
if (notShowSort || propType === 'extColor') {
return false
}
const isChartMix = chartType.includes('chart-mix')
const isDimensionType = ['dimension', 'dimensionStack', 'dimensionExt'].includes(propType)
return !isChartMix || isDimensionType
}
})
const showSortPriority = computed(() => {
if (props.chart.type.includes('chart-mix')) {
return false
}
return showSort.value
})
const toggleHide = () => {
item.value.index = props.index
item.value.hide = !item.value.hide
@@ -227,17 +235,17 @@ onMounted(() => {
:style="{ backgroundColor: tagType + '0a', border: '1px solid ' + tagType }"
>
<span v-if="type !== 'extColor'" style="display: flex; color: #646a73">
<el-icon v-if="'asc' === item.sort && showSort()">
<el-icon v-if="'asc' === item.sort && showSort">
<Icon name="icon_sort-a-to-z_outlined"
><icon_sortAToZ_outlined class="svg-icon"
/></Icon>
</el-icon>
<el-icon v-if="'desc' === item.sort && showSort()">
<el-icon v-if="'desc' === item.sort && showSort">
<Icon name="icon_sort-z-to-a_outlined"
><icon_sortZToA_outlined class="svg-icon"
/></Icon>
</el-icon>
<el-icon v-if="'custom_sort' === item.sort && showSort()">
<el-icon v-if="'custom_sort' === item.sort && showSort">
<Icon name="icon_sort_outlined"><icon_sort_outlined class="svg-icon" /></Icon>
</el-icon>
<el-icon>
@@ -284,7 +292,7 @@ onMounted(() => {
class="item-span-style"
:class="{
'hidden-status': showHideIcon,
'sort-status': showSort() && item.sort !== 'none'
'sort-status': showSort && item.sort !== 'none'
}"
>
<span class="item-name">{{ item.chartShowName ? item.chartShowName : item.name }}</span>
@@ -313,7 +321,7 @@ onMounted(() => {
class="drop-style"
:class="themes === 'dark' ? 'dark-dimension-quota' : ''"
>
<el-dropdown-item @click.prevent v-if="showSort()">
<el-dropdown-item @click.prevent v-if="showSort">
<el-dropdown
:effect="themes"
popper-class="data-dropdown_popper_mr9"
@@ -400,7 +408,7 @@ onMounted(() => {
</el-dropdown>
</el-dropdown-item>
<el-dropdown-item
v-if="showSort()"
v-if="showSortPriority"
:command="beforeClickItem('sortPriority')"
class="menu-item-padding"
>

View File

@@ -315,14 +315,22 @@ const showHideIcon = computed(() => {
return ['tale-info', 'table-normal'].includes(props.chart.type) && item.value.hide
})
const NOT_SUPPORT_SORT = [
'circle-packing',
'indicator',
'liquid',
'gauge',
'word-cloud',
'stock-line',
'treemap'
]
const showSort = computed(() => {
return (
props.type !== 'extLabel' &&
props.type !== 'extTooltip' &&
props.type !== 'extBubble' &&
!['indicator', 'liquid', 'gauge', 'word-cloud', 'stock-line', 'treemap'].includes(
chart.value.type
) &&
!NOT_SUPPORT_SORT.includes(chart.value.type) &&
!chart.value.type.includes('chart-mix')
)
})