feat: privilege management i18n
This commit is contained in:
parent
4952172103
commit
df480e537e
@ -552,6 +552,28 @@ const I18N_CONF = {
|
||||
usernameError: 'User name cannot be empty!',
|
||||
roleError: 'Role cannot be empty!',
|
||||
},
|
||||
PermissionsManagement: {
|
||||
privilegeManagement: 'Permissions Management',
|
||||
addPermission: 'Add Permission',
|
||||
role: 'Role',
|
||||
resource: 'Resource',
|
||||
action: 'Action',
|
||||
operation: 'Operation',
|
||||
deletePermission: 'Delete',
|
||||
deletePermissionTip: 'Do you want to delete this permission?',
|
||||
},
|
||||
NewPermissions: {
|
||||
addPermission: 'Add Permission',
|
||||
role: 'Role',
|
||||
resource: 'Resource',
|
||||
action: 'Action',
|
||||
resourcePlaceholder: 'Please enter Resource',
|
||||
rolePlaceholder: 'Please enter Role',
|
||||
actionPlaceholder: 'Please enter Action',
|
||||
resourceError: 'Resource cannot be empty!',
|
||||
roleError: 'Role cannot be empty!',
|
||||
actionError: 'Action cannot be empty!',
|
||||
},
|
||||
};
|
||||
|
||||
export default I18N_CONF;
|
||||
|
@ -549,6 +549,28 @@ const I18N_CONF = {
|
||||
usernameError: '用户名不能为空!',
|
||||
roleError: '角色名不能为空!',
|
||||
},
|
||||
PermissionsManagement: {
|
||||
privilegeManagement: '权限管理',
|
||||
addPermission: '添加权限',
|
||||
role: '角色名',
|
||||
resource: '资源',
|
||||
action: '动作',
|
||||
operation: '操作',
|
||||
deletePermission: '删除',
|
||||
deletePermissionTip: '是否要删除该权限?',
|
||||
},
|
||||
NewPermissions: {
|
||||
addPermission: '添加权限',
|
||||
role: '角色名',
|
||||
resource: '资源',
|
||||
action: '动作',
|
||||
resourcePlaceholder: '请输入资源',
|
||||
rolePlaceholder: '请输入角色名',
|
||||
actionPlaceholder: '请输入动作',
|
||||
resourceError: '资源不能为空!',
|
||||
roleError: '角色名不能为空!',
|
||||
actionError: '动作不能为空!',
|
||||
},
|
||||
};
|
||||
|
||||
export default I18N_CONF;
|
||||
|
@ -18,8 +18,8 @@ import { Field, Form, Input, Dialog, ConfigProvider } from '@alifd/next';
|
||||
const FormItem = Form.Item;
|
||||
|
||||
const formItemLayout = {
|
||||
labelCol: { fixedSpan: 3 },
|
||||
wrapperCol: { span: 20 },
|
||||
labelCol: { fixedSpan: 4 },
|
||||
wrapperCol: { span: 19 },
|
||||
};
|
||||
|
||||
@ConfigProvider.config
|
||||
@ -34,10 +34,11 @@ class NewPermissions extends React.Component {
|
||||
};
|
||||
|
||||
check() {
|
||||
const { locale } = this.props;
|
||||
const errors = {
|
||||
role: '角色不能为空!',
|
||||
resource: '资源不能为空!',
|
||||
action: '动作不能为空!',
|
||||
role: locale.roleError,
|
||||
resource: locale.resourceError,
|
||||
action: locale.actionError,
|
||||
};
|
||||
const vals = Object.keys(errors).map(key => {
|
||||
const val = this.field.getValue(key);
|
||||
@ -54,11 +55,11 @@ class NewPermissions extends React.Component {
|
||||
|
||||
render() {
|
||||
const { getError } = this.field;
|
||||
const { visible, onOk, onCancel } = this.props;
|
||||
const { visible, onOk, onCancel, locale } = this.props;
|
||||
return (
|
||||
<>
|
||||
<Dialog
|
||||
title="添加授权"
|
||||
title={locale.addPermission}
|
||||
visible={visible}
|
||||
onOk={() => {
|
||||
const vals = this.check();
|
||||
@ -71,14 +72,14 @@ class NewPermissions extends React.Component {
|
||||
afterClose={() => this.field.reset()}
|
||||
>
|
||||
<Form style={{ width: 400 }} {...formItemLayout} field={this.field}>
|
||||
<FormItem label="角色" required help={getError('role')}>
|
||||
<Input name="role" trim placeholder="Please Enter Role" />
|
||||
<FormItem label={locale.role} required help={getError('role')}>
|
||||
<Input name="role" trim placeholder={locale.rolePlaceholder} />
|
||||
</FormItem>
|
||||
<FormItem label="资源" required help={getError('resource')}>
|
||||
<Input name="resource" trim placeholder="Please Enter Resource" />
|
||||
<FormItem label={locale.resource} required help={getError('resource')}>
|
||||
<Input name="resource" trim placeholder={locale.resourcePlaceholder} />
|
||||
</FormItem>
|
||||
<FormItem label="动作" required help={getError('username')}>
|
||||
<Input name="action" trim placeholder="Please Enter Action" />
|
||||
<FormItem label={locale.action} required help={getError('action')}>
|
||||
<Input name="action" trim placeholder={locale.actionPlaceholder} />
|
||||
</FormItem>
|
||||
</Form>
|
||||
</Dialog>
|
||||
|
@ -63,22 +63,22 @@ class PermissionsManagement extends React.Component {
|
||||
}
|
||||
|
||||
render() {
|
||||
const { permissions } = this.props;
|
||||
const { permissions, locale } = this.props;
|
||||
const { loading, pageSize, pageNo, createPermissionVisible } = this.state;
|
||||
return (
|
||||
<>
|
||||
<RegionGroup left={'权限管理'} />
|
||||
<RegionGroup left={locale.privilegeManagement} />
|
||||
<div className="filter-panel">
|
||||
<Button type="primary" onClick={() => this.setState({ createPermissionVisible: true })}>
|
||||
添加权限
|
||||
{locale.addPermission}
|
||||
</Button>
|
||||
</div>
|
||||
<Table dataSource={permissions.pageItems} loading={loading} maxBodyHeight={476} fixedHeader>
|
||||
<Table.Column title="角色" dataIndex="role" />
|
||||
<Table.Column title="资源" dataIndex="resource" />
|
||||
<Table.Column title="动作" dataIndex="action" />
|
||||
<Table.Column title={locale.role} dataIndex="role" />
|
||||
<Table.Column title={locale.resource} dataIndex="resource" />
|
||||
<Table.Column title={locale.action} dataIndex="action" />
|
||||
<Table.Column
|
||||
title="操作"
|
||||
title={locale.operation}
|
||||
cell={(value, index, record) => (
|
||||
<>
|
||||
<Button
|
||||
@ -86,8 +86,8 @@ class PermissionsManagement extends React.Component {
|
||||
warning
|
||||
onClick={() =>
|
||||
Dialog.confirm({
|
||||
title: '确认',
|
||||
content: '是否要删除该权限?',
|
||||
title: locale.deletePermission,
|
||||
content: locale.deletePermissionTip,
|
||||
onOk: () =>
|
||||
deletePermission(record).then(() =>
|
||||
this.setState({ pageNo: 1 }, () => this.getPermissions())
|
||||
@ -95,7 +95,7 @@ class PermissionsManagement extends React.Component {
|
||||
})
|
||||
}
|
||||
>
|
||||
刪除
|
||||
{locale.deletePermission}
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
|
Loading…
Reference in New Issue
Block a user