diff --git a/src/features/projects/ProjectsPage.vue b/src/features/projects/ProjectsPage.vue index f382ca5..87704b1 100644 --- a/src/features/projects/ProjectsPage.vue +++ b/src/features/projects/ProjectsPage.vue @@ -6,12 +6,13 @@ import { NButton, NDataTable, NInput, + NDropdown, NRadioButton, NRadioGroup, type DataTableColumns, type DataTableInst } from 'naive-ui' -import { Pencil, RefreshCw, Search, Trash2 } from '@lucide/vue' +import { MoreHorizontal, Pencil, RefreshCw, Search, Trash2 } from '@lucide/vue' import WorkspacePage from '../../components/ui/WorkspacePage.vue' import { useQuery } from '../../composables/useQuery' import { StatusBadge } from '../../components/ui' @@ -92,20 +93,36 @@ const columns: DataTableColumns = [ { title: '', key: 'actions', - width: 104, + width: 64, render: row => - h('div', { class: 'flex items-center gap-1' }, [ - h( - NButton, - { quaternary: true, circle: true, title: '编辑项目', 'aria-label': `编辑 ${row.title || row.topic}`, onClick: () => editProject(row) }, - { icon: () => h(Pencil, { size: 15 }) } - ), - h( - NButton, - { quaternary: true, circle: true, type: 'error', title: '删除项目', 'aria-label': `删除 ${row.title || row.topic}`, onClick: () => deleteProject(row) }, - { icon: () => h(Trash2, { size: 15 }) } - ) - ]) + h( + NDropdown, + { + trigger: 'click', + placement: 'bottom-end', + options: [ + { label: '编辑', key: 'edit', icon: () => h(Pencil, { size: 16 }) }, + { label: '删除', key: 'delete', icon: () => h(Trash2, { size: 16 }) } + ], + onSelect: key => { + if (key === 'edit') editProject(row) + if (key === 'delete') deleteProject(row) + } + }, + { + default: () => + h( + NButton, + { + quaternary: true, + circle: true, + title: '更多操作', + 'aria-label': `${row.title || row.topic} 更多操作` + }, + { icon: () => h(MoreHorizontal, { size: 18 }) } + ) + } + ) } ] /** 创建回执只用于跳转,生成进度以后端查询为准。 */ @@ -182,7 +199,7 @@ function clearFilters() { :loading="query.loading.value" flex-height table-layout="fixed" - :scroll-x="890" + :scroll-x="850" @scroll="loadMore" >