diff --git a/config/defaultForm.ts b/config/defaultForm.ts index b4b33d9..52a9151 100644 --- a/config/defaultForm.ts +++ b/config/defaultForm.ts @@ -2,7 +2,7 @@ * @Author: zhoux zhouxia@supervision.ltd * @Date: 2023-11-13 14:19:57 * @LastEditors: donghao donghao@supervision.ltd - * @LastEditTime: 2024-04-18 16:47:39 + * @LastEditTime: 2024-04-25 16:25:44 * @FilePath: \general-ai-platform-web\config\defaultForm.ts * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE2 */ @@ -42,7 +42,7 @@ export const proFormItemStyleProps: Record = { }; // max 968 -export const proFormMaxModelWidth: number = 968; +export const proFormMaxModelWidth: number = 920; export const proFormMaxItemStyleProps: Record = { width: proFormMaxModelWidth - formBoxMargin, column2Width: (proFormMaxModelWidth - formBoxMargin - formItemGap) / 2, // 两列 diff --git a/mock/businessModel.ts b/mock/businessModel.ts new file mode 100644 index 0000000..8ec2632 --- /dev/null +++ b/mock/businessModel.ts @@ -0,0 +1,40 @@ +/* + * @Author: donghao donghao@supervision.ltd + * @Date: 2024-04-24 17:57:58 + * @LastEditors: donghao donghao@supervision.ltd + * @LastEditTime: 2024-04-25 15:20:55 + * @FilePath: \general-ai-platform-web\mock\businessModel.ts + * @Description: mock 业务模型 api + */ +import { + mockGetBaseBusinessModelListData, + mockGetBusinessModelListData, +} from './pools/businessModelData'; +import { successMockApiProps } from './typing'; +import { fetchCurrPageByList } from './utils/apiMock'; +export default { + // 企业业务模型列表 + 'GET /api/businessModel/list': async (req: Request, res: Response) => { + // get 使用 query 读取参数 + const { page, pageSize } = req.query; + const resData: successMockApiProps = { + ...fetchCurrPageByList({ + ...mockGetBusinessModelListData, + data: { ...mockGetBusinessModelListData.data, page, pageSize: pageSize || 10 }, + }), + }; + res.json(resData); + }, + // 企业基础业务模型列表 + 'GET /api/businessModel/base/list': async (req: Request, res: Response) => { + // get 使用 query 读取参数 + const { page, pageSize } = req.query; + const resData: successMockApiProps = { + ...fetchCurrPageByList({ + ...mockGetBaseBusinessModelListData, + data: { ...mockGetBaseBusinessModelListData.data, page, pageSize: pageSize || 10 }, + }), + }; + res.json(resData); + }, +}; diff --git a/mock/device.ts b/mock/device.ts deleted file mode 100644 index 921de8c..0000000 --- a/mock/device.ts +++ /dev/null @@ -1,38 +0,0 @@ -/* - * @Author: donghao donghao@supervision.ltd - * @Date: 2024-04-02 16:28:13 - * @LastEditors: donghao donghao@supervision.ltd - * @LastEditTime: 2024-04-02 17:53:29 - * @FilePath: \uighur-recognition-web2\mock\device.ts - * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE - */ -/**告警列表模块 mock */ -import { mockGetDeviceData, mockGetUploadDeviceData } from './pools/deviceData'; -import { successMockApiProps } from './typing'; -import { fetchCurrPageByList } from './utils/apiMock'; -export default { - // 实时分析告警列表分页 - 'GET /api/device/': async (req: Request, res: Response) => { - // get 使用 query 读取参数 - const { page, pageSize } = req.query; - const resData: successMockApiProps = { - ...fetchCurrPageByList({ - ...mockGetDeviceData, - data: { ...mockGetDeviceData.data, page, pageSize: pageSize || 10 }, - }), - }; - res.json(resData); - }, - // 离线分析告警列表分页 - 'GET /api/upload_device/': async (req: Request, res: Response) => { - // get 使用 query 读取参数 - const { page, pageSize } = req.query; - const resData: successMockApiProps = { - ...fetchCurrPageByList({ - ...mockGetUploadDeviceData, - data: { ...mockGetUploadDeviceData.data, page, pageSize: pageSize || 10 }, - }), - }; - res.json(resData); - }, -}; diff --git a/mock/deviceGroup.ts b/mock/deviceGroup.ts new file mode 100644 index 0000000..d1eaf50 --- /dev/null +++ b/mock/deviceGroup.ts @@ -0,0 +1,67 @@ +/* + * @Author: donghao donghao@supervision.ltd + * @Date: 2024-01-25 16:53:15 + * @LastEditors: donghao donghao@supervision.ltd + * @LastEditTime: 2024-04-25 15:50:16 + * @FilePath: \general-ai-platform-web\mock\deviceGroup.ts + * @Description: 节点设备设置 mock + */ +import { + mockGetDeviceGroupData1, + mockGetDeviceGroupData2, + mockGetDeviceGroupData3, + mockGetDeviceGroupFkSelectData, + mockGetDeviceGroupListData, + mockGetDeviceGroupTreeData, +} from './pools/deviceGroupData'; +import { successMockApiProps } from './typing'; +import { fetchCurrPageByList, fetchMockSuccessFullByOther } from './utils/apiMock'; +export default { + // 设备组列表分页 + 'GET /api/device_group/getDeviceGroupList': async (req: Request, res: Response) => { + const { page, pageSize } = req.query; + const resData: successMockApiProps = { + ...fetchCurrPageByList({ + ...mockGetDeviceGroupListData, + data: { ...mockGetDeviceGroupListData.data, page, pageSize: pageSize || 10 }, + }), + }; + res.json(resData); + }, + + // 设备组网点选项列表 + 'GET /api/device_group/getDeviceGroupFkSelect': async (req: Request, res: Response) => { + const resData: successMockApiProps = { + ...fetchMockSuccessFullByOther(mockGetDeviceGroupFkSelectData), + }; + res.json(resData); + }, + // 设备组网点树列表 + 'GET /api/device_group/getDeviceGroupTree': async (req: Request, res: Response) => { + const resData: successMockApiProps = { + ...fetchMockSuccessFullByOther(mockGetDeviceGroupTreeData), + }; + res.json(resData); + }, + // 设备组详情 + 'GET /api/device_group/getDeviceGroupById': async (req: Request, res: Response) => { + const { id } = req.query; + let currRes = {}; + switch (Number(id)) { + case 2: + currRes = mockGetDeviceGroupData1; + break; + case 3: + currRes = mockGetDeviceGroupData2; + break; + case 5: + currRes = mockGetDeviceGroupData3; + break; + } + + const resData: successMockApiProps = { + ...fetchMockSuccessFullByOther(currRes), + }; + res.json(resData); + }, +}; diff --git a/mock/model.ts b/mock/model.ts index 699527e..e2574b9 100644 --- a/mock/model.ts +++ b/mock/model.ts @@ -2,9 +2,9 @@ * @Author: donghao donghao@supervision.ltd * @Date: 2024-04-11 14:13:34 * @LastEditors: donghao donghao@supervision.ltd - * @LastEditTime: 2024-04-18 09:10:26 + * @LastEditTime: 2024-04-24 17:58:27 * @FilePath: \general-ai-manage\mock\model.ts - * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE + * @Description: mock 模型 api */ /**模型管理模块 mock */ diff --git a/mock/pools/businessModelData.ts b/mock/pools/businessModelData.ts new file mode 100644 index 0000000..8d1a5ed --- /dev/null +++ b/mock/pools/businessModelData.ts @@ -0,0 +1,86 @@ +/* + * @Author: donghao donghao@supervision.ltd + * @Date: 2024-04-24 17:51:07 + * @LastEditors: donghao donghao@supervision.ltd + * @LastEditTime: 2024-04-25 15:19:23 + * @FilePath: \general-ai-platform-web\mock\pools\businessModelData.ts + * @Description: mock 业务模型数据 + */ +import { generateRandomString } from '../utils/mockHash'; +import { generateRandomDateTimeByYear } from '../utils/mockMoment'; + +// 模型列表 +const startBusinessModelList = () => { + const currList: Record[] = []; + const nameArr = ['陌生人群检测', '在岗打瞌睡检测', '上班离岗检测']; + const count = nameArr.length; + const baseVersion = 'V' + Math.floor(Math.random() * 10); + const currFileTime = new Date().getTime(); + const randomString = generateRandomString(20); + // const hash = generateHash(randomString) + for (let i = 0; i < count; i++) { + const isEnable = i === 0; + currList.push({ + id: i + '1', + createTime: generateRandomDateTimeByYear(2022), + updateTime: generateRandomDateTimeByYear(2023), + industry: '通用', + name: nameArr[i], + deviceSort: '文字识别', + remark: + '光学字符识别(OCR)是可进行字体训练的工具,用于自动识别字符。它可以防止误读、处理流程变化并提供轻松的字体管理。', + defaultVersionFkId: 'V1.6.25', + type: '经典算法', + provider: '苏胜天', + }); + } + return { + count, + results: currList, + }; +}; + +export const mockGetBusinessModelListData = { + data: { + next: null, + previous: null, + ...JSON.parse(JSON.stringify(startBusinessModelList())), + }, +}; + +// 基础模型列表 +const startBaseBusinessModelList = () => { + const currList: Record[] = []; + const nameArr = ['玩手机识别', '打瞌睡识别', '离岗检测']; + const count = nameArr.length; + const baseVersion = 'V' + Math.floor(Math.random() * 10); + const currFileTime = new Date().getTime(); + const randomString = generateRandomString(20); + // const hash = generateHash(randomString) + for (let i = 0; i < count; i++) { + const isEnable = i === 0; + currList.push({ + id: i + '1', + createTime: generateRandomDateTimeByYear(2022), + updateTime: generateRandomDateTimeByYear(2023), + industry: '通用', + name: nameArr[i], + deviceSort: '文字识别', + defaultVersionFkId: 'V1.6.25', + type: '经典算法', + provider: '苏胜天', + }); + } + return { + count, + results: currList, + }; +}; + +export const mockGetBaseBusinessModelListData = { + data: { + next: null, + previous: null, + ...startBaseBusinessModelList(), + }, +}; diff --git a/mock/pools/deviceData.ts b/mock/pools/deviceData.ts deleted file mode 100644 index f2d39db..0000000 --- a/mock/pools/deviceData.ts +++ /dev/null @@ -1,159 +0,0 @@ -/* - * @Author: donghao donghao@supervision.ltd - * @Date: 2024-04-02 15:42:40 - * @LastEditors: donghao donghao@supervision.ltd - * @LastEditTime: 2024-04-02 17:48:37 - * @FilePath: \uighur-recognition-web2\mock\pools\warningRuleData.ts - * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE - */ -/**@实时分析设备列表模块 */ -// 设备列表分页 -export const mockGetDeviceData = { - data: { - count: 3, - next: null, - previous: null, - results: [ - { - id: 3, - device_name: '东大街西', - device_code: null, - device_api: 'test2', - is_use: 0, - device_status: 1, - note: null, - test_time: '2024-03-25T14:46:59.254201', - test_result: 1, - device_ip: '192.168.10.28', - device_port: null, - create_time: '2024-02-26T14:12:21.632020', - update_time: '2024-03-25T14:46:59.256200', - picture_path: - 'http://192.168.10.82:8080/UR_face/2024-02-27/normal/cam01_AZ8478568_20240206140518032_FACE_SNAP_4098.jpg', - appear_time: '2024-04-02T10:05:19', - }, - { - id: 2, - device_name: '东大街南', - device_code: null, - device_api: 'test', - is_use: 0, - device_status: 1, - note: null, - test_time: '2024-03-22T13:28:38.741433', - test_result: 1, - device_ip: '192.168.10.10', - device_port: null, - create_time: '2024-02-26T09:59:36.599018', - update_time: '2024-03-22T13:28:38.743432', - picture_path: - 'http://192.168.10.82:8080/UR_face/2024-02-27/normal/cam01_AZ8478568_20240206140518032_FACE_SNAP_4098.jpg', - appear_time: '2024-04-02T10:05:19', - }, - { - id: 1, - device_name: '东大街东', - device_code: null, - device_api: null, - is_use: 0, - device_status: 1, - note: null, - test_time: '2024-03-22T13:33:21.783679', - test_result: 1, - device_ip: '192.168.10.28', - device_port: null, - create_time: '2024-02-26T09:57:25', - update_time: '2024-03-22T13:33:21.786678', - picture_path: - 'http://192.168.10.82:8080/UR_face/2024-02-27/normal/cam01_AZ8478568_20240206140518032_FACE_SNAP_4098.jpg', - appear_time: '2024-04-02T10:05:19', - }, - ], - }, - msg: null, - success: true, - status: 200, -}; -/**@离线分析设备列表模块 */ -// 设备列表分页 -export const mockGetUploadDeviceData = { - data: { - count: 3, - next: null, - previous: null, - results: [ - { - id: 3, - device_name: 'test2', - device_uuid: '098eea8c_c649_4a6a_8a39_4f4b9c4c1cc0', - upload_or_download: 1, - operate_mode: 2, - device_ip: '127.0.0.1', - device_port: 80, - device_username: 'admin', - device_password: 'admin', - source_directory: null, - destination_directory: '/home\\098eea8c_c649_4a6a_8a39_4f4b9c4c1cc0', - access_key_id: null, - access_key_secret: null, - bucket: null, - is_use: 1, - device_status: 1, - note: 'test23', - test_time: null, - test_result: null, - create_time: '2024-04-02T16:42:14.596765', - update_time: '2024-04-02T17:19:50.855507', - }, - { - id: 2, - device_name: 'test1', - device_uuid: '430bce6b_4df5_4dfa_a64c_776934746069', - upload_or_download: 2, - operate_mode: 3, - device_ip: 'test1', - device_port: null, - device_username: null, - device_password: null, - source_directory: null, - destination_directory: '/home\\430bce6b_4df5_4dfa_a64c_776934746069', - access_key_id: '112233', - access_key_secret: '332211', - bucket: '123456', - is_use: 1, - device_status: 1, - note: '654321', - test_time: null, - test_result: null, - create_time: '2024-04-02T16:06:32.241551', - update_time: '2024-04-02T17:20:40.696287', - }, - { - id: 1, - device_name: 'test', - device_uuid: '252f9533_fd3f_4282_aafe_dadc9b3044c4', - upload_or_download: 2, - operate_mode: 1, - device_ip: '192.10.10.1', - device_port: 8080, - device_username: 'test', - device_password: '123456', - source_directory: 'test1', - destination_directory: '/home\\252f9533_fd3f_4282_aafe_dadc9b3044c4', - access_key_id: null, - access_key_secret: null, - bucket: null, - is_use: 1, - device_status: 1, - note: 'test1', - test_time: null, - test_result: null, - create_time: '2024-04-02T15:47:37.276475', - update_time: '2024-04-02T17:24:02.682003', - }, - ], - }, - msg: null, - success: true, - status: 200, -}; diff --git a/mock/pools/deviceGroupData.ts b/mock/pools/deviceGroupData.ts new file mode 100644 index 0000000..b815405 --- /dev/null +++ b/mock/pools/deviceGroupData.ts @@ -0,0 +1,241 @@ +/* + * @Author: donghao donghao@supervision.ltd + * @Date: 2024-01-25 16:32:31 + * @LastEditors: donghao donghao@supervision.ltd + * @LastEditTime: 2024-04-25 15:51:57 + * @FilePath: \general-ai-platform-web\mock\pools\deviceGroupData.ts + * @Description: 节点设备设置 + */ +// 设备组节点选项列表 +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: '南京节点', + 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, + }, +}; + +// 设备组详情 +export const mockGetDeviceGroupData1 = { + data: { + deviceGroup: { + 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: '', + }, + }, +}; +export const mockGetDeviceGroupData2 = { + data: { + deviceGroup: { + 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: '', + }, + }, +}; +export const mockGetDeviceGroupData3 = { + data: { + deviceGroup: { + 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: '', + }, + }, +}; diff --git a/mock/pools/modelData.ts b/mock/pools/modelData.ts index 8d5bbe0..6426c80 100644 --- a/mock/pools/modelData.ts +++ b/mock/pools/modelData.ts @@ -3217,7 +3217,6 @@ export const mockGetModelRuntimeLibFilesListData = { }, }; // 模型版本 - const startModelVersionList = () => { const currList: Record[] = []; const count = Math.floor(Math.random() * 100) + 1; diff --git a/mock/pools/recognitionPeopleData.ts b/mock/pools/recognitionPeopleData.ts deleted file mode 100644 index d554c4e..0000000 --- a/mock/pools/recognitionPeopleData.ts +++ /dev/null @@ -1,281 +0,0 @@ -/* - * @Author: donghao donghao@supervision.ltd - * @Date: 2024-04-02 14:04:18 - * @LastEditors: donghao donghao@supervision.ltd - * @LastEditTime: 2024-04-02 17:05:46 - * @FilePath: \uighur-recognition-web2\mock\pools\recognitionPeopleData.ts - * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE - */ -/**@实时分析告警汇总模块 */ -// 告警汇总列表分页 -export const mockGetRecognitionPeopleData = { - data: { - count: 12, - next: null, - previous: null, - results: [ - { - id: 3, - person_id: '0df18ed7-d6e7-445f-824d-6b3942c27915', - picture_path: - 'http://192.168.10.82:8080/UR_face/2024-02-27/normal/cam01_AZ8478568_20240206140518032_FACE_SNAP_4098.jpg', - classify: 0, - classify_time: '2024-03-25T13:55:00.394393', - similar_person_pk: null, - status: 1, - note: null, - create_time: '2024-03-04T10:24:13', - update_time: '2024-03-25T13:55:00.396393', - device_id: 3, - device_name: 'cam03', - appear_time: '2024-04-02T10:05:19', - }, - { - id: 2, - person_id: '0df18ed7-d6e7-445f-824d-6b3942c27914', - picture_path: - 'http://192.168.10.82:8080/UR_face/2024-02-27/normal/cam01_AZ8478568_20240206140518032_FACE_SNAP_4098.jpg', - classify: 1, - classify_time: '2024-03-08T15:41:08.170979', - similar_person_pk: null, - status: 1, - note: null, - create_time: '2024-03-04T10:24:13', - update_time: '2024-03-08T15:41:08.171978', - device_id: 2, - device_name: 'cam02', - appear_time: '2024-04-02T10:05:19', - }, - { - id: 1, - person_id: '0df18ed7-d6e7-445f-824d-6b3942c27913', - picture_path: - 'http://192.168.10.82:8080/UR_face/2024-02-27/normal/cam01_AZ8478568_20240206140518032_FACE_SNAP_4098.jpg', - classify: 0, - classify_time: '2024-03-25T13:51:08.471682', - similar_person_pk: null, - status: 1, - note: null, - create_time: '2024-03-04T10:24:13', - update_time: '2024-03-25T13:51:08.472683', - device_id: 1, - device_name: 'cam01', - appear_time: '2024-04-02T10:05:19', - }, - { - id: 30, - person_id: '0df18ed7-d6e7-445f-824d-6b3942c27915', - picture_path: - 'http://192.168.10.82:8080/UR_face/2024-02-27/normal/cam01_AZ8478568_20240206140518032_FACE_SNAP_4098.jpg', - classify: 0, - classify_time: '2024-03-25T13:55:00.394393', - similar_person_pk: null, - status: 1, - note: null, - create_time: '2024-03-04T10:24:13', - update_time: '2024-03-25T13:55:00.396393', - device_id: 3, - device_name: 'cam03', - appear_time: '2024-04-02T10:05:19', - }, - { - id: 32, - person_id: '0df18ed7-d6e7-445f-824d-6b3942c27914', - picture_path: - 'http://192.168.10.82:8080/UR_face/2024-02-27/normal/cam01_AZ8478568_20240206140518032_FACE_SNAP_4098.jpg', - classify: 1, - classify_time: '2024-03-08T15:41:08.170979', - similar_person_pk: null, - status: 1, - note: null, - create_time: '2024-03-04T10:24:13', - update_time: '2024-03-08T15:41:08.171978', - device_id: 2, - device_name: 'cam02', - appear_time: '2024-04-02T10:05:19', - }, - { - id: 31, - person_id: '0df18ed7-d6e7-445f-824d-6b3942c27913', - picture_path: - 'http://192.168.10.82:8080/UR_face/2024-02-27/normal/cam01_AZ8478568_20240206140518032_FACE_SNAP_4098.jpg', - classify: 0, - classify_time: '2024-03-25T13:51:08.471682', - similar_person_pk: null, - status: 1, - note: null, - create_time: '2024-03-04T10:24:13', - update_time: '2024-03-25T13:51:08.472683', - device_id: 1, - device_name: 'cam01', - appear_time: '2024-04-02T10:05:19', - }, - { - id: 23, - person_id: '0df18ed7-d6e7-445f-824d-6b3942c27915', - picture_path: - 'http://192.168.10.82:8080/UR_face/2024-02-27/normal/cam01_AZ8478568_20240206140518032_FACE_SNAP_4098.jpg', - classify: 0, - classify_time: '2024-03-25T13:55:00.394393', - similar_person_pk: null, - status: 1, - note: null, - create_time: '2024-03-04T10:24:13', - update_time: '2024-03-25T13:55:00.396393', - device_id: 3, - device_name: 'cam03', - appear_time: '2024-04-02T10:05:19', - }, - { - id: 22, - person_id: '0df18ed7-d6e7-445f-824d-6b3942c27914', - picture_path: - 'http://192.168.10.82:8080/UR_face/2024-02-27/normal/cam01_AZ8478568_20240206140518032_FACE_SNAP_4098.jpg', - classify: 1, - classify_time: '2024-03-08T15:41:08.170979', - similar_person_pk: null, - status: 1, - note: null, - create_time: '2024-03-04T10:24:13', - update_time: '2024-03-08T15:41:08.171978', - device_id: 2, - device_name: 'cam02', - appear_time: '2024-04-02T10:05:19', - }, - { - id: 21, - person_id: '0df18ed7-d6e7-445f-824d-6b3942c27913', - picture_path: - 'http://192.168.10.82:8080/UR_face/2024-02-27/normal/cam01_AZ8478568_20240206140518032_FACE_SNAP_4098.jpg', - classify: 0, - classify_time: '2024-03-25T13:51:08.471682', - similar_person_pk: null, - status: 1, - note: null, - create_time: '2024-03-04T10:24:13', - update_time: '2024-03-25T13:51:08.472683', - device_id: 1, - device_name: 'cam01', - appear_time: '2024-04-02T10:05:19', - }, - { - id: 13, - person_id: '0df18ed7-d6e7-445f-824d-6b3942c27915', - picture_path: - 'http://192.168.10.82:8080/UR_face/2024-02-27/normal/cam01_AZ8478568_20240206140518032_FACE_SNAP_4098.jpg', - classify: 0, - classify_time: '2024-03-25T13:55:00.394393', - similar_person_pk: null, - status: 1, - note: null, - create_time: '2024-03-04T10:24:13', - update_time: '2024-03-25T13:55:00.396393', - device_id: 3, - device_name: 'cam03', - appear_time: '2024-04-02T10:05:19', - }, - { - id: 12, - person_id: '0df18ed7-d6e7-445f-824d-6b3942c27914', - picture_path: - 'http://192.168.10.82:8080/UR_face/2024-02-27/normal/cam01_AZ8478568_20240206140518032_FACE_SNAP_4098.jpg', - classify: 1, - classify_time: '2024-03-08T15:41:08.170979', - similar_person_pk: null, - status: 1, - note: null, - create_time: '2024-03-04T10:24:13', - update_time: '2024-03-08T15:41:08.171978', - device_id: 2, - device_name: 'cam02', - appear_time: '2024-04-02T10:05:19', - }, - { - id: 11, - person_id: '0df18ed7-d6e7-445f-824d-6b3942c27913', - picture_path: - 'http://192.168.10.82:8080/UR_face/2024-02-27/normal/cam01_AZ8478568_20240206140518032_FACE_SNAP_4098.jpg', - classify: 0, - classify_time: '2024-03-25T13:51:08.471682', - similar_person_pk: null, - status: 1, - note: null, - create_time: '2024-03-04T10:24:13', - update_time: '2024-03-25T13:51:08.472683', - device_id: 1, - device_name: 'cam01', - appear_time: '2024-04-02T10:05:19', - }, - ], - }, - msg: null, - success: true, - status: 200, -}; - -/**@离线分析告警汇总模块 */ -// 告警汇总列表分页 -export const mockGetUploadRecognitionPeopleData = { - data: { - count: 3, - next: null, - previous: null, - results: [ - { - id: 3, - person_id: '0df18ed7-d6e7-445f-824d-6b3942c27915', - picture_path: - 'http://192.168.10.82:8080/UR_face/2024-02-27/normal/cam01_AZ8478568_20240206140518032_FACE_SNAP_4098.jpg', - classify: 1, - classify_time: '2024-03-25T14:47:22.991546', - similar_person_pk: null, - status: 1, - note: null, - create_time: '2024-03-04T10:24:13', - update_time: '2024-03-25T14:47:22.993546', - video_id: '2', - video_name: 'test.mp4', - relative_time: 712, - analyse_time: '2024-03-20T15:11:48', - }, - { - id: 2, - person_id: '0df18ed7-d6e7-445f-824d-6b3942c27914', - picture_path: - 'http://192.168.10.82:8080/UR_face/2024-02-27/normal/cam01_AZ8478568_20240206140518032_FACE_SNAP_4098.jpg', - classify: 1, - classify_time: '2024-03-25T13:57:00.222531', - similar_person_pk: null, - status: 1, - note: null, - create_time: '2024-03-04T10:24:13', - update_time: '2024-03-25T13:57:00.224531', - video_id: '1', - video_name: 'test.mp4', - relative_time: 512, - analyse_time: '2024-03-20T15:11:48', - }, - { - id: 1, - person_id: '0df18ed7-d6e7-445f-824d-6b3942c27913', - picture_path: - 'http://192.168.10.82:8080/UR_face/2024-02-27/normal/cam01_AZ8478568_20240206140518032_FACE_SNAP_4098.jpg', - classify: 1, - classify_time: '2024-03-26T13:14:25.219923', - similar_person_pk: null, - status: 1, - note: null, - create_time: '2024-03-04T10:24:13', - update_time: '2024-03-26T13:14:25.221925', - video_id: '1', - video_name: 'test.mp4', - relative_time: 512, - analyse_time: '2024-03-20T15:11:48', - }, - ], - }, - msg: null, - success: true, - status: 200, -}; -// upload_recognition_people diff --git a/mock/pools/travelTrackData.ts b/mock/pools/travelTrackData.ts deleted file mode 100644 index 78d6e67..0000000 --- a/mock/pools/travelTrackData.ts +++ /dev/null @@ -1,322 +0,0 @@ -/* - * @Author: donghao donghao@supervision.ltd - * @Date: 2024-04-02 14:05:08 - * @LastEditors: donghao donghao@supervision.ltd - * @LastEditTime: 2024-04-02 17:08:19 - * @FilePath: \uighur-recognition-web2\mock\pools\travelTrackData.ts - * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE - */ -/**@实时分析告警追踪模块 */ -// 告警追踪列表分页 -export const mockGetTravelTrackData = { - data: { - count: 20, - next: 'http://192.168.10.21:8000/api/travel_track/?page=2&pageSize=10&person_id=0df18ed7-d6e7-445f-824d-6b3942c27915', - previous: null, - results: [ - { - id: 15, - person_id: '0df18ed7-d6e7-445f-824d-6b3942c27915', - device_id: 3, - device_name: '东大街西', - appear_time: '2024-04-02T10:05:19', - picture_path: - 'http://192.168.10.82:8080/UR_face/2024-02-27/normal/cam01_AZ8478568_20240206140518032_FACE_SNAP_4098.jpg', - is_ignore: 0, - cancel_trip: null, - create_time: '2024-02-27T14:36:37.505000', - update_time: '2024-03-04T11:35:18.704087', - person_classify: 0, - device_note: null, - }, - { - id: 16, - person_id: '0df18ed7-d6e7-445f-824d-6b3942c27915', - device_id: 3, - device_name: '东大街西', - appear_time: '2024-04-02T10:05:19', - picture_path: - 'http://192.168.10.82:8080/UR_face/2024-02-27/normal/cam01_AZ8478568_20240206140518032_FACE_SNAP_4098.jpg', - is_ignore: 0, - cancel_trip: null, - create_time: '2024-02-27T14:36:37.505000', - update_time: '2024-03-04T11:35:18.704087', - person_classify: 0, - device_note: null, - }, - { - id: 17, - person_id: '0df18ed7-d6e7-445f-824d-6b3942c27915', - device_id: 3, - device_name: '东大街西', - appear_time: '2024-04-02T10:05:19', - picture_path: - 'http://192.168.10.82:8080/UR_face/2024-02-27/normal/cam01_AZ8478568_20240206140518032_FACE_SNAP_4098.jpg', - is_ignore: 0, - cancel_trip: null, - create_time: '2024-02-27T14:36:37.505000', - update_time: '2024-03-04T11:35:18.704087', - person_classify: 0, - device_note: null, - }, - { - id: 18, - person_id: '0df18ed7-d6e7-445f-824d-6b3942c27915', - device_id: 3, - device_name: '东大街西', - appear_time: '2024-04-02T10:05:19', - picture_path: - 'http://192.168.10.82:8080/UR_face/2024-02-27/normal/cam01_AZ8478568_20240206140518032_FACE_SNAP_4098.jpg', - is_ignore: 0, - cancel_trip: null, - create_time: '2024-02-27T14:36:37.505000', - update_time: '2024-03-04T11:35:18.704087', - person_classify: 0, - device_note: null, - }, - { - id: 19, - person_id: '0df18ed7-d6e7-445f-824d-6b3942c27915', - device_id: 3, - device_name: '东大街西', - appear_time: '2024-04-02T10:05:19', - picture_path: - 'http://192.168.10.82:8080/UR_face/2024-02-27/normal/cam01_AZ8478568_20240206140518032_FACE_SNAP_4098.jpg', - is_ignore: 0, - cancel_trip: null, - create_time: '2024-02-27T14:36:37.505000', - update_time: '2024-03-04T11:35:18.704087', - person_classify: 0, - device_note: null, - }, - { - id: 20, - person_id: '0df18ed7-d6e7-445f-824d-6b3942c27915', - device_id: 3, - device_name: '东大街西', - appear_time: '2024-04-02T10:05:19', - picture_path: - 'http://192.168.10.82:8080/UR_face/2024-02-27/normal/cam01_AZ8478568_20240206140518032_FACE_SNAP_4098.jpg', - is_ignore: 0, - cancel_trip: null, - create_time: '2024-02-27T14:36:37.505000', - update_time: '2024-03-04T11:35:18.704087', - person_classify: 0, - device_note: null, - }, - { - id: 21, - person_id: '0df18ed7-d6e7-445f-824d-6b3942c27915', - device_id: 3, - device_name: '东大街西', - appear_time: '2024-04-02T10:05:19', - picture_path: - 'http://192.168.10.82:8080/UR_face/2024-02-27/normal/cam01_AZ8478568_20240206140518032_FACE_SNAP_4098.jpg', - is_ignore: 0, - cancel_trip: null, - create_time: '2024-02-27T14:36:37.505000', - update_time: '2024-03-04T11:35:18.704087', - person_classify: 0, - device_note: null, - }, - { - id: 22, - person_id: '0df18ed7-d6e7-445f-824d-6b3942c27915', - device_id: 3, - device_name: '东大街西', - appear_time: '2024-04-02T10:05:19', - picture_path: - 'http://192.168.10.82:8080/UR_face/2024-02-27/normal/cam01_AZ8478568_20240206140518032_FACE_SNAP_4098.jpg', - is_ignore: 0, - cancel_trip: null, - create_time: '2024-02-27T14:36:37.505000', - update_time: '2024-03-04T11:35:18.704087', - person_classify: 0, - device_note: null, - }, - { - id: 23, - person_id: '0df18ed7-d6e7-445f-824d-6b3942c27915', - device_id: 3, - device_name: '东大街西', - appear_time: '2024-04-02T10:05:19', - picture_path: - 'http://192.168.10.82:8080/UR_face/2024-02-27/normal/cam01_AZ8478568_20240206140518032_FACE_SNAP_4098.jpg', - is_ignore: 0, - cancel_trip: null, - create_time: '2024-02-27T14:36:37.505000', - update_time: '2024-03-04T11:35:18.704087', - person_classify: 0, - device_note: null, - }, - { - id: 24, - person_id: '0df18ed7-d6e7-445f-824d-6b3942c27915', - device_id: 3, - device_name: '东大街西', - appear_time: '2024-04-02T10:05:19', - picture_path: - 'http://192.168.10.82:8080/UR_face/2024-02-27/normal/cam01_AZ8478568_20240206140518032_FACE_SNAP_4098.jpg', - is_ignore: 0, - cancel_trip: null, - create_time: '2024-02-27T14:36:37.505000', - update_time: '2024-03-04T11:35:18.704087', - person_classify: 0, - device_note: null, - }, - ], - }, - msg: null, - success: true, - status: 200, -}; - -/**@离线分析告警追踪模块 */ -// 告警追踪列表分页 -export const mockGetUploadTravelTrackData = { - data: { - count: 9, - next: null, - previous: null, - results: [ - { - id: 15, - person_id: '0df18ed7-d6e7-445f-824d-6b3942c27915', - video_id: '2', - video_name: 'test.mp4', - relative_time: '11分52秒', - picture_path: - 'http://192.168.10.82:8080/UR_face/2024-02-27/normal/cam01_AZ8478568_20240206140518032_FACE_SNAP_4098.jpg', - is_ignore: 0, - cancel_trip: null, - create_time: '2024-03-20T15:11:48', - update_time: '2024-03-20T15:11:50', - person_classify: 1, - video_length: '1时53分20秒', - }, - { - id: 14, - person_id: '0df18ed7-d6e7-445f-824d-6b3942c27915', - video_id: '2', - video_name: 'test.mp4', - relative_time: '10分12秒', - picture_path: - 'http://192.168.10.82:8080/UR_face/2024-02-27/normal/cam01_AZ8478568_20240206140518032_FACE_SNAP_4098.jpg', - is_ignore: 0, - cancel_trip: null, - create_time: '2024-03-20T15:11:48', - update_time: '2024-03-20T15:11:50', - person_classify: 1, - video_length: '1时53分20秒', - }, - { - id: 13, - person_id: '0df18ed7-d6e7-445f-824d-6b3942c27915', - video_id: '2', - video_name: 'test.mp4', - relative_time: '8分32秒', - picture_path: - 'http://192.168.10.82:8080/UR_face/2024-02-27/normal/cam01_AZ8478568_20240206140518032_FACE_SNAP_4098.jpg', - is_ignore: 0, - cancel_trip: null, - create_time: '2024-03-20T15:11:48', - update_time: '2024-03-20T15:11:50', - person_classify: 1, - video_length: '1时53分20秒', - }, - { - id: 12, - person_id: '0df18ed7-d6e7-445f-824d-6b3942c27915', - video_id: '2', - video_name: 'test.mp4', - relative_time: '6分52秒', - picture_path: - 'http://192.168.10.82:8080/UR_face/2024-02-27/normal/cam01_AZ8478568_20240206140518032_FACE_SNAP_4098.jpg', - is_ignore: 0, - cancel_trip: null, - create_time: '2024-03-20T15:11:48', - update_time: '2024-03-20T15:11:50', - person_classify: 1, - video_length: '1时53分20秒', - }, - { - id: 11, - person_id: '0df18ed7-d6e7-445f-824d-6b3942c27915', - video_id: '2', - video_name: 'test.mp4', - relative_time: '5分12秒', - picture_path: - 'http://192.168.10.82:8080/UR_face/2024-02-27/normal/cam01_AZ8478568_20240206140518032_FACE_SNAP_4098.jpg', - is_ignore: 0, - cancel_trip: null, - create_time: '2024-03-20T15:11:48', - update_time: '2024-03-20T15:11:50', - person_classify: 1, - video_length: '1时53分20秒', - }, - { - id: 10, - person_id: '0df18ed7-d6e7-445f-824d-6b3942c27915', - video_id: '1', - video_name: 'test.mp4', - relative_time: '10分12秒', - picture_path: - 'http://192.168.10.82:8080/UR_face/2024-02-27/normal/cam01_AZ8478568_20240206140518032_FACE_SNAP_4098.jpg', - is_ignore: 0, - cancel_trip: null, - create_time: '2024-03-20T15:11:48', - update_time: '2024-03-20T15:11:50', - person_classify: 1, - video_length: '1时3分20秒', - }, - { - id: 9, - person_id: '0df18ed7-d6e7-445f-824d-6b3942c27915', - video_id: '1', - video_name: 'test.mp4', - relative_time: '8分32秒', - picture_path: - 'http://192.168.10.82:8080/UR_face/2024-02-27/normal/cam01_AZ8478568_20240206140518032_FACE_SNAP_4098.jpg', - is_ignore: 0, - cancel_trip: null, - create_time: '2024-03-20T15:11:48', - update_time: '2024-03-20T15:11:50', - person_classify: 1, - video_length: '1时3分20秒', - }, - { - id: 8, - person_id: '0df18ed7-d6e7-445f-824d-6b3942c27915', - video_id: '1', - video_name: 'test.mp4', - relative_time: '6分52秒', - picture_path: - 'http://192.168.10.82:8080/UR_face/2024-02-27/normal/cam01_AZ8478568_20240206140518032_FACE_SNAP_4098.jpg', - is_ignore: 0, - cancel_trip: null, - create_time: '2024-03-20T15:11:48', - update_time: '2024-03-20T15:11:50', - person_classify: 1, - video_length: '1时3分20秒', - }, - { - id: 7, - person_id: '0df18ed7-d6e7-445f-824d-6b3942c27915', - video_id: '1', - video_name: 'test.mp4', - relative_time: '5分12秒', - picture_path: - 'http://192.168.10.82:8080/UR_face/2024-02-27/normal/cam01_AZ8478568_20240206140518032_FACE_SNAP_4098.jpg', - is_ignore: 0, - cancel_trip: null, - create_time: '2024-03-20T15:11:48', - update_time: '2024-03-20T15:11:50', - person_classify: 1, - video_length: '1时3分20秒', - }, - ], - }, - msg: null, - success: true, - status: 200, -}; diff --git a/mock/pools/warningInfoData.ts b/mock/pools/warningInfoData.ts deleted file mode 100644 index 1e93f91..0000000 --- a/mock/pools/warningInfoData.ts +++ /dev/null @@ -1,224 +0,0 @@ -/* - * @Author: donghao donghao@supervision.ltd - * @Date: 2024-04-01 20:26:23 - * @LastEditors: donghao donghao@supervision.ltd - * @LastEditTime: 2024-04-02 17:10:20 - * @FilePath: \uighur-recognition-web2\mock\pools\warningInfoData.ts - * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE - */ -/**@实时分析告警模块 */ -// 告警列表分页 -export const mockGetWarningInfoData = { - data: { - results: [ - { - warning_name: '单人徘徊', - picture_path: [ - 'http://192.168.10.82:8080/UR_face/2024-02-27/normal/cam01_AZ8478568_20240206140518032_FACE_SNAP_4098.jpg', - 'http://192.168.10.82:8080/UR_face/2024-02-27/normal/cam01_AZ8478568_20240206140518032_FACE_SNAP_4098.jpg', - 'http://192.168.10.82:8080/UR_face/2024-02-27/normal/cam01_AZ8478568_20240206140518032_FACE_SNAP_4098.jpg', - 'http://192.168.10.82:8080/UR_face/2024-02-27/normal/cam01_AZ8478568_20240206140518032_FACE_SNAP_4098.jpg', - ], - person_classify: 0, - device_name: '东大街东', - device_note: null, - person_id: '0df18ed7-d6e7-445f-824d-6b3942c27913', - trigger_time: '2024-04-02T09:43:38.581250', - }, - { - warning_name: '单人徘徊', - picture_path: [ - 'http://192.168.10.82:8080/UR_face/2024-02-27/normal/cam01_AZ8478568_20240206140518032_FACE_SNAP_4098.jpg', - 'http://192.168.10.82:8080/UR_face/2024-02-27/normal/cam01_AZ8478568_20240206140518032_FACE_SNAP_4098.jpg', - ], - person_classify: 1, - device_name: '东大街东', - device_note: null, - person_id: '0df18ed7-d6e7-445f-824d-6b3942c27914', - trigger_time: '2024-04-02T09:43:38.584291', - }, - { - warning_name: '单人徘徊', - picture_path: [ - 'http://192.168.10.82:8080/UR_face/2024-02-27/normal/cam01_AZ8478568_20240206140518032_FACE_SNAP_4098.jpg', - 'http://192.168.10.82:8080/UR_face/2024-02-27/normal/cam01_AZ8478568_20240206140518032_FACE_SNAP_4098.jpg', - ], - person_classify: 0, - device_name: '东大街东', - device_note: null, - person_id: '0df18ed7-d6e7-445f-824d-6b3942c27915', - trigger_time: '2024-04-02T09:43:38.588170', - }, - { - warning_name: '单人徘徊', - picture_path: [ - 'http://192.168.10.82:8080/UR_face/2024-02-27/normal/cam01_AZ8478568_20240206140518032_FACE_SNAP_4098.jpg', - 'http://192.168.10.82:8080/UR_face/2024-02-27/normal/cam01_AZ8478568_20240206140518032_FACE_SNAP_4098.jpg', - ], - person_classify: 1, - device_name: '东大街南', - device_note: null, - person_id: '0df18ed7-d6e7-445f-824d-6b3942c27914', - trigger_time: '2024-04-02T09:43:38.592134', - }, - { - warning_name: '单人徘徊', - picture_path: [ - 'http://192.168.10.82:8080/UR_face/2024-02-27/normal/cam01_AZ8478568_20240206140518032_FACE_SNAP_4098.jpg', - 'http://192.168.10.82:8080/UR_face/2024-02-27/normal/cam01_AZ8478568_20240206140518032_FACE_SNAP_4098.jpg', - ], - person_classify: 0, - device_name: '东大街西', - device_note: null, - person_id: '0df18ed7-d6e7-445f-824d-6b3942c27915', - trigger_time: '2024-04-02T09:43:38.596134', - }, - ], - count: 5, - }, -}; - -/**@离线分析告警模块 */ -// 告警列表分页 -export const mockGetUploadWarningInfoData = { - data: { - count: 5, - next: null, - previous: null, - results: [ - { - id: 11, - video_id: '2', - start_result_id: '14', - warning_name: '单人徘徊', - warning_type: 1, - origin: 'test2.mp4', - trigger_time: '2024-04-01 16:25:38.113472', - person_id_list: '["0df18ed7-d6e7-445f-824d-6b3942c27915"]', - is_ignore: 0, - create_time: '2024-04-01T16:25:38.115472', - update_time: '2024-04-01T16:25:38.115472', - picture_path: [ - 'http://192.168.10.82:8080/UR_face/2024-02-27/normal/cam01_AZ8478568_20240206140518032_FACE_SNAP_4098.jpg', - ], - person_list: [ - [ - '0df18ed7-d6e7-445f-824d-6b3942c27915', - 'http://192.168.10.82:8080/UR_face/2024-02-27/normal/cam01_AZ8478568_20240206140518032_FACE_SNAP_4098.jpg', - 1, - ], - ], - video_length: '1时53分20秒', - upload_time: '2024-03-20T15:10:17', - video_start: '10分12秒', - }, - { - id: 10, - video_id: '2', - start_result_id: '11', - warning_name: '单人徘徊', - warning_type: 1, - origin: 'test2.mp4', - trigger_time: '2024-04-01 16:25:38.104473', - person_id_list: '["0df18ed7-d6e7-445f-824d-6b3942c27915"]', - is_ignore: 0, - create_time: '2024-04-01T16:25:38.107473', - update_time: '2024-04-01T16:25:38.107473', - picture_path: [ - 'http://192.168.10.82:8080/UR_face/2024-02-27/normal/cam01_AZ8478568_20240206140518032_FACE_SNAP_4098.jpg', - ], - person_list: [ - [ - '0df18ed7-d6e7-445f-824d-6b3942c27915', - 'http://192.168.10.82:8080/UR_face/2024-02-27/normal/cam01_AZ8478568_20240206140518032_FACE_SNAP_4098.jpg', - 1, - ], - ], - video_length: '1时53分20秒', - upload_time: '2024-03-20T15:10:17', - video_start: '5分12秒', - }, - { - id: 8, - video_id: '1', - start_result_id: '7', - warning_name: '单人徘徊', - warning_type: 1, - origin: 'test.mp4', - trigger_time: '2024-04-01 16:24:09.085472', - person_id_list: '["0df18ed7-d6e7-445f-824d-6b3942c27915"]', - is_ignore: 0, - create_time: '2024-04-01T16:24:09.087472', - update_time: '2024-04-01T16:24:09.087472', - picture_path: [ - 'http://192.168.10.82:8080/UR_face/2024-02-27/normal/cam01_AZ8478568_20240206140518032_FACE_SNAP_4098.jpg', - ], - person_list: [ - [ - '0df18ed7-d6e7-445f-824d-6b3942c27915', - 'http://192.168.10.82:8080/UR_face/2024-02-27/normal/cam01_AZ8478568_20240206140518032_FACE_SNAP_4098.jpg', - 1, - ], - ], - video_length: '1时3分20秒', - upload_time: '2024-03-20T15:10:17', - video_start: '5分12秒', - }, - { - id: 7, - video_id: '1', - start_result_id: '4', - warning_name: '单人徘徊', - warning_type: 1, - origin: 'test.mp4', - trigger_time: '2024-04-01 16:24:09.080472', - person_id_list: '["0df18ed7-d6e7-445f-824d-6b3942c27914"]', - is_ignore: 0, - create_time: '2024-04-01T16:24:09.082472', - update_time: '2024-04-01T16:24:09.082472', - picture_path: [ - 'http://192.168.10.82:8080/UR_face/2024-02-27/normal/cam01_AZ8478568_20240206140518032_FACE_SNAP_4098.jpg', - ], - person_list: [ - [ - '0df18ed7-d6e7-445f-824d-6b3942c27914', - 'http://192.168.10.82:8080/UR_face/2024-02-27/normal/cam01_AZ8478568_20240206140518032_FACE_SNAP_4098.jpg', - 1, - ], - ], - video_length: '1时3分20秒', - upload_time: '2024-03-20T15:10:17', - video_start: '5分12秒', - }, - { - id: 6, - video_id: '1', - start_result_id: '1', - warning_name: '单人徘徊', - warning_type: 1, - origin: 'test.mp4', - trigger_time: '2024-04-01 16:24:09.072472', - person_id_list: '["0df18ed7-d6e7-445f-824d-6b3942c27913"]', - is_ignore: 0, - create_time: '2024-04-01T16:24:09.075472', - update_time: '2024-04-01T16:24:09.075472', - picture_path: [ - 'http://192.168.10.82:8080/UR_face/2024-02-27/normal/cam01_AZ8478568_20240206140518032_FACE_SNAP_4098.jpg', - ], - person_list: [ - [ - '0df18ed7-d6e7-445f-824d-6b3942c27913', - 'http://192.168.10.82:8080/UR_face/2024-02-27/normal/cam01_AZ8478568_20240206140518032_FACE_SNAP_4098.jpg', - 1, - ], - ], - video_length: '1时3分20秒', - upload_time: '2024-03-20T15:10:17', - video_start: '5分12秒', - }, - ], - }, - msg: null, - success: true, - status: 200, -}; diff --git a/mock/pools/warningRuleData.ts b/mock/pools/warningRuleData.ts deleted file mode 100644 index 51efa37..0000000 --- a/mock/pools/warningRuleData.ts +++ /dev/null @@ -1,107 +0,0 @@ -/* - * @Author: donghao donghao@supervision.ltd - * @Date: 2024-04-02 15:42:40 - * @LastEditors: donghao donghao@supervision.ltd - * @LastEditTime: 2024-04-02 15:45:45 - * @FilePath: \uighur-recognition-web2\mock\pools\warningRuleData.ts - * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE - */ -/**@实时分析告警规则模块 */ -// 告警规则分页 -export const mockGetWarningRuleData = { - data: { - count: 3, - next: null, - previous: null, - results: [ - { - id: 3, - warning_name: '敏感时间', - warning_level: 3, - warning_type: 3, - is_use: 1, - person_number: 1, - appear_number: 1, - time_interval: null, - time_period: null, - trigger_start_time: '09:09:16', - trigger_end_time: '18:00:00', - create_time: null, - update_time: '2024-04-01T17:53:40.998904', - }, - { - id: 2, - warning_name: '多人聚集', - warning_level: 2, - warning_type: 2, - is_use: 1, - person_number: 3, - appear_number: 1, - time_interval: 1, - time_period: null, - trigger_start_time: null, - trigger_end_time: null, - create_time: '2024-01-22T10:59:37', - update_time: '2024-04-01T17:53:54.752905', - }, - { - id: 1, - warning_name: '单人徘徊', - warning_level: 1, - warning_type: 1, - is_use: 1, - person_number: 1, - appear_number: 2, - time_interval: 1, - time_period: 10, - trigger_start_time: null, - trigger_end_time: null, - create_time: '2024-01-22T10:58:57', - update_time: '2024-04-01T17:54:01.945906', - }, - ], - }, - msg: null, - success: true, - status: 200, -}; -/**@离线分析告警规则模块 */ -// 告警规则分页 -export const mockGetUploadWarningRuleData = { - data: { - count: 2, - next: null, - previous: null, - results: [ - { - id: 2, - warning_name: '多人聚集', - warning_level: 2, - warning_type: 2, - is_use: 1, - person_number: 3, - appear_number: 1, - time_interval: 5, - time_period: null, - create_time: '2024-04-01T16:15:05', - update_time: '2024-04-02T14:25:10.087767', - }, - { - id: 1, - warning_name: '单人徘徊', - warning_level: 1, - warning_type: 1, - is_use: 1, - person_number: 1, - appear_number: 2, - time_interval: 1, - time_period: 10, - create_time: '2024-04-01T16:14:35', - update_time: '2024-04-02T14:25:16.505613', - }, - ], - }, - msg: null, - success: true, - status: 200, -}; diff --git a/src/app.tsx b/src/app.tsx index 42cb01c..fc50d7a 100644 --- a/src/app.tsx +++ b/src/app.tsx @@ -153,7 +153,7 @@ export const layout: RunTimeLayoutConfig = ({ initialState, setInitialState }) =
- + {currMenu?.name && intl.formatMessage({ id: `menu.${currMenu?.name}`, defaultMessage: '首页' })} diff --git a/src/base.css b/src/base.css index 53780fb..52f586f 100644 --- a/src/base.css +++ b/src/base.css @@ -12,7 +12,7 @@ color: #999999; } .bg_active_1 { - background: #EBF3FF; + background: #ebf3ff; } /* 标题 */ .h1 { @@ -25,6 +25,16 @@ text-align: left; text-transform: none; } +.head4 { + color: #333333; + font-weight: bold; + font-size: 18px; + font-family: PingFang SC, PingFang SC; + font-style: normal; + line-height: 22px; + text-align: left; + text-transform: none; +} .head5 { color: #333333; font-weight: bold; diff --git a/src/base.less b/src/base.less index c61b8a3..6f5334b 100644 --- a/src/base.less +++ b/src/base.less @@ -29,6 +29,16 @@ text-transform: none; } +.head4 { + color: #333333; + font-weight: bold; + font-size: 18px; + font-family: PingFang SC, PingFang SC; + font-style: normal; + line-height: 22px; + text-align: left; + text-transform: none; +} .head5 { color: #333333; font-weight: bold; diff --git a/src/components/TableActionCard/index.tsx b/src/components/TableActionCard/index.tsx index f33562d..cb219d7 100644 --- a/src/components/TableActionCard/index.tsx +++ b/src/components/TableActionCard/index.tsx @@ -2,7 +2,7 @@ * @Author: zhoux zhouxia@supervision.ltd * @Date: 2023-11-14 15:49:36 * @LastEditors: donghao donghao@supervision.ltd - * @LastEditTime: 2024-04-19 09:20:27 + * @LastEditTime: 2024-04-25 11:33:25 * @FilePath: \general-ai-platform-web\src\components\TableActionCard\index.tsx * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE */ @@ -62,7 +62,7 @@ const TableActionCard: React.FC = (props) => { }, [props.renderActions]); return ( -
+
{prevActions.map((item, index) => { return ( .ant-pro-card-header { + height: 54px; margin: 0; padding: 10px 16px; - height: 54px; - border-bottom: 1px solid #E0E0E0; + border-bottom: 1px solid #e0e0e0; } .gn_card > .ant-pro-card-body { margin: 0; @@ -97,6 +97,72 @@ ol { .gn_table_query_filter .ant-pro-form .ant-form-item { margin: 0; } +.gn_model_steps_form .ant-pro-steps-form-step { + margin: 0; +} +.gn_model_steps_form .ant-steps { + margin: 12px 0 20px; +} +.gn_model_steps_form .ant-modal-content .ant-modal-body .ant-steps .ant-steps-item { + flex: auto; + margin-right: 12px; + background: #f5f5f5; + border: 1px solid rgba(21, 77, 221, 0.1); + border-radius: 4px; +} +.gn_model_steps_form .ant-modal-content .ant-modal-body .ant-steps .ant-steps-item:last-child { + margin-right: 0; +} +.gn_model_steps_form .ant-modal-content .ant-modal-body .ant-steps .ant-steps-item .ant-steps-item-container { + display: flex; + align-items: center; + justify-content: center; + margin: 8px 0; +} +.gn_model_steps_form .ant-modal-content .ant-modal-body .ant-steps .ant-steps-item .ant-steps-item-tail { + display: none; +} +.gn_model_steps_form .ant-modal-content .ant-modal-body .ant-steps .ant-steps-item .ant-steps-item-icon { + margin: 0 8px; +} +.gn_model_steps_form .ant-modal-content .ant-modal-body .ant-steps .ant-steps-item .ant-steps-item-content { + margin: 0; + text-align: left; +} +.gn_model_steps_form .ant-modal-content .ant-modal-body .ant-steps .ant-steps-item .ant-steps-item-title { + color: #333333; + font-size: 14px; +} +.gn_model_steps_form .ant-modal-content .ant-modal-body .ant-steps .ant-steps-item .ant-steps-item-description { + color: #666666; + font-size: 12px; +} +.gn_model_steps_form .ant-modal-content .ant-modal-body .ant-steps .ant-steps-item-finish { + background: #e5edff; + border: 1px solid #154ddd; +} +.gn_model_steps_form .ant-modal-content .ant-modal-body .ant-steps .ant-steps-item-finish .ant-steps-item-icon { + background-color: #154ddd; +} +.gn_model_steps_form .ant-modal-content .ant-modal-body .ant-steps .ant-steps-item-finish .ant-steps-item-icon .ant-steps-icon { + color: white; +} +.gn_model_steps_form .ant-modal-content .ant-modal-body .ant-steps .ant-steps-item-finish .ant-steps-item-title { + color: #154ddd; +} +.gn_model_steps_form .ant-modal-content .ant-modal-body .ant-steps .ant-steps-item-finish .ant-steps-item-description { + color: #154ddd; +} +.gn_model_steps_form .ant-modal-content .ant-modal-body .ant-steps .ant-steps-item-active { + background: #e5edff; + border: 1px solid #154ddd; +} +.gn_model_steps_form .ant-modal-content .ant-modal-body .ant-steps .ant-steps-item-active .ant-steps-item-title { + color: #154ddd; +} +.gn_model_steps_form .ant-modal-content .ant-modal-body .ant-steps .ant-steps-item-active .ant-steps-item-description { + color: #154ddd; +} /* Descriptions */ .gn_table_descriptions { padding: 16px 16px 0; @@ -141,7 +207,7 @@ ol { /* 限制显示的行数 */ } .ant-pro-layout .ant-pro-layout-bg-list { - background: #F8FAFD; + background: #f8fafd; } ::-webkit-scrollbar-track-piece { -webkit-border-radius: 0; diff --git a/src/global.less b/src/global.less index 2012f67..37f1a3f 100644 --- a/src/global.less +++ b/src/global.less @@ -126,8 +126,85 @@ ol { } } +// 分步表单 +.gn_model_steps_form { + .ant-pro-steps-form-step { + margin: 0; + } + .ant-steps { + margin: 12px 0 20px; + } + // 步骤条 + .ant-modal-content .ant-modal-body .ant-steps { + .ant-steps-item { + flex: auto; + margin-right: 12px; + background: #f5f5f5; + border: 1px solid rgba(21, 77, 221, 0.1); + border-radius: 4px; + &:last-child { + margin-right: 0; + } + + .ant-steps-item-container { + display: flex; + align-items: center; + justify-content: center; + margin: 8px 0; + } + .ant-steps-item-tail { + display: none; + } + .ant-steps-item-icon { + margin: 0 8px; + } + .ant-steps-item-content { + margin: 0; + text-align: left; + } + .ant-steps-item-title { + color: #333333; + font-size: 14px; + } + .ant-steps-item-description { + color: #666666; + font-size: 12px; + } + } + + // 已完成 + .ant-steps-item-finish { + background: #e5edff; + border: 1px solid #154ddd; + .ant-steps-item-icon { + background-color: #154ddd; + .ant-steps-icon { + color: white; + } + } + .ant-steps-item-title { + color: #154ddd; + } + .ant-steps-item-description { + color: #154ddd; + } + } + // 当前选中 + .ant-steps-item-active { + background: #e5edff; + border: 1px solid #154ddd; + .ant-steps-item-title { + color: #154ddd; + } + .ant-steps-item-description { + color: #154ddd; + } + } + } +} + /* Descriptions */ -// 筛选表单 +// 描述展示 .gn_table_descriptions { padding: 16px 16px 0; background: #ffffff; diff --git a/src/locales/zh-CN/common.ts b/src/locales/zh-CN/common.ts index 77793e9..d272c36 100644 --- a/src/locales/zh-CN/common.ts +++ b/src/locales/zh-CN/common.ts @@ -51,4 +51,5 @@ export default { 'common.delete': '删除', 'common.okText': '确认', 'common.cancelText': '取消', + 'common.form.required': '此项为必填项', }; diff --git a/src/locales/zh-CN/model.ts b/src/locales/zh-CN/model.ts index 97a7ec0..11a1c8f 100644 --- a/src/locales/zh-CN/model.ts +++ b/src/locales/zh-CN/model.ts @@ -2,7 +2,7 @@ * @Author: donghao donghao@supervision.ltd * @Date: 2024-04-10 17:21:34 * @LastEditors: donghao donghao@supervision.ltd - * @LastEditTime: 2024-04-18 17:13:31 + * @LastEditTime: 2024-04-25 15:54:52 * @FilePath: \general-ai-manage\src\locales\zh-CN\model.ts * @Description: 模型管理 */ @@ -68,7 +68,8 @@ export const model_version: { [key: string]: string } = { 'model_detail.version.stepForm.project_file.description': '上传模型文件', 'model_detail.version.stepForm.config': '参数配置', 'model_detail.version.stepForm.config.description': '模型参数配置', - + 'model_detail.version.stepForm.group': '关联节点', + 'model_detail.version.stepForm.group.description': '关联相关设备节点', 'model_detail.version.form.modelFkId': '模型', 'model_detail.version.form.name': '版本号', 'model_detail.version.form.required.name': '请填写版本号', @@ -79,8 +80,26 @@ export const model_version: { [key: string]: string } = { 'model_detail.version.table.rule.required.path': '模型地址为必填项', }; -// 企业项目列表 -export const business_project_list: { [key: string]: string } = {}; +// 业务模型 +export const business_project_list: { [key: string]: string } = { + 'business_model.table.title': '业务模型列表', + 'business_model.table.list.add.name': '创建模型', + 'business_model.table.list.name': '业务模型名称', + 'business_model.table.list.createTime': '创建时间', + 'business_model.stepForm.base': '基本信息', + 'business_model.stepForm.base.description': '填写基础信息', + 'business_model.stepForm.baseModel': '关联模型', + 'business_model.stepForm.baseModel.description': '关联基础模型', + 'business_model.stepForm.project_file': '业务代码', + 'business_model.stepForm.project_file.description': '上传业务代码', + 'business_model.stepForm.config': '参数配置', + 'business_model.stepForm.config.description': '配置业务参数', + 'business_model.form.modelFkId': '业务模型名称', + 'business_model.form.remark': '简介', + + 'business_model.form.name': '版本号', + 'business_model.form.required.name': '请填写版本号', +}; // 未启用 export const business_image: { [key: string]: string } = { diff --git a/src/pages/Business/BusinessModel/components/createForm.tsx b/src/pages/Business/BusinessModel/components/createForm.tsx new file mode 100644 index 0000000..2f5e9c9 --- /dev/null +++ b/src/pages/Business/BusinessModel/components/createForm.tsx @@ -0,0 +1,489 @@ +import { + ProForm, + ProFormInstance, + ProFormList, + ProFormSelect, + ProFormText, + ProFormTextArea, + ProFormUploadDragger, + StepsForm, +} from '@ant-design/pro-components'; +import { FormListActionType } from '@ant-design/pro-form/lib'; + +import { getBaseBusinessModelList } from '@/services/testApi/businessModel'; +import { getDeviceGroupTree } from '@/services/testApi/deviceGroup'; +import { FormattedMessage, useIntl } from '@umijs/max'; +import { Modal, Transfer, Tree, UploadFile, message } from 'antd'; +import yaml from 'js-yaml'; +import React, { useEffect, useRef, useState } from 'react'; +import { + proFormMaxItemStyleProps, + proFormMaxModelWidth, + proFormStepsFormProps, +} from '../../../../../config/defaultForm'; +// import {beforeUploadFile} from "@/utils/common"; +// @ts-ignore +import cookie from 'react-cookies'; + +export type FormValueType = { + target?: string; + template?: string; + type?: string; + time?: string; + frequency?: string; +} & Partial; + +export type CreateFormProps = { + createModalOpen: boolean; + handleModal: () => void; + values: Partial; + reload: any; + currentDefaultFieldsData?: Record; +}; +const waitTime = (time: number = 100) => { + return new Promise((resolve) => { + setTimeout(() => { + resolve(true); + }, time); + }); +}; +// interface ProjectConfig { +// params: Array; +// } +const CreateForm: React.FC = (props) => { + const actionFormListRef = useRef< + FormListActionType<{ + name: string; + }> + >(); + + const intl = useIntl(); + const [isHasModelFkId, setIsHasModelFkId] = useState(false); + const [dataFormList] = useState([]); + const dataFormListRef = useRef(dataFormList); + const [fileList, setFileList] = useState[]>([]); + // 关联模型state + const [modalData, setModalData] = useState([]); + const [targetKeys, setTargetKeys] = useState([]); + + // 关联节点state + const [treeData, setTreeData] = React.useState([]); + const [selectKeys, setSelectKeys] = useState([]); + + // const [form] = Form.useForm(); + const [current, setCurrent] = useState(0); + const formRef = useRef(); + const [filePath, setFilePath] = useState(''); + + const handleFileChange = ({ file }: { file: UploadFile }) => { + let curFile: any; + + switch (file.status) { + case 'uploading': + case 'done': + curFile = [file]; + break; + + case 'removed': + default: + curFile = []; + break; + } + + setFileList([...curFile]); + }; + + // todo disabled: !v?.defaultVersionFkId,设置 暂时设置为false 创建成功后报error + const getModelData = () => { + getBaseBusinessModelList({ keyword: '', page: 1, pageSize: 100 }).then((res) => { + console.log(66666, res.data); + let result = (res.data?.results || []).map((v: any) => { + console.log(v); + return { + key: v.id, + title: v.name, + chosen: false, + disabled: false, + }; + }); + setModalData(result); + }); + // setMockData(tempMockData); + // setTargetKeys(tempTargetKeys); + }; + + const handleChange = (newTargetKeys: string[]) => { + setTargetKeys(newTargetKeys); + }; + + useEffect(() => { + setTargetKeys([]); + console.log('selectKeys', selectKeys); + if (props.createModalOpen) { + getModelData(); + getDeviceGroupTree() + .then((resp: API.Response) => { + setTreeData(resp.data.tree); + }) + .catch(() => {}); + } else { + formRef.current?.resetFields(); + } + }, [props.createModalOpen]); + + useEffect(() => { + if (props.currentDefaultFieldsData) { + // 如果是在模型详情新增版本,ModelFkId不可编辑 + console.log(props.values, isHasModelFkId, 'currentDefaultFieldsData'); + setIsHasModelFkId(true); + } else { + setIsHasModelFkId(false); + } + }, []); + return ( +
+ + stepsProps={proFormStepsFormProps.stepsProps} + current={current} + onCurrentChange={setCurrent} + formProps={{ + validateMessages: { + required: `${intl.formatMessage({ + id: 'common.form.required', + defaultMessage: '此项为必填项', + })}`, + }, + }} + stepsFormRender={(dom, submitter) => { + return ( + + } + width={proFormMaxModelWidth} + onCancel={() => { + setCurrent(0); + formRef.current?.resetFields(); + setFileList([]); + props.handleModal(); + }} + open={props.createModalOpen} + footer={submitter} + destroyOnClose + > + {dom} + + ); + }} + > + {/* 基本信息 数据创建 */} + + className="gn_form" + name="base" + formRef={formRef} + title={} + stepProps={{ + description: ( + + ), + }} + onFinish={async () => { + // setFormData(formRef.current?.getFieldsValue()); + await waitTime(500); + return true; + }} + > + + {/* //TODO 默认填充模型 无需选择 */} + } + placeholder={`${intl.formatMessage({ + id: 'common.please_select', + defaultMessage: '$$$', + })}${intl.formatMessage({ + id: 'business_model.form.modelFkId', + defaultMessage: '$$$', + })}`} + required={true} + // initialValue={props.values.modelFkId} + showSearch + debounceTime={1000} + disabled={true} + // request={async (keyWord) => { + // const resp = await getBaseBusinessModelList({ + // keyword: keyWord?.keyWords || '', + // }); + // return resp.data.list.map((v: any) => { + // return { + // label: v.name, + // value: v.id, + // }; + // }); + // }} + /> + } + placeholder={`${intl.formatMessage({ + id: 'common.please_input', + defaultMessage: '$$$', + })}${intl.formatMessage({ + id: 'business_model.form.remark', + defaultMessage: '$$$', + })}`} + required={false} + disabled={false} + /> + + + {/* 关联算法模型 */} + + name="baseModel" + title={ + + } + stepProps={{ + description: ( + + ), + }} + onFinish={async () => { + return true; + }} + > + {/* //TODO 与UI确定调整尺寸布局 */} + item.title} + /> + + {/* 业务代码 */} + + className="gn_form" + name="project_file" + title={ + + } + style={{ width: proFormMaxItemStyleProps.width }} + stepProps={{ + description: ( + + ), + }} + onFinish={async (values: any) => { + if ('projectFilePath' in values && values['projectFilePath'].length > 0) { + let projectFilePath = values['projectFilePath'][0]?.response?.data?.path || ''; + setFilePath(projectFilePath); + } + return true; + }} + > + 上传业务代码} + name="projectFilePath" + action="/api/v1/file/uploadFile" + max={1} + fieldProps={{ + name: 'file', + // beforeUpload: beforeUploadFile, + data: { path: `models/${Date.now()}` }, + headers: { + 'X-CSRFToken': cookie.load('csrftoken'), + Authorization: `Bearer ${localStorage.getItem('access') || ''}`, + }, + }} + /> +
请上传格式为zip.tar.gz的业务代码文件
+ + {/* 参数配置 */} + + className="gn_form" + name="config" + title={} + stepProps={{ + description: ( + + ), + }} + onFinish={async (values: any) => { + setFileList([]); + let formData = formRef.current?.getFieldsValue(); + if (formData?.modelFkId) { + await waitTime(500); + formData.modelConfig = { params: values?.params || [] }; + if (filePath) { + formData.path = filePath; + } + // postModelVersionCreateModelVersion(formData) + // .then(() => { + // message.success( + // intl.formatMessage({ id: 'common.success', defaultMessage: '$$$' }), + // ); + // props.handleModal(); + // props.reload(); + // }) + // .catch(() => { + // message.error(intl.formatMessage({ id: 'common.failure', defaultMessage: '$$$' })); + // return false; + // }); + } + return true; + }} + > + 上传配置文件} + value={fileList} + name="dragger" + fieldProps={{ + onChange: handleFileChange, + onRemove: () => { + let index_ids = actionFormListRef.current?.getList()?.map((v, i) => { + return i; + }); + actionFormListRef.current?.remove(index_ids || []); + }, + beforeUpload: (file) => { + if ( + !file.name.endsWith('.yaml') && + !file.name.endsWith('.yml') && + !file.name.endsWith('.json') + ) { + message.error('请上传yaml或json文件').then(() => {}); + return false; + } else { + let parsedData = {}; + file + .text() + .then((text) => { + if (file.name.endsWith('.yaml') || file.name.endsWith('.yml')) { + parsedData = yaml.load(text) as Record; + } + if (file.name.endsWith('.json')) { + parsedData = JSON.parse(text) as Record; + } + if (Object.keys(parsedData).length > 0) { + dataFormListRef.current = Object.entries(parsedData).map( + ([key, value]) => ({ + name: key, + default: value, + }), + ); + + dataFormListRef.current.forEach((v: any, i: number) => { + actionFormListRef.current?.add(v, i); + }); + } + return true; + }) + .catch(() => { + return false; + }); + } + }, + }} + /> + + {/* // TODO label字重与上面统一, 操作按钮需要与输入框对齐 */} + + 模型参数 +

+ 暂未上传模型配置文件,可根据业务需求手动添加参数字段~ +

+
+ } + actionRef={actionFormListRef} + itemContainerRender={(doms) => { + return {doms}; + }} + alwaysShowItemLabel + > + {() => { + return ( + <> + + + + ); + }} + + + {/* 关联节点 */} + + name="group" + title={} + stepProps={{ + description: ( + + ), + }} + onFinish={async () => { + return true; + }} + style={{ width: proFormMaxItemStyleProps.width }} + > +
{'节点信息'}
+ { + // form.setFieldsValue({menuIds: checkedKeys}) + setSelectKeys(checkedKeys); + // formRef3.current?.setFieldValue('groupIds', checkedKeys) + }} + treeData={treeData} + // loadData={({treeNode}) => { + // return treeData + // }} + /> + + + + ); +}; +export default CreateForm; diff --git a/src/pages/Business/BusinessModel/index.tsx b/src/pages/Business/BusinessModel/index.tsx index 8119fb1..5af58ff 100644 --- a/src/pages/Business/BusinessModel/index.tsx +++ b/src/pages/Business/BusinessModel/index.tsx @@ -2,13 +2,211 @@ * @Author: donghao donghao@supervision.ltd * @Date: 2024-04-22 15:23:36 * @LastEditors: donghao donghao@supervision.ltd - * @LastEditTime: 2024-04-22 15:37:39 + * @LastEditTime: 2024-04-25 16:11:40 * @FilePath: \general-ai-platform-web\src\pages\Node\BusinessModel\index.tsx * @Description: 业务模型 * @交互说明 + * 1、业务模型列表的分页展示 + * 2、新增、更新、删除(模型)功能 + * 3. 模型详情展示 */ +// const BusinessModel: React.FC = () => { +// return
业务模型
; +// }; + +// export default BusinessModel; + +import TableActionCard from '@/components/TableActionCard'; +import IsDelete from '@/components/TableActionCard/isDelete'; +import { getBusinessModelList } from '@/services/testApi/businessModel'; +import { ExclamationCircleFilled } from '@ant-design/icons'; +import type { ActionType, ProColumns } from '@ant-design/pro-components'; +import { ProCard, ProTable } from '@ant-design/pro-components'; +import { FormattedMessage } from '@umijs/max'; +import { Button } from 'antd'; +import { useRef, useState } from 'react'; +import { proTableCommonOptions, proTablePaginationOptions } from '../../../../config/defaultTable'; +import CreateForm from './components/createForm'; + const BusinessModel: React.FC = () => { - return
业务模型
; + // const intl = useIntl(); + const actionRef = useRef(); + + const [createModalOpen, setCreateModalOpen] = useState(false); + // const [categoryFkIdIds, setCategoryFkIdIds] = useState([]); + // 动态设置每页数量 + const [currentPageSize, setCurrentPageSize] = useState(10); + // const [currentRow, setCurrentRow] = useState>({}); + + /** + * @en-US The pop-up window of the distribution update window + * @zh-CN 分布更新窗口的弹窗 + * */ + // const [updateModalOpen, setUpdateModalOpen] = useState(false); + // const [showDetail, setShowDetail] = useState(false); + + /**新增 编辑 删除 */ + // 新增 + const handleCreateModal = () => { + if (createModalOpen) { + setCreateModalOpen(false); + } else { + setCreateModalOpen(true); + } + }; + + function reloadList() { + actionRef.current?.reload(); + } + + // 业务模型列表信息 + const columns: ProColumns>[] = [ + { + title: , + dataIndex: 'name', + hideInSearch: true, + key: 'fixedName', + fixed: 'left', + }, + + { + title: ( + + ), + dataIndex: 'createTime', + hideInSearch: true, + valueType: 'dateTime', + }, + + { + title: , + dataIndex: 'option', + valueType: 'option', + fixed: 'right', + key: 'option', + render: (_, record) => [ + { + // TODO 编辑在新增联调后实现 + // setCurrentRow(record); + // history.push('/home/model-detail'); + // doToDetail(record); + // setShowDetail(true); + // setUpdateModalOpen(true); + }} + > + + + ), + }, + { + key: 'destroy', + renderDom: ( + { + handleDestroy(record).then(() => {}); + }} + > + ), + }, + ]} + >, + ], + }, + ]; + return ( +
+ + + + } + extra={ + + } + > +
+ + 业务模型需关联设备节点请先至“设备节点”页创建需关联的节点 +
+ { + console.log(data, 'onDataSourceChange_data'); + // let CategoryFkIdIds: any = data.map((v) => { + // return v.categoryFkId; + // }); + // setCategoryFkIdIds(CategoryFkIdIds); + }} + pagination={{ + ...proTablePaginationOptions, + pageSize: currentPageSize, + onChange: (page, pageSize) => setCurrentPageSize(pageSize), + }} + columnsState={{ + persistenceKey: 'algorithm_model_list', + persistenceType: 'localStorage', + }} + request={async (params = {}) => { + const { current, ...rest } = params; + const reqParams = { + page: current, + ...rest, + }; + let resp = await getBusinessModelList({ ...reqParams }); + console.log(resp, 'getModelVersionList_resp'); + return { + data: resp.data?.results.map((v: Record) => { + return { ...v, key: v.id }; + }), + success: resp.success, + total: resp.data.count, + current: current, + pageSize: currentPageSize, + }; + }} + columns={columns} + /> +
+ +
+ ); }; export default BusinessModel; diff --git a/src/pages/Model/ModelDetail/components/createForm.tsx b/src/pages/Model/ModelDetail/components/createForm.tsx index 0ba2fd5..71372ae 100644 --- a/src/pages/Model/ModelDetail/components/createForm.tsx +++ b/src/pages/Model/ModelDetail/components/createForm.tsx @@ -108,6 +108,7 @@ const CreateForm: React.FC = (props) => { stepsFormRender={(dom, submitter) => { return ( } diff --git a/src/services/testApi/businessModel.ts b/src/services/testApi/businessModel.ts new file mode 100644 index 0000000..6ff27c9 --- /dev/null +++ b/src/services/testApi/businessModel.ts @@ -0,0 +1,51 @@ +/* + * @Author: donghao donghao@supervision.ltd + * @Date: 2024-04-09 13:46:44 + * @LastEditors: donghao donghao@supervision.ltd + * @LastEditTime: 2024-04-25 15:21:56 + * @FilePath: \general-ai-manage\src\services\testApi\businessModel.ts + * @Description: 企业模型mock数据映射 + */ +// @ts-ignore +/* eslint-disable */ +import { request } from '@umijs/max'; + +/** 企业业务模型分页列表 */ +export async function getBusinessModelList( + body: Record, // + options?: { [key: string]: any }, +) { + return request( + `/api/businessModel/list`, + { + method: 'GET', + headers: { + 'Content-Type': 'application/json', + }, + params: { + ...body, + }, + ...(options || {}), + }, + ); +} + +/** 企业基础业务模型分页列表 */ +export async function getBaseBusinessModelList( + body: Record, // + options?: { [key: string]: any }, +) { + return request( + `/api/businessModel/base/list`, + { + method: 'GET', + headers: { + 'Content-Type': 'application/json', + }, + params: { + ...body, + }, + ...(options || {}), + }, + ); +} diff --git a/src/services/testApi/deviceGroup.ts b/src/services/testApi/deviceGroup.ts new file mode 100644 index 0000000..b8491b6 --- /dev/null +++ b/src/services/testApi/deviceGroup.ts @@ -0,0 +1,51 @@ +/* + * @Author: donghao donghao@supervision.ltd + * @Date: 2024-04-25 15:39:42 + * @LastEditors: donghao donghao@supervision.ltd + * @LastEditTime: 2024-04-25 15:49:38 + * @FilePath: \general-ai-platform-web\src\services\testApi\deviceGroup.ts + * @Description: 节点设置api + */ +// @ts-ignore +/* eslint-disable */ +import { request } from '@umijs/max'; + +/** 节点设置分页列表 */ +// export async function getDeviceGroupList( +// body: Record, // +// options?: { [key: string]: any }, +// ) { +// return request( +// `/api/device_group/list`, +// { +// method: 'GET', +// headers: { +// 'Content-Type': 'application/json', +// }, +// params: { +// ...body, +// }, +// ...(options || {}), +// }, +// ); +// } + +/** 获取设备组树 POST /device_group/getDeviceGroupTree */ +export async function getDeviceGroupTree( + body: Record, // + options?: { [key: string]: any }, +) { + return request( + `/api/device_group/getDeviceGroupTree`, + { + method: 'GET', + headers: { + 'Content-Type': 'application/json', + }, + params: { + ...body, + }, + ...(options || {}), + }, + ); +}