diff --git a/config/proxy.ts b/config/proxy.ts index 78f79e5..95b1eb6 100644 --- a/config/proxy.ts +++ b/config/proxy.ts @@ -2,7 +2,7 @@ * @Author: donghao donghao@supervision.ltd * @Date: 2024-03-27 14:56:27 * @LastEditors: donghao donghao@supervision.ltd - * @LastEditTime: 2024-04-01 19:21:12 + * @LastEditTime: 2024-04-19 16:51:36 * @FilePath: \general-ai-manage\config\proxy.ts * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE */ @@ -29,7 +29,28 @@ export default { // changeOrigin: true, // }, // }, + dev: { + // localhost:8000/api/** -> https://preview.pro.ant.design/api/** + '/api/v1/': { + // 要代理的地址 + target: 'http://192.168.10.94:8999/', + // target: 'https://www.baidu.com', + // 配置了这个可以从 http 代理到 https + // 依赖 origin 的功能可能需要这个,比如 cookie + changeOrigin: true, + secure: false, + }, + // '/video_save_path/': { + // // 要代理的地址 + // target: 'http://192.168.10.96/', + // // target: 'https://www.baidu.com', + // // 配置了这个可以从 http 代理到 https + // // 依赖 origin 的功能可能需要这个,比如 cookie + // changeOrigin: true, + // secure: false, + // }, + }, /** * @name 详细的代理配置 * @doc https://github.com/chimurai/http-proxy-middleware diff --git a/config/routes.ts b/config/routes.ts index 3fcc258..b6d05ae 100644 --- a/config/routes.ts +++ b/config/routes.ts @@ -2,7 +2,7 @@ * @Author: donghao donghao@supervision.ltd * @Date: 2024-03-27 14:56:27 * @LastEditors: donghao donghao@supervision.ltd - * @LastEditTime: 2024-04-17 10:57:31 + * @LastEditTime: 2024-04-19 14:51:38 * @FilePath: \general-ai-manage\config\routes.ts * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE */ @@ -116,36 +116,46 @@ export default [ ], }, { - name: 'realTime', - path: '/realTime', + name: 'businessInfo', + path: '/businessInfo', access: 'canReadMenu', routes: [ { - name: 'realTime-involved-list', - path: '/realTime/involved-list', - component: './RealTime/InvolvedList', - access: 'canReadMenu', - }, - { - name: 'realTime-alarm-list', - path: '/realTime/alarm-list', - component: './RealTime/AlarmList', - access: 'canReadMenu', - }, - { - name: 'realTime-alarm-rules', - path: '/realTime/alarm-rules', - component: './RealTime/AlarmRules', - access: 'canReadMenu', - }, - { - name: 'realTime-device-list', - path: '/realTime/device-list', - component: './RealTime/DeviceList', + name: 'business-info-index', + path: '/businessInfo/index', + component: './Project/BusinessInfo', access: 'canReadMenu', }, + // { + // name: 'realTime-alarm-list', + // path: '/realTime/alarm-list', + // component: './RealTime/AlarmList', + // access: 'canReadMenu', + // }, + // { + // name: 'realTime-alarm-rules', + // path: '/realTime/alarm-rules', + // component: './RealTime/AlarmRules', + // access: 'canReadMenu', + // }, + // { + // name: 'realTime-device-list', + // path: '/realTime/device-list', + // component: './RealTime/DeviceList', + // access: 'canReadMenu', + // }, ], }, + { + path: '/', + redirect: '/home/business-project', + }, + { + path: '*', + layout: false, + component: './404', + }, + // test demo { path: '/admin', name: 'admin', @@ -162,13 +172,4 @@ export default [ }, ], }, - { - path: '/', - redirect: '/home/business-project', - }, - { - path: '*', - layout: false, - component: './404', - }, ]; diff --git a/mock/businessProject.ts b/mock/businessProject.ts index 76793e7..b2694bb 100644 --- a/mock/businessProject.ts +++ b/mock/businessProject.ts @@ -1,8 +1,8 @@ import { mockGetBusinessProjectData } from './pools/businessProjectData'; import { successMockApiProps } from './typing'; -import { fetchCurrPageByList } from './utils/apiMock'; +import { fetchCurrPageByList, fetchMockSuccessFullByOther } from './utils/apiMock'; export default { - // 实时分析告警列表分页 + // 企业列表 'GET /api/businessProject/': async (req: Request, res: Response) => { // get 使用 query 读取参数 const { page, pageSize } = req.query; @@ -14,4 +14,20 @@ export default { }; res.json(resData); }, + // 企业详情 + 'GET /api/businessProject/detail': async (req: Request, res: Response) => { + // get 使用 query 读取参数 + const { id } = req.query; + let finalData = {}; + mockGetBusinessProjectData.data.results.forEach((item) => { + if (item.id === Number(id)) { + finalData = item; + // break; + } + }); + const resData: successMockApiProps = fetchMockSuccessFullByOther({ + data: finalData, + }); + res.json(resData); + }, }; diff --git a/mock/pools/businessProjectData.ts b/mock/pools/businessProjectData.ts index ab257e8..2668a69 100644 --- a/mock/pools/businessProjectData.ts +++ b/mock/pools/businessProjectData.ts @@ -2,7 +2,7 @@ * @Author: donghao donghao@supervision.ltd * @Date: 2024-04-02 15:42:40 * @LastEditors: donghao donghao@supervision.ltd - * @LastEditTime: 2024-04-09 17:47:57 + * @LastEditTime: 2024-04-19 14:37:55 * @FilePath: \uighur-recognition-web2\mock\pools\warningRuleData.ts * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE */ @@ -18,67 +18,81 @@ export const mockGetBusinessProjectData = { id: '1', name: '一名科技有限公司', // 公司名称 address: '', // 公司地址 - industry: '冶金制造业', // 公司所属行业 + industry: 1002, + industryName: '制造业', // 公司所属行业 contacts: '', // 联系人 contactWay: '', // 联系方式 remark: '', // 简介 logo: '', // 企业logo - model_number: 3, // 模型数量 - device_number: 1, // 设备数量 + modelCount: 3, // 模型数量 + deviceCount: 1, // 设备数量 create_time: '2024-01-22T10:59:37', update_time: '2024-04-01T17:53:40', }, { id: '2', name: '江川科技有限公司', - industry: '冶金制造业', - model_number: 2, - device_number: 3, + industry: 1002, + industryName: '制造业', + modelCount: 2, + deviceCount: 3, create_time: '2024-01-22T10:59:37', update_time: '2024-04-01T17:53:54', }, { id: '3', name: '苏胜天信息科技有限公司', - industry: '互联网科技', - model_number: 1, - device_number: 1, + industry: 1001, + industryName: '互联网科技', + modelCount: 1, + deviceCount: 1, create_time: '2024-01-22T10:58:57', update_time: '2024-04-01T17:54:01', + province: '江苏省', + city: '南京市', + address: '雨花台区软件大道新华汇B4栋4楼', // 公司地址 + contacts: '张三', // 联系人 + contactWay: '17755551234', // 联系方式 + remark: + '南京苏胜天信息科技有限公司成立于2016,年拥有专业计算机视觉和深度学习方面的技术团队,助力制造业工业检测实现智能化,实现企业降本增效。公司核心技术是机器视觉算法,致力于自动化成套视觉检测设备。 ', }, { id: '4', name: '雅信视觉科技有限公司', // 公司名称 - industry: '互联网科技', - model_number: 3, // 模型数量 - device_number: 1, // 设备数量 + industry: 1001, + industryName: '互联网科技', + modelCount: 3, // 模型数量 + deviceCount: 1, // 设备数量 create_time: '2024-01-22T10:59:37', update_time: '2024-04-01T17:53:40', }, { id: '5', name: '超越科技有限公司', - industry: '互联网科技', - model_number: 2, - device_number: 3, + industry: 1001, + industryName: '互联网科技', + modelCount: 2, + deviceCount: 3, create_time: '2024-01-22T10:59:37', update_time: '2024-04-01T17:53:54', }, { id: '6', name: '金怡工厂', - industry: '冶金制造业', - model_number: 1, - device_number: 1, + industry: 1002, + industryName: '冶金制造业', + modelCount: 1, + deviceCount: 1, create_time: '2024-01-22T10:58:57', update_time: '2024-04-01T17:54:01', }, { id: '7', name: '乐乐五金制造', - industry: '冶金制造业', - model_number: 2, - device_number: 3, + industry: 1002, + industryName: '冶金制造业', + modelCount: 2, + deviceCount: 3, create_time: '2024-01-22T10:59:37', update_time: '2024-04-01T17:53:54', }, diff --git a/mock/user.ts b/mock/user.ts index ba97431..45b72e4 100644 --- a/mock/user.ts +++ b/mock/user.ts @@ -30,10 +30,10 @@ const getAccess = () => { // 代码中会兼容本地 service mock 以及部署站点的静态数据 export default { // 登录 - 'POST /api/base/login': async (req: Request, res: Response) => { + 'POST /api/v1/login': async (req: Request, res: Response) => { const { password, username, type } = req.body; await waitTime(1000); - if (password === 'admin123' && username === 'admin') { + if (password === 'Sju2984?' && username === 'admin') { const adminData: successMockApiProps = { ...fetchMockSuccessFullByOther(mockBaseLoginData), }; diff --git a/src/pages/Project/BusinessProject/components/businessCard.tsx b/src/pages/Project/BusinessProject/components/businessCard.tsx index 5aaebbb..bb454a5 100644 --- a/src/pages/Project/BusinessProject/components/businessCard.tsx +++ b/src/pages/Project/BusinessProject/components/businessCard.tsx @@ -2,7 +2,7 @@ * @Author: donghao donghao@supervision.ltd * @Date: 2024-04-08 16:57:30 * @LastEditors: donghao donghao@supervision.ltd - * @LastEditTime: 2024-04-19 13:55:11 + * @LastEditTime: 2024-04-19 14:24:57 * @FilePath: \general-ai-manage\src\pages\Project\BusinessProject\components\businessCard.tsx * @Description: 企业项目卡片 */ @@ -31,7 +31,7 @@ const BusinessCard: React.FC = ({ info, renderActions }) => { >
-
{info?.industry}
+
{info?.industryName}
@@ -51,14 +51,14 @@ const BusinessCard: React.FC = ({ info, renderActions }) => { 模型数量: - {info.model_number} + {info.modelCount}
  • 设备数量: - {info.device_number} + {info.deviceCount}
  • diff --git a/src/pages/User/Login/index.tsx b/src/pages/User/Login/index.tsx index 89997e4..d834d7f 100644 --- a/src/pages/User/Login/index.tsx +++ b/src/pages/User/Login/index.tsx @@ -190,7 +190,7 @@ const Login: React.FC = () => { const [form] = Form.useForm>(); useEffect(() => { - form.setFieldsValue({ username: 'admin', password: 'admin123' }); + form.setFieldsValue({ username: 'admin', password: 'Sju2984?' }); // console.log(form.getFieldsValue(), 'login_form'); }, []); diff --git a/src/services/system/Base.ts b/src/services/system/Base.ts index b409f51..de02bab 100644 --- a/src/services/system/Base.ts +++ b/src/services/system/Base.ts @@ -2,7 +2,7 @@ * @Author: donghao donghao@supervision.ltd * @Date: 2024-04-01 11:20:09 * @LastEditors: donghao donghao@supervision.ltd - * @LastEditTime: 2024-04-01 19:09:53 + * @LastEditTime: 2024-04-19 16:36:08 * @FilePath: \uighur-recognition-web2\src\services\system\Base.ts * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE */ @@ -23,7 +23,7 @@ export async function postBaseCaptcha(options?: { [key: string]: any }) { /** 用户登录 POST /base/login */ export async function postBaseLogin(body: API.Login, options?: { [key: string]: any }) { - return request(`/api/base/login`, { + return request(`/api/v1/login`, { method: 'POST', headers: { 'Content-Type': 'application/json', diff --git a/src/services/testApi/businessProject.ts b/src/services/testApi/businessProject.ts index d877477..6e48f79 100644 --- a/src/services/testApi/businessProject.ts +++ b/src/services/testApi/businessProject.ts @@ -2,7 +2,7 @@ * @Author: donghao donghao@supervision.ltd * @Date: 2024-04-09 13:46:44 * @LastEditors: donghao donghao@supervision.ltd - * @LastEditTime: 2024-04-17 14:09:35 + * @LastEditTime: 2024-04-19 14:48:49 * @FilePath: \general-ai-manage\src\services\testApi\businessProject.ts * @Description: 企业项目mock数据映射 */ @@ -26,3 +26,22 @@ export async function getBusinessProject( ...(options || {}), }); } +// 企业详情 +export async function getBusinessDetail( + body: Record, // + options?: { [key: string]: any }, +) { + return request( + `/api/businessProject/detail/`, + { + method: 'GET', + headers: { + 'Content-Type': 'application/json', + }, + params: { + ...body, + }, + ...(options || {}), + }, + ); +}