diff --git a/threadpool/console-new/src/config/theme/dark-algorithm.ts b/threadpool/console-new/src/config/theme/dark-algorithm.ts index e7d20afc..5e1fea63 100644 --- a/threadpool/console-new/src/config/theme/dark-algorithm.ts +++ b/threadpool/console-new/src/config/theme/dark-algorithm.ts @@ -2,7 +2,6 @@ import { theme } from 'antd'; import { darkDefaultTheme } from '.'; export const darkAlgorithm = { token: { - borderRadius: 6, colorPrimary: darkDefaultTheme.primary, fontSize: 14, }, @@ -14,16 +13,16 @@ export const darkAlgorithm = { Button: { fontSize: 14, }, - Table: { - // borderRadius: 0, - // borderRadiusLG: 0, - padding: 10, - paddingXS: 5, - margin: 0, - fontSize: 14, - colorBorderSecondary: darkDefaultTheme.borderColor.bl1, - paddingContentVerticalLG: 4, - }, + // Table: { + // borderRadius: 0, + // borderRadiusLG: 0, + // padding: 10, + // paddingXS: 5, + // margin: 0, + // fontSize: 14, + // colorBorderSecondary: darkDefaultTheme.borderColor.bl1, + // paddingContentVerticalLG: 4, + // }, Modal: { borderRadiusLG: 2, borderRadiusSM: 2, diff --git a/threadpool/console-new/src/config/theme/default-algnorithm.ts b/threadpool/console-new/src/config/theme/default-algnorithm.ts index be07d984..4ebe96e7 100644 --- a/threadpool/console-new/src/config/theme/default-algnorithm.ts +++ b/threadpool/console-new/src/config/theme/default-algnorithm.ts @@ -2,7 +2,6 @@ import { theme } from 'antd'; import { lightDefaultTheme } from '.'; export const defaultAlgorithm = { token: { - borderRadius: 6, colorPrimary: lightDefaultTheme.primary, fontSize: 14, // colorBgBase: lightDefaultTheme.backgroundColor.bg1, diff --git a/threadpool/console-new/src/page/tenant/index.tsx b/threadpool/console-new/src/page/tenant/index.tsx new file mode 100644 index 00000000..cecb767e --- /dev/null +++ b/threadpool/console-new/src/page/tenant/index.tsx @@ -0,0 +1,88 @@ +import { useAntdTable } from 'ahooks'; +import { Button, Form, Input, Row, Space, Table, Col } from 'antd'; +import React, { useState } from 'react'; +import { fetchTenantList } from './service'; + +const baseColumns = [ + { + title: '序号', + dataIndex: 'num', + }, + { + title: '租户', + dataIndex: 'tenant', + }, + { + title: '租户名称', + dataIndex: 'tenantName', + }, + { + title: '负责人', + dataIndex: 'creator', + }, + { + title: '修改时间', + dataIndex: 'data', + }, +]; + +const Tenant: React.FC = () => { + const [editVisible, setEditVisible] = useState(false); + const [form] = Form.useForm(); + const { tableProps, search } = useAntdTable(fetchTenantList, { form }); + const actions = (type: string) => { + switch (type) { + case 'create': + setEditVisible(true); + break; + case 'edit': + setEditVisible(true); + break; + case 'delete': + break; + default: + break; + } + }; + + return ( +
+
+ + + + + + + + + + + + + +
+ { + return ( + + + + + ); + }, + }, + ]} + /> + + ); +}; + +export default Tenant; diff --git a/threadpool/console-new/src/page/tenant/router.tsx b/threadpool/console-new/src/page/tenant/router.tsx new file mode 100644 index 00000000..d61681ae --- /dev/null +++ b/threadpool/console-new/src/page/tenant/router.tsx @@ -0,0 +1,8 @@ +import { lazy } from 'react'; +import { IRouterList } from '@/typings'; + +const Tenant = lazy(() => import('./index')); + +const routerList: IRouterList[] = [{ path: '/tenant', component: () => }]; + +export default routerList; diff --git a/threadpool/console-new/src/page/tenant/service.ts b/threadpool/console-new/src/page/tenant/service.ts new file mode 100644 index 00000000..a8b16d3d --- /dev/null +++ b/threadpool/console-new/src/page/tenant/service.ts @@ -0,0 +1,46 @@ +import request from '@/utils'; + +const fetchTenantList = async ( + pageProps: { current: number; pageSize: number }, + formData: { tencent: string | number } +) => { + // mock request + return { + total: 3, + list: [ + { + num: '1', + tenant: 'admin', + tenantName: 'admin', + creator: 'admin', + data: 'admin', + }, + ], + }; + const res = await request('/tenants', { + method: 'POST', + params: { + ...formData, + pageNum: pageProps.current, + pageSize: pageProps.pageSize, + }, + }); + + if (res && res.success) { + return { + total: 3, + list: [ + { + num: '1', + tenant: 'admin', + tenantName: 'admin', + creator: 'admin', + data: 'admin', + }, + ], + }; + } + throw new Error(res.msg || '接口异常'); +}; + +export { fetchTenantList }; diff --git a/threadpool/console-new/src/route/index.tsx b/threadpool/console-new/src/route/index.tsx index d5f6f838..bb3681ca 100644 --- a/threadpool/console-new/src/route/index.tsx +++ b/threadpool/console-new/src/route/index.tsx @@ -1,6 +1,7 @@ import { IRouterList } from '@/typings'; import homeRouter from '@/page/home/router'; import aboutRouter from '@/page/about/router'; +import tenantRouter from '@/page/tenant/router'; -const routerList: IRouterList[] = [...homeRouter, ...aboutRouter]; +const routerList: IRouterList[] = [...homeRouter, ...aboutRouter, ...tenantRouter]; export default routerList; diff --git a/threadpool/console-new/src/utils/request/index.ts b/threadpool/console-new/src/utils/request/index.ts index 89516eb9..22a2a2c6 100644 --- a/threadpool/console-new/src/utils/request/index.ts +++ b/threadpool/console-new/src/utils/request/index.ts @@ -12,8 +12,8 @@ interface HeaderConfig extends Record { interface RequestOptions { headers?: HeaderConfig; method?: HttpMethods; - params?: { [key: string]: string } | null; - body?: { [key: string]: string } | null; + params?: { [key: string]: any } | null; + body?: { [key: string]: any } | null; timeout?: number; credentials?: boolean; moda?: 'cors' | 'same-origin';