refactor: 调整 eslint.config.js,优化代码格式

This commit is contained in:
2024-10-28 21:20:08 +08:00
parent 0e8fe5ff1f
commit 9e5dff144b
176 changed files with 5956 additions and 5624 deletions

View File

@@ -34,8 +34,10 @@
</a-doption>
</template>
</a-dropdown>
<a-popover v-if="showSettingColumnBtn" trigger="click" position="br"
:content-style="{ minWidth: '120px', padding: '6px 8px 10px' }">
<a-popover
v-if="showSettingColumnBtn" trigger="click" position="br"
:content-style="{ minWidth: '120px', padding: '6px 8px 10px' }"
>
<a-tooltip content="列设置">
<a-button>
<template #icon>
@@ -101,7 +103,7 @@ const props = withDefaults(defineProps<Props>(), {
title: '',
data: () => [],
disabledTools: () => [], // 禁止显示的工具
disabledColumnKeys: () => [] // 禁止控制显示隐藏的列
disabledColumnKeys: () => [], // 禁止控制显示隐藏的列
})
const emit = defineEmits<{
@@ -142,10 +144,10 @@ const size = ref<TableInstance['size']>('medium')
const isBordered = ref(false)
const isFullscreen = ref(false)
type SizeItem = { label: string, value: TableInstance['size'] }
interface SizeItem { label: string, value: TableInstance['size'] }
const sizeList: SizeItem[] = [
{ label: '紧凑', value: 'small' },
{ label: '默认', value: 'medium' }
{ label: '默认', value: 'medium' },
]
const handleSelect: DropdownInstance['onSelect'] = (value) => {
@@ -160,9 +162,9 @@ const showRefreshBtn = computed(() => !props.disabledTools.includes('refresh'))
const showSizeBtn = computed(() => !props.disabledTools.includes('size'))
const showFullscreenBtn = computed(() => !props.disabledTools.includes('fullscreen'))
const showSettingColumnBtn = computed(
() => !props.disabledTools.includes('setting') && attrs?.columns && (attrs?.columns as TableColumnData[])?.length
() => !props.disabledTools.includes('setting') && attrs?.columns && (attrs?.columns as TableColumnData[])?.length,
)
type SettingColumnItem = { title: string, key: string, show: boolean, disabled: boolean }
interface SettingColumnItem { title: string, key: string, show: boolean, disabled: boolean }
const settingColumnList = ref<SettingColumnItem[]>([])
// 重置配置列
@@ -176,8 +178,8 @@ const resetSettingColumns = () => {
title: typeof item.title === 'string' ? item.title : '',
show: item.show ?? true,
disabled: props.disabledColumnKeys.includes(
item.dataIndex || (typeof item.title === 'string' ? item.title : '')
)
item.dataIndex || (typeof item.title === 'string' ? item.title : ''),
),
})
})
}
@@ -188,7 +190,7 @@ watch(
() => {
resetSettingColumns()
},
{ immediate: true }
{ immediate: true },
)
// 排序和过滤可显示的列数据
@@ -201,7 +203,7 @@ const _columns = computed(() => {
.map((i) => i.key || (typeof i.title === 'string' ? i.title : ''))
// 显示的columns数据
const filterColumns = arr.filter((i) =>
showDataIndexs.includes(i.dataIndex || (typeof i.title === 'string' ? i.title : ''))
showDataIndexs.includes(i.dataIndex || (typeof i.title === 'string' ? i.title : '')),
)
const sortedColumns: TableColumnData[] = []
settingColumnList.value.forEach((i) => {