From a9134e7bf35a1688cfafd45df0b31da563e36154 Mon Sep 17 00:00:00 2001 From: donghao Date: Thu, 25 Jan 2024 18:00:34 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=B5=84=E6=BA=90=E3=80=81=E8=AE=BE?= =?UTF-8?q?=E5=A4=87mock=E6=95=B0=E6=8D=AE=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mock/algorithmModel.ts | 31 ++ mock/businessImage.ts | 28 ++ mock/device.ts | 36 +++ mock/deviceCategory.ts | 39 +++ mock/deviceGroup.ts | 47 +++ mock/menu.ts | 7 +- mock/modelCategory.ts | 33 +++ mock/modelImage.ts | 15 + mock/modelVersion.ts | 34 ++- mock/pools/algorithmModelData.ts | 118 +++++++- mock/pools/businessImageData.ts | 35 +++ mock/pools/deviceCategoryData.ts | 53 ++++ mock/pools/deviceData.ts | 83 ++++++ mock/pools/deviceGroupData.ts | 174 +++++++++++ mock/pools/modelCategoryData.ts | 44 +++ mock/pools/modelImageData.ts | 28 ++ mock/pools/modelVersionData.ts | 466 ++++++++++++++++++++++++++++- mock/pools/projectData.ts | 487 +++++++++++++++++++++++++++++++ mock/project.ts | 35 +++ mock/user.ts | 145 +++++---- mock/utils/apiMock.ts | 16 +- 21 files changed, 1868 insertions(+), 86 deletions(-) create mode 100644 mock/algorithmModel.ts create mode 100644 mock/businessImage.ts create mode 100644 mock/device.ts create mode 100644 mock/deviceCategory.ts create mode 100644 mock/deviceGroup.ts create mode 100644 mock/modelCategory.ts create mode 100644 mock/modelImage.ts create mode 100644 mock/pools/businessImageData.ts create mode 100644 mock/pools/deviceCategoryData.ts create mode 100644 mock/pools/deviceData.ts create mode 100644 mock/pools/deviceGroupData.ts create mode 100644 mock/pools/modelCategoryData.ts create mode 100644 mock/pools/modelImageData.ts create mode 100644 mock/pools/projectData.ts create mode 100644 mock/project.ts diff --git a/mock/algorithmModel.ts b/mock/algorithmModel.ts new file mode 100644 index 0000000..bd5642e --- /dev/null +++ b/mock/algorithmModel.ts @@ -0,0 +1,31 @@ +/* + * @Author: donghao donghao@supervision.ltd + * @Date: 2024-01-24 17:18:11 + * @LastEditors: donghao donghao@supervision.ltd + * @LastEditTime: 2024-01-25 13:44:15 + * @FilePath: \general-ai-platform-web\mock\modelVersion.ts + * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE + */ +/**算法模型模块 mock */ + +import { mockGetAlgorithmModelFkSelectData , mockGetAlgorithmModelListData} from './pools/algorithmModelData'; +import { successMockApiProps } from './typing'; +import { fetchCurrPageByList, fetchMockSuccessFullByOther } from './utils/apiMock'; +export default { + // 选择模型 + 'POST /api/v1/algorithm_model/getAlgorithmModelFkSelect': async (req: Request, res: Response) => { + const resData: successMockApiProps = { + ...fetchMockSuccessFullByOther(mockGetAlgorithmModelFkSelectData), + }; + res.send(resData); + }, + // 模型列表 + 'POST /api/v1/algorithm_model/getAlgorithmModelList': async (req: Request, res: Response) => { + console.log(req, 'getModelVersionList_req') + const { page , pageSize} = req.body; + const resData: successMockApiProps = { + ...fetchCurrPageByList({...mockGetAlgorithmModelListData, data: {...mockGetAlgorithmModelListData.data, page, pageSize: pageSize || 10} }), + }; + res.send(resData); + }, +}; diff --git a/mock/businessImage.ts b/mock/businessImage.ts new file mode 100644 index 0000000..5f1c6bb --- /dev/null +++ b/mock/businessImage.ts @@ -0,0 +1,28 @@ + +/**业务镜像模块 mock */ + +import { mockGetBusinessImageListData } from './pools/businessImageData'; +import { successMockApiProps } from './typing'; +import { fetchCurrPageByList } from './utils/apiMock'; +export default { + // 业务镜像列表分页 + 'POST /api/v1/business_image/getBusinessImageList': async (req: Request, res: Response) => { + const { page, pageSize } = req.body; + + const resData: successMockApiProps = { + ...fetchCurrPageByList({ + ...mockGetBusinessImageListData, + data: { ...mockGetBusinessImageListData.data, page, pageSize: pageSize || 10 }, + }), + }; + res.send(resData); + }, + + // 选择模型 + // 'POST /api/v1/model_version/getModelVersionFkSelect': async (req: Request, res: Response) => { + // const resData: successMockApiProps = { + // ...fetchMockSuccessFullByOther(mockGetModelVersionFkSelect), + // }; + // res.send(resData); + // } +}; diff --git a/mock/device.ts b/mock/device.ts new file mode 100644 index 0000000..98d60b5 --- /dev/null +++ b/mock/device.ts @@ -0,0 +1,36 @@ +/* + * @Author: donghao donghao@supervision.ltd + * @Date: 2024-01-25 16:53:15 + * @LastEditors: donghao donghao@supervision.ltd + * @LastEditTime: 2024-01-25 17:29:39 + * @FilePath: \general-ai-platform-web\mock\deviceCategory.ts + * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE + */ + +/**设备组模块 mock */ + +import { mockGetDeviceListData } from './pools/deviceData'; +import { successMockApiProps } from './typing'; +import { fetchCurrPageByList , fetchMockSuccessFullByOther} from './utils/apiMock'; +export default { + // 设备组列表分页 + 'POST /api/v1/device/getDeviceList': async (req: Request, res: Response) => { + const { page, pageSize } = req.body; + + const resData: successMockApiProps = { + ...fetchCurrPageByList({ + ...mockGetDeviceListData, + data: { ...mockGetDeviceListData.data, page, pageSize: pageSize || 10 }, + }), + }; + res.send(resData); + }, + + // 选择模型 +// 'POST /api/v1/model_version/12': async (req: Request, res: Response) => { +// const resData: successMockApiProps = { +// ...fetchMockSuccessFullByOther(mockGetDeviceGroupFkSelectData), +// }; +// res.send(resData); +// } +}; diff --git a/mock/deviceCategory.ts b/mock/deviceCategory.ts new file mode 100644 index 0000000..43439ef --- /dev/null +++ b/mock/deviceCategory.ts @@ -0,0 +1,39 @@ +/* + * @Author: donghao donghao@supervision.ltd + * @Date: 2024-01-25 16:53:15 + * @LastEditors: donghao donghao@supervision.ltd + * @LastEditTime: 2024-01-25 17:29:25 + * @FilePath: \general-ai-platform-web\mock\deviceCategory.ts + * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE + */ + +/**设备组模块 mock */ + +import { + mockGetDeviceCategoryFkSelectData, + mockGetDeviceCategoryListData, +} from './pools/deviceCategoryData'; +import { successMockApiProps } from './typing'; +import { fetchCurrPageByList , fetchMockSuccessFullByOther} from './utils/apiMock'; +export default { + // 设备组列表分页 + 'POST /api/v1/device_category/getDeviceCategoryList': async (req: Request, res: Response) => { + const { page, pageSize } = req.body; + + const resData: successMockApiProps = { + ...fetchCurrPageByList({ + ...mockGetDeviceCategoryListData, + data: { ...mockGetDeviceCategoryListData.data, page, pageSize: pageSize || 10 }, + }), + }; + res.send(resData); + }, + + // 设备类别选项列表不分页 + 'POST /api/v1/device_category/getDeviceCategoryFkSelect': async (req: Request, res: Response) => { + const resData: successMockApiProps = { + ...fetchMockSuccessFullByOther(mockGetDeviceCategoryFkSelectData), + }; + res.send(resData); + }, +}; diff --git a/mock/deviceGroup.ts b/mock/deviceGroup.ts new file mode 100644 index 0000000..50b2330 --- /dev/null +++ b/mock/deviceGroup.ts @@ -0,0 +1,47 @@ +/* + * @Author: donghao donghao@supervision.ltd + * @Date: 2024-01-25 16:53:15 + * @LastEditors: donghao donghao@supervision.ltd + * @LastEditTime: 2024-01-25 17:40:01 + * @FilePath: \general-ai-platform-web\mock\deviceCategory.ts + * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE + */ + +/**设备组模块 mock */ + +import { + mockGetDeviceGroupFkSelectData, + mockGetDeviceGroupListData, + mockGetDeviceGroupTreeData, +} from './pools/deviceGroupData'; +import { successMockApiProps } from './typing'; +import { fetchCurrPageByList, fetchMockSuccessFullByOther } from './utils/apiMock'; +export default { + // 设备组列表分页 + 'POST /api/v1/device_group/getDeviceGroupList': async (req: Request, res: Response) => { + const { page, pageSize } = req.body; + + const resData: successMockApiProps = { + ...fetchCurrPageByList({ + ...mockGetDeviceGroupListData, + data: { ...mockGetDeviceGroupListData.data, page, pageSize: pageSize || 10 }, + }), + }; + res.send(resData); + }, + + // 设备组网点选项列表 + 'POST /api/v1/device_group/getDeviceGroupFkSelect': async (req: Request, res: Response) => { + const resData: successMockApiProps = { + ...fetchMockSuccessFullByOther(mockGetDeviceGroupFkSelectData), + }; + res.send(resData); + }, + // 设备组网点树列表 + 'POST /api/v1/device_group/getDeviceGroupTree': async (req: Request, res: Response) => { + const resData: successMockApiProps = { + ...fetchMockSuccessFullByOther(mockGetDeviceGroupTreeData), + }; + res.send(resData); + }, +}; diff --git a/mock/menu.ts b/mock/menu.ts index 4f4a4f3..86bfc1b 100644 --- a/mock/menu.ts +++ b/mock/menu.ts @@ -2,11 +2,11 @@ * @Author: donghao donghao@supervision.ltd * @Date: 2023-11-01 13:56:33 * @LastEditors: donghao donghao@supervision.ltd - * @LastEditTime: 2024-01-24 17:16:51 + * @LastEditTime: 2024-01-25 11:25:29 * @FilePath: \general-ai-platform-web\mock\route.ts * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE */ -// 使用中 +/**菜单模块 mock */ import { mockGetMenuData } from './pools/menuData'; import { successMockApiProps } from './typing'; @@ -19,6 +19,5 @@ export default { ...fetchMockSuccessFullByOther(mockGetMenuData), }; res.send(resData); - }, - + } }; diff --git a/mock/modelCategory.ts b/mock/modelCategory.ts new file mode 100644 index 0000000..0b72ba9 --- /dev/null +++ b/mock/modelCategory.ts @@ -0,0 +1,33 @@ +/* + * @Author: donghao donghao@supervision.ltd + * @Date: 2024-01-25 13:34:56 + * @LastEditors: donghao donghao@supervision.ltd + * @LastEditTime: 2024-01-25 14:00:57 + * @FilePath: \general-ai-platform-web\mock\modelCategory.ts + * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE + */ +/**模型类别模块 mock */ + +import { + mockGetModelCategoryFkSelectData, + mockGetModelCategoryListData, +} from './pools/modelCategoryData'; +import { successMockApiProps } from './typing'; +import { fetchMockSuccessFullByOther } from './utils/apiMock'; +export default { + // 模型类别列表 + 'POST /api/v1/model_category/getModelCategoryList': async (req: Request, res: Response) => { + const resData: successMockApiProps = { + ...fetchMockSuccessFullByOther(mockGetModelCategoryListData), + }; + res.send(resData); + }, + + // 模型类别列表 + 'POST /api/v1/model_category/getModelCategoryFkSelect': async (req: Request, res: Response) => { + const resData: successMockApiProps = { + ...fetchMockSuccessFullByOther(mockGetModelCategoryFkSelectData), + }; + res.send(resData); + }, +}; diff --git a/mock/modelImage.ts b/mock/modelImage.ts new file mode 100644 index 0000000..f23c05c --- /dev/null +++ b/mock/modelImage.ts @@ -0,0 +1,15 @@ +/**模型镜像模块 mock */ + +import { mockGetModelImageListData } from './pools/modelImageData'; +import { successMockApiProps } from './typing'; +import { fetchCurrPageByList, fetchMockSuccessFullByOther } from './utils/apiMock'; +export default { + +// 选择模型镜像列表 +'POST /api/v1/model_image/getModelImageList': async (req: Request, res: Response) => { + const resData: successMockApiProps = { + ...fetchMockSuccessFullByOther(mockGetModelImageListData), + }; + res.send(resData); + } +}; diff --git a/mock/modelVersion.ts b/mock/modelVersion.ts index 9fe05d8..345c4a8 100644 --- a/mock/modelVersion.ts +++ b/mock/modelVersion.ts @@ -1 +1,33 @@ -// 模型版本 mock +/* + * @Author: donghao donghao@supervision.ltd + * @Date: 2024-01-24 17:18:11 + * @LastEditors: donghao donghao@supervision.ltd + * @LastEditTime: 2024-01-25 13:09:42 + * @FilePath: \general-ai-platform-web\mock\modelVersion.ts + * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE + */ +/**模型版本模块 mock */ + +import { mockGetModelVersionListData , mockGetModelVersionFkSelect} from './pools/modelVersionData'; +import { successMockApiProps } from './typing'; +import { fetchCurrPageByList, fetchMockSuccessFullByOther } from './utils/apiMock'; +export default { + // 获取模型版本列表 + 'POST /api/v1/model_version/getModelVersionList': async (req: Request, res: Response) => { + console.log(req, 'getModelVersionList_req') + const { page , pageSize} = req.body; + + const resData: successMockApiProps = { + ...fetchCurrPageByList({...mockGetModelVersionListData, data: {...mockGetModelVersionListData.data, page, pageSize: pageSize || 10} }), + }; + res.send(resData); + }, + + // 选择模型 +'POST /api/v1/model_version/getModelVersionFkSelect': async (req: Request, res: Response) => { + const resData: successMockApiProps = { + ...fetchMockSuccessFullByOther(mockGetModelVersionFkSelect), + }; + res.send(resData); + } +}; diff --git a/mock/pools/algorithmModelData.ts b/mock/pools/algorithmModelData.ts index 26a58f9..0ce3e38 100644 --- a/mock/pools/algorithmModelData.ts +++ b/mock/pools/algorithmModelData.ts @@ -2,11 +2,13 @@ * @Author: donghao donghao@supervision.ltd * @Date: 2024-01-24 16:58:15 * @LastEditors: donghao donghao@supervision.ltd - * @LastEditTime: 2024-01-24 16:58:26 + * @LastEditTime: 2024-01-25 13:42:01 * @FilePath: \general-ai-platform-web\mock\pools\algorithmModelData.ts * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE */ -/**模型版本-选择模型 */ +/**算法模型- */ + +// 选择模型 export const mockGetAlgorithmModelFkSelectData = { data: { list: [ @@ -16,7 +18,7 @@ export const mockGetAlgorithmModelFkSelectData = { defaultVersionFkId: null, }, { - name: '打瞌睡', + name: '打瞌睡123', id: 2, defaultVersionFkId: null, }, @@ -58,3 +60,113 @@ export const mockGetAlgorithmModelFkSelectData = { ], }, }; + +// 模型列表 +export const mockGetAlgorithmModelListData = { + data: { + list: [ + { + id: 10, + createTime: '2024-01-25T13:36:46.33681+08:00', + updateTime: '2024-01-25T13:36:46.33681+08:00', + name: '测试模型123', + categoryFkId: 1, + defaultVersionFkId: null, + remark: '123', + }, + { + id: 11, + createTime: '2024-01-25T13:36:46.33681+08:00', + updateTime: '2024-01-25T13:36:46.33681+08:00', + name: '测试模型1234', + categoryFkId: 1, + defaultVersionFkId: null, + remark: '123', + }, + { + id: 1, + createTime: '2023-10-20T14:00:18.456143+08:00', + updateTime: '2023-10-20T14:00:18.456143+08:00', + name: '玩手机识别', + categoryFkId: 2, + defaultVersionFkId: null, + remark: '', + }, + { + id: 2, + createTime: '2023-10-20T14:23:46.171669+08:00', + updateTime: '2023-10-20T14:23:46.171669+08:00', + name: '打瞌睡', + categoryFkId: 2, + defaultVersionFkId: null, + remark: '', + }, + { + id: 3, + createTime: '2023-10-20T14:23:56.158622+08:00', + updateTime: '2023-10-20T14:23:56.158622+08:00', + name: '离岗', + categoryFkId: 2, + defaultVersionFkId: null, + remark: '', + }, + { + id: 4, + createTime: '2023-10-21T16:04:49.320165+08:00', + updateTime: '2023-10-25T13:54:15.94921+08:00', + name: '玩手机识别1', + categoryFkId: 2, + defaultVersionFkId: 6, + remark: '', + }, + { + id: 5, + createTime: '2023-10-23T09:23:03.597298+08:00', + updateTime: '2023-10-25T13:54:27.484468+08:00', + name: '玩手机yolo1', + categoryFkId: 2, + defaultVersionFkId: 5, + remark: '', + }, + { + id: 6, + createTime: '2023-10-23T09:23:19.067037+08:00', + updateTime: '2023-10-25T13:55:23.80657+08:00', + name: '玩手机yolo2', + categoryFkId: 2, + defaultVersionFkId: 4, + remark: '', + }, + { + id: 7, + createTime: '2023-10-25T13:57:36.711626+08:00', + updateTime: '2023-10-25T13:58:14.534822+08:00', + name: '打瞌睡yolo1', + categoryFkId: 2, + defaultVersionFkId: 7, + remark: '', + }, + { + id: 8, + createTime: '2023-10-25T13:58:42.279758+08:00', + updateTime: '2023-11-09T09:44:07.929241+08:00', + name: '离岗yolo1', + categoryFkId: 2, + defaultVersionFkId: 23, + remark: '', + }, + { + id: 9, + createTime: '2023-12-26T17:18:58.490561+08:00', + updateTime: '2023-12-28T16:04:06.451455+08:00', + name: '测试模型', + categoryFkId: 2, + defaultVersionFkId: 27, + remark: '', + } + ], + total: 11, + page: 1, + pageSize: 10, + } +}; diff --git a/mock/pools/businessImageData.ts b/mock/pools/businessImageData.ts new file mode 100644 index 0000000..74ceb64 --- /dev/null +++ b/mock/pools/businessImageData.ts @@ -0,0 +1,35 @@ +/* + * @Author: donghao donghao@supervision.ltd + * @Date: 2024-01-25 16:35:15 + * @LastEditors: donghao donghao@supervision.ltd + * @LastEditTime: 2024-01-25 16:45:13 + * @FilePath: \general-ai-platform-web\mock\pools\businessImageData.ts + * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE + */ +/**业务镜像- */ + + +// 业务镜像列表分页 +export const mockGetBusinessImageListData = { + data: { + list: [ + { + id: 1, + createTime: '2024-01-25T16:36:06.575908+08:00', + updateTime: '2024-01-25T16:36:06.575908+08:00', + name: '测试123', + version: 'v1', + projectFkId: 38, + path: 'http://jingxiang.com', + startCode: '123', + config: null, + configHash: '', + remark: '', + }, + ], + total: 1, + page: 1, + pageSize: 10, + }, + }; + \ No newline at end of file diff --git a/mock/pools/deviceCategoryData.ts b/mock/pools/deviceCategoryData.ts new file mode 100644 index 0000000..2082e1f --- /dev/null +++ b/mock/pools/deviceCategoryData.ts @@ -0,0 +1,53 @@ +/* + * @Author: donghao donghao@supervision.ltd + * @Date: 2024-01-25 16:53:24 + * @LastEditors: donghao donghao@supervision.ltd + * @LastEditTime: 2024-01-25 17:34:49 + * @FilePath: \general-ai-platform-web\mock\pools\deviceCategoryData.ts + * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE + */ + +/**设备类别- */ + +// 设备类别列表分页 +export const mockGetDeviceCategoryListData = { + data: { + list: [ + { + id: 1, + createTime: '2023-10-17T10:35:41.14308+08:00', + updateTime: '2023-10-17T10:35:41.14308+08:00', + name: '监控1', + code: 'DC00002', + remark: '', + }, + { + id: 2, + createTime: '2023-10-17T10:40:28.292883+08:00', + updateTime: '2023-10-26T11:02:51.356036+08:00', + name: '控制器', + code: 'DC00003', + remark: '', + }, + ], + total: 2, + page: 1, + pageSize: 10, + }, +}; + +// 设备类别选项列表不分页 +export const mockGetDeviceCategoryFkSelectData = { + data: { + list: [ + { + name: '监控1', + id: 1, + }, + { + name: '控制器', + id: 2, + }, + ], + } +}; diff --git a/mock/pools/deviceData.ts b/mock/pools/deviceData.ts new file mode 100644 index 0000000..8e3288a --- /dev/null +++ b/mock/pools/deviceData.ts @@ -0,0 +1,83 @@ + +/**设备- */ + +// 设备列表分页 +export const mockGetDeviceListData= { + data: { + list: [ + { + id: 2, + createTime: '2023-10-17T10:47:51.629494+08:00', + updateTime: '2023-10-26T11:02:39.559715+08:00', + name: '控制设备1', + code: 'DEVICE00002', + position: '', + param: '', + spec: '', + categoryFkId: 2, + groupFkId: 3, + isEnable: true, + remark: '', + }, + { + id: 3, + createTime: '2023-10-17T14:59:28.10666+08:00', + updateTime: '2023-12-28T16:15:37.839819+08:00', + name: '监控2', + code: 'DEVICE00003', + position: '', + param: 'rtsp://192.168.10.14:8554/mystream', + spec: '', + categoryFkId: 1, + groupFkId: 3, + isEnable: true, + remark: '', + }, + { + id: 4, + createTime: '2023-10-17T15:05:53.494168+08:00', + updateTime: '2023-10-17T15:05:53.494168+08:00', + name: '监控3', + code: 'DEVICE00004', + position: '', + param: '', + spec: '', + categoryFkId: 1, + groupFkId: 5, + isEnable: true, + remark: '', + }, + { + id: 5, + createTime: '2023-10-18T17:08:22.249904+08:00', + updateTime: '2023-10-18T17:08:22.249904+08:00', + name: '监控1', + code: 'DEVICE00005', + position: '', + param: 'rtsp://admin:123456abc@192.168.10.83', + spec: '', + categoryFkId: 1, + groupFkId: 3, + isEnable: true, + remark: '', + }, + { + id: 6, + createTime: '2023-10-25T14:05:16.797145+08:00', + updateTime: '2023-10-25T15:59:06.907597+08:00', + name: '监控5', + code: 'DEVICE00006', + position: '大厅1', + param: 'rtsp://admin:@192.168.10.203', + spec: '', + categoryFkId: 1, + groupFkId: 2, + isEnable: true, + remark: '', + }, + ], + total: 5, + page: 1, + pageSize: 10, + }, +}; diff --git a/mock/pools/deviceGroupData.ts b/mock/pools/deviceGroupData.ts new file mode 100644 index 0000000..085fb67 --- /dev/null +++ b/mock/pools/deviceGroupData.ts @@ -0,0 +1,174 @@ +/* + * @Author: donghao donghao@supervision.ltd + * @Date: 2024-01-25 16:32:31 + * @LastEditors: donghao donghao@supervision.ltd + * @LastEditTime: 2024-01-25 17:33:13 + * @FilePath: \general-ai-platform-web\mock\pools\deviceGroupData.ts + * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE + */ +/**设备组- */ +// 设备组网点选项列表 +export const mockGetDeviceGroupFkSelectData = { + data: { + list: [ + { + name: '南京网点', + id: 1, + }, + { + name: '秦淮网点', + id: 2, + }, + { + name: '江宁网点', + id: 3, + }, + { + name: '安徽网点', + id: 4, + }, + { + name: '合肥网点', + id: 5, + }, + ], + }, +}; + +// 设备组网点树 +export const mockGetDeviceGroupTreeData = { + data: { + tree: [ + { + title: '南京网点1', + key: 1, + children: [ + { + title: '秦淮网点', + key: 2, + children: [], + }, + { + title: '江宁网点', + key: 3, + children: [], + }, + ], + }, + { + title: '安徽网点', + key: 4, + children: [ + { + title: '合肥网点', + key: 5, + children: [], + }, + ], + }, + ], + }, +}; + +// 设备组列表分页 +export const mockGetDeviceGroupListData = { + data: { + list: [ + { + id: 1, + createTime: '2023-10-17T10:43:31.254107+08:00', + updateTime: '2023-10-17T10:45:25.030034+08:00', + name: '南京网点', + code: 'DG00002', + address: '江苏省南京市南京市栖霞区紫东路南京紫东国际创意园', + telephone: '12345', + lon: '118.914349', + lat: '32.086019', + managerName: '张三', + managerPhone: '111111111', + isEnable: true, + parentFkId: 0, + remark: '', + children: [ + { + id: 2, + createTime: '2023-10-17T13:37:31.758471+08:00', + updateTime: '2023-10-17T13:39:31.530494+08:00', + name: '秦淮网点', + code: 'DG00003', + address: '江苏省南京市秦淮区中山南路79号', + telephone: '', + lon: '118.791819', + lat: '32.045002', + managerName: '', + managerPhone: '', + isEnable: true, + parentFkId: 1, + remark: '', + children: null, + key: '2', + }, + { + id: 3, + createTime: '2023-10-17T13:40:28.823372+08:00', + updateTime: '2023-10-17T13:40:28.823372+08:00', + name: '江宁网点', + code: 'DG00004', + address: '江苏省南京市经济技术开发区双龙大道1680号', + telephone: '', + lon: '118.824682', + lat: '31.937062', + managerName: '', + managerPhone: '', + isEnable: true, + parentFkId: 1, + remark: '', + children: null, + key: '3', + }, + ], + key: '1', + }, + { + id: 4, + createTime: '2023-10-17T15:02:30.725705+08:00', + updateTime: '2023-10-17T15:02:30.725705+08:00', + name: '安徽网点', + code: 'DG00005', + address: '', + telephone: '', + lon: '', + lat: '', + managerName: '', + managerPhone: '', + isEnable: true, + parentFkId: 0, + remark: '', + children: [ + { + id: 5, + createTime: '2023-10-17T15:05:13.542992+08:00', + updateTime: '2023-10-17T15:08:01.071315+08:00', + name: '合肥网点', + code: 'DG00006', + address: '安徽省合肥市包河区马鞍山路130号', + telephone: '', + lon: '117.309214', + lat: '31.862594', + managerName: '', + managerPhone: '', + isEnable: true, + parentFkId: 4, + remark: '', + children: null, + key: '5', + }, + ], + key: '4', + }, + ], + total: 0, + page: 1, + pageSize: 10, + }, +}; diff --git a/mock/pools/modelCategoryData.ts b/mock/pools/modelCategoryData.ts new file mode 100644 index 0000000..1c338fc --- /dev/null +++ b/mock/pools/modelCategoryData.ts @@ -0,0 +1,44 @@ +/**模型类别 */ + +// 模型列表列表分页 +export const mockGetModelCategoryListData = { + data: { + list: [ + { + id: 1, + createTime: '2023-10-19T14:42:20.743086+08:00', + updateTime: '2023-10-19T14:42:20.743086+08:00', + name: 'ocr识别1', + code: 'MC00001', + remark: '', + }, + { + id: 2, + createTime: '2023-10-20T13:55:51.395842+08:00', + updateTime: '2023-10-20T13:55:51.395842+08:00', + name: '目标识别', + code: 'MC00002', + remark: '', + }, + ], + total: 2, + page: 1, + pageSize: 10, + }, +}; + +// 模型列表不分页 +export const mockGetModelCategoryFkSelectData = { + data: { + list: [ + { + name: 'ocr识别1', + id: 1, + }, + { + name: '目标识别', + id: 2, + }, + ], + } +}; diff --git a/mock/pools/modelImageData.ts b/mock/pools/modelImageData.ts new file mode 100644 index 0000000..7e12bfa --- /dev/null +++ b/mock/pools/modelImageData.ts @@ -0,0 +1,28 @@ +/* + * @Author: donghao donghao@supervision.ltd + * @Date: 2024-01-25 09:54:36 + * @LastEditors: donghao donghao@supervision.ltd + * @LastEditTime: 2024-01-25 13:20:48 + * @FilePath: \general-ai-platform-web\mock\pools\modelImage.ts + * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE + */ +/**模型镜像-选择模型 */ +// 模型镜像列表 +export const mockGetModelImageListData = { + data: { + list: [ + { + id: 1, + createTime: '2023-12-28T10:53:15.871746+08:00', + updateTime: '2023-12-28T10:53:15.871746+08:00', + name: 'ubuntu基础1', + path: '192.168.10.60:5000/ubuntu:v1', + startCode: '', + remark: '', + }, + ], + total: 1, + page: 1, + pageSize: 10, + }, +}; diff --git a/mock/pools/modelVersionData.ts b/mock/pools/modelVersionData.ts index 0a4f03c..c4db6e5 100644 --- a/mock/pools/modelVersionData.ts +++ b/mock/pools/modelVersionData.ts @@ -2,14 +2,226 @@ * @Author: donghao donghao@supervision.ltd * @Date: 2024-01-24 16:59:35 * @LastEditors: donghao donghao@supervision.ltd - * @LastEditTime: 2024-01-24 17:06:32 + * @LastEditTime: 2024-01-25 13:24:41 * @FilePath: \general-ai-platform-web\mock\pools\modelVersionData.ts * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE */ -/**模型版本-选择模型 */ +/**模型版本 */ + +// 模型版本列表 export const mockGetModelVersionListData = { data: { list: [ + { + id: 240, + createTime: '2023-11-10T16:05:24.289341+08:00', + updateTime: '2023-11-10T16:05:24.289341+08:00', + modelFkId: 4, + version: '', + path: '测试', + modelConfig: { + params: [ + { + name: 'frame11', + default: 10, + }, + { + name: 'name11', + default: 'test', + }, + { + name: 'cews', + default: '111', + }, + ], + }, + startCode: '', + status: 1, + isEnable: true, + remark: '', + }, + { + id: 25, + createTime: '2023-11-10T16:05:53.393208+08:00', + updateTime: '2023-11-13T11:07:27.657412+08:00', + modelFkId: 6, + version: 'V1.22', + path: '////', + modelConfig: { + params: [ + { + name: 'frame', + default: 10, + }, + { + name: 'name', + default: 'test', + }, + ], + }, + startCode: '', + status: 1, + isEnable: true, + remark: '', + }, + { + id: 26, + createTime: '2023-12-26T16:58:53.617618+08:00', + updateTime: '2023-12-26T16:58:53.617618+08:00', + modelFkId: 1, + version: 'v1', + path: 'uploads/file/models/1703581116930/cddfa9c25b2c3c20ce703209385ea557_20231226165845.zip', + modelConfig: { + params: [ + { + name: 'model', + default: './model_file/yolov5_phone.onnx', + }, + { + name: 'model_cache', + default: './tensort_cache/yolov5_phone.trt', + }, + { + name: 'model_parameter', + default: { + device: 'gpu', + confidence: 0.2, + label_names: ['Keypad', 'hands', 'keyboard', 'mouse', 'phone'], + object_num_min: false, + relevancy_para: 0.001, + compara_relevancy: 'overlap', + compara_label_names: ['hands', 'phone'], + }, + }, + { + name: 'save_path', + default: false, + }, + { + name: 'test_path', + default: false, + }, + { + name: 'save_path_original', + default: false, + }, + { + name: 'save_annotations', + default: false, + }, + { + name: 'save_videos', + default: './video_save_path/hands', + }, + { + name: 'detect_time', + default: 300, + }, + { + name: 'detect_time_small', + default: 20, + }, + { + name: 'detect_ratio', + default: 0.5, + }, + { + name: 'test', + default: [ + { + eee: 'eee', + }, + { + bbb: 'bbb', + }, + ], + }, + ], + }, + startCode: '', + status: 1, + isEnable: true, + remark: '', + }, + { + id: 27, + createTime: '2023-12-26T17:19:45.436658+08:00', + updateTime: '2023-12-26T17:19:45.436658+08:00', + modelFkId: 9, + version: 'V1', + path: 'uploads/file/models/1703582356909/cddfa9c25b2c3c20ce703209385ea557_20231226171938.zip', + modelConfig: { + params: [ + { + name: 'model', + default: './model_file/yolov5_phone.onnx', + }, + { + name: 'model_cache', + default: './tensort_cache/yolov5_phone.trt', + }, + { + name: 'model_parameter', + default: { + device: 'gpu', + confidence: 0.2, + label_names: ['Keypad', 'hands', 'keyboard', 'mouse', 'phone'], + object_num_min: false, + relevancy_para: 0.001, + compara_relevancy: 'overlap', + compara_label_names: ['hands', 'phone'], + }, + }, + { + name: 'save_path', + default: false, + }, + { + name: 'test_path', + default: false, + }, + { + name: 'save_path_original', + default: false, + }, + { + name: 'save_annotations', + default: false, + }, + { + name: 'save_videos', + default: './video_save_path/hands', + }, + { + name: 'detect_time', + default: 300, + }, + { + name: 'detect_time_small', + default: 20, + }, + { + name: 'detect_ratio', + default: 0.5, + }, + { + name: 'test', + default: [ + { + eee: 'eee', + }, + { + bbb: 'bbb', + }, + ], + }, + ], + }, + startCode: '', + status: 1, + isEnable: true, + remark: '', + }, { id: 1, createTime: '2023-10-21T11:16:46.244747+08:00', @@ -165,9 +377,259 @@ export const mockGetModelVersionListData = { isEnable: true, remark: '', }, + { + id: 14, + createTime: '2023-11-03T16:47:24.709797+08:00', + updateTime: '2023-11-03T16:47:24.709797+08:00', + modelFkId: 3, + version: '', + path: 'ss', + modelConfig: { + params: [], + }, + startCode: '', + status: 1, + isEnable: true, + remark: '', + }, + { + id: 15, + createTime: '2023-11-03T16:48:31.95034+08:00', + updateTime: '2023-11-03T16:48:31.95034+08:00', + modelFkId: 3, + version: '', + path: '111', + modelConfig: { + params: [], + }, + startCode: '', + status: 1, + isEnable: true, + remark: '', + }, + { + id: 16, + createTime: '2023-11-03T16:49:41.864377+08:00', + updateTime: '2023-11-03T16:49:41.864377+08:00', + modelFkId: 2, + version: '', + path: 'aaaa', + modelConfig: { + params: [], + }, + startCode: '', + status: 1, + isEnable: true, + remark: '', + }, + { + id: 17, + createTime: '2023-11-03T16:51:14.719832+08:00', + updateTime: '2023-11-03T16:51:14.719832+08:00', + modelFkId: 2, + version: '', + path: 'sss', + modelConfig: { + params: [], + }, + startCode: '', + status: 1, + isEnable: true, + remark: '', + }, + { + id: 18, + createTime: '2023-11-03T16:54:33.550247+08:00', + updateTime: '2023-11-03T16:54:33.550247+08:00', + modelFkId: 2, + version: '', + path: 'sss', + modelConfig: { + params: [], + }, + startCode: '', + status: 1, + isEnable: true, + remark: '', + }, + { + id: 19, + createTime: '2023-11-03T16:56:04.760163+08:00', + updateTime: '2023-11-03T16:56:04.760163+08:00', + modelFkId: 3, + version: '', + path: 'sss', + modelConfig: { + params: [], + }, + startCode: '', + status: 1, + isEnable: true, + remark: '', + }, + { + id: 20, + createTime: '2023-11-03T16:56:56.39397+08:00', + updateTime: '2023-11-03T16:56:56.39397+08:00', + modelFkId: 3, + version: '', + path: 'ddd', + modelConfig: { + params: [], + }, + startCode: '', + status: 1, + isEnable: true, + remark: '', + }, + { + id: 21, + createTime: '2023-11-03T16:57:43.040174+08:00', + updateTime: '2023-11-03T16:57:43.040174+08:00', + modelFkId: 2, + version: '', + path: 'aaa', + modelConfig: { + params: [], + }, + startCode: '', + status: 1, + isEnable: true, + remark: '', + }, + { + id: 22, + createTime: '2023-11-03T16:59:59.243265+08:00', + updateTime: '2023-11-03T16:59:59.243265+08:00', + modelFkId: 1, + version: '', + path: 'aaa', + modelConfig: { + params: [ + { + name: 'model', + remark: '1', + default: './model_file/yolov5_phone.onnx', + }, + { + name: 'model_cache', + remark: '2', + default: './tensort_cache/yolov5_phone.trt', + }, + ], + }, + startCode: '', + status: 1, + isEnable: true, + remark: '', + }, + { + id: 23, + createTime: '2023-11-09T09:43:51.549764+08:00', + updateTime: '2023-11-09T09:43:51.549764+08:00', + modelFkId: 8, + version: 'V1.1', + path: 'fff', + modelConfig: { + params: [ + { + name: 'model', + default: './model_file/yolov5_phone.onnx', + }, + { + name: 'model_cache', + default: './tensort_cache/yolov5_phone.trt', + }, + { + name: 'save_path', + default: false, + }, + { + name: 'test_path', + default: false, + }, + { + name: 'save_path_original', + default: false, + }, + { + name: 'save_annotations', + default: false, + }, + { + name: 'save_videos', + default: './video_save_path/hands', + }, + { + name: 'detect_time', + default: 300, + }, + { + name: 'detect_time_small', + default: 20, + }, + { + name: 'detect_ratio', + default: 0.5, + }, + ], + }, + startCode: '', + status: 1, + isEnable: true, + remark: '', + }, ], total: 24, page: 1, pageSize: 10, }, }; + +// 模型版本-选择 +export const mockGetModelVersionFkSelect = { + data: { + list: [ + { + name: 'V1.0001', + id: 1, + }, + { + name: 'V1.2', + id: 2, + }, + { + name: 'V1.1', + id: 3, + }, + { + name: 'v1', + id: 26, + }, + { + name: 'V1', + id: 27, + }, + { + name: 'V11', + id: 5, + }, + { + name: 'V1.0', + id: 7, + }, + { + name: 'V1.0', + id: 8, + }, + { + name: '', + id: 11, + }, + { + name: '', + id: 12, + }, + ], + } +}; diff --git a/mock/pools/projectData.ts b/mock/pools/projectData.ts new file mode 100644 index 0000000..1f94b14 --- /dev/null +++ b/mock/pools/projectData.ts @@ -0,0 +1,487 @@ +/* + * @Author: donghao donghao@supervision.ltd + * @Date: 2024-01-25 16:43:31 + * @LastEditors: donghao donghao@supervision.ltd + * @LastEditTime: 2024-01-25 17:43:43 + * @FilePath: \general-ai-platform-web\mock\pools\projectData.ts + * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE + */ +/**项目- */ + +// 项目选项 (不分页) +export const mockGetProjectFkSelectData = { + data: { + list: [ + { + name: '玩手机1', + id: 38, + }, + { + name: '离岗检测', + id: 40, + }, + { + name: '打瞌睡检测', + id: 39, + }, + { + name: '测试', + id: 42, + }, + { + name: '测试1', + id: 43, + }, + { + name: '测试2', + id: 44, + }, + { + name: '测试4', + id: 46, + }, + { + name: '测试5', + id: 47, + }, + { + name: '测试6', + id: 48, + }, + { + name: '测试7', + id: 49, + }, + ], + }, +}; + +// 项目列表 分页 +export const mockGetProjectListData = { + data: { + list: [ + { + id: 38, + createTime: '2023-10-24T14:03:52.959113+08:00', + updateTime: '2023-10-24T14:03:52.959113+08:00', + name: '玩手机1', + code: 'XM00038', + info: '玩手机', + projectFilePath: + 'uploads/file/project/files/da9c3e5bd8bdf5026aa47bee87e81ccc_20231024140343.zip', + inferConfig: { + models: [5], + params: [], + }, + isEnable: true, + groupIds: null, + remark: '', + }, + { + id: 39, + createTime: '2023-10-25T13:06:28.092394+08:00', + updateTime: '2023-10-25T13:06:28.092394+08:00', + name: '打瞌睡检测', + code: 'XM00039', + info: '打瞌睡', + projectFilePath: '', + inferConfig: { + models: [7], + params: [], + }, + isEnable: true, + groupIds: null, + remark: '', + }, + { + id: 40, + createTime: '2023-10-25T14:01:24.985459+08:00', + updateTime: '2023-10-25T14:01:24.985459+08:00', + name: '离岗检测', + code: 'XM00040', + info: '离岗检测', + projectFilePath: '', + inferConfig: { + models: [8], + params: [], + }, + isEnable: true, + groupIds: null, + remark: '', + }, + { + id: 42, + createTime: '2023-11-06T10:11:06.735872+08:00', + updateTime: '2023-11-06T10:11:06.735872+08:00', + name: '测试', + code: 'XM00042', + info: '测试1', + projectFilePath: '', + inferConfig: { + models: [1], + params: [ + { + name: 'model', + default: './model_file/yolov5_phone.onnx', + }, + { + name: 'model_cache', + default: './tensort_cache/yolov5_phone.trt', + }, + { + name: 'model_parameter', + default: { + device: 'gpu', + confidence: 0.2, + label_names: ['Keypad', 'hands', 'keyboard', 'mouse', 'phone'], + object_num_min: false, + relevancy_para: 0.001, + compara_relevancy: 'overlap', + compara_label_names: ['hands', 'phone'], + }, + }, + { + name: 'save_path', + default: false, + }, + { + name: 'test_path', + default: false, + }, + { + name: 'save_path_original', + default: false, + }, + { + name: 'save_annotations', + default: false, + }, + { + name: 'save_videos', + default: './video_save_path/hands', + }, + { + name: 'detect_time', + default: 300, + }, + { + name: 'detect_time_small', + default: 20, + }, + { + name: 'detect_ratio', + default: 0.5, + }, + ], + }, + isEnable: true, + groupIds: null, + remark: '', + }, + { + id: 43, + createTime: '2023-11-06T13:40:16.031088+08:00', + updateTime: '2023-11-06T13:40:16.031088+08:00', + name: '测试1', + code: 'XM00043', + info: '测试1', + projectFilePath: '', + inferConfig: { + models: [1], + params: [ + { + name: 'model', + default: './model_file/yolov5_phone.onnx', + }, + { + name: 'model_cache', + default: './tensort_cache/yolov5_phone.trt', + }, + { + name: 'model_parameter', + default: { + device: 'gpu', + confidence: 0.2, + label_names: ['Keypad', 'hands', 'keyboard', 'mouse', 'phone'], + object_num_min: false, + relevancy_para: 0.001, + compara_relevancy: 'overlap', + compara_label_names: ['hands', 'phone'], + }, + }, + { + name: 'save_path', + default: false, + }, + { + name: 'test_path', + default: false, + }, + { + name: 'save_path_original', + default: false, + }, + { + name: 'save_annotations', + default: false, + }, + { + name: 'save_videos', + default: './video_save_path/hands', + }, + { + name: 'detect_time', + default: 300, + }, + { + name: 'detect_time_small', + default: 20, + }, + { + name: 'detect_ratio', + default: 0.5, + }, + { + name: 'test', + default: [ + { + eee: 'eee', + }, + { + bbb: 'bbb', + }, + ], + }, + ], + }, + isEnable: true, + groupIds: null, + remark: '', + }, + { + id: 44, + createTime: '2023-11-06T13:41:20.873017+08:00', + updateTime: '2023-11-06T13:41:20.873017+08:00', + name: '测试2', + code: 'XM00044', + info: '测试2', + projectFilePath: '', + inferConfig: { + models: [1], + params: [ + { + name: 'model', + default: './model_file/yolov5_phone.onnx', + }, + { + name: 'model_cache', + default: './tensort_cache/yolov5_phone.trt', + }, + { + name: 'save_path', + default: false, + }, + { + name: 'test_path', + default: false, + }, + { + name: 'save_path_original', + default: false, + }, + { + name: 'save_annotations', + default: false, + }, + { + name: 'save_videos', + default: './video_save_path/hands', + }, + { + name: 'detect_time', + default: 300, + }, + { + name: 'detect_time_small', + default: 20, + }, + { + name: 'detect_ratio', + default: 0.5, + }, + ], + }, + isEnable: true, + groupIds: null, + remark: '', + }, + { + id: 46, + createTime: '2023-11-06T16:20:16.19561+08:00', + updateTime: '2023-11-06T16:20:16.19561+08:00', + name: '测试4', + code: 'XM00046', + info: '测试4', + projectFilePath: '', + inferConfig: { + models: [8], + params: [ + { + name: 'model', + default: './model_file/yolov5_phone.onnx', + }, + { + name: 'model_cache', + default: './tensort_cache/yolov5_phone.trt', + }, + { + name: 'save_path', + default: false, + }, + { + name: 'test_path', + default: false, + }, + { + name: 'save_path_original', + default: false, + }, + { + name: 'save_annotations', + default: false, + }, + { + name: 'save_videos', + default: './video_save_path/hands', + }, + { + name: 'detect_time', + default: 300, + }, + { + name: 'detect_time_small', + default: 20, + }, + { + name: 'detect_ratio', + default: 0.5, + }, + ], + }, + isEnable: true, + groupIds: null, + remark: '', + }, + { + id: 47, + createTime: '2023-11-06T16:29:11.765524+08:00', + updateTime: '2023-11-06T16:29:11.765524+08:00', + name: '测试5', + code: 'XM00047', + info: '测试5', + projectFilePath: '', + inferConfig: { + models: [7, 6], + params: [ + { + name: 'model', + default: './model_file/yolov5_phone.onnx', + }, + { + name: 'model_cache', + default: './tensort_cache/yolov5_phone.trt', + }, + { + name: 'save_path', + default: false, + }, + { + name: 'test_path', + default: false, + }, + { + name: 'save_path_original', + default: false, + }, + { + name: 'save_annotations', + default: false, + }, + { + name: 'save_videos', + default: './video_save_path/hands', + }, + { + name: 'detect_time', + default: 300, + }, + { + name: 'detect_time_small', + default: 20, + }, + { + name: 'detect_ratio', + default: 0.5, + }, + ], + }, + isEnable: true, + groupIds: null, + remark: '', + }, + { + id: 48, + createTime: '2023-11-07T16:17:51.448947+08:00', + updateTime: '2023-11-07T16:17:51.448947+08:00', + name: '测试6', + code: 'XM00048', + info: '测试6', + projectFilePath: '', + inferConfig: { + models: [8, 7, 6], + params: [ + { + name: 'model', + default: './model_file/yolov5_phone.onnx', + }, + { + name: 'model_cache', + default: './tensort_cache/yolov5_phone.trt', + }, + ], + }, + isEnable: true, + groupIds: null, + remark: '', + }, + { + id: 49, + createTime: '2023-11-07T16:22:03.174411+08:00', + updateTime: '2023-11-07T16:22:03.174411+08:00', + name: '测试7', + code: 'XM00049', + info: '测试7', + projectFilePath: '', + inferConfig: { + models: [8, 7, 6], + params: [ + { + name: 'model', + default: './model_file/yolov5_phone.onnx', + }, + { + name: 'model_cache', + default: './tensort_cache/yolov5_phone.trt', + }, + ], + }, + isEnable: true, + groupIds: null, + remark: '', + }, + ], + total: 27, + page: 1, + pageSize: 10, + }, +}; diff --git a/mock/project.ts b/mock/project.ts new file mode 100644 index 0000000..7dd37fb --- /dev/null +++ b/mock/project.ts @@ -0,0 +1,35 @@ +/* + * @Author: donghao donghao@supervision.ltd + * @Date: 2024-01-25 14:07:33 + * @LastEditors: donghao donghao@supervision.ltd + * @LastEditTime: 2024-01-25 17:43:22 + * @FilePath: \general-ai-platform-web\mock\project.ts + * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE + */ +/**项目模块 mock */ + +import { mockGetProjectFkSelectData, mockGetProjectListData } from './pools/projectData'; +import { successMockApiProps } from './typing'; +import { fetchCurrPageByList, fetchMockSuccessFullByOther } from './utils/apiMock'; +export default { + // 项目选项 + 'POST /api/v1/project/getProjectFkSelect': async (req: Request, res: Response) => { + const resData: successMockApiProps = { + ...fetchMockSuccessFullByOther(mockGetProjectFkSelectData), + }; + res.send(resData); + }, + + // 项目列表分页 + 'POST /api/v1/project/getProjectList': async (req: Request, res: Response) => { + const { page, pageSize } = req.body; + + const resData: successMockApiProps = { + ...fetchCurrPageByList({ + ...mockGetProjectListData, + data: { ...mockGetProjectListData.data, page, pageSize: pageSize || 10 }, + }), + }; + res.send(resData); + }, +}; diff --git a/mock/user.ts b/mock/user.ts index f4266a0..7a1f5f2 100644 --- a/mock/user.ts +++ b/mock/user.ts @@ -1,4 +1,5 @@ -// 用户 mock +/**用户模块 mock */ + import { Request, Response } from 'express'; import { mockBaseCaptchaData, mockBaseLoginData, mockGetUserInfoData } from './pools/userData'; @@ -13,11 +14,6 @@ const waitTime = (time: number = 100) => { }); }; -async function getFakeCaptcha(req: Request, res: Response) { - await waitTime(2000); - return res.json('captcha-xxx'); -} - const { ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION } = process.env; /** @@ -33,6 +29,74 @@ const getAccess = () => { // 代码中会兼容本地 service mock 以及部署站点的静态数据 export default { + // 登录 + 'POST /api/v1/base/login': async (req: Request, res: Response) => { + const { password, username, type } = req.body; + await waitTime(1000); + if (password === '123456' && username === 'admin') { + const adminData: successMockApiProps = { + ...fetchMockSuccessFullByOther(mockBaseLoginData), + }; + res.send(adminData); + access = 'admin'; + return; + } + // TODO 以下未做任何处理 + // if (password === 'ant.design' && username === 'user') { + // res.send({ + // status: 'ok', + // type, + // currentAuthority: 'user', + // }); + // access = 'user'; + // return; + // } + // if (type === 'mobile') { + // res.send({ + // status: 'ok', + // type, + // currentAuthority: 'admin', + // }); + // access = 'admin'; + // return; + // } + const failData: failMockApiProps = { + ...fetchMockFailFullByOther({ + data: {}, + msg: '账号或者密码错误', + }), + }; + res.send(failData as failMockApiProps); + access = 'guest'; + }, + // 获取用户信息 + 'GET /api/v1/user/getUserInfo': async (req: Request, res: Response) => { + await waitTime(1000); + const adminData: successMockApiProps = { + ...fetchMockSuccessFullByOther(mockGetUserInfoData), + }; + res.send(adminData); + access = 'admin'; + }, + // 获取图形验证码 + 'POST /api/v1/base/captcha': (req: Request, res: Response) => { + const resData: successMockApiProps = { + ...fetchMockSuccessFullByOther(mockBaseCaptchaData), + }; + res.send(resData); + }, + // 登出 + 'POST /api/v1/jwt/jsonInBlacklist': (req: Request, res: Response) => { + const resData: successMockApiProps = { + ...fetchMockSuccessFullByOther({ data: {}, msg: 'jwt作废成功' }), + }; + res.send(resData); + }, + // TODO 以下未使用 + 'POST /api/login/outLogin': (req: Request, res: Response) => { + access = ''; + res.send({ data: {}, success: true }); + }, // 支持值为 Object 和 Array 'GET /api/currentUser': (req: Request, res: Response) => { if (!getAccess()) { @@ -122,75 +186,6 @@ export default { address: 'Sidney No. 1 Lake Park', }, ], - - // 登录 - 'POST /api/v1/base/login': async (req: Request, res: Response) => { - const { password, username, type } = req.body; - await waitTime(1000); - if (password === '123456' && username === 'admin') { - const adminData: successMockApiProps = { - ...fetchMockSuccessFullByOther(mockBaseLoginData), - }; - res.send(adminData); - access = 'admin'; - return; - } - // TODO 以下未做任何处理 - // if (password === 'ant.design' && username === 'user') { - // res.send({ - // status: 'ok', - // type, - // currentAuthority: 'user', - // }); - // access = 'user'; - // return; - // } - // if (type === 'mobile') { - // res.send({ - // status: 'ok', - // type, - // currentAuthority: 'admin', - // }); - // access = 'admin'; - // return; - // } - const failData: failMockApiProps = { - ...fetchMockFailFullByOther({ - data: {}, - msg: '账号或者密码错误', - }), - }; - res.send(failData as failMockApiProps); - access = 'guest'; - }, - // 获取用户信息 - 'GET /api/v1/user/getUserInfo': async (req: Request, res: Response) => { - await waitTime(1000); - const adminData: successMockApiProps = { - ...fetchMockSuccessFullByOther(mockGetUserInfoData), - }; - res.send(adminData); - access = 'admin'; - }, - // 获取图形验证码 - 'POST /api/v1/base/captcha': (req: Request, res: Response) => { - const resData: successMockApiProps = { - ...fetchMockSuccessFullByOther(mockBaseCaptchaData), - }; - res.send(resData); - }, - // 登出 - 'POST /api/v1/jwt/jsonInBlacklist': (req: Request, res: Response) => { - const resData: successMockApiProps = { - ...fetchMockSuccessFullByOther({ data: {}, msg: 'jwt作废成功' }), - }; - res.send(resData); - }, - - 'POST /api/login/outLogin': (req: Request, res: Response) => { - access = ''; - res.send({ data: {}, success: true }); - }, 'POST /api/register': (req: Request, res: Response) => { res.send({ status: 'ok', currentAuthority: 'user', success: true }); }, diff --git a/mock/utils/apiMock.ts b/mock/utils/apiMock.ts index 87ae854..5dd8867 100644 --- a/mock/utils/apiMock.ts +++ b/mock/utils/apiMock.ts @@ -2,7 +2,7 @@ * @Author: donghao donghao@supervision.ltd * @Date: 2024-01-24 15:08:23 * @LastEditors: donghao donghao@supervision.ltd - * @LastEditTime: 2024-01-24 17:00:49 + * @LastEditTime: 2024-01-25 11:05:32 * @FilePath: \general-ai-platform-web\mock\utils\apiMock.ts * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE */ @@ -27,3 +27,17 @@ export function fetchMockFailFullByOther({ data, msg }): failMockApiProps { isMock: true, // true 标识当前是模拟数据 } as failMockApiProps; } + +// 分页展示 +export function fetchCurrPageByList({ data }): successMockApiProps { + console.log("fetchCurrPageByList_data", data) + const { page, pageSize } = data; + const prevPage = page - 1; + const currPageData = { + ...data, + list: data.list.slice(prevPage * pageSize, page * pageSize), + }; + return fetchMockSuccessFullByOther({ data: currPageData }); +} + +