|
|
|
@ -19,14 +19,17 @@ import { history } from '@@/core/history';
|
|
|
|
|
|
|
|
|
|
import { PageContainer } from '@ant-design/pro-components';
|
|
|
|
|
import { useMount } from 'ahooks';
|
|
|
|
|
import { App } from 'antd';
|
|
|
|
|
import { useState } from 'react';
|
|
|
|
|
import { App, Button } from 'antd';
|
|
|
|
|
import React, { useState } from 'react';
|
|
|
|
|
import LoginAudit from './components/LoginAudit';
|
|
|
|
|
import UserInfo from './components/UserInfo';
|
|
|
|
|
import { UserDetailTabs } from './constant';
|
|
|
|
|
import queryString from 'query-string';
|
|
|
|
|
import { useLocation } from '@umijs/max';
|
|
|
|
|
import { useIntl } from '@@/exports';
|
|
|
|
|
import { ExclamationCircleFilled } from '@ant-design/icons';
|
|
|
|
|
import { removeUser } from '@/services/account';
|
|
|
|
|
import AppAccess from '@/pages/account/UserDetail/components/AppAccess';
|
|
|
|
|
|
|
|
|
|
export default () => {
|
|
|
|
|
const location = useLocation();
|
|
|
|
@ -38,6 +41,7 @@ export default () => {
|
|
|
|
|
type: UserDetailTabs;
|
|
|
|
|
};
|
|
|
|
|
const [tabActiveKey, setTabActiveKey] = useState<string>();
|
|
|
|
|
|
|
|
|
|
useMount(() => {
|
|
|
|
|
if (!id) {
|
|
|
|
|
useApp.message
|
|
|
|
@ -65,13 +69,49 @@ export default () => {
|
|
|
|
|
tabList={[
|
|
|
|
|
{
|
|
|
|
|
key: UserDetailTabs.user_info,
|
|
|
|
|
tab: '用户信息',
|
|
|
|
|
tab: intl.formatMessage({ id: 'pages.account.user_detail.tabs.user_info' }),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: UserDetailTabs.app_access,
|
|
|
|
|
tab: intl.formatMessage({ id: 'pages.account.user_detail.tabs.app_access' }),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: UserDetailTabs.login_audit,
|
|
|
|
|
tab: '登录日志',
|
|
|
|
|
tab: intl.formatMessage({ id: 'pages.account.user_detail.tabs.login_audit' }),
|
|
|
|
|
},
|
|
|
|
|
]}
|
|
|
|
|
extra={[
|
|
|
|
|
<Button
|
|
|
|
|
key="delete"
|
|
|
|
|
type="primary"
|
|
|
|
|
danger
|
|
|
|
|
onClick={() => {
|
|
|
|
|
const confirmed = useApp.modal.error({
|
|
|
|
|
centered: true,
|
|
|
|
|
title: intl.formatMessage({
|
|
|
|
|
id: 'pages.account.user_detail.extra.delete.confirm_title',
|
|
|
|
|
}),
|
|
|
|
|
icon: <ExclamationCircleFilled />,
|
|
|
|
|
content: intl.formatMessage({
|
|
|
|
|
id: 'pages.account.user_detail.extra.delete.confirm_content',
|
|
|
|
|
}),
|
|
|
|
|
okText: intl.formatMessage({ id: 'app.confirm' }),
|
|
|
|
|
okType: 'danger',
|
|
|
|
|
okCancel: true,
|
|
|
|
|
cancelText: intl.formatMessage({ id: 'app.cancel' }),
|
|
|
|
|
onOk: async () => {
|
|
|
|
|
const { success } = await removeUser(id);
|
|
|
|
|
if (success) {
|
|
|
|
|
useApp.message.success(intl.formatMessage({ id: 'app.operation_success' }));
|
|
|
|
|
confirmed.destroy();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
{intl.formatMessage({ id: 'pages.account.user_detail.extra.delete' })}
|
|
|
|
|
</Button>,
|
|
|
|
|
]}
|
|
|
|
|
tabActiveKey={tabActiveKey}
|
|
|
|
|
onTabChange={(key: string) => {
|
|
|
|
|
setTabActiveKey(key);
|
|
|
|
@ -83,8 +123,10 @@ export default () => {
|
|
|
|
|
>
|
|
|
|
|
{/*用户信息*/}
|
|
|
|
|
{UserDetailTabs.user_info === tabActiveKey && <UserInfo userId={id} />}
|
|
|
|
|
{/*应用授权*/}
|
|
|
|
|
{UserDetailTabs.app_access === tabActiveKey && <AppAccess userId={id} />}
|
|
|
|
|
{/*登录日志*/}
|
|
|
|
|
{UserDetailTabs.login_audit === tabActiveKey && <LoginAudit id={id} />}
|
|
|
|
|
{UserDetailTabs.login_audit === tabActiveKey && <LoginAudit userId={id} />}
|
|
|
|
|
</PageContainer>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|