2024-09-24 10:39:36 +08:00
|
|
|
import type { FormSchemaGetter } from '#/adapter';
|
|
|
|
|
|
|
|
import { DictEnum } from '@vben/constants';
|
|
|
|
|
|
|
|
import { getDictOptions } from '#/utils/dict';
|
|
|
|
|
2024-09-22 18:14:04 +08:00
|
|
|
/**
|
|
|
|
* authScopeOptions user也会用到
|
|
|
|
*/
|
|
|
|
export const authScopeOptions = [
|
|
|
|
{ color: 'green', label: '全部数据权限', value: '1' },
|
|
|
|
{ color: 'default', label: '自定数据权限', value: '2' },
|
|
|
|
{ color: 'orange', label: '本部门数据权限', value: '3' },
|
|
|
|
{ color: 'cyan', label: '本部门及以下数据权限', value: '4' },
|
|
|
|
{ color: 'error', label: '仅本人数据权限', value: '5' },
|
|
|
|
];
|
2024-09-24 10:39:36 +08:00
|
|
|
|
|
|
|
export const querySchema: FormSchemaGetter = () => [
|
|
|
|
{
|
|
|
|
component: 'Input',
|
|
|
|
componentProps: {
|
|
|
|
placeholder: '请输入',
|
|
|
|
},
|
|
|
|
fieldName: 'roleName',
|
|
|
|
label: '角色名称',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
component: 'Input',
|
|
|
|
componentProps: {
|
|
|
|
placeholder: '请输入',
|
|
|
|
},
|
|
|
|
fieldName: 'roleKey',
|
|
|
|
label: '权限字符',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
component: 'Select',
|
|
|
|
componentProps: {
|
|
|
|
options: getDictOptions(DictEnum.SYS_NORMAL_DISABLE),
|
|
|
|
placeholder: '请选择',
|
|
|
|
},
|
|
|
|
fieldName: 'status',
|
|
|
|
label: '状态',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
component: 'RangePicker',
|
|
|
|
fieldName: 'createTime',
|
|
|
|
label: '创建时间',
|
|
|
|
},
|
|
|
|
];
|
2024-09-24 15:35:02 +08:00
|
|
|
|
|
|
|
export const drawerSchema: FormSchemaGetter = () => [
|
|
|
|
{
|
|
|
|
component: 'Input',
|
|
|
|
dependencies: {
|
|
|
|
show: () => false,
|
|
|
|
triggerFields: [''],
|
|
|
|
},
|
|
|
|
fieldName: 'roleId',
|
|
|
|
label: '角色ID',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
component: 'Input',
|
|
|
|
componentProps: {
|
|
|
|
placeholder: '请输入',
|
|
|
|
},
|
|
|
|
fieldName: 'roleName',
|
|
|
|
label: '角色名称',
|
|
|
|
rules: 'required',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
component: 'Input',
|
|
|
|
componentProps: {
|
|
|
|
placeholder: '请输入',
|
|
|
|
},
|
|
|
|
fieldName: 'roleKey',
|
|
|
|
help: '如: test simpleUser等',
|
|
|
|
label: '权限标识',
|
|
|
|
rules: 'required',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
component: 'InputNumber',
|
|
|
|
componentProps: {
|
|
|
|
placeholder: '请输入',
|
|
|
|
},
|
|
|
|
fieldName: 'roleSort',
|
|
|
|
label: '角色排序',
|
|
|
|
rules: 'required',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
component: 'Select',
|
|
|
|
componentProps: {
|
|
|
|
allowClear: false,
|
|
|
|
options: getDictOptions(DictEnum.SYS_NORMAL_DISABLE),
|
|
|
|
placeholder: '请选择',
|
|
|
|
},
|
|
|
|
defaultValue: '0',
|
|
|
|
fieldName: 'status',
|
|
|
|
help: '修改后, 拥有该角色的用户将自动下线.',
|
|
|
|
label: '角色状态',
|
|
|
|
rules: 'required',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
component: 'Input',
|
|
|
|
defaultValue: [],
|
|
|
|
fieldName: 'menuIds',
|
|
|
|
label: '菜单权限',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
component: 'Textarea',
|
|
|
|
componentProps: {
|
|
|
|
placeholder: '请输入',
|
|
|
|
},
|
|
|
|
defaultValue: '',
|
|
|
|
fieldName: 'remark',
|
|
|
|
formItemClass: 'items-baseline',
|
|
|
|
label: '备注',
|
|
|
|
},
|
|
|
|
];
|