refactor: 项目操作收纳为下拉菜单

This commit is contained in:
GouJ committed 2026-09-25 01:06:28 +08:00
1 parent 898778c20d
commit aca4a4754c
1 file changed
+29 -12
+29 -12
View File
@@ -6,12 +6,13 @@ import {
NButton, NButton,
NDataTable, NDataTable,
NInput, NInput,
NDropdown,
NRadioButton, NRadioButton,
NRadioGroup, NRadioGroup,
type DataTableColumns, type DataTableColumns,
type DataTableInst type DataTableInst
} from 'naive-ui' } 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 WorkspacePage from '../../components/ui/WorkspacePage.vue'
import { useQuery } from '../../composables/useQuery' import { useQuery } from '../../composables/useQuery'
import { StatusBadge } from '../../components/ui' import { StatusBadge } from '../../components/ui'
@@ -92,20 +93,36 @@ const columns: DataTableColumns<Project> = [
{ {
title: '', title: '',
key: 'actions', key: 'actions',
width: 104, width: 64,
render: row => render: row =>
h('div', { class: 'flex items-center gap-1' }, [ 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( h(
NButton, NButton,
{ quaternary: true, circle: true, title: '编辑项目', 'aria-label': `编辑 ${row.title || row.topic}`, onClick: () => editProject(row) }, {
{ icon: () => h(Pencil, { size: 15 }) } quaternary: true,
), circle: true,
h( title: '更多操作',
NButton, 'aria-label': `${row.title || row.topic} 更多操作`
{ quaternary: true, circle: true, type: 'error', title: '删除项目', 'aria-label': `删除 ${row.title || row.topic}`, onClick: () => deleteProject(row) }, },
{ icon: () => h(Trash2, { size: 15 }) } { icon: () => h(MoreHorizontal, { size: 18 }) }
)
}
) )
])
} }
] ]
/** 创建回执只用于跳转,生成进度以后端查询为准。 */ /** 创建回执只用于跳转,生成进度以后端查询为准。 */
@@ -182,7 +199,7 @@ function clearFilters() {
:loading="query.loading.value" :loading="query.loading.value"
flex-height flex-height
table-layout="fixed" table-layout="fixed"
:scroll-x="890" :scroll-x="850"
@scroll="loadMore" @scroll="loadMore"
> >
<template #empty <template #empty