mirror of
https://gitee.com/nocobase/nocobase.git
synced 2024-11-30 11:18:36 +08: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 { ISchema } from '@formily/react';
|
||||||
|
import { uid } from '@formily/shared';
|
||||||
|
import { useRequest } from '../../../api-client';
|
||||||
|
import { useActionContext } from '../../../schema-component';
|
||||||
import { roleCollectionsSchema } from './roleCollections';
|
import { roleCollectionsSchema } from './roleCollections';
|
||||||
|
|
||||||
const collection = {
|
const collection = {
|
||||||
@ -25,7 +28,6 @@ const collection = {
|
|||||||
title: '角色标识',
|
title: '角色标识',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
'x-component': 'Input',
|
'x-component': 'Input',
|
||||||
description: '使用英文',
|
|
||||||
} as ISchema,
|
} as ISchema,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -92,6 +94,20 @@ export const roleSchema: ISchema = {
|
|||||||
type: 'void',
|
type: 'void',
|
||||||
'x-component': 'Action.Drawer',
|
'x-component': 'Action.Drawer',
|
||||||
'x-decorator': 'Form',
|
'x-decorator': 'Form',
|
||||||
|
'x-decorator-props': {
|
||||||
|
useValues(options) {
|
||||||
|
const ctx = useActionContext();
|
||||||
|
return useRequest(
|
||||||
|
() =>
|
||||||
|
Promise.resolve({
|
||||||
|
data: {
|
||||||
|
name: `r_${uid()}`,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
{ ...options, refreshDeps: [ctx.visible] },
|
||||||
|
);
|
||||||
|
},
|
||||||
|
},
|
||||||
title: '添加角色',
|
title: '添加角色',
|
||||||
properties: {
|
properties: {
|
||||||
title: {
|
title: {
|
||||||
@ -101,6 +117,7 @@ export const roleSchema: ISchema = {
|
|||||||
name: {
|
name: {
|
||||||
'x-component': 'CollectionField',
|
'x-component': 'CollectionField',
|
||||||
'x-decorator': 'FormItem',
|
'x-decorator': 'FormItem',
|
||||||
|
description: '{{t("Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.")}}',
|
||||||
},
|
},
|
||||||
default: {
|
default: {
|
||||||
'x-component': 'CollectionField',
|
'x-component': 'CollectionField',
|
||||||
|
@ -100,7 +100,7 @@ export default {
|
|||||||
"Create collection": "创建数据表",
|
"Create collection": "创建数据表",
|
||||||
"Collection display name": "数据表名称",
|
"Collection display name": "数据表名称",
|
||||||
"Collection 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": "存储类型",
|
"Storage type": "存储类型",
|
||||||
"Edit": "编辑",
|
"Edit": "编辑",
|
||||||
"Edit collection": "编辑数据表",
|
"Edit collection": "编辑数据表",
|
||||||
|
@ -105,7 +105,7 @@ export const FormBlockInitializer = (props) => {
|
|||||||
<DataBlockInitializer
|
<DataBlockInitializer
|
||||||
{...props}
|
{...props}
|
||||||
icon={<FormOutlined />}
|
icon={<FormOutlined />}
|
||||||
componentType={'Form'}
|
componentType={'CreateForm'}
|
||||||
createBlockSchema={createFormBlockSchema}
|
createBlockSchema={createFormBlockSchema}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user