feat: 角色管理

This commit is contained in:
dap
2024-10-05 15:12:39 +08:00
parent 34c2117aa0
commit e6fa2be3eb
2 changed files with 239 additions and 89 deletions

View File

@@ -1,8 +1,10 @@
import type { FormSchemaGetter } from '#/adapter';
import type { FormSchemaGetter, VxeGridProps } from '#/adapter';
import { DictEnum } from '@vben/constants';
import { getPopupContainer } from '@vben/utils';
import { Tag } from 'ant-design-vue';
import { getDictOptions } from '#/utils/dict';
/**
@@ -42,6 +44,58 @@ export const querySchema: FormSchemaGetter = () => [
},
];
export const columns: VxeGridProps['columns'] = [
{ type: 'checkbox', width: 60 },
{
title: '角色名称',
field: 'roleName',
},
{
title: '权限字符',
field: 'roleKey',
slots: {
default: ({ row }) => {
return <Tag color="processing">{row.roleKey}</Tag>;
},
},
},
{
title: '数据权限',
field: 'dataScope',
slots: {
default: ({ row }) => {
const found = authScopeOptions.find(
(item) => item.value === row.dataScope,
);
if (found) {
return <Tag color={found.color}>{found.label}</Tag>;
}
return <Tag>{row.dataScope}</Tag>;
},
},
},
{
title: '排序',
field: 'roleSort',
},
{
title: '状态',
field: 'status',
slots: { default: 'status' },
},
{
title: '创建时间',
field: 'createTime',
},
{
field: 'action',
fixed: 'right',
slots: { default: 'action' },
title: '操作',
width: 180,
},
];
export const drawerSchema: FormSchemaGetter = () => [
{
component: 'Input',