mirror of https://github.com/longtai-cn/hippo4j
parent
19104a7220
commit
1727caca44
@ -0,0 +1,18 @@
|
|||||||
|
import useUrlState from '@ahooksjs/use-url-state';
|
||||||
|
|
||||||
|
export const useUrlSet = (options: { form: any }) => {
|
||||||
|
const { form } = options;
|
||||||
|
const [state, setState] = useUrlState({});
|
||||||
|
|
||||||
|
const setUrl = () => {
|
||||||
|
const params = form.getFieldsValue();
|
||||||
|
Object.keys(params).forEach(key => {
|
||||||
|
if (!params[key]) {
|
||||||
|
params[key] = undefined;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
setState({ ...params });
|
||||||
|
};
|
||||||
|
|
||||||
|
return { setUrl };
|
||||||
|
};
|
@ -0,0 +1,5 @@
|
|||||||
|
.tenant_wrapper {
|
||||||
|
.opreate_btn {
|
||||||
|
padding: 0px;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,120 @@
|
|||||||
|
import { useAntdTable } from 'ahooks';
|
||||||
|
import { Button, Form, Input, Row, Space, Table, Col, Modal } from 'antd';
|
||||||
|
import { SearchOutlined, EditOutlined } from '@ant-design/icons';
|
||||||
|
import React, { useState } from 'react';
|
||||||
|
import { fetchTenantList } from './service';
|
||||||
|
import { useUrlSet } from '@/hooks/useUrlSet';
|
||||||
|
import style from './index.module.less';
|
||||||
|
|
||||||
|
const baseColumns = [
|
||||||
|
{
|
||||||
|
title: '序号',
|
||||||
|
dataIndex: 'id',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '租户',
|
||||||
|
dataIndex: 'tenantId',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '租户名称',
|
||||||
|
dataIndex: 'tenantName',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '负责人',
|
||||||
|
dataIndex: 'owner',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '修改时间',
|
||||||
|
dataIndex: 'gmtModified',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const Tenant: React.FC = () => {
|
||||||
|
const [editVisible, setEditVisible] = useState(false);
|
||||||
|
const [type, setType] = useState('add');
|
||||||
|
const [form] = Form.useForm();
|
||||||
|
const { setUrl } = useUrlSet({ form });
|
||||||
|
const { tableProps, search } = useAntdTable(fetchTenantList, { form });
|
||||||
|
// const {run: delete} = useRequest(fetchDeleteTenant, { manual: true });
|
||||||
|
const actions = (type: string, item?: any) => {
|
||||||
|
switch (type) {
|
||||||
|
case 'add':
|
||||||
|
setEditVisible(true);
|
||||||
|
break;
|
||||||
|
case 'edit':
|
||||||
|
setEditVisible(true);
|
||||||
|
break;
|
||||||
|
case 'delete':
|
||||||
|
// handleDelete();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const handleSearch = () => {
|
||||||
|
setUrl();
|
||||||
|
search.submit();
|
||||||
|
};
|
||||||
|
// const handleDelete = (item: any) => {
|
||||||
|
// Modal.confirm({
|
||||||
|
// title: `此操作将删除${item.tenantName}, 是否继续?`,
|
||||||
|
// onOk: () => {
|
||||||
|
// search.submit();
|
||||||
|
// },
|
||||||
|
// });
|
||||||
|
// };
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={style.tenant_wrapper}>
|
||||||
|
<Form form={form} wrapperCol={{ span: 23 }}>
|
||||||
|
<Row>
|
||||||
|
<Col span={6}>
|
||||||
|
<Form.Item name="note">
|
||||||
|
<Input placeholder="租户" />
|
||||||
|
</Form.Item>
|
||||||
|
</Col>
|
||||||
|
<Col span={18}>
|
||||||
|
<Space>
|
||||||
|
<Button onClick={() => handleSearch()} type="primary" icon={<SearchOutlined />}>
|
||||||
|
搜索
|
||||||
|
</Button>
|
||||||
|
<Button onClick={() => setEditVisible(true)} type="primary" icon={<EditOutlined />}>
|
||||||
|
添加
|
||||||
|
</Button>
|
||||||
|
</Space>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
<Row>
|
||||||
|
<Col span={6}></Col>
|
||||||
|
<Col span={18}></Col>
|
||||||
|
</Row>
|
||||||
|
</Form>
|
||||||
|
<Table
|
||||||
|
{...tableProps}
|
||||||
|
bordered
|
||||||
|
rowKey="id"
|
||||||
|
columns={[
|
||||||
|
...baseColumns,
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
key: 'action',
|
||||||
|
render: (text: string, record: any) => {
|
||||||
|
return (
|
||||||
|
<Space>
|
||||||
|
<Button onClick={() => actions('edit', record)} type="link" className={style.opreate_btn}>
|
||||||
|
编辑
|
||||||
|
</Button>
|
||||||
|
<Button onClick={() => actions('edit', record)} type="link" className={style.opreate_btn}>
|
||||||
|
删除
|
||||||
|
</Button>
|
||||||
|
</Space>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Tenant;
|
@ -0,0 +1,8 @@
|
|||||||
|
import { lazy } from 'react';
|
||||||
|
import { IRouterList } from '@/typings';
|
||||||
|
|
||||||
|
const ItemManage = lazy(() => import('./index'));
|
||||||
|
|
||||||
|
const routerList: IRouterList[] = [{ path: '/item', component: () => <ItemManage /> }];
|
||||||
|
|
||||||
|
export default routerList;
|
@ -0,0 +1,79 @@
|
|||||||
|
import request from '@/utils';
|
||||||
|
|
||||||
|
const fetchTenantList = async (
|
||||||
|
pageProps: { current: number; pageSize: number },
|
||||||
|
formData: { tencent: string | number }
|
||||||
|
): Promise<{ total: number; list: Array<any> }> => {
|
||||||
|
const res: any = await request('/hippo4j/v1/cs/tenant/query/page', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
Authorization:
|
||||||
|
'Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiI3LGJhb3hpbnlpX2FkbWluIiwiaXNzIjoiYWRtaW4iLCJleHAiOjE2OTUzOTg4NDksImlhdCI6MTY5NDc5NDA0OSwicm9sIjoiUk9MRV9BRE1JTiJ9.syRDshKpd-xETsSdeMPRtk956f4BJkPt4utVsUl4smgH71Woj8SUq4w2RX1YtGTC4aTZRJYdKOfkTqwK0g_dHQ',
|
||||||
|
cookie:
|
||||||
|
'Admin-Token=Bearer%20eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiI3LGJhb3hpbnlpX2FkbWluIiwiaXNzIjoiYWRtaW4iLCJleHAiOjE2OTUzOTg4NDksImlhdCI6MTY5NDc5NDA0OSwicm9sIjoiUk9MRV9BRE1JTiJ9.syRDshKpd-xETsSdeMPRtk956f4BJkPt4utVsUl4smgH71Woj8SUq4w2RX1YtGTC4aTZRJYdKOfkTqwK0g_dHQ; userName=baoxinyi_admin',
|
||||||
|
},
|
||||||
|
body: {
|
||||||
|
...formData,
|
||||||
|
current: pageProps.current,
|
||||||
|
size: pageProps.pageSize,
|
||||||
|
desc: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
if (res && res.success) {
|
||||||
|
return {
|
||||||
|
total: res.data.total,
|
||||||
|
list: res.data.records,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
throw new Error(res.msg || '服务器开小差啦~');
|
||||||
|
};
|
||||||
|
|
||||||
|
const fetchAddTenant = async (id: string) => {
|
||||||
|
const res = await request('/hippo4j/v1/cs/tenant/save', {
|
||||||
|
method: 'POST',
|
||||||
|
params: { id },
|
||||||
|
});
|
||||||
|
|
||||||
|
if (res && res.success) {
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
throw new Error(res.msg || '服务器开小差啦~');
|
||||||
|
};
|
||||||
|
|
||||||
|
const fetchDeleteTenant = async (id: string) => {
|
||||||
|
const res = await request('/tenants', {
|
||||||
|
method: 'POST',
|
||||||
|
params: { id },
|
||||||
|
});
|
||||||
|
|
||||||
|
if (res && res.success) {
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
throw new Error(res.msg || '服务器开小差啦~');
|
||||||
|
};
|
||||||
|
|
||||||
|
const fetchUpdateTenant = async (id: string) => {
|
||||||
|
const res = await request('hippo4j/v1/cs/tenant/update', {
|
||||||
|
method: 'POST',
|
||||||
|
params: { id },
|
||||||
|
});
|
||||||
|
|
||||||
|
if (res && res.success) {
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
throw new Error(res.msg || '服务器开小差啦~');
|
||||||
|
};
|
||||||
|
|
||||||
|
const fetchTenantDetail = async (id: string) => {
|
||||||
|
const res = await request('/tenants', {
|
||||||
|
method: 'POST',
|
||||||
|
params: { id },
|
||||||
|
});
|
||||||
|
|
||||||
|
if (res && res.success) {
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
throw new Error(res.msg || '服务器开小差啦~');
|
||||||
|
};
|
||||||
|
|
||||||
|
export { fetchTenantList, fetchAddTenant, fetchDeleteTenant, fetchUpdateTenant, fetchTenantDetail };
|
@ -0,0 +1,5 @@
|
|||||||
|
.tenant_wrapper {
|
||||||
|
.opreate_btn {
|
||||||
|
padding: 0px;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,120 @@
|
|||||||
|
import { useAntdTable } from 'ahooks';
|
||||||
|
import { Button, Form, Input, Row, Space, Table, Col, Modal } from 'antd';
|
||||||
|
import { SearchOutlined, EditOutlined } from '@ant-design/icons';
|
||||||
|
import React, { useState } from 'react';
|
||||||
|
import { fetchTenantList } from './service';
|
||||||
|
import { useUrlSet } from '@/hooks/useUrlSet';
|
||||||
|
import style from './index.module.less';
|
||||||
|
|
||||||
|
const baseColumns = [
|
||||||
|
{
|
||||||
|
title: '序号',
|
||||||
|
dataIndex: 'id',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '租户',
|
||||||
|
dataIndex: 'tenantId',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '租户名称',
|
||||||
|
dataIndex: 'tenantName',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '负责人',
|
||||||
|
dataIndex: 'owner',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '修改时间',
|
||||||
|
dataIndex: 'gmtModified',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const Tenant: React.FC = () => {
|
||||||
|
const [editVisible, setEditVisible] = useState(false);
|
||||||
|
const [type, setType] = useState('add');
|
||||||
|
const [form] = Form.useForm();
|
||||||
|
const { setUrl } = useUrlSet({ form });
|
||||||
|
const { tableProps, search } = useAntdTable(fetchTenantList, { form });
|
||||||
|
// const {run: delete} = useRequest(fetchDeleteTenant, { manual: true });
|
||||||
|
const actions = (type: string, item?: any) => {
|
||||||
|
switch (type) {
|
||||||
|
case 'add':
|
||||||
|
setEditVisible(true);
|
||||||
|
break;
|
||||||
|
case 'edit':
|
||||||
|
setEditVisible(true);
|
||||||
|
break;
|
||||||
|
case 'delete':
|
||||||
|
// handleDelete();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const handleSearch = () => {
|
||||||
|
setUrl();
|
||||||
|
search.submit();
|
||||||
|
};
|
||||||
|
// const handleDelete = (item: any) => {
|
||||||
|
// Modal.confirm({
|
||||||
|
// title: `此操作将删除${item.tenantName}, 是否继续?`,
|
||||||
|
// onOk: () => {
|
||||||
|
// search.submit();
|
||||||
|
// },
|
||||||
|
// });
|
||||||
|
// };
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={style.tenant_wrapper}>
|
||||||
|
<Form form={form} wrapperCol={{ span: 23 }}>
|
||||||
|
<Row>
|
||||||
|
<Col span={6}>
|
||||||
|
<Form.Item name="note">
|
||||||
|
<Input placeholder="租户" />
|
||||||
|
</Form.Item>
|
||||||
|
</Col>
|
||||||
|
<Col span={18}>
|
||||||
|
<Space>
|
||||||
|
<Button onClick={() => handleSearch()} type="primary" icon={<SearchOutlined />}>
|
||||||
|
搜索
|
||||||
|
</Button>
|
||||||
|
<Button onClick={() => setEditVisible(true)} type="primary" icon={<EditOutlined />}>
|
||||||
|
添加
|
||||||
|
</Button>
|
||||||
|
</Space>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
<Row>
|
||||||
|
<Col span={6}></Col>
|
||||||
|
<Col span={18}></Col>
|
||||||
|
</Row>
|
||||||
|
</Form>
|
||||||
|
<Table
|
||||||
|
{...tableProps}
|
||||||
|
bordered
|
||||||
|
rowKey="id"
|
||||||
|
columns={[
|
||||||
|
...baseColumns,
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
key: 'action',
|
||||||
|
render: (text: string, record: any) => {
|
||||||
|
return (
|
||||||
|
<Space>
|
||||||
|
<Button onClick={() => actions('edit', record)} type="link" className={style.opreate_btn}>
|
||||||
|
编辑
|
||||||
|
</Button>
|
||||||
|
<Button onClick={() => actions('edit', record)} type="link" className={style.opreate_btn}>
|
||||||
|
删除
|
||||||
|
</Button>
|
||||||
|
</Space>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Tenant;
|
@ -0,0 +1,8 @@
|
|||||||
|
import { lazy } from 'react';
|
||||||
|
import { IRouterList } from '@/typings';
|
||||||
|
|
||||||
|
const LogManage = lazy(() => import('./index'));
|
||||||
|
|
||||||
|
const routerList: IRouterList[] = [{ path: '/log', component: () => <LogManage /> }];
|
||||||
|
|
||||||
|
export default routerList;
|
@ -0,0 +1,79 @@
|
|||||||
|
import request from '@/utils';
|
||||||
|
|
||||||
|
const fetchTenantList = async (
|
||||||
|
pageProps: { current: number; pageSize: number },
|
||||||
|
formData: { tencent: string | number }
|
||||||
|
): Promise<{ total: number; list: Array<any> }> => {
|
||||||
|
const res: any = await request('/hippo4j/v1/cs/tenant/query/page', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
Authorization:
|
||||||
|
'Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiI3LGJhb3hpbnlpX2FkbWluIiwiaXNzIjoiYWRtaW4iLCJleHAiOjE2OTUzOTg4NDksImlhdCI6MTY5NDc5NDA0OSwicm9sIjoiUk9MRV9BRE1JTiJ9.syRDshKpd-xETsSdeMPRtk956f4BJkPt4utVsUl4smgH71Woj8SUq4w2RX1YtGTC4aTZRJYdKOfkTqwK0g_dHQ',
|
||||||
|
cookie:
|
||||||
|
'Admin-Token=Bearer%20eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiI3LGJhb3hpbnlpX2FkbWluIiwiaXNzIjoiYWRtaW4iLCJleHAiOjE2OTUzOTg4NDksImlhdCI6MTY5NDc5NDA0OSwicm9sIjoiUk9MRV9BRE1JTiJ9.syRDshKpd-xETsSdeMPRtk956f4BJkPt4utVsUl4smgH71Woj8SUq4w2RX1YtGTC4aTZRJYdKOfkTqwK0g_dHQ; userName=baoxinyi_admin',
|
||||||
|
},
|
||||||
|
body: {
|
||||||
|
...formData,
|
||||||
|
current: pageProps.current,
|
||||||
|
size: pageProps.pageSize,
|
||||||
|
desc: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
if (res && res.success) {
|
||||||
|
return {
|
||||||
|
total: res.data.total,
|
||||||
|
list: res.data.records,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
throw new Error(res.msg || '服务器开小差啦~');
|
||||||
|
};
|
||||||
|
|
||||||
|
const fetchAddTenant = async (id: string) => {
|
||||||
|
const res = await request('/hippo4j/v1/cs/tenant/save', {
|
||||||
|
method: 'POST',
|
||||||
|
params: { id },
|
||||||
|
});
|
||||||
|
|
||||||
|
if (res && res.success) {
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
throw new Error(res.msg || '服务器开小差啦~');
|
||||||
|
};
|
||||||
|
|
||||||
|
const fetchDeleteTenant = async (id: string) => {
|
||||||
|
const res = await request('/tenants', {
|
||||||
|
method: 'POST',
|
||||||
|
params: { id },
|
||||||
|
});
|
||||||
|
|
||||||
|
if (res && res.success) {
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
throw new Error(res.msg || '服务器开小差啦~');
|
||||||
|
};
|
||||||
|
|
||||||
|
const fetchUpdateTenant = async (id: string) => {
|
||||||
|
const res = await request('hippo4j/v1/cs/tenant/update', {
|
||||||
|
method: 'POST',
|
||||||
|
params: { id },
|
||||||
|
});
|
||||||
|
|
||||||
|
if (res && res.success) {
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
throw new Error(res.msg || '服务器开小差啦~');
|
||||||
|
};
|
||||||
|
|
||||||
|
const fetchTenantDetail = async (id: string) => {
|
||||||
|
const res = await request('/tenants', {
|
||||||
|
method: 'POST',
|
||||||
|
params: { id },
|
||||||
|
});
|
||||||
|
|
||||||
|
if (res && res.success) {
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
throw new Error(res.msg || '服务器开小差啦~');
|
||||||
|
};
|
||||||
|
|
||||||
|
export { fetchTenantList, fetchAddTenant, fetchDeleteTenant, fetchUpdateTenant, fetchTenantDetail };
|
@ -0,0 +1,5 @@
|
|||||||
|
.tenant_wrapper {
|
||||||
|
.opreate_btn {
|
||||||
|
padding: 0px;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,5 @@
|
|||||||
|
.tenant_wrapper {
|
||||||
|
.opreate_btn {
|
||||||
|
padding: 0px;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,120 @@
|
|||||||
|
import { useAntdTable } from 'ahooks';
|
||||||
|
import { Button, Form, Input, Row, Space, Table, Col, Modal } from 'antd';
|
||||||
|
import { SearchOutlined, EditOutlined } from '@ant-design/icons';
|
||||||
|
import React, { useState } from 'react';
|
||||||
|
import { fetchTenantList } from './service';
|
||||||
|
import { useUrlSet } from '@/hooks/useUrlSet';
|
||||||
|
import style from './index.module.less';
|
||||||
|
|
||||||
|
const baseColumns = [
|
||||||
|
{
|
||||||
|
title: '序号',
|
||||||
|
dataIndex: 'id',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '租户',
|
||||||
|
dataIndex: 'tenantId',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '租户名称',
|
||||||
|
dataIndex: 'tenantName',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '负责人',
|
||||||
|
dataIndex: 'owner',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '修改时间',
|
||||||
|
dataIndex: 'gmtModified',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const Tenant: React.FC = () => {
|
||||||
|
const [editVisible, setEditVisible] = useState(false);
|
||||||
|
const [type, setType] = useState('add');
|
||||||
|
const [form] = Form.useForm();
|
||||||
|
const { setUrl } = useUrlSet({ form });
|
||||||
|
const { tableProps, search } = useAntdTable(fetchTenantList, { form });
|
||||||
|
// const {run: delete} = useRequest(fetchDeleteTenant, { manual: true });
|
||||||
|
const actions = (type: string, item?: any) => {
|
||||||
|
switch (type) {
|
||||||
|
case 'add':
|
||||||
|
setEditVisible(true);
|
||||||
|
break;
|
||||||
|
case 'edit':
|
||||||
|
setEditVisible(true);
|
||||||
|
break;
|
||||||
|
case 'delete':
|
||||||
|
// handleDelete();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const handleSearch = () => {
|
||||||
|
setUrl();
|
||||||
|
search.submit();
|
||||||
|
};
|
||||||
|
// const handleDelete = (item: any) => {
|
||||||
|
// Modal.confirm({
|
||||||
|
// title: `此操作将删除${item.tenantName}, 是否继续?`,
|
||||||
|
// onOk: () => {
|
||||||
|
// search.submit();
|
||||||
|
// },
|
||||||
|
// });
|
||||||
|
// };
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className={style.tenant_wrapper}>
|
||||||
|
<Form form={form} wrapperCol={{ span: 23 }}>
|
||||||
|
<Row>
|
||||||
|
<Col span={6}>
|
||||||
|
<Form.Item name="note">
|
||||||
|
<Input placeholder="租户" />
|
||||||
|
</Form.Item>
|
||||||
|
</Col>
|
||||||
|
<Col span={18}>
|
||||||
|
<Space>
|
||||||
|
<Button onClick={() => handleSearch()} type="primary" icon={<SearchOutlined />}>
|
||||||
|
搜索
|
||||||
|
</Button>
|
||||||
|
<Button onClick={() => setEditVisible(true)} type="primary" icon={<EditOutlined />}>
|
||||||
|
添加
|
||||||
|
</Button>
|
||||||
|
</Space>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
<Row>
|
||||||
|
<Col span={6}></Col>
|
||||||
|
<Col span={18}></Col>
|
||||||
|
</Row>
|
||||||
|
</Form>
|
||||||
|
<Table
|
||||||
|
{...tableProps}
|
||||||
|
bordered
|
||||||
|
rowKey="id"
|
||||||
|
columns={[
|
||||||
|
...baseColumns,
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
key: 'action',
|
||||||
|
render: (text: string, record: any) => {
|
||||||
|
return (
|
||||||
|
<Space>
|
||||||
|
<Button onClick={() => actions('edit', record)} type="link" className={style.opreate_btn}>
|
||||||
|
编辑
|
||||||
|
</Button>
|
||||||
|
<Button onClick={() => actions('edit', record)} type="link" className={style.opreate_btn}>
|
||||||
|
删除
|
||||||
|
</Button>
|
||||||
|
</Space>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Tenant;
|
@ -0,0 +1,8 @@
|
|||||||
|
import { lazy } from 'react';
|
||||||
|
import { IRouterList } from '@/typings';
|
||||||
|
|
||||||
|
const UserManage = lazy(() => import('./index'));
|
||||||
|
|
||||||
|
const routerList: IRouterList[] = [{ path: '/user', component: () => <UserManage /> }];
|
||||||
|
|
||||||
|
export default routerList;
|
@ -0,0 +1,79 @@
|
|||||||
|
import request from '@/utils';
|
||||||
|
|
||||||
|
const fetchTenantList = async (
|
||||||
|
pageProps: { current: number; pageSize: number },
|
||||||
|
formData: { tencent: string | number }
|
||||||
|
): Promise<{ total: number; list: Array<any> }> => {
|
||||||
|
const res: any = await request('/hippo4j/v1/cs/tenant/query/page', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
Authorization:
|
||||||
|
'Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiI3LGJhb3hpbnlpX2FkbWluIiwiaXNzIjoiYWRtaW4iLCJleHAiOjE2OTUzOTg4NDksImlhdCI6MTY5NDc5NDA0OSwicm9sIjoiUk9MRV9BRE1JTiJ9.syRDshKpd-xETsSdeMPRtk956f4BJkPt4utVsUl4smgH71Woj8SUq4w2RX1YtGTC4aTZRJYdKOfkTqwK0g_dHQ',
|
||||||
|
cookie:
|
||||||
|
'Admin-Token=Bearer%20eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiI3LGJhb3hpbnlpX2FkbWluIiwiaXNzIjoiYWRtaW4iLCJleHAiOjE2OTUzOTg4NDksImlhdCI6MTY5NDc5NDA0OSwicm9sIjoiUk9MRV9BRE1JTiJ9.syRDshKpd-xETsSdeMPRtk956f4BJkPt4utVsUl4smgH71Woj8SUq4w2RX1YtGTC4aTZRJYdKOfkTqwK0g_dHQ; userName=baoxinyi_admin',
|
||||||
|
},
|
||||||
|
body: {
|
||||||
|
...formData,
|
||||||
|
current: pageProps.current,
|
||||||
|
size: pageProps.pageSize,
|
||||||
|
desc: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
if (res && res.success) {
|
||||||
|
return {
|
||||||
|
total: res.data.total,
|
||||||
|
list: res.data.records,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
throw new Error(res.msg || '服务器开小差啦~');
|
||||||
|
};
|
||||||
|
|
||||||
|
const fetchAddTenant = async (id: string) => {
|
||||||
|
const res = await request('/hippo4j/v1/cs/tenant/save', {
|
||||||
|
method: 'POST',
|
||||||
|
params: { id },
|
||||||
|
});
|
||||||
|
|
||||||
|
if (res && res.success) {
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
throw new Error(res.msg || '服务器开小差啦~');
|
||||||
|
};
|
||||||
|
|
||||||
|
const fetchDeleteTenant = async (id: string) => {
|
||||||
|
const res = await request('/tenants', {
|
||||||
|
method: 'POST',
|
||||||
|
params: { id },
|
||||||
|
});
|
||||||
|
|
||||||
|
if (res && res.success) {
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
throw new Error(res.msg || '服务器开小差啦~');
|
||||||
|
};
|
||||||
|
|
||||||
|
const fetchUpdateTenant = async (id: string) => {
|
||||||
|
const res = await request('hippo4j/v1/cs/tenant/update', {
|
||||||
|
method: 'POST',
|
||||||
|
params: { id },
|
||||||
|
});
|
||||||
|
|
||||||
|
if (res && res.success) {
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
throw new Error(res.msg || '服务器开小差啦~');
|
||||||
|
};
|
||||||
|
|
||||||
|
const fetchTenantDetail = async (id: string) => {
|
||||||
|
const res = await request('/tenants', {
|
||||||
|
method: 'POST',
|
||||||
|
params: { id },
|
||||||
|
});
|
||||||
|
|
||||||
|
if (res && res.success) {
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
throw new Error(res.msg || '服务器开小差啦~');
|
||||||
|
};
|
||||||
|
|
||||||
|
export { fetchTenantList, fetchAddTenant, fetchDeleteTenant, fetchUpdateTenant, fetchTenantDetail };
|
Loading…
Reference in new issue