|
|
@@ -4,23 +4,21 @@ import type { TenantDetail } from '@/pages/system/Tenant/typings';
|
|
|
import type { TenantItem } from '@/pages/system/Tenant/typings';
|
|
|
import BaseCrud from '@/components/BaseCrud';
|
|
|
import { useRef } from 'react';
|
|
|
-import { Avatar, message, Popconfirm, Tooltip } from 'antd';
|
|
|
+import { Avatar, Drawer, Tooltip } from 'antd';
|
|
|
import Service from '@/pages/system/Tenant/service';
|
|
|
-import {
|
|
|
- CloseCircleOutlined,
|
|
|
- EyeOutlined,
|
|
|
- KeyOutlined,
|
|
|
- PlayCircleOutlined,
|
|
|
-} from '@ant-design/icons';
|
|
|
+import { EyeOutlined, KeyOutlined } from '@ant-design/icons';
|
|
|
import { useIntl } from '@@/plugin-locale/localeExports';
|
|
|
import moment from 'moment';
|
|
|
import { Link } from 'umi';
|
|
|
import TenantModel from '@/pages/system/Tenant/model';
|
|
|
import type { ISchema } from '@formily/json-schema';
|
|
|
+import autzModel from '@/components/Authorization/autz';
|
|
|
+import Authorization from '@/components/Authorization';
|
|
|
+import { observer } from '@formily/react';
|
|
|
|
|
|
export const service = new Service('tenant');
|
|
|
|
|
|
-const Tenant = () => {
|
|
|
+const Tenant = observer(() => {
|
|
|
const intl = useIntl();
|
|
|
const actionRef = useRef<ActionType>();
|
|
|
const columns: ProColumns<TenantItem>[] = [
|
|
|
@@ -133,7 +131,14 @@ const Tenant = () => {
|
|
|
</Tooltip>
|
|
|
</Link>,
|
|
|
|
|
|
- <a onClick={() => console.log('授权')}>
|
|
|
+ <a
|
|
|
+ key="auth"
|
|
|
+ onClick={() => {
|
|
|
+ autzModel.autzTarget.id = record.tenant.id!;
|
|
|
+ autzModel.autzTarget.name = record.tenant.name!;
|
|
|
+ autzModel.visible = true;
|
|
|
+ }}
|
|
|
+ >
|
|
|
<Tooltip
|
|
|
title={intl.formatMessage({
|
|
|
id: 'pages.data.option.authorize',
|
|
|
@@ -143,38 +148,6 @@ const Tenant = () => {
|
|
|
<KeyOutlined />
|
|
|
</Tooltip>
|
|
|
</a>,
|
|
|
- <a href={record.tenant.id} target="_blank" rel="noopener noreferrer" key="view">
|
|
|
- <Popconfirm
|
|
|
- title={intl.formatMessage({
|
|
|
- id: 'pages.data.option.disabled.tips',
|
|
|
- defaultMessage: '确认禁用?',
|
|
|
- })}
|
|
|
- onConfirm={async () => {
|
|
|
- await service.update({
|
|
|
- tenant: {
|
|
|
- id: record.tenant.id,
|
|
|
- state: record.tenant?.state.value ? 0 : 1,
|
|
|
- },
|
|
|
- });
|
|
|
- message.success(
|
|
|
- intl.formatMessage({
|
|
|
- id: 'pages.data.option.success',
|
|
|
- defaultMessage: '操作成功!',
|
|
|
- }),
|
|
|
- );
|
|
|
- actionRef.current?.reload();
|
|
|
- }}
|
|
|
- >
|
|
|
- <Tooltip
|
|
|
- title={intl.formatMessage({
|
|
|
- id: `pages.data.option.${record.tenant?.state.value ? 'disabled' : 'enabled'}`,
|
|
|
- defaultMessage: record.tenant?.state?.value ? '禁用' : '启用',
|
|
|
- })}
|
|
|
- >
|
|
|
- {record.tenant?.state.value ? <CloseCircleOutlined /> : <PlayCircleOutlined />}
|
|
|
- </Tooltip>
|
|
|
- </Popconfirm>
|
|
|
- </a>,
|
|
|
],
|
|
|
},
|
|
|
];
|
|
|
@@ -261,7 +234,26 @@ const Tenant = () => {
|
|
|
schema={schema}
|
|
|
actionRef={actionRef}
|
|
|
/>
|
|
|
+ <Drawer
|
|
|
+ title={intl.formatMessage({
|
|
|
+ id: 'pages.data.option.authorize',
|
|
|
+ defaultMessage: '授权',
|
|
|
+ })}
|
|
|
+ width="50vw"
|
|
|
+ visible={autzModel.visible}
|
|
|
+ onClose={() => {
|
|
|
+ autzModel.visible = false;
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ <Authorization
|
|
|
+ close={() => {
|
|
|
+ autzModel.visible = false;
|
|
|
+ }}
|
|
|
+ target={autzModel.autzTarget}
|
|
|
+ type={'tenant'}
|
|
|
+ />
|
|
|
+ </Drawer>
|
|
|
</PageContainer>
|
|
|
);
|
|
|
-};
|
|
|
+});
|
|
|
export default Tenant;
|