flat:初始化
This commit is contained in:
274
src/pages/System/Role/authUser.tsx
Normal file
274
src/pages/System/Role/authUser.tsx
Normal file
@@ -0,0 +1,274 @@
|
||||
|
||||
import React, { useState, useRef, useEffect } from 'react';
|
||||
import { useIntl, FormattedMessage, useAccess, history, useParams } from '@umijs/max';
|
||||
import { Button, Modal, message } from 'antd';
|
||||
import { ActionType, PageContainer, ProColumns, ProTable } from '@ant-design/pro-components';
|
||||
import { PlusOutlined, DeleteOutlined, ExclamationCircleOutlined, RollbackOutlined } from '@ant-design/icons';
|
||||
import { authUserSelectAll, authUserCancel, authUserCancelAll, allocatedUserList, unallocatedUserList } from '@/services/system/role';
|
||||
import { getDictValueEnum } from '@/services/system/dict';
|
||||
import DictTag from '@/components/DictTag';
|
||||
import UserSelectorModal from './components/UserSelectorModal';
|
||||
import { HttpResult } from '@/enums/httpEnum';
|
||||
|
||||
/**
|
||||
* 删除节点
|
||||
*
|
||||
* @param selectedRows
|
||||
*/
|
||||
const cancelAuthUserAll = async (roleId: string, selectedRows: API.System.User[]) => {
|
||||
const hide = message.loading('正在取消授权');
|
||||
if (!selectedRows) return true;
|
||||
try {
|
||||
const userIds = selectedRows.map((row) => row.userId).join(',');
|
||||
const resp = await authUserCancelAll({roleId, userIds});
|
||||
hide();
|
||||
if (resp.code === 200) {
|
||||
message.success('取消授权成功,即将刷新');
|
||||
} else {
|
||||
message.error(resp.msg);
|
||||
}
|
||||
return true;
|
||||
} catch (error) {
|
||||
hide();
|
||||
message.error('取消授权失败,请重试');
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
const cancelAuthUser = async (roleId: string, userId: number) => {
|
||||
const hide = message.loading('正在取消授权');
|
||||
try {
|
||||
const resp = await authUserCancel({ userId, roleId });
|
||||
hide();
|
||||
if (resp.code === 200) {
|
||||
message.success('取消授权成功,即将刷新');
|
||||
} else {
|
||||
message.error(resp.msg);
|
||||
}
|
||||
return true;
|
||||
} catch (error) {
|
||||
hide();
|
||||
message.error('取消授权失败,请重试');
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
const AuthUserTableList: React.FC = () => {
|
||||
|
||||
const [modalVisible, setModalVisible] = useState<boolean>(false);
|
||||
|
||||
const actionRef = useRef<ActionType>();
|
||||
const [selectedRows, setSelectedRows] = useState<API.System.User[]>([]);
|
||||
const [statusOptions, setStatusOptions] = useState<any>([]);
|
||||
|
||||
const access = useAccess();
|
||||
|
||||
/** 国际化配置 */
|
||||
const intl = useIntl();
|
||||
|
||||
const params = useParams();
|
||||
if (params.id === undefined) {
|
||||
history.back();
|
||||
}
|
||||
const roleId = params.id || '0';
|
||||
|
||||
useEffect(() => {
|
||||
getDictValueEnum('sys_normal_disable').then((data) => {
|
||||
setStatusOptions(data);
|
||||
});
|
||||
}, []);
|
||||
|
||||
const columns: ProColumns<API.System.User>[] = [
|
||||
{
|
||||
title: <FormattedMessage id="system.user.user_id" defaultMessage="用户编号" />,
|
||||
dataIndex: 'deptId',
|
||||
valueType: 'text',
|
||||
},
|
||||
{
|
||||
title: <FormattedMessage id="system.user.user_name" defaultMessage="用户账号" />,
|
||||
dataIndex: 'userName',
|
||||
valueType: 'text',
|
||||
},
|
||||
{
|
||||
title: <FormattedMessage id="system.user.nick_name" defaultMessage="用户昵称" />,
|
||||
dataIndex: 'nickName',
|
||||
valueType: 'text',
|
||||
},
|
||||
{
|
||||
title: <FormattedMessage id="system.user.phonenumber" defaultMessage="手机号码" />,
|
||||
dataIndex: 'phonenumber',
|
||||
valueType: 'text',
|
||||
},
|
||||
{
|
||||
title: <FormattedMessage id="system.role.create_time" defaultMessage="创建时间" />,
|
||||
dataIndex: 'createTime',
|
||||
valueType: 'dateRange',
|
||||
render: (_, record) => {
|
||||
return (<span>{record.createTime.toString()} </span>);
|
||||
},
|
||||
hideInSearch: true,
|
||||
},
|
||||
{
|
||||
title: <FormattedMessage id="system.user.status" defaultMessage="帐号状态" />,
|
||||
dataIndex: 'status',
|
||||
valueType: 'select',
|
||||
valueEnum: statusOptions,
|
||||
render: (_, record) => {
|
||||
return (<DictTag enums={statusOptions} value={record.status} />);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: <FormattedMessage id="pages.searchTable.titleOption" defaultMessage="操作" />,
|
||||
dataIndex: 'option',
|
||||
width: '60px',
|
||||
valueType: 'option',
|
||||
render: (_, record) => [
|
||||
<Button
|
||||
type="link"
|
||||
size="small"
|
||||
danger
|
||||
icon={<DeleteOutlined />}
|
||||
key="remove"
|
||||
hidden={!access.hasPerms('system:role:remove')}
|
||||
onClick={async () => {
|
||||
Modal.confirm({
|
||||
title: '删除',
|
||||
content: '确认要取消该用户' + record.userName + '"角色授权吗?',
|
||||
okText: '确认',
|
||||
cancelText: '取消',
|
||||
onOk: async () => {
|
||||
const success = await cancelAuthUser(roleId, record.userId);
|
||||
if (success) {
|
||||
if (actionRef.current) {
|
||||
actionRef.current.reload();
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
}}
|
||||
>
|
||||
取消授权
|
||||
</Button>,
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<PageContainer>
|
||||
<div style={{ width: '100%', float: 'right' }}>
|
||||
<ProTable<API.System.User>
|
||||
headerTitle={intl.formatMessage({
|
||||
id: 'pages.searchTable.title',
|
||||
defaultMessage: '信息',
|
||||
})}
|
||||
actionRef={actionRef}
|
||||
rowKey="userId"
|
||||
key="userList"
|
||||
search={{
|
||||
labelWidth: 120,
|
||||
}}
|
||||
toolBarRender={() => [
|
||||
<Button
|
||||
type="primary"
|
||||
key="add"
|
||||
hidden={!access.hasPerms('system:role:add')}
|
||||
onClick={async () => {
|
||||
setModalVisible(true);
|
||||
}}
|
||||
>
|
||||
<PlusOutlined /> <FormattedMessage id="system.role.auth.addUser" defaultMessage="添加用户" />
|
||||
</Button>,
|
||||
<Button
|
||||
type="primary"
|
||||
key="remove"
|
||||
danger
|
||||
hidden={selectedRows?.length === 0 || !access.hasPerms('system:role:remove')}
|
||||
onClick={async () => {
|
||||
Modal.confirm({
|
||||
title: '是否确认删除所选数据项?',
|
||||
icon: <ExclamationCircleOutlined />,
|
||||
content: '请谨慎操作',
|
||||
async onOk() {
|
||||
const success = await cancelAuthUserAll(roleId, selectedRows);
|
||||
if (success) {
|
||||
setSelectedRows([]);
|
||||
actionRef.current?.reloadAndRest?.();
|
||||
}
|
||||
},
|
||||
onCancel() { },
|
||||
});
|
||||
}}
|
||||
>
|
||||
<DeleteOutlined />
|
||||
<FormattedMessage id="system.role.auth.cancelAll" defaultMessage="批量取消授权" />
|
||||
</Button>,
|
||||
<Button
|
||||
type="primary"
|
||||
key="back"
|
||||
onClick={async () => {
|
||||
history.back();
|
||||
}}
|
||||
>
|
||||
<RollbackOutlined />
|
||||
<FormattedMessage id="pages.goback" defaultMessage="返回" />
|
||||
</Button>,
|
||||
]}
|
||||
request={(params) =>
|
||||
allocatedUserList({ ...params, roleId } as API.System.RoleListParams).then((res) => {
|
||||
const result = {
|
||||
data: res.rows,
|
||||
total: res.total,
|
||||
success: true,
|
||||
};
|
||||
return result;
|
||||
})
|
||||
}
|
||||
columns={columns}
|
||||
rowSelection={{
|
||||
onChange: (_, selectedRows) => {
|
||||
setSelectedRows(selectedRows);
|
||||
},
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<UserSelectorModal
|
||||
open={modalVisible}
|
||||
onSubmit={(values: React.Key[]) => {
|
||||
const userIds = values.join(",");
|
||||
if (userIds === "") {
|
||||
message.warning("请选择要分配的用户");
|
||||
return;
|
||||
}
|
||||
authUserSelectAll({ roleId: roleId, userIds: userIds }).then(resp => {
|
||||
if (resp.code === HttpResult.SUCCESS) {
|
||||
message.success('更新成功!');
|
||||
if (actionRef.current) {
|
||||
actionRef.current.reload();
|
||||
}
|
||||
} else {
|
||||
message.warning(resp.msg);
|
||||
}
|
||||
})
|
||||
setModalVisible(false);
|
||||
}}
|
||||
onCancel={() => {
|
||||
setModalVisible(false);
|
||||
}}
|
||||
params={{roleId}}
|
||||
request={(params) =>
|
||||
unallocatedUserList({ ...params } as API.System.RoleListParams).then((res) => {
|
||||
const result = {
|
||||
data: res.rows,
|
||||
total: res.rows.length,
|
||||
success: true,
|
||||
};
|
||||
return result;
|
||||
})
|
||||
}
|
||||
/>
|
||||
</PageContainer>
|
||||
);
|
||||
};
|
||||
|
||||
export default AuthUserTableList;
|
||||
233
src/pages/System/Role/components/DataScope.tsx
Normal file
233
src/pages/System/Role/components/DataScope.tsx
Normal file
@@ -0,0 +1,233 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { Checkbox, Col, Form, Modal, Row, Tree } from 'antd';
|
||||
import { FormattedMessage, useIntl } from '@umijs/max';
|
||||
import { Key, ProForm, ProFormDigit, ProFormSelect, ProFormText } from '@ant-design/pro-components';
|
||||
import { DataNode } from 'antd/es/tree';
|
||||
import { CheckboxValueType } from 'antd/es/checkbox/Group';
|
||||
|
||||
/* *
|
||||
*
|
||||
* @author whiteshader@163.com
|
||||
* @datetime 2023/02/06
|
||||
*
|
||||
* */
|
||||
|
||||
export type FormValueType = any & Partial<API.System.Dept>;
|
||||
|
||||
export type DataScopeFormProps = {
|
||||
onCancel: (flag?: boolean, formVals?: FormValueType) => void;
|
||||
onSubmit: (values: FormValueType) => Promise<void>;
|
||||
open: boolean;
|
||||
values: Partial<API.System.Role>;
|
||||
deptTree: DataNode[];
|
||||
deptCheckedKeys: string[];
|
||||
};
|
||||
|
||||
const DataScopeForm: React.FC<DataScopeFormProps> = (props) => {
|
||||
const [form] = Form.useForm();
|
||||
|
||||
const { deptTree, deptCheckedKeys } = props;
|
||||
const [dataScopeType, setDataScopeType] = useState<string | undefined>('1');
|
||||
const [deptIds, setDeptIds] = useState<string[] | {checked: string[], halfChecked: string[]}>([]);
|
||||
const [deptTreeExpandKey, setDeptTreeExpandKey] = useState<Key[]>([]);
|
||||
const [checkStrictly, setCheckStrictly] = useState<boolean>(true);
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
setDeptIds(deptCheckedKeys);
|
||||
form.resetFields();
|
||||
form.setFieldsValue({
|
||||
roleId: props.values.roleId,
|
||||
roleName: props.values.roleName,
|
||||
roleKey: props.values.roleKey,
|
||||
dataScope: props.values.dataScope,
|
||||
});
|
||||
setDataScopeType(props.values.dataScope);
|
||||
}, [props.values]);
|
||||
|
||||
const intl = useIntl();
|
||||
const handleOk = () => {
|
||||
form.submit();
|
||||
};
|
||||
const handleCancel = () => {
|
||||
props.onCancel();
|
||||
};
|
||||
const handleFinish = async (values: Record<string, any>) => {
|
||||
props.onSubmit({ ...values, deptIds } as FormValueType);
|
||||
};
|
||||
|
||||
const getAllDeptNode = (node: DataNode[]) => {
|
||||
let keys: any[] = [];
|
||||
node.forEach(value => {
|
||||
keys.push(value.key);
|
||||
if(value.children) {
|
||||
keys = keys.concat(getAllDeptNode(value.children));
|
||||
}
|
||||
});
|
||||
return keys;
|
||||
}
|
||||
|
||||
const deptAllNodes = getAllDeptNode(deptTree);
|
||||
|
||||
|
||||
const onDeptOptionChange = (checkedValues: CheckboxValueType[]) => {
|
||||
if(checkedValues.includes('deptExpand')) {
|
||||
setDeptTreeExpandKey(deptAllNodes);
|
||||
} else {
|
||||
setDeptTreeExpandKey([]);
|
||||
}
|
||||
if(checkedValues.includes('deptNodeAll')) {
|
||||
setDeptIds(deptAllNodes);
|
||||
} else {
|
||||
setDeptIds([]);
|
||||
}
|
||||
|
||||
if(checkedValues.includes('deptCheckStrictly')) {
|
||||
setCheckStrictly(false);
|
||||
} else {
|
||||
setCheckStrictly(true);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<Modal
|
||||
width={640}
|
||||
title={intl.formatMessage({
|
||||
id: 'system.user.auth.role',
|
||||
defaultMessage: '分配角色',
|
||||
})}
|
||||
open={props.open}
|
||||
destroyOnClose
|
||||
forceRender
|
||||
onOk={handleOk}
|
||||
onCancel={handleCancel}
|
||||
>
|
||||
<ProForm
|
||||
form={form}
|
||||
grid={true}
|
||||
layout="horizontal"
|
||||
onFinish={handleFinish}
|
||||
initialValues={{
|
||||
login_password: '',
|
||||
confirm_password: '',
|
||||
}}
|
||||
>
|
||||
|
||||
<ProFormDigit
|
||||
name="roleId"
|
||||
label={intl.formatMessage({
|
||||
id: 'system.role.role_id',
|
||||
defaultMessage: '角色编号',
|
||||
})}
|
||||
colProps={{ md: 12, xl: 12 }}
|
||||
placeholder="请输入角色编号"
|
||||
disabled
|
||||
hidden={true}
|
||||
rules={[
|
||||
{
|
||||
required: false,
|
||||
message: <FormattedMessage id="请输入角色编号!" defaultMessage="请输入角色编号!" />,
|
||||
},
|
||||
]}
|
||||
/>
|
||||
<ProFormText
|
||||
name="roleName"
|
||||
label={intl.formatMessage({
|
||||
id: 'system.role.role_name',
|
||||
defaultMessage: '角色名称',
|
||||
})}
|
||||
disabled
|
||||
placeholder="请输入角色名称"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: <FormattedMessage id="请输入角色名称!" defaultMessage="请输入角色名称!" />,
|
||||
},
|
||||
]}
|
||||
/>
|
||||
<ProFormText
|
||||
name="roleKey"
|
||||
label={intl.formatMessage({
|
||||
id: 'system.role.role_key',
|
||||
defaultMessage: '权限字符串',
|
||||
})}
|
||||
disabled
|
||||
placeholder="请输入角色权限字符串"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: <FormattedMessage id="请输入角色权限字符串!" defaultMessage="请输入角色权限字符串!" />,
|
||||
},
|
||||
]}
|
||||
/>
|
||||
<ProFormSelect
|
||||
name="dataScope"
|
||||
label='权限范围'
|
||||
initialValue={'1'}
|
||||
placeholder="请输入用户性别"
|
||||
valueEnum={{
|
||||
"1": "全部数据权限",
|
||||
"2": "自定数据权限",
|
||||
"3": "本部门数据权限",
|
||||
"4": "本部门及以下数据权限",
|
||||
"5": "仅本人数据权限"
|
||||
}}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
},
|
||||
]}
|
||||
fieldProps={{
|
||||
onChange: (value) => {
|
||||
setDataScopeType(value);
|
||||
},
|
||||
}}
|
||||
/>
|
||||
<ProForm.Item
|
||||
name="deptIds"
|
||||
label={intl.formatMessage({
|
||||
id: 'system.role.auth',
|
||||
defaultMessage: '菜单权限',
|
||||
})}
|
||||
required={dataScopeType === '1'}
|
||||
hidden={dataScopeType !== '1'}
|
||||
>
|
||||
<Row gutter={[16, 16]}>
|
||||
<Col md={24}>
|
||||
<Checkbox.Group
|
||||
options={[
|
||||
{ label: '展开/折叠', value: 'deptExpand' },
|
||||
{ label: '全选/全不选', value: 'deptNodeAll' },
|
||||
// { label: '父子联动', value: 'deptCheckStrictly' },
|
||||
]}
|
||||
onChange={onDeptOptionChange} />
|
||||
</Col>
|
||||
<Col md={24}>
|
||||
<Tree
|
||||
checkable={true}
|
||||
checkStrictly={checkStrictly}
|
||||
expandedKeys={deptTreeExpandKey}
|
||||
treeData={deptTree}
|
||||
checkedKeys={deptIds}
|
||||
defaultCheckedKeys={deptCheckedKeys}
|
||||
onCheck={(checkedKeys: any, checkInfo: any) => {
|
||||
console.log(checkedKeys, checkInfo);
|
||||
if(checkStrictly) {
|
||||
return setDeptIds(checkedKeys.checked);
|
||||
} else {
|
||||
return setDeptIds({checked: checkedKeys, halfChecked: checkInfo.halfCheckedKeys});
|
||||
}
|
||||
}}
|
||||
onExpand={(expandedKeys: Key[]) => {
|
||||
setDeptTreeExpandKey(deptTreeExpandKey.concat(expandedKeys));
|
||||
}}
|
||||
/>
|
||||
</Col>
|
||||
</Row>
|
||||
</ProForm.Item>
|
||||
</ProForm>
|
||||
</Modal>
|
||||
);
|
||||
};
|
||||
|
||||
export default DataScopeForm;
|
||||
125
src/pages/System/Role/components/UserSelectorModal.tsx
Normal file
125
src/pages/System/Role/components/UserSelectorModal.tsx
Normal file
@@ -0,0 +1,125 @@
|
||||
import React, { useEffect, useRef, useState } from 'react';
|
||||
import { Modal } from 'antd';
|
||||
import { FormattedMessage, useIntl } from '@umijs/max';
|
||||
import { ActionType, ParamsType, ProColumns, ProTable, RequestData } from '@ant-design/pro-components';
|
||||
import { getDictValueEnum } from '@/services/system/dict';
|
||||
import DictTag from '@/components/DictTag';
|
||||
|
||||
|
||||
/* *
|
||||
*
|
||||
* @author whiteshader@163.com
|
||||
* @datetime 2023/02/10
|
||||
*
|
||||
* */
|
||||
|
||||
export type DataScopeFormProps = {
|
||||
onCancel: () => void;
|
||||
onSubmit: (values: React.Key[]) => void;
|
||||
open: boolean;
|
||||
params: ParamsType;
|
||||
request?: (params: Record<string, any>) => Promise<Partial<RequestData<API.System.User>>>;
|
||||
};
|
||||
|
||||
const UserSelectorModal: React.FC<DataScopeFormProps> = (props) => {
|
||||
|
||||
const actionRef = useRef<ActionType>();
|
||||
const [selectedRowKeys, setSelectedRowKeys] = useState<React.Key[]>([]);
|
||||
const [statusOptions, setStatusOptions] = useState<any>([]);
|
||||
|
||||
useEffect(() => {
|
||||
getDictValueEnum('sys_normal_disable').then((data) => {
|
||||
setStatusOptions(data);
|
||||
});
|
||||
}, [props]);
|
||||
|
||||
const intl = useIntl();
|
||||
const handleOk = () => {
|
||||
props.onSubmit(selectedRowKeys);
|
||||
};
|
||||
const handleCancel = () => {
|
||||
props.onCancel();
|
||||
};
|
||||
|
||||
const columns: ProColumns<API.System.User>[] = [
|
||||
{
|
||||
title: <FormattedMessage id="system.user.user_id" defaultMessage="用户编号" />,
|
||||
dataIndex: 'userId',
|
||||
valueType: 'text',
|
||||
hideInSearch: true,
|
||||
},
|
||||
{
|
||||
title: <FormattedMessage id="system.user.user_name" defaultMessage="用户账号" />,
|
||||
dataIndex: 'userName',
|
||||
valueType: 'text',
|
||||
},
|
||||
{
|
||||
title: <FormattedMessage id="system.user.nick_name" defaultMessage="用户昵称" />,
|
||||
dataIndex: 'nickName',
|
||||
valueType: 'text',
|
||||
hideInSearch: true,
|
||||
},
|
||||
{
|
||||
title: <FormattedMessage id="system.user.phonenumber" defaultMessage="手机号码" />,
|
||||
dataIndex: 'phonenumber',
|
||||
valueType: 'text',
|
||||
},
|
||||
{
|
||||
title: <FormattedMessage id="system.user.status" defaultMessage="帐号状态" />,
|
||||
dataIndex: 'status',
|
||||
valueType: 'select',
|
||||
hideInSearch: true,
|
||||
valueEnum: statusOptions,
|
||||
render: (_, record) => {
|
||||
return (<DictTag enums={statusOptions} value={record.status} />);
|
||||
},
|
||||
},
|
||||
{
|
||||
title: <FormattedMessage id="system.user.create_time" defaultMessage="创建时间" />,
|
||||
dataIndex: 'createTime',
|
||||
valueType: 'dateRange',
|
||||
hideInSearch: true,
|
||||
render: (_, record) => {
|
||||
return (<span>{record.createTime.toString()} </span>);
|
||||
},
|
||||
}
|
||||
];
|
||||
|
||||
return (
|
||||
<Modal
|
||||
width={800}
|
||||
title={intl.formatMessage({
|
||||
id: 'system.role.auth.user',
|
||||
defaultMessage: '选择用户',
|
||||
})}
|
||||
open={props.open}
|
||||
destroyOnClose
|
||||
onOk={handleOk}
|
||||
onCancel={handleCancel}
|
||||
>
|
||||
<ProTable<API.System.User>
|
||||
headerTitle={intl.formatMessage({
|
||||
id: 'pages.searchTable.title',
|
||||
defaultMessage: '信息',
|
||||
})}
|
||||
actionRef={actionRef}
|
||||
rowKey="userId"
|
||||
key="userList"
|
||||
search={{
|
||||
labelWidth: 120,
|
||||
}}
|
||||
toolbar={{}}
|
||||
params={props.params}
|
||||
request={props.request}
|
||||
columns={columns}
|
||||
rowSelection={{
|
||||
onChange: (selectedRowKeys: React.Key[]) => {
|
||||
setSelectedRowKeys(selectedRowKeys);
|
||||
},
|
||||
}}
|
||||
/>
|
||||
</Modal>
|
||||
);
|
||||
};
|
||||
|
||||
export default UserSelectorModal;
|
||||
199
src/pages/System/Role/edit.tsx
Normal file
199
src/pages/System/Role/edit.tsx
Normal file
@@ -0,0 +1,199 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import {
|
||||
ProForm,
|
||||
ProFormDigit,
|
||||
ProFormText,
|
||||
ProFormRadio,
|
||||
ProFormTextArea,
|
||||
} from '@ant-design/pro-components';
|
||||
import { Form, Modal } from 'antd';
|
||||
import { useIntl, FormattedMessage } from '@umijs/max';
|
||||
import Tree, { DataNode } from 'antd/es/tree';
|
||||
import { DictValueEnumObj } from '@/components/DictTag';
|
||||
|
||||
export type RoleFormData = Record<string, unknown> & Partial<API.System.Role>;
|
||||
|
||||
export type RoleFormProps = {
|
||||
onCancel: (flag?: boolean, formVals?: RoleFormData) => void;
|
||||
onSubmit: (values: RoleFormData) => Promise<void>;
|
||||
open: boolean;
|
||||
values: Partial<API.System.Role>;
|
||||
menuTree: DataNode[];
|
||||
menuCheckedKeys: string[];
|
||||
statusOptions: DictValueEnumObj;
|
||||
};
|
||||
|
||||
const RoleForm: React.FC<RoleFormProps> = (props) => {
|
||||
const [form] = Form.useForm();
|
||||
const { menuTree, menuCheckedKeys } = props;
|
||||
const [menuIds, setMenuIds] = useState<string[]>([]);
|
||||
const { statusOptions } = props;
|
||||
|
||||
useEffect(() => {
|
||||
form.resetFields();
|
||||
form.setFieldsValue({
|
||||
roleId: props.values.roleId,
|
||||
roleName: props.values.roleName,
|
||||
roleKey: props.values.roleKey,
|
||||
roleSort: props.values.roleSort,
|
||||
dataScope: props.values.dataScope,
|
||||
menuCheckStrictly: props.values.menuCheckStrictly,
|
||||
deptCheckStrictly: props.values.deptCheckStrictly,
|
||||
status: props.values.status,
|
||||
delFlag: props.values.delFlag,
|
||||
createBy: props.values.createBy,
|
||||
createTime: props.values.createTime,
|
||||
updateBy: props.values.updateBy,
|
||||
updateTime: props.values.updateTime,
|
||||
remark: props.values.remark,
|
||||
});
|
||||
}, [form, props]);
|
||||
|
||||
const intl = useIntl();
|
||||
const handleOk = () => {
|
||||
form.submit();
|
||||
};
|
||||
const handleCancel = () => {
|
||||
props.onCancel();
|
||||
};
|
||||
const handleFinish = async (values: Record<string, any>) => {
|
||||
props.onSubmit({ ...values, menuIds } as RoleFormData);
|
||||
};
|
||||
|
||||
return (
|
||||
<Modal
|
||||
width={640}
|
||||
title={intl.formatMessage({
|
||||
id: 'system.role.title',
|
||||
defaultMessage: '编辑角色信息',
|
||||
})}
|
||||
forceRender
|
||||
open={props.open}
|
||||
destroyOnClose
|
||||
onOk={handleOk}
|
||||
onCancel={handleCancel}
|
||||
>
|
||||
<ProForm
|
||||
form={form}
|
||||
grid={true}
|
||||
layout="horizontal"
|
||||
submitter={false}
|
||||
onFinish={handleFinish}>
|
||||
<ProFormDigit
|
||||
name="roleId"
|
||||
label={intl.formatMessage({
|
||||
id: 'system.role.role_id',
|
||||
defaultMessage: '角色编号',
|
||||
})}
|
||||
placeholder="请输入角色编号"
|
||||
disabled
|
||||
hidden={true}
|
||||
rules={[
|
||||
{
|
||||
required: false,
|
||||
message: <FormattedMessage id="请输入角色编号!" defaultMessage="请输入角色编号!" />,
|
||||
},
|
||||
]}
|
||||
/>
|
||||
<ProFormText
|
||||
name="roleName"
|
||||
label={intl.formatMessage({
|
||||
id: 'system.role.role_name',
|
||||
defaultMessage: '角色名称',
|
||||
})}
|
||||
placeholder="请输入角色名称"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: <FormattedMessage id="请输入角色名称!" defaultMessage="请输入角色名称!" />,
|
||||
},
|
||||
]}
|
||||
/>
|
||||
<ProFormText
|
||||
name="roleKey"
|
||||
label={intl.formatMessage({
|
||||
id: 'system.role.role_key',
|
||||
defaultMessage: '权限字符串',
|
||||
})}
|
||||
placeholder="请输入角色权限字符串"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: <FormattedMessage id="请输入角色权限字符串!" defaultMessage="请输入角色权限字符串!" />,
|
||||
},
|
||||
]}
|
||||
/>
|
||||
<ProFormDigit
|
||||
name="roleSort"
|
||||
label={intl.formatMessage({
|
||||
id: 'system.role.role_sort',
|
||||
defaultMessage: '显示顺序',
|
||||
})}
|
||||
placeholder="请输入显示顺序"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: <FormattedMessage id="请输入显示顺序!" defaultMessage="请输入显示顺序!" />,
|
||||
},
|
||||
]}
|
||||
fieldProps = {{
|
||||
defaultValue: 1
|
||||
}}
|
||||
/>
|
||||
<ProFormRadio.Group
|
||||
valueEnum={statusOptions}
|
||||
name="status"
|
||||
label={intl.formatMessage({
|
||||
id: 'system.role.status',
|
||||
defaultMessage: '角色状态',
|
||||
})}
|
||||
placeholder="请输入角色状态"
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: <FormattedMessage id="请输入角色状态!" defaultMessage="请输入角色状态!" />,
|
||||
},
|
||||
]}
|
||||
fieldProps = {{
|
||||
defaultValue: "0"
|
||||
}}
|
||||
/>
|
||||
<ProForm.Item
|
||||
name="menuIds"
|
||||
label={intl.formatMessage({
|
||||
id: 'system.role.auth',
|
||||
defaultMessage: '菜单权限',
|
||||
})}
|
||||
>
|
||||
<Tree
|
||||
checkable={true}
|
||||
multiple={true}
|
||||
checkStrictly={true}
|
||||
defaultExpandAll={false}
|
||||
treeData={menuTree}
|
||||
defaultCheckedKeys={menuCheckedKeys}
|
||||
onCheck={(checkedKeys: any) => {
|
||||
return setMenuIds(checkedKeys.checked);
|
||||
}}
|
||||
/>
|
||||
</ProForm.Item>
|
||||
<ProFormTextArea
|
||||
name="remark"
|
||||
label={intl.formatMessage({
|
||||
id: 'system.role.remark',
|
||||
defaultMessage: '备注',
|
||||
})}
|
||||
placeholder="请输入备注"
|
||||
rules={[
|
||||
{
|
||||
required: false,
|
||||
message: <FormattedMessage id="请输入备注!" defaultMessage="请输入备注!" />,
|
||||
},
|
||||
]}
|
||||
/>
|
||||
</ProForm>
|
||||
</Modal>
|
||||
);
|
||||
};
|
||||
|
||||
export default RoleForm;
|
||||
513
src/pages/System/Role/index.tsx
Normal file
513
src/pages/System/Role/index.tsx
Normal file
@@ -0,0 +1,513 @@
|
||||
|
||||
import React, { useState, useRef, useEffect } from 'react';
|
||||
import { useIntl, FormattedMessage, useAccess, history } from '@umijs/max';
|
||||
import { DataNode } from 'antd/es/tree';
|
||||
import { Button, message, Modal, Dropdown, FormInstance, Space, Switch } from 'antd';
|
||||
import { ActionType, FooterToolbar, PageContainer, ProColumns, ProTable } from '@ant-design/pro-components';
|
||||
import { PlusOutlined, EditOutlined, DeleteOutlined, ExclamationCircleOutlined, DownOutlined } from '@ant-design/icons';
|
||||
import { getRoleList, removeRole, addRole, updateRole, exportRole, getRoleMenuList, changeRoleStatus, updateRoleDataScope, getDeptTreeSelect, getRole } from '@/services/system/role';
|
||||
import UpdateForm from './edit';
|
||||
import { getDictValueEnum } from '@/services/system/dict';
|
||||
import { formatTreeData } from '@/utils/tree';
|
||||
import { getMenuTree } from '@/services/system/menu';
|
||||
import DataScopeForm from './components/DataScope';
|
||||
|
||||
const { confirm } = Modal;
|
||||
|
||||
/**
|
||||
* 添加节点
|
||||
*
|
||||
* @param fields
|
||||
*/
|
||||
const handleAdd = async (fields: API.System.Role) => {
|
||||
const hide = message.loading('正在添加');
|
||||
try {
|
||||
const resp = await addRole({ ...fields });
|
||||
hide();
|
||||
if (resp.code === 200) {
|
||||
message.success('添加成功');
|
||||
} else {
|
||||
message.error(resp.msg);
|
||||
}
|
||||
return true;
|
||||
} catch (error) {
|
||||
hide();
|
||||
message.error('添加失败请重试!');
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 更新节点
|
||||
*
|
||||
* @param fields
|
||||
*/
|
||||
const handleUpdate = async (fields: API.System.Role) => {
|
||||
const hide = message.loading('正在更新');
|
||||
try {
|
||||
const resp = await updateRole(fields);
|
||||
hide();
|
||||
if (resp.code === 200) {
|
||||
message.success('更新成功');
|
||||
} else {
|
||||
message.error(resp.msg);
|
||||
}
|
||||
return true;
|
||||
} catch (error) {
|
||||
hide();
|
||||
message.error('配置失败请重试!');
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 删除节点
|
||||
*
|
||||
* @param selectedRows
|
||||
*/
|
||||
const handleRemove = async (selectedRows: API.System.Role[]) => {
|
||||
const hide = message.loading('正在删除');
|
||||
if (!selectedRows) return true;
|
||||
try {
|
||||
const resp = await removeRole(selectedRows.map((row) => row.roleId).join(','));
|
||||
hide();
|
||||
if (resp.code === 200) {
|
||||
message.success('删除成功,即将刷新');
|
||||
} else {
|
||||
message.error(resp.msg);
|
||||
}
|
||||
return true;
|
||||
} catch (error) {
|
||||
hide();
|
||||
message.error('删除失败,请重试');
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
const handleRemoveOne = async (selectedRow: API.System.Role) => {
|
||||
const hide = message.loading('正在删除');
|
||||
if (!selectedRow) return true;
|
||||
try {
|
||||
const params = [selectedRow.roleId];
|
||||
const resp = await removeRole(params.join(','));
|
||||
hide();
|
||||
if (resp.code === 200) {
|
||||
message.success('删除成功,即将刷新');
|
||||
} else {
|
||||
message.error(resp.msg);
|
||||
}
|
||||
return true;
|
||||
} catch (error) {
|
||||
hide();
|
||||
message.error('删除失败,请重试');
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
*
|
||||
*
|
||||
*/
|
||||
const handleExport = async () => {
|
||||
const hide = message.loading('正在导出');
|
||||
try {
|
||||
await exportRole();
|
||||
hide();
|
||||
message.success('导出成功');
|
||||
return true;
|
||||
} catch (error) {
|
||||
hide();
|
||||
message.error('导出失败,请重试');
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
const RoleTableList: React.FC = () => {
|
||||
|
||||
const [messageApi, contextHolder] = message.useMessage();
|
||||
const formTableRef = useRef<FormInstance>();
|
||||
|
||||
const [modalVisible, setModalVisible] = useState<boolean>(false);
|
||||
const [dataScopeModalOpen, setDataScopeModalOpen] = useState<boolean>(false);
|
||||
|
||||
const actionRef = useRef<ActionType>();
|
||||
const [currentRow, setCurrentRow] = useState<API.System.Role>();
|
||||
const [selectedRows, setSelectedRows] = useState<API.System.Role[]>([]);
|
||||
|
||||
const [menuTree, setMenuTree] = useState<DataNode[]>();
|
||||
const [menuIds, setMenuIds] = useState<string[]>([]);
|
||||
const [statusOptions, setStatusOptions] = useState<any>([]);
|
||||
|
||||
const access = useAccess();
|
||||
|
||||
/** 国际化配置 */
|
||||
const intl = useIntl();
|
||||
|
||||
useEffect(() => {
|
||||
getDictValueEnum('sys_normal_disable').then((data) => {
|
||||
setStatusOptions(data);
|
||||
});
|
||||
}, []);
|
||||
|
||||
const showChangeStatusConfirm = (record: API.System.Role) => {
|
||||
let text = record.status === "1" ? "启用" : "停用";
|
||||
const newStatus = record.status === '0' ? '1' : '0';
|
||||
confirm({
|
||||
title: `确认要${text}${record.roleName}角色吗?`,
|
||||
onOk() {
|
||||
changeRoleStatus(record.roleId, newStatus).then(resp => {
|
||||
if (resp.code === 200) {
|
||||
messageApi.open({
|
||||
type: 'success',
|
||||
content: '更新成功!',
|
||||
});
|
||||
actionRef.current?.reload();
|
||||
} else {
|
||||
messageApi.open({
|
||||
type: 'error',
|
||||
content: '更新失败!',
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const columns: ProColumns<API.System.Role>[] = [
|
||||
{
|
||||
title: <FormattedMessage id="system.role.role_id" defaultMessage="角色编号" />,
|
||||
dataIndex: 'roleId',
|
||||
valueType: 'text',
|
||||
},
|
||||
{
|
||||
title: <FormattedMessage id="system.role.role_name" defaultMessage="角色名称" />,
|
||||
dataIndex: 'roleName',
|
||||
valueType: 'text',
|
||||
},
|
||||
{
|
||||
title: <FormattedMessage id="system.role.role_key" defaultMessage="角色权限字符串" />,
|
||||
dataIndex: 'roleKey',
|
||||
valueType: 'text',
|
||||
hideInSearch: true,
|
||||
},
|
||||
{
|
||||
title: <FormattedMessage id="system.role.role_sort" defaultMessage="显示顺序" />,
|
||||
dataIndex: 'roleSort',
|
||||
valueType: 'text',
|
||||
hideInSearch: true,
|
||||
},
|
||||
{
|
||||
title: <FormattedMessage id="system.role.status" defaultMessage="角色状态" />,
|
||||
dataIndex: 'status',
|
||||
valueType: 'select',
|
||||
valueEnum: statusOptions,
|
||||
render: (_, record) => {
|
||||
return (
|
||||
<Switch
|
||||
checked={record.status === '0'}
|
||||
checkedChildren="正常"
|
||||
unCheckedChildren="停用"
|
||||
defaultChecked
|
||||
onClick={() => showChangeStatusConfirm(record)}
|
||||
/>)
|
||||
},
|
||||
},
|
||||
{
|
||||
title: <FormattedMessage id="system.role.create_time" defaultMessage="创建时间" />,
|
||||
dataIndex: 'createTime',
|
||||
valueType: 'dateRange',
|
||||
render: (_, record) => {
|
||||
return (<span>{record.createTime.toString()} </span>);
|
||||
},
|
||||
search: {
|
||||
transform: (value) => {
|
||||
return {
|
||||
'params[beginTime]': value[0],
|
||||
'params[endTime]': value[1],
|
||||
};
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
title: <FormattedMessage id="pages.searchTable.titleOption" defaultMessage="操作" />,
|
||||
dataIndex: 'option',
|
||||
width: '220px',
|
||||
valueType: 'option',
|
||||
render: (_, record) => [
|
||||
<Button
|
||||
type="link"
|
||||
size="small"
|
||||
key="edit"
|
||||
icon=<EditOutlined />
|
||||
hidden={!access.hasPerms('system:role:edit')}
|
||||
onClick={() => {
|
||||
getRoleMenuList(record.roleId).then((res) => {
|
||||
if (res.code === 200) {
|
||||
const treeData = formatTreeData(res.menus);
|
||||
setMenuTree(treeData);
|
||||
setMenuIds(res.checkedKeys.map(item => {
|
||||
return `${item}`
|
||||
}));
|
||||
setModalVisible(true);
|
||||
setCurrentRow(record);
|
||||
} else {
|
||||
message.warning(res.msg);
|
||||
}
|
||||
});
|
||||
}}
|
||||
>
|
||||
编辑
|
||||
</Button>,
|
||||
<Button
|
||||
type="link"
|
||||
size="small"
|
||||
danger
|
||||
key="batchRemove"
|
||||
icon=<DeleteOutlined />
|
||||
hidden={!access.hasPerms('system:role:remove')}
|
||||
onClick={async () => {
|
||||
Modal.confirm({
|
||||
title: '删除',
|
||||
content: '确定删除该项吗?',
|
||||
okText: '确认',
|
||||
cancelText: '取消',
|
||||
onOk: async () => {
|
||||
const success = await handleRemoveOne(record);
|
||||
if (success) {
|
||||
if (actionRef.current) {
|
||||
actionRef.current.reload();
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
}}
|
||||
>
|
||||
删除
|
||||
</Button>,
|
||||
<Dropdown
|
||||
key="more"
|
||||
menu={{
|
||||
items: [
|
||||
{
|
||||
label: '数据权限',
|
||||
key: 'datascope',
|
||||
disabled: !access.hasPerms('system:role:edit'),
|
||||
},
|
||||
{
|
||||
label: '分配用户',
|
||||
key: 'authUser',
|
||||
disabled: !access.hasPerms('system:role:edit'),
|
||||
},
|
||||
],
|
||||
onClick: ({ key }: any) => {
|
||||
if (key === 'datascope') {
|
||||
getRole(record.roleId).then(resp => {
|
||||
if(resp.code === 200) {
|
||||
setCurrentRow(resp.data);
|
||||
setDataScopeModalOpen(true);
|
||||
}
|
||||
})
|
||||
getDeptTreeSelect(record.roleId).then(resp => {
|
||||
if (resp.code === 200) {
|
||||
setMenuTree(formatTreeData(resp.depts));
|
||||
setMenuIds(resp.checkedKeys.map((item:number) => {
|
||||
return `${item}`
|
||||
}));
|
||||
}
|
||||
})
|
||||
}
|
||||
else if (key === 'authUser') {
|
||||
history.push(`/system/role-auth/user/${record.roleId}`);
|
||||
}
|
||||
}
|
||||
}}
|
||||
>
|
||||
<a onClick={(e) => e.preventDefault()}>
|
||||
<Space>
|
||||
<DownOutlined />
|
||||
更多
|
||||
</Space>
|
||||
</a>
|
||||
</Dropdown>,
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<PageContainer>
|
||||
{contextHolder}
|
||||
<div style={{ width: '100%', float: 'right' }}>
|
||||
<ProTable<API.System.Role>
|
||||
headerTitle={intl.formatMessage({
|
||||
id: 'pages.searchTable.title',
|
||||
defaultMessage: '信息',
|
||||
})}
|
||||
actionRef={actionRef}
|
||||
formRef={formTableRef}
|
||||
rowKey="roleId"
|
||||
key="roleList"
|
||||
search={{
|
||||
labelWidth: 120,
|
||||
}}
|
||||
toolBarRender={() => [
|
||||
<Button
|
||||
type="primary"
|
||||
key="add"
|
||||
hidden={!access.hasPerms('system:role:add')}
|
||||
onClick={async () => {
|
||||
getMenuTree().then((res: any) => {
|
||||
if (res.code === 200) {
|
||||
const treeData = formatTreeData(res.data);
|
||||
setMenuTree(treeData);
|
||||
setMenuIds([]);
|
||||
setModalVisible(true);
|
||||
setCurrentRow(undefined);
|
||||
} else {
|
||||
message.warning(res.msg);
|
||||
}
|
||||
});
|
||||
}}
|
||||
>
|
||||
<PlusOutlined /> <FormattedMessage id="pages.searchTable.new" defaultMessage="新建" />
|
||||
</Button>,
|
||||
<Button
|
||||
type="primary"
|
||||
key="remove"
|
||||
danger
|
||||
hidden={selectedRows?.length === 0 || !access.hasPerms('system:role:remove')}
|
||||
onClick={async () => {
|
||||
Modal.confirm({
|
||||
title: '是否确认删除所选数据项?',
|
||||
icon: <ExclamationCircleOutlined />,
|
||||
content: '请谨慎操作',
|
||||
async onOk() {
|
||||
const success = await handleRemove(selectedRows);
|
||||
if (success) {
|
||||
setSelectedRows([]);
|
||||
actionRef.current?.reloadAndRest?.();
|
||||
}
|
||||
},
|
||||
onCancel() { },
|
||||
});
|
||||
}}
|
||||
>
|
||||
<DeleteOutlined />
|
||||
<FormattedMessage id="pages.searchTable.delete" defaultMessage="删除" />
|
||||
</Button>,
|
||||
<Button
|
||||
type="primary"
|
||||
key="export"
|
||||
hidden={!access.hasPerms('system:role:export')}
|
||||
onClick={async () => {
|
||||
handleExport();
|
||||
}}
|
||||
>
|
||||
<PlusOutlined />
|
||||
<FormattedMessage id="pages.searchTable.export" defaultMessage="导出" />
|
||||
</Button>,
|
||||
]}
|
||||
request={(params) =>
|
||||
getRoleList({ ...params } as API.System.RoleListParams).then((res) => {
|
||||
const result = {
|
||||
data: res.rows,
|
||||
total: res.total,
|
||||
success: true,
|
||||
};
|
||||
return result;
|
||||
})
|
||||
}
|
||||
columns={columns}
|
||||
rowSelection={{
|
||||
onChange: (_, selectedRows) => {
|
||||
setSelectedRows(selectedRows);
|
||||
},
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
{selectedRows?.length > 0 && (
|
||||
<FooterToolbar
|
||||
extra={
|
||||
<div>
|
||||
<FormattedMessage id="pages.searchTable.chosen" defaultMessage="已选择" />
|
||||
<a style={{ fontWeight: 600 }}>{selectedRows.length}</a>
|
||||
<FormattedMessage id="pages.searchTable.item" defaultMessage="项" />
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<Button
|
||||
key="remove"
|
||||
danger
|
||||
hidden={!access.hasPerms('system:role:del')}
|
||||
onClick={async () => {
|
||||
Modal.confirm({
|
||||
title: '删除',
|
||||
content: '确定删除该项吗?',
|
||||
okText: '确认',
|
||||
cancelText: '取消',
|
||||
onOk: async () => {
|
||||
const success = await handleRemove(selectedRows);
|
||||
if (success) {
|
||||
setSelectedRows([]);
|
||||
actionRef.current?.reloadAndRest?.();
|
||||
}
|
||||
},
|
||||
});
|
||||
}}
|
||||
>
|
||||
<FormattedMessage id="pages.searchTable.batchDeletion" defaultMessage="批量删除" />
|
||||
</Button>
|
||||
</FooterToolbar>
|
||||
)}
|
||||
<UpdateForm
|
||||
onSubmit={async (values) => {
|
||||
let success = false;
|
||||
if (values.roleId) {
|
||||
success = await handleUpdate({ ...values } as API.System.Role);
|
||||
} else {
|
||||
success = await handleAdd({ ...values } as API.System.Role);
|
||||
}
|
||||
if (success) {
|
||||
setModalVisible(false);
|
||||
setCurrentRow(undefined);
|
||||
if (actionRef.current) {
|
||||
actionRef.current.reload();
|
||||
}
|
||||
}
|
||||
}}
|
||||
onCancel={() => {
|
||||
setModalVisible(false);
|
||||
setCurrentRow(undefined);
|
||||
}}
|
||||
open={modalVisible}
|
||||
values={currentRow || {}}
|
||||
menuTree={menuTree || []}
|
||||
menuCheckedKeys={menuIds || []}
|
||||
statusOptions={statusOptions}
|
||||
/>
|
||||
<DataScopeForm
|
||||
onSubmit={async (values: any) => {
|
||||
const success = await updateRoleDataScope(values);
|
||||
if (success) {
|
||||
setDataScopeModalOpen(false);
|
||||
setSelectedRows([]);
|
||||
setCurrentRow(undefined);
|
||||
message.success('配置成功。');
|
||||
}
|
||||
}}
|
||||
onCancel={() => {
|
||||
setDataScopeModalOpen(false);
|
||||
setSelectedRows([]);
|
||||
setCurrentRow(undefined);
|
||||
}}
|
||||
open={dataScopeModalOpen}
|
||||
values={currentRow || {}}
|
||||
deptTree={menuTree || []}
|
||||
deptCheckedKeys={menuIds || []}
|
||||
/>
|
||||
</PageContainer>
|
||||
);
|
||||
};
|
||||
|
||||
export default RoleTableList;
|
||||
Reference in New Issue
Block a user