mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 12:54:05 +00:00
fix: randomly generate role name
This commit is contained in:
parent
2af045979f
commit
85fb8d7452
@ -1,4 +1,7 @@
|
||||
import { ISchema } from '@formily/react';
|
||||
import { uid } from '@formily/shared';
|
||||
import { useRequest } from '../../../api-client';
|
||||
import { useActionContext } from '../../../schema-component';
|
||||
import { roleCollectionsSchema } from './roleCollections';
|
||||
|
||||
const collection = {
|
||||
@ -25,7 +28,6 @@ const collection = {
|
||||
title: '角色标识',
|
||||
type: 'string',
|
||||
'x-component': 'Input',
|
||||
description: '使用英文',
|
||||
} as ISchema,
|
||||
},
|
||||
{
|
||||
@ -92,6 +94,20 @@ export const roleSchema: ISchema = {
|
||||
type: 'void',
|
||||
'x-component': 'Action.Drawer',
|
||||
'x-decorator': 'Form',
|
||||
'x-decorator-props': {
|
||||
useValues(options) {
|
||||
const ctx = useActionContext();
|
||||
return useRequest(
|
||||
() =>
|
||||
Promise.resolve({
|
||||
data: {
|
||||
name: `r_${uid()}`,
|
||||
},
|
||||
}),
|
||||
{ ...options, refreshDeps: [ctx.visible] },
|
||||
);
|
||||
},
|
||||
},
|
||||
title: '添加角色',
|
||||
properties: {
|
||||
title: {
|
||||
@ -101,6 +117,7 @@ export const roleSchema: ISchema = {
|
||||
name: {
|
||||
'x-component': 'CollectionField',
|
||||
'x-decorator': 'FormItem',
|
||||
description: '{{t("Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.")}}',
|
||||
},
|
||||
default: {
|
||||
'x-component': 'CollectionField',
|
||||
|
@ -100,7 +100,7 @@ export default {
|
||||
"Create collection": "创建数据表",
|
||||
"Collection display name": "数据表名称",
|
||||
"Collection name": "数据表标识",
|
||||
"Randomly generated and can be modified. Support letters, numbers and underscores, must start with a letter.": "随机生成,可修改。支持英文、数字和下划线,必须以英文字母开头。",
|
||||
"Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.": "随机生成,可修改。支持英文、数字和下划线,必须以英文字母开头。",
|
||||
"Storage type": "存储类型",
|
||||
"Edit": "编辑",
|
||||
"Edit collection": "编辑数据表",
|
||||
|
@ -105,7 +105,7 @@ export const FormBlockInitializer = (props) => {
|
||||
<DataBlockInitializer
|
||||
{...props}
|
||||
icon={<FormOutlined />}
|
||||
componentType={'Form'}
|
||||
componentType={'CreateForm'}
|
||||
createBlockSchema={createFormBlockSchema}
|
||||
/>
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user