mirror of https://gitee.com/topiam/eiam
✨ 新增锁定后解锁操作
parent
9d2cd04d4e
commit
88bb33b8e9
|
@ -21,6 +21,7 @@ import {
|
||||||
getUserList,
|
getUserList,
|
||||||
removeBatchUser,
|
removeBatchUser,
|
||||||
removeUser,
|
removeUser,
|
||||||
|
unlockUser,
|
||||||
} from '@/services/account';
|
} from '@/services/account';
|
||||||
import { history } from '@@/core/history';
|
import { history } from '@@/core/history';
|
||||||
import { PlusOutlined, QuestionCircleOutlined } from '@ant-design/icons';
|
import { PlusOutlined, QuestionCircleOutlined } from '@ant-design/icons';
|
||||||
|
@ -74,7 +75,7 @@ export default (props: UserListProps) => {
|
||||||
const actionRef = useRef<ActionType>();
|
const actionRef = useRef<ActionType>();
|
||||||
const { styles: className } = useStyle();
|
const { styles: className } = useStyle();
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
let useApp = App.useApp();
|
let { message, modal } = App.useApp();
|
||||||
const [id, setId] = useState<string>();
|
const [id, setId] = useState<string>();
|
||||||
/** 包含子部门*/
|
/** 包含子部门*/
|
||||||
const [inclSubOrganization, setInclSubOrganization] = useState<boolean>(true);
|
const [inclSubOrganization, setInclSubOrganization] = useState<boolean>(true);
|
||||||
|
@ -93,7 +94,7 @@ export default (props: UserListProps) => {
|
||||||
dataIndex: 'username',
|
dataIndex: 'username',
|
||||||
width: 130,
|
width: 130,
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
renderText: (dom, row) => (
|
renderText: (_dom, row) => (
|
||||||
<Space>
|
<Space>
|
||||||
<Avatar avatar={row.avatar} username={row.username} />
|
<Avatar avatar={row.avatar} username={row.username} />
|
||||||
<a
|
<a
|
||||||
|
@ -249,9 +250,42 @@ export default (props: UserListProps) => {
|
||||||
width: 110,
|
width: 110,
|
||||||
align: 'center',
|
align: 'center',
|
||||||
fixed: 'right',
|
fixed: 'right',
|
||||||
render: (text: any, row: AccountAPI.ListUser) => {
|
render: (_text: any, row: AccountAPI.ListUser) => {
|
||||||
return [
|
return [
|
||||||
...[
|
...[
|
||||||
|
(row.status === 'locked' ||
|
||||||
|
row.status === 'expired_locked' ||
|
||||||
|
row.status === 'password_expired_locked') && (
|
||||||
|
<a
|
||||||
|
key="lock"
|
||||||
|
onClick={() => {
|
||||||
|
const confirmed = modal.warning({
|
||||||
|
title: intl.formatMessage({
|
||||||
|
id: 'pages.account.user_list.user.columns.option.unlock_title',
|
||||||
|
}),
|
||||||
|
content: intl.formatMessage({
|
||||||
|
id: 'pages.account.user_list.user.columns.option.unlock_content',
|
||||||
|
}),
|
||||||
|
okText: intl.formatMessage({ id: 'app.confirm' }),
|
||||||
|
centered: true,
|
||||||
|
okType: 'primary',
|
||||||
|
okCancel: true,
|
||||||
|
cancelText: intl.formatMessage({ id: 'app.cancel' }),
|
||||||
|
onOk: async () => {
|
||||||
|
const { success } = await unlockUser(row.id);
|
||||||
|
if (success) {
|
||||||
|
confirmed.destroy();
|
||||||
|
message.success(intl.formatMessage({ id: 'app.operation_success' }));
|
||||||
|
actionRef.current?.reload();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{intl.formatMessage({ id: 'pages.account.user_list.user.columns.option.unlock' })}
|
||||||
|
</a>
|
||||||
|
),
|
||||||
row.status === 'enabled' ? (
|
row.status === 'enabled' ? (
|
||||||
<Popconfirm
|
<Popconfirm
|
||||||
title={intl.formatMessage({
|
title={intl.formatMessage({
|
||||||
|
@ -269,7 +303,7 @@ export default (props: UserListProps) => {
|
||||||
onConfirm={async () => {
|
onConfirm={async () => {
|
||||||
const { success } = await disableUser(row.id);
|
const { success } = await disableUser(row.id);
|
||||||
if (success) {
|
if (success) {
|
||||||
useApp.message.success(intl.formatMessage({ id: 'app.operation_success' }));
|
message.success(intl.formatMessage({ id: 'app.operation_success' }));
|
||||||
actionRef.current?.reload();
|
actionRef.current?.reload();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -291,7 +325,7 @@ export default (props: UserListProps) => {
|
||||||
onConfirm={async () => {
|
onConfirm={async () => {
|
||||||
const { success } = await enableUser(row.id);
|
const { success } = await enableUser(row.id);
|
||||||
if (success) {
|
if (success) {
|
||||||
useApp.message.success(intl.formatMessage({ id: 'app.operation_success' }));
|
message.success(intl.formatMessage({ id: 'app.operation_success' }));
|
||||||
actionRef.current?.reload();
|
actionRef.current?.reload();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -340,7 +374,7 @@ export default (props: UserListProps) => {
|
||||||
onConfirm={async () => {
|
onConfirm={async () => {
|
||||||
const { success } = await removeUser(row.id);
|
const { success } = await removeUser(row.id);
|
||||||
if (success) {
|
if (success) {
|
||||||
useApp.message.success(intl.formatMessage({ id: 'app.operation_success' }));
|
message.success(intl.formatMessage({ id: 'app.operation_success' }));
|
||||||
actionRef.current?.reload();
|
actionRef.current?.reload();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -424,7 +458,7 @@ export default (props: UserListProps) => {
|
||||||
onConfirm={async () => {
|
onConfirm={async () => {
|
||||||
const { success } = await removeBatchUser(selectedRowKeys);
|
const { success } = await removeBatchUser(selectedRowKeys);
|
||||||
if (success) {
|
if (success) {
|
||||||
useApp.message.success(intl.formatMessage({ id: 'app.operation_success' }));
|
message.success(intl.formatMessage({ id: 'app.operation_success' }));
|
||||||
onCleanSelected();
|
onCleanSelected();
|
||||||
actionRef.current?.reload();
|
actionRef.current?.reload();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue