import type { CrudSchema } from '@/hooks/web/useCrudSchemas' import { dateFormatter } from '@/utils/formatTime' // 表单校验 export const RoleRules = reactive({ name: [required], code: [required], }) export const Role = useCrudSchemas(reactive([ { label: '角色ID', field: 'id', sort: 'custom', isForm: false, }, { label: '角色名称', field: 'name', sort: 'custom', }, { label: '角色权限字符串', field: 'code', sort: 'custom', width: 200, }, { label: '显示顺序', field: 'sort', sort: 'custom', form: { component: 'InputNumber', value: 0 }, }, { label: '数据权限范围', field: 'dataScope', sort: 'custom', dictType: DICT_TYPE.DATA_SCOPE, dictClass: 'string', // 默认都是字符串类型其他暂不考虑 width: 200, }, { label: '数据部门范围', field: 'dataScopeDeptIds', sort: 'custom', }, { label: '角色状态', field: 'status', sort: 'custom', dictType: DICT_TYPE.ROLE_STATUS, dictClass: 'string', // 默认都是字符串类型其他暂不考虑 }, { label: '角色类型', field: 'type', sort: 'custom', dictType: DICT_TYPE.SYSTEM_ROLE_TYPE, dictClass: 'string', // 默认都是字符串类型其他暂不考虑 }, { label: '备注', field: 'remark', sort: 'custom', }, { label: '创建时间', field: 'createTime', sort: 'custom', formatter: dateFormatter, isForm: false, }, { label: '操作', field: 'action', isForm: false, table: { width: 150, fixed: 'right' } } ]))