用户详情新增删除,调整应用授权为单独tab

pull/50/head
smallbun 1 year ago
parent a4daa29bcf
commit 845e9b79e2

@ -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>
);
};

@ -15,6 +15,6 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import AccessStrategy from './AccessStrategy';
import AppAccess from './AppAccess';
export default AccessStrategy;
export default AppAccess;

@ -24,8 +24,8 @@ import { EventStatus } from '@/pages/audit/data.d';
import { getLoginAuditList } from '@/services/account';
import { useIntl } from '@umijs/max';
export default (props: { id: string }) => {
const { id } = props;
export default (props: { userId: string }) => {
const { userId } = props;
useEffect(() => {}, []);
const intl = useIntl();
@ -97,7 +97,7 @@ export default (props: { id: string }) => {
columns={columns}
search={false}
request={getLoginAuditList}
params={{ id }}
params={{ userId: userId }}
pagination={{ pageSize: 10 }}
/>
</>

@ -31,7 +31,7 @@ import { QuestionCircleOutlined } from '@ant-design/icons';
import { omit } from 'lodash';
import classNames from 'classnames';
import { ParamCheckType } from '@/constant';
import AccessStrategy from '../AccessStrategy';
import AppAccess from '../AppAccess';
import { useIntl } from '@umijs/max';
const prefixCls = 'user-detail-info';
@ -480,8 +480,6 @@ export default (props: { userId: string }) => {
toolbar={{ settings: [] }}
/>
</ProCard>
<br />
<AccessStrategy userId={userId} />
</div>
);
};

@ -21,8 +21,8 @@
export enum UserDetailTabs {
//用户信息
user_info = 'user-info',
//
permission_info = 'permission-info',
//应用授
app_access = 'app_access',
//登录审计
login_audit = 'login-audit',
}

@ -16,6 +16,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
export default {
'pages.account.user_detail.tabs.user_info': '用户信息',
'pages.account.user_detail.tabs.login_audit': '登录日志',
'pages.account.user_detail.tabs.app_access': '应用授权',
'pages.account.user_detail.extra.delete': '删除用户',
'pages.account.user_detail.extra.delete.confirm_title': '您确定要删除此用户?',
'pages.account.user_detail.extra.delete.confirm_content': '此操作不可恢复,请谨慎操作!',
'pages.account.user_detail.user_info': '账户信息',
'pages.account.user_detail.user_info.not_selected': '未选择用户',
'pages.account.user_detail.user_info.columns.open_id': '显示名',

Loading…
Cancel
Save