diff --git a/threadpool/console-new/package.json b/threadpool/console-new/package.json index b72766d7..43c1e5f8 100644 --- a/threadpool/console-new/package.json +++ b/threadpool/console-new/package.json @@ -5,6 +5,7 @@ "dependencies": { "@ahooksjs/use-url-state": "^3.5.1", "@ant-design/icons": "^5.2.6", + "@tanem/react-nprogress": "^5.0.51", "@testing-library/jest-dom": "^5.16.5", "@testing-library/react": "^13.4.0", "@testing-library/user-event": "^13.5.0", diff --git a/threadpool/console-new/src/page/item/index.tsx b/threadpool/console-new/src/page/item/index.tsx index a7c0b23f..8684894a 100644 --- a/threadpool/console-new/src/page/item/index.tsx +++ b/threadpool/console-new/src/page/item/index.tsx @@ -1,23 +1,23 @@ import { useAntdTable } from 'ahooks'; -import { Button, Form, Input, Row, Space, Table, Col, Modal } from 'antd'; +import { Button, Form, Input, Row, Space, Table, Col } from 'antd'; import { SearchOutlined, EditOutlined } from '@ant-design/icons'; import React, { useState } from 'react'; -import { fetchTenantList } from './service'; +import { fetchItemList } from './service'; import { useUrlSet } from '@/hooks/useUrlSet'; import style from './index.module.less'; const baseColumns = [ { title: '序号', - dataIndex: 'id', + dataIndex: 'index', }, { title: '租户', dataIndex: 'tenantId', }, { - title: '租户名称', - dataIndex: 'tenantName', + title: '项目名称', + dataIndex: 'itemName', }, { title: '负责人', @@ -34,7 +34,7 @@ const Tenant: React.FC = () => { const [type, setType] = useState('add'); const [form] = Form.useForm(); const { setUrl } = useUrlSet({ form }); - const { tableProps, search } = useAntdTable(fetchTenantList, { form }); + const { tableProps, search } = useAntdTable(fetchItemList, { form }); // const {run: delete} = useRequest(fetchDeleteTenant, { manual: true }); const actions = (type: string, item?: any) => { switch (type) { @@ -70,7 +70,7 @@ const Tenant: React.FC = () => { - + @@ -92,7 +92,7 @@ const Tenant: React.FC = () => { }> => { - const res: any = await request('/hippo4j/v1/cs/tenant/query/page', { + const res: any = await request('/hippo4j/v1/cs/item/query/page', { method: 'POST', headers: { Authorization: @@ -22,16 +22,24 @@ const fetchTenantList = async ( if (res && res.success) { return { total: res.data.total, - list: res.data.records, + list: res.data.records.map((item: any, index: number) => ({ index: index + 1, ...item })), }; } throw new Error(res.msg || '服务器开小差啦~'); }; -const fetchAddTenant = async (id: string) => { +const fetchAddTenant = async (params: { + itemDesc: string; // 项目简介 + itemId: string; // 项目 + itemName: string; // 项目名称 + owner: string; // 负责人 + tenantId: string; // 租户 + tenantDesc?: string; + tenantName?: string; +}) => { const res = await request('/hippo4j/v1/cs/tenant/save', { method: 'POST', - params: { id }, + body: { ...params }, }); if (res && res.success) { @@ -40,22 +48,10 @@ const fetchAddTenant = async (id: string) => { 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 }, +const fetchDeleteItem = async (id: string) => { + const url = 'hippo4j/v1/cs/item/delete/prescription/' + id; + const res = await request(url, { + method: 'DELETE', }); if (res && res.success) { @@ -64,8 +60,8 @@ const fetchUpdateTenant = async (id: string) => { throw new Error(res.msg || '服务器开小差啦~'); }; -const fetchTenantDetail = async (id: string) => { - const res = await request('/tenants', { +const fetchUpdateItem = async (id: string) => { + const res = await request('/hippo4j/v1/cs/item/update', { method: 'POST', params: { id }, }); @@ -76,4 +72,4 @@ const fetchTenantDetail = async (id: string) => { throw new Error(res.msg || '服务器开小差啦~'); }; -export { fetchTenantList, fetchAddTenant, fetchDeleteTenant, fetchUpdateTenant, fetchTenantDetail }; +export { fetchItemList, fetchAddTenant, fetchDeleteItem, fetchUpdateItem }; diff --git a/threadpool/console-new/src/page/user/index.tsx b/threadpool/console-new/src/page/user/index.tsx index a7c0b23f..fb2504fd 100644 --- a/threadpool/console-new/src/page/user/index.tsx +++ b/threadpool/console-new/src/page/user/index.tsx @@ -1,27 +1,27 @@ import { useAntdTable } from 'ahooks'; -import { Button, Form, Input, Row, Space, Table, Col, Modal } from 'antd'; +import { Button, Form, Input, Row, Space, Table, Col } from 'antd'; import { SearchOutlined, EditOutlined } from '@ant-design/icons'; import React, { useState } from 'react'; -import { fetchTenantList } from './service'; +import { fetchUserList } from './service'; import { useUrlSet } from '@/hooks/useUrlSet'; import style from './index.module.less'; const baseColumns = [ { title: '序号', - dataIndex: 'id', + dataIndex: 'index', }, { - title: '租户', - dataIndex: 'tenantId', + title: '用户名', + dataIndex: 'userName', }, { - title: '租户名称', - dataIndex: 'tenantName', + title: '角色', + dataIndex: 'role', }, { - title: '负责人', - dataIndex: 'owner', + title: '创建时间', + dataIndex: 'gmtCreate', }, { title: '修改时间', @@ -34,7 +34,7 @@ const Tenant: React.FC = () => { const [type, setType] = useState('add'); const [form] = Form.useForm(); const { setUrl } = useUrlSet({ form }); - const { tableProps, search } = useAntdTable(fetchTenantList, { form }); + const { tableProps, search } = useAntdTable(fetchUserList, { form }); // const {run: delete} = useRequest(fetchDeleteTenant, { manual: true }); const actions = (type: string, item?: any) => { switch (type) { @@ -70,7 +70,7 @@ const Tenant: React.FC = () => { - + @@ -92,7 +92,7 @@ const Tenant: React.FC = () => {
}> => { - const res: any = await request('/hippo4j/v1/cs/tenant/query/page', { + const res: any = await request('/hippo4j/v1/cs/auth/users/page', { method: 'POST', headers: { Authorization: @@ -16,13 +16,12 @@ const fetchTenantList = async ( ...formData, current: pageProps.current, size: pageProps.pageSize, - desc: true, }, }); if (res && res.success) { return { total: res.data.total, - list: res.data.records, + list: res.data.records.map((item: any, index: number) => ({ index: index + 1, ...item })), }; } throw new Error(res.msg || '服务器开小差啦~'); @@ -76,4 +75,4 @@ const fetchTenantDetail = async (id: string) => { throw new Error(res.msg || '服务器开小差啦~'); }; -export { fetchTenantList, fetchAddTenant, fetchDeleteTenant, fetchUpdateTenant, fetchTenantDetail }; +export { fetchUserList, fetchAddTenant, fetchDeleteTenant, fetchUpdateTenant, fetchTenantDetail };