refactor: 将 menu 的 data.ts 融合到 index.vue 中

This commit is contained in:
YunaiV
2025-04-02 23:16:48 +08:00
parent 94ea0fc086
commit ff67eb3380
2 changed files with 117 additions and 126 deletions

View File

@@ -1,82 +0,0 @@
import type { OnActionClickFn, VxeTableGridOptions } from '#/adapter/vxe-table';
import type { SystemMenuApi } from '#/api/system/menu';
import { DICT_TYPE } from '#/utils/dict';
export function useGridColumns(
onActionClick: OnActionClickFn<SystemMenuApi.SystemMenu>,
): VxeTableGridOptions<SystemMenuApi.SystemMenu>['columns'] {
return [
{
align: 'left',
field: 'name',
fixed: 'left',
slots: { default: 'name' },
title: '菜单名称',
treeNode: true,
minWidth: 250,
},
{
cellRender: {
name: 'CellDict',
props: { type: DICT_TYPE.SYSTEM_MENU_TYPE },
},
field: 'type',
title: '菜单类型',
minWidth: 100,
},
{
field: 'sort',
title: '显示排序',
minWidth: 100,
},
{
field: 'permission',
title: '权限标识',
minWidth: 200,
},
{
field: 'path',
title: '组件路径',
minWidth: 200,
},
{
field: 'componentName',
minWidth: 200,
title: '组件名称',
},
{
cellRender: {
name: 'CellDict',
props: { type: DICT_TYPE.COMMON_STATUS },
},
field: 'status',
title: '状态',
minWidth: 100,
},
{
align: 'right',
cellRender: {
attrs: {
nameField: 'name',
onClick: onActionClick,
},
name: 'CellOperation',
options: [
{
code: 'append',
text: '新增下级',
},
'edit', // 默认的编辑按钮
'delete', // 默认的删除按钮
],
},
field: 'operation',
fixed: 'right',
headerAlign: 'center',
showOverflow: false,
title: '操作',
minWidth: 200,
},
];
}