diff --git a/config/routes.ts b/config/routes.ts
index 384183f..035ee61 100644
--- a/config/routes.ts
+++ b/config/routes.ts
@@ -2,7 +2,7 @@
* @Author: donghao donghao@supervision.ltd
* @Date: 2024-03-27 14:56:27
* @LastEditors: donghao donghao@supervision.ltd
- * @LastEditTime: 2024-06-12 14:04:24
+ * @LastEditTime: 2024-06-17 14:42:27
* @FilePath: \general-ai-manage\config\routes.ts
* @Description: 页面路由池
*/
@@ -201,25 +201,25 @@ export default [
component: './404',
},
// test demo
- {
- path: '/admin',
- name: 'admin',
- icon: 'crown',
- routes: [
- {
- path: '/admin',
- redirect: '/admin/index',
- },
- {
- path: '/admin/index',
- name: 'admin-index',
- component: './Admin',
- },
- {
- path: '/admin/previewFile',
- name: 'admin-preview-file',
- component: './Admin/previewFile',
- },
- ],
- },
+ // {
+ // path: '/admin',
+ // name: 'admin',
+ // icon: 'crown',
+ // routes: [
+ // {
+ // path: '/admin',
+ // redirect: '/admin/index',
+ // },
+ // {
+ // path: '/admin/index',
+ // name: 'admin-index',
+ // component: './Admin',
+ // },
+ // {
+ // path: '/admin/previewFile',
+ // name: 'admin-preview-file',
+ // component: './Admin/previewFile',
+ // },
+ // ],
+ // },
];
diff --git a/mock/deviceGroup.ts b/mock/deviceGroup.ts
index 5f9952c..0bc7f4c 100644
--- a/mock/deviceGroup.ts
+++ b/mock/deviceGroup.ts
@@ -2,7 +2,7 @@
* @Author: donghao donghao@supervision.ltd
* @Date: 2024-01-25 16:53:15
* @LastEditors: donghao donghao@supervision.ltd
- * @LastEditTime: 2024-04-26 16:35:54
+ * @LastEditTime: 2024-06-18 09:28:19
* @FilePath: \general-ai-platform-web\mock\deviceGroup.ts
* @Description: 节点设备设置 mock
*/
@@ -18,7 +18,7 @@ import {
import { successMockApiProps } from './typing';
import { fetchCurrPageByList, fetchMockSuccessFullByOther } from './utils/apiMock';
export default {
- // 设备组列表分页
+ // 节点列表分页
'GET /api/device_group/getDeviceGroupList': async (req: Request, res: Response) => {
const { pageNo, pageSize } = req.query;
const resData: successMockApiProps = {
@@ -30,7 +30,7 @@ export default {
res.json(resData);
},
- // 设备组网点树列表
+ // 设备节点树列表
'GET /api/device_group/setting_data': async (req: Request, res: Response) => {
const resData: successMockApiProps = {
...fetchMockSuccessFullByOther(mockGetDeviceGroupSettingData),
@@ -39,14 +39,14 @@ export default {
},
/** 未启用 */
- // 设备组网点选项列表
+ // 设备节点选项列表
'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),
@@ -54,7 +54,7 @@ export default {
res.json(resData);
},
- // 设备组详情
+ // 节点详情
'GET /api/device_group/getDeviceGroupById': async (req: Request, res: Response) => {
const { id } = req.query;
let currRes = {};
diff --git a/mock/pools/businessStateData.ts b/mock/pools/businessStateData.ts
index 81c52dd..8b54624 100644
--- a/mock/pools/businessStateData.ts
+++ b/mock/pools/businessStateData.ts
@@ -135,7 +135,7 @@ const fetchDeviceList = () => {
updateTime: generateRandomDateTimeByYear(2023),
isEnable: Math.floor(Math.random() * 8) % 2 === 0,
name: '设备' + (i + 1),
- groupName: '设备组0' + ((Math.floor(Math.random() * 8) % 3) + 1),
+ groupName: '节点0' + ((Math.floor(Math.random() * 8) % 3) + 1),
deviceType: '设备分类' + ((Math.floor(Math.random() * 8) % 4) + 1),
index: i,
provider: '苏胜天',
diff --git a/mock/pools/deviceGroupData.ts b/mock/pools/deviceGroupData.ts
index f7e4b1e..c5994ce 100644
--- a/mock/pools/deviceGroupData.ts
+++ b/mock/pools/deviceGroupData.ts
@@ -2,7 +2,7 @@
* @Author: donghao donghao@supervision.ltd
* @Date: 2024-04-25 15:45:31
* @LastEditors: donghao donghao@supervision.ltd
- * @LastEditTime: 2024-05-31 14:28:44
+ * @LastEditTime: 2024-06-18 09:27:29
* @FilePath: \general-ai-platform-web\mock\pools\deviceGroupData.ts
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
@@ -15,7 +15,7 @@
* @Description: 节点设备设置
*/
-// 设备组节点树
+// 设备节点树
export const mockGetDeviceGroupSettingData = {
data: [
{
@@ -286,7 +286,7 @@ export const mockGetDeviceGroupTreeData = {
},
};
-// 设备组列表分页
+// 节点列表分页
export const mockGetDeviceGroupListData = {
data: {
data: [
@@ -368,7 +368,7 @@ export const mockGetDeviceGroupListData = {
};
/** 未启用 */
-// 设备组节点选项列表
+// 节点节点选项列表
export const mockGetDeviceGroupFkSelectData = {
data: {
list: [
@@ -396,7 +396,7 @@ export const mockGetDeviceGroupFkSelectData = {
},
};
-// 设备组详情
+// 节点详情
export const mockGetDeviceGroupData1 = {
data: {
deviceGroup: {
diff --git a/src/app.less b/src/app.less
index dbbc004..83f829d 100644
--- a/src/app.less
+++ b/src/app.less
@@ -2,7 +2,6 @@
.app_page_wrap {
height: calc(100vh);
padding: 0;
- /* TODO 替换整体页面背景图 */
.ant-pro-layout .ant-pro-layout-content {
position: relative;
display: flex;
diff --git a/src/components/MenuBar/index.tsx b/src/components/MenuBar/index.tsx
index a56730a..68f2468 100644
--- a/src/components/MenuBar/index.tsx
+++ b/src/components/MenuBar/index.tsx
@@ -117,7 +117,6 @@ const MenuBar: React.FC = ({ menuData, changeMenu }) => {
- {/* // TODO 菜单需要补充路由聚焦状态 */}
{menuData &&
diff --git a/src/components/Tree/src/baseTree.tsx b/src/components/Tree/src/baseTree.tsx
index 6a0a478..9785278 100644
--- a/src/components/Tree/src/baseTree.tsx
+++ b/src/components/Tree/src/baseTree.tsx
@@ -145,7 +145,9 @@ const BaseTree: React.FC = (props) => {
return (
@@ -234,25 +236,6 @@ const BaseTree: React.FC = (props) => {
{renderAddAction()}
- {/* 添加一级节点
*/}
-
- {/* TODO 使用ProForm */}
- {/*
-
-
-
-
- */}
);
};
diff --git a/src/components/UploadFile/src/formUploadDraggerToken.tsx b/src/components/UploadFile/src/formUploadDraggerToken.tsx
index 2e2b6f4..dd1d574 100644
--- a/src/components/UploadFile/src/formUploadDraggerToken.tsx
+++ b/src/components/UploadFile/src/formUploadDraggerToken.tsx
@@ -2,7 +2,7 @@
* @Author: donghao donghao@supervision.ltd
* @Date: 2024-06-04 15:14:27
* @LastEditors: donghao donghao@supervision.ltd
- * @LastEditTime: 2024-06-12 14:40:40
+ * @LastEditTime: 2024-06-17 14:23:18
* @FilePath: \general-ai-platform-web\src\components\UploadFile\src\FormUploadDraggerToken.tsx
* @Description: 手动文件上传、删除
* // TODO 需要支持多文件上传
@@ -109,7 +109,7 @@ const FormUploadDraggerToken: React.FC = (props) =>
// requestDelFile?.(code === 200);
// return code === 200;
};
- // TODO 组装初始值
+ // 组装初始值
return (
<>
[] = [
export const deviceStateEnums: DICTENUM.DICT_TAB_ITEM[] = [
{
label: '全部状态',
- key: '0',
+ key: '1000',
},
{
label: '在线',
- key: '1',
+ key: '1001',
className: 'online_info',
},
{
label: '离线',
- key: '2',
+ key: '1002',
className: 'outline_info',
},
{
label: '运行中',
- key: '3',
+ key: '1003',
className: 'process_info',
},
{
label: '故障',
- key: '4',
+ key: '1004',
className: 'error_info',
},
];
diff --git a/src/layouts/HomeLayout.tsx b/src/layouts/HomeLayout.tsx
index 3a73352..a9a9b75 100644
--- a/src/layouts/HomeLayout.tsx
+++ b/src/layouts/HomeLayout.tsx
@@ -2,7 +2,7 @@
* @Author: donghao donghao@supervision.ltd
* @Date: 2024-04-07 15:25:23
* @LastEditors: donghao donghao@supervision.ltd
- * @LastEditTime: 2024-05-20 15:26:48
+ * @LastEditTime: 2024-06-17 14:23:43
* @FilePath: \general-ai-manage\src\layouts\HomeLayout.tsx
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
@@ -171,7 +171,6 @@ const HomeLayout: React.FC = () => {
{/* 二级菜单 */}
- {/* //TODO 按UI图调整二级菜单栏效果 */}
{currRoute?.subMenu && !currRoute?.isHideMenu && (
{currRoute.subMenu.map((menuItem, index) => {
diff --git a/src/locales/zh-CN/alarm.ts b/src/locales/zh-CN/alarm.ts
index 8a7a98f..b1f21bd 100644
--- a/src/locales/zh-CN/alarm.ts
+++ b/src/locales/zh-CN/alarm.ts
@@ -27,7 +27,7 @@ export const alarm_setting: { [key: string]: string } = {
'alarm.setting.table.list.update': '编辑告警项',
'alarm.setting.table.rule.required.code': '类别代码为必填项',
'alarm.setting.table.model.alarmStatusSetting': '告警等级',
- 'alarm.list.table.list.deviceGroup': '设备组',
+ 'alarm.list.table.list.deviceGroup': '节点',
'alarm.list.table.list.alarmTime': '告警时间',
'alarm.setting.table.list.rule.required.name': '请填写告警名称',
};
diff --git a/src/locales/zh-CN/device.ts b/src/locales/zh-CN/device.ts
index 23a59f0..0b78b85 100644
--- a/src/locales/zh-CN/device.ts
+++ b/src/locales/zh-CN/device.ts
@@ -2,7 +2,7 @@
* @Author: zhoux zhouxia@supervision.ltd
* @Date: 2023-11-01 13:56:33
* @LastEditors: donghao donghao@supervision.ltd
- * @LastEditTime: 2024-05-29 16:06:49
+ * @LastEditTime: 2024-06-19 11:32:14
* @FilePath: \general-ai-platform-web\src\locales\zh-CN\device.ts
* @Description: 设备相关
*/
@@ -50,6 +50,8 @@ export const device_group_list: { [key: string]: string } = {
'device_group_list.table.list.name': '设备名称',
'device_group_list.table.list.rule.required.name': '请填写设备名称',
'device_group_list.table.list.deviceSite': '设备位置',
+ 'device_group_list.table.list.deviceNode': '节点',
+
'device_group_list.table.list.deviceType': '设备分类',
'device_group_list.table.list.rule.required.deviceType': '请选择设备分类',
@@ -81,13 +83,13 @@ export const device_group_list: { [key: string]: string } = {
// 设备状态
export const device_state: { [key: string]: string } = {
- 'device_state.table.form.groupName': '设备组',
+ 'device_state.table.form.groupName': '节点',
'device_state.table.form.deviceType': '设备分类',
'device_state.table.form.name': '设备名称',
'device_state.table.form.remark': '备注',
// 日志
'device_state.table.stateLog.list.ip': '设备IP',
- 'device_state.table.stateLog.list.runTime': '默认端口',
+ 'device_state.table.stateLog.list.runTime': '运行时长',
'device_state.table.stateLog.list.updateTime': '更新时间',
'device_state.table.detail.echarts.used': '已占用',
diff --git a/src/pages/Business/BusinessModel/components/detailCard.tsx b/src/pages/Business/BusinessModel/components/detailCard.tsx
index 5babbbd..7f3bfc8 100644
--- a/src/pages/Business/BusinessModel/components/detailCard.tsx
+++ b/src/pages/Business/BusinessModel/components/detailCard.tsx
@@ -2,7 +2,7 @@
* @Author: donghao donghao@supervision.ltd
* @Date: 2024-06-11 13:33:07
* @LastEditors: donghao donghao@supervision.ltd
- * @LastEditTime: 2024-06-12 16:30:51
+ * @LastEditTime: 2024-06-13 09:51:34
* @FilePath: \general-ai-platform-web\src\pages\Business\BusinessModel\components\detailCard.tsx
* @Description: 业务模型详情
*/
@@ -10,7 +10,6 @@
import { isArrayAndNotEmpty } from '@/utils/is';
import { ProCard } from '@ant-design/pro-components';
import { Modal } from 'antd';
-import { useEffect, useState } from 'react';
import { proFormSmallModelWidth } from '../../../../../config/defaultForm';
type DetailCardProps = {
info: Record
;
@@ -21,11 +20,6 @@ type DetailCardProps = {
const DetailCard: React.FC = (props) => {
/**state */
// const intl = useIntl();
- const [setForceRender] = useState(false);
-
- useEffect(() => {
- setForceRender(props.detailModalOpen);
- }, [props.detailModalOpen]);
return (
= (props) => {
open={props.detailModalOpen}
onCancel={props.handleModal}
footer={null}
- afterVisibleChange={(isVisible) => {
- if (!isVisible) {
- setForceRender(false); // Modal 关闭时重置状态
- }
- }}
>
diff --git a/src/pages/Business/BusinessState/components/detailDeviceState.tsx b/src/pages/Business/BusinessState/components/detailDeviceState.tsx
index bcaa8d1..1641596 100644
--- a/src/pages/Business/BusinessState/components/detailDeviceState.tsx
+++ b/src/pages/Business/BusinessState/components/detailDeviceState.tsx
@@ -2,7 +2,7 @@
* @Author: donghao donghao@supervision.ltd
* @Date: 2024-04-08 16:57:30
* @LastEditors: donghao donghao@supervision.ltd
- * @LastEditTime: 2024-05-22 16:52:38
+ * @LastEditTime: 2024-06-19 11:30:46
* @FilePath: \general-ai-manage\src\pages\Project\BusinessProject\components\detailDeviceState.tsx
* @Description: 设备详情
* @交互说明
@@ -11,7 +11,12 @@
import { bsDeviceDetailEnums } from '@/enums/device';
import { getModelGroupBaseModelList } from '@/services/testApi/model';
import { isSuccessApi } from '@/utils/forApi';
-import { ProCard, ProDescriptions, ProList, ProTable } from '@ant-design/pro-components';
+import {
+ ProCard,
+ ProDescriptions,
+ // ProList,
+ ProTable,
+} from '@ant-design/pro-components';
import { FormattedMessage, useIntl } from '@umijs/max';
import { Modal, Tabs } from 'antd';
import * as echarts from 'echarts';
@@ -21,27 +26,33 @@ import { proFormMaxModelWidth } from '../../../../../config/defaultForm';
import DetailDeviceStateLog from './detailDeviceStateLog';
type DetailDeviceStateProps = {
info: Record;
+ commInfo: Record;
detailOpen: boolean;
closeModal: () => void;
};
-const DetailDeviceState: React.FC = ({ info, detailOpen, closeModal }) => {
+const DetailDeviceState: React.FC = ({
+ info,
+ commInfo,
+ detailOpen,
+ closeModal,
+}) => {
/**state */
const intl = useIntl();
const [tabKey, setTabKey] = useState(bsDeviceDetailEnums[0].key);
const [tabs] = useState([...bsDeviceDetailEnums]);
- const [modelData, setModelData] = useState[]>([]); // 列表数据
+ // const [modelData, setModelData] = useState[]>([]); // 列表数据
const [forceRender, setForceRender] = useState(false);
// 基础模型信息
const ModelDetailColumns = [
{
- title: ,
- dataIndex: 'groupName',
+ title: ,
+ dataIndex: 'group',
},
{
title: ,
- dataIndex: 'deviceType',
+ dataIndex: 'classification',
},
{
title: ,
@@ -49,27 +60,27 @@ const DetailDeviceState: React.FC = ({ info, detailOpen,
},
{
title: ,
- dataIndex: 'remark',
+ dataIndex: 'comment',
},
];
-
+ // TODO 切换详情展示,未能渲染出来信息环形图
// 硬件信息环形图
const fetchOptionByData = (record) => {
- const totalCount = 100 * Math.floor(Math.random() * 15);
+ const totalCount = 100;
const currData = [
{
- value: record?.percent * totalCount,
+ value: Math.floor(record?.percent * totalCount),
name: `${intl.formatMessage({
id: 'device_state.table.detail.echarts.used',
defaultMessage: '已占用',
- })}${record?.percent * 100}%`,
+ })}${Math.floor(record?.percent * totalCount)}%`,
},
{
- value: totalCount - record?.percent * totalCount,
+ value: totalCount - Math.floor(record?.percent * totalCount),
name: `${intl.formatMessage({
id: 'device_state.table.detail.echarts.free',
defaultMessage: '未占用',
- })}${100 - record?.percent * 100}%`,
+ })}${100 - Math.floor(record?.percent * totalCount)}%`,
},
];
@@ -89,7 +100,7 @@ const DetailDeviceState: React.FC = ({ info, detailOpen,
},
tooltip: {
trigger: 'item',
- formatter: '{a}
{b} : {c} ({d}%)',
+ formatter: '{a}
{b}',
},
legend: {
orient: 'horizontal',
@@ -219,7 +230,7 @@ const DetailDeviceState: React.FC = ({ info, detailOpen,
),
}));
- setModelData(finalList);
+ // setModelData(finalList);
console.log(finalList, 'toListDomByData_finalList');
}
@@ -231,8 +242,14 @@ const DetailDeviceState: React.FC = ({ info, detailOpen,
}
}
+ function resetData() {
+ setTabKey(() => bsDeviceDetailEnums[0].key);
+ }
useEffect(() => {
setForceRender(detailOpen);
+ if (!detailOpen) {
+ resetData();
+ }
}, [detailOpen]);
// 初始化加载
@@ -275,7 +292,7 @@ const DetailDeviceState: React.FC = ({ info, detailOpen,
@@ -308,7 +325,8 @@ const DetailDeviceState: React.FC
= ({ info, detailOpen,
})}
-
+ {/* 暂无数据,隐藏当前任务 */}
+ {/*
= ({ info, detailOpen,
}}
/>
-
+ */}
)}
- {tabKey === '1' && }
+ {tabKey === '1' && }
);
diff --git a/src/pages/Business/BusinessState/components/detailDeviceStateLog.tsx b/src/pages/Business/BusinessState/components/detailDeviceStateLog.tsx
index 08d3c2d..4edc8a2 100644
--- a/src/pages/Business/BusinessState/components/detailDeviceStateLog.tsx
+++ b/src/pages/Business/BusinessState/components/detailDeviceStateLog.tsx
@@ -2,21 +2,25 @@
* @Author: donghao donghao@supervision.ltd
* @Date: 2024-04-22 15:23:36
* @LastEditors: donghao donghao@supervision.ltd
- * @LastEditTime: 2024-05-10 17:07:15
+ * @LastEditTime: 2024-06-19 11:33:59
* @FilePath: \general-ai-platform-web\src\pages\Business\BusinessState\components\detailDeviceStateLog.tsx
* @Description: 设备日志
* @交互说明
* 1、设备日志列表的分页展示
*/
-import { getDeviceStateLogList } from '@/services/testApi/businessState';
+import { apiDeviceStatusLog } from '@/services/business/device';
+import { isSuccessApi } from '@/utils/forApi';
import type { ActionType, ProColumns } from '@ant-design/pro-components';
import { ProCard, ProTable } from '@ant-design/pro-components';
import { FormattedMessage } from '@umijs/max';
import { useRef, useState } from 'react';
import { proTablePaginationOptions } from '../../../../../config/defaultTable';
-
-const DetailDeviceStateLog: React.FC = () => {
+type DetailDeviceStateLogProps = {
+ commInfo: Record;
+};
+// TODO 根据具体数据展示
+const DetailDeviceStateLog: React.FC = (props) => {
const actionRef = useRef();
// 动态设置每页数量
const [currentPageSize, setCurrentPageSize] = useState(10);
@@ -34,7 +38,7 @@ const DetailDeviceStateLog: React.FC = () => {
title: (
),
- dataIndex: 'runTime',
+ dataIndex: 'duration',
hideInSearch: true,
width: '20%',
},
@@ -45,7 +49,7 @@ const DetailDeviceStateLog: React.FC = () => {
defaultMessage="更新时间"
/>
),
- dataIndex: 'updateTime',
+ dataIndex: 'update_time',
hideInSearch: true,
valueType: 'dateTime',
},
@@ -75,11 +79,15 @@ const DetailDeviceStateLog: React.FC = () => {
request={async (params = {}) => {
const { current, ...rest } = params;
const reqParams = {
+ entity_id: props?.commInfo?.id,
pageNo: current,
...rest,
};
- let resp = await getDeviceStateLogList({ ...reqParams });
+ let resp = await apiDeviceStatusLog({ ...reqParams });
console.log(resp, 'getDeviceStateLogList_resp');
+ if (!isSuccessApi(resp)) {
+ return { data: [], success: true };
+ }
return {
data: resp.data?.data,
success: resp.success,
diff --git a/src/pages/Business/BusinessState/components/detailServerState.tsx b/src/pages/Business/BusinessState/components/detailServerState.tsx
index 1288b3d..87291ca 100644
--- a/src/pages/Business/BusinessState/components/detailServerState.tsx
+++ b/src/pages/Business/BusinessState/components/detailServerState.tsx
@@ -2,16 +2,14 @@
* @Author: donghao donghao@supervision.ltd
* @Date: 2024-04-08 16:57:30
* @LastEditors: donghao donghao@supervision.ltd
- * @LastEditTime: 2024-05-22 16:51:39
+ * @LastEditTime: 2024-06-18 11:43:19
* @FilePath: \general-ai-manage\src\pages\Project\BusinessProject\components\detailServerState.tsx
* @Description: 服务器详情
* @交互说明
*
*/
import { bsServerDetailEnums } from '@/enums/server';
-import { getModelGroupBaseModelList } from '@/services/testApi/model';
-import { isSuccessApi } from '@/utils/forApi';
-import { ProCard, ProDescriptions, ProList, ProTable } from '@ant-design/pro-components';
+import { ProCard, ProDescriptions } from '@ant-design/pro-components';
import { FormattedMessage, useIntl } from '@umijs/max';
import { Modal, Tabs } from 'antd';
import * as echarts from 'echarts';
@@ -30,7 +28,7 @@ const DetailServerState: React.FC = ({ info, detailOpen,
const intl = useIntl();
const [tabKey, setTabKey] = useState(bsServerDetailEnums[0].key);
const [tabs] = useState([...bsServerDetailEnums]);
- const [modelData, setModelData] = useState[]>([]); // 列表数据
+ // const [modelData, setModelData] = useState[]>([]); // 列表数据
const [forceRender, setForceRender] = useState(false);
// 基础模型信息
@@ -156,98 +154,98 @@ const DetailServerState: React.FC = ({ info, detailOpen,
};
// 模型列表信息
- const columns: ProColumns>[] = [
- {
- title: ,
- dataIndex: 'name',
- hideInSearch: true,
- key: 'fixedName',
- fixed: 'left',
- width: '45%',
- },
- {
- title: ,
- dataIndex: 'version',
- hideInSearch: true,
- width: '20%',
- },
- {
- title: (
-
- ),
- dataIndex: 'runtimeLibFile',
- hideInSearch: true,
- render: (dom, record) => {
- return (
-
- {record.runtimeLibFile ? (
- dom
- ) : (
-
-
-
-
-
-
- )}
-
- );
- },
- },
- ];
+ // const columns: ProColumns>[] = [
+ // {
+ // title: ,
+ // dataIndex: 'name',
+ // hideInSearch: true,
+ // key: 'fixedName',
+ // fixed: 'left',
+ // width: '45%',
+ // },
+ // {
+ // title: ,
+ // dataIndex: 'version',
+ // hideInSearch: true,
+ // width: '20%',
+ // },
+ // {
+ // title: (
+ //
+ // ),
+ // dataIndex: 'runtimeLibFile',
+ // hideInSearch: true,
+ // render: (dom, record) => {
+ // return (
+ //
+ // {record.runtimeLibFile ? (
+ // dom
+ // ) : (
+ //
+ //
+ //
+ //
+ //
+ //
+ // )}
+ //
+ // );
+ // },
+ // },
+ // ];
// 将数据组装成reactDom
- function toListDomByData(record) {
- let startList = [...record];
- let finalList = startList.map((item) => ({
- content: (
-
-
-
- {item.name}
-
-
{
- console.log(data, 'onDataSourceChange_data');
- }}
- pagination={false}
- dataSource={item.list}
- columns={columns}
- />
-
- ),
- }));
- setModelData(finalList);
- console.log(finalList, 'toListDomByData_finalList');
- }
+ // function toListDomByData(record) {
+ // let startList = [...record];
+ // let finalList = startList.map((item) => ({
+ // content: (
+ //
+ //
+ //
+ // {item.name}
+ //
+ //
{
+ // console.log(data, 'onDataSourceChange_data');
+ // }}
+ // pagination={false}
+ // dataSource={item.list}
+ // columns={columns}
+ // />
+ //
+ // ),
+ // }));
+ // setModelData(finalList);
+ // console.log(finalList, 'toListDomByData_finalList');
+ // }
// 基础模型列表数据api
- async function fetchData() {
- const resp = await getModelGroupBaseModelList();
- if (isSuccessApi(resp)) {
- toListDomByData(resp.data.data);
- }
- }
+ // async function fetchData() {
+ // const resp = await getModelGroupBaseModelList();
+ // if (isSuccessApi(resp)) {
+ // toListDomByData(resp.data.data);
+ // }
+ // }
useEffect(() => {
setForceRender(detailOpen);
}, [detailOpen]);
// 初始化加载
- useEffect(() => {
- fetchData();
- }, []);
+ // useEffect(() => {
+ // fetchData();
+ // }, []);
return (
= ({ info, detailOpen,
})}
-
+ {/* 服务器信息暂时不需要当前任务模块 */}
+ {/*
= ({ info, detailOpen,
}}
/>
-
+ */}
diff --git a/src/pages/Business/BusinessState/components/deviceStateCard.tsx b/src/pages/Business/BusinessState/components/deviceStateCard.tsx
index b1a36b8..86e34b5 100644
--- a/src/pages/Business/BusinessState/components/deviceStateCard.tsx
+++ b/src/pages/Business/BusinessState/components/deviceStateCard.tsx
@@ -2,7 +2,7 @@
* @Author: donghao donghao@supervision.ltd
* @Date: 2024-04-08 16:57:30
* @LastEditors: donghao donghao@supervision.ltd
- * @LastEditTime: 2024-05-22 16:20:13
+ * @LastEditTime: 2024-06-17 13:33:33
* @FilePath: \general-ai-manage\src\pages\Business\BusinessState\components\deviceStateCard.tsx
* @Description: 设备状态项卡片
*/
@@ -22,17 +22,17 @@ type DeviceStateCardProps = {
};
const DeviceStateCard: React.FC = ({ info, renderActions, fetchDetail }) => {
- const formatStateByVal = (record: string): DICTENUM.DICT_TAB_ITEM => {
- return deviceStateEnums.find((item: DICTENUM.DICT_TAB_ITEM) => item.key === record);
+ const formatStateByVal = (record: number): DICTENUM.DICT_TAB_ITEM => {
+ return deviceStateEnums.find((item: DICTENUM.DICT_TAB_ITEM) => Number(item.key) === record);
};
// 动效类型
const fetchAnimatePicByType = () => {
- switch (info?.state) {
- case '1':
- case '3':
+ switch (info?.status + '') {
+ case '1001':
+ case '1003':
return ;
- case '4':
+ case '1004':
return ;
default:
@@ -48,18 +48,18 @@ const DeviceStateCard: React.FC = ({ info, renderActions,
}}
className={`bs_card_box`}
>
-
+
{info?.name}
- {formatStateByVal(info?.state)?.label}
+ {formatStateByVal(info?.status)?.label}
diff --git a/src/pages/Business/BusinessState/deviceSate.tsx b/src/pages/Business/BusinessState/deviceSate.tsx
index 9000c88..c7e54ed 100644
--- a/src/pages/Business/BusinessState/deviceSate.tsx
+++ b/src/pages/Business/BusinessState/deviceSate.tsx
@@ -2,7 +2,7 @@
* @Author: donghao donghao@supervision.ltd
* @Date: 2024-05-10 10:47:45
* @LastEditors: donghao donghao@supervision.ltd
- * @LastEditTime: 2024-05-22 11:14:05
+ * @LastEditTime: 2024-06-19 11:29:16
* @FilePath: \general-ai-platform-web\src\pages\Business\BusinessState\deviceSate.tsx
* @Description: 设备状态列表
* @交互说明
@@ -13,10 +13,22 @@
import { CommButton, TextButton } from '@/components/Button';
import IsConfirmAction from '@/components/TableActionCard/isConfirmAction';
import { deviceStateEnums } from '@/enums/device';
-import { getDeviceStateList } from '@/services/testApi/businessState';
-import { getDictDeviceType } from '@/services/testApi/dict';
+import { useBusinessInfo } from '@/hooks/useBusinessInfo';
+import {
+ apiDeviceClassification,
+ apiDeviceStatusInfo,
+ apiDeviceStatusList,
+} from '@/services/business/device';
+import { apiEntityNodes } from '@/services/business/entity';
import { isSuccessApi } from '@/utils/forApi';
-import { ProCard, ProForm, ProFormSelect, ProList } from '@ant-design/pro-components';
+import { mathSumByNumberArr } from '@/utils/forMath';
+import {
+ ProCard,
+ ProForm,
+ ProFormSelect,
+ ProFormTreeSelect,
+ ProList,
+} from '@ant-design/pro-components';
import { FormattedMessage, useIntl } from '@umijs/max';
import { Tabs } from 'antd';
import { useEffect, useState } from 'react';
@@ -30,6 +42,9 @@ import { ReactComponent as SearchIcon } from '/public/home/search_icon.svg';
const DeviceSate: React.FC = () => {
/**state */
const intl = useIntl();
+ const { getStoreBusinessInfo } = useBusinessInfo();
+ const [commInfo] = useState>({ ...getStoreBusinessInfo() }); // 通用信息
+
// 列表
const [serverList, setServerList] = useState[]>([]); // 列表数据
const [currentRow, setCurrentRow] = useState>();
@@ -45,16 +60,70 @@ const DeviceSate: React.FC = () => {
const [querysData, setQuerysData] = useState>({}); // 列表查询参数
const [tabKey, setTabKey] = useState(deviceStateEnums[0].key);
const [tabs, setTabs] = useState([]);
+ const [deviceTreeList, setDeviceTreeList] = useState[]>([]);
+
+ // 组装进度展示信息
+
+ function toProgressListByItem(record) {
+ const { cpu, gpu, mem, storage } = record;
+ return [
+ {
+ label: 'CPU',
+ percent: cpu / 100,
+ strokeColor: 'rgb(243,48,5)',
+ usedColors: ['#FFAB00', '#FF4409'],
+ freeColors: ['#477BFF', '#0048FE'],
+ },
+ {
+ label: '内存',
+ percent: mem / 100,
+ strokeColor: 'rgb(33,169,122)',
+ usedColors: ['#47A3FF', '#0D6EFF'],
+ freeColors: ['#00C45A ', '#4AE003'],
+ },
+ {
+ label: '存储',
+ percent: storage / 100,
+ strokeColor: 'rgb(33,169,122)',
+ usedColors: ['#FF8110', '#EB0404'],
+ freeColors: ['#4200FF', '#9520F0'],
+ },
+ {
+ label: 'GPU',
+ percent: gpu / 100,
+ strokeColor: 'rgb(250,173,20)',
+ usedColors: ['#AE47FF', '#F008AF'],
+ freeColors: ['#FF4D00', '#F2B721'],
+ },
+ ];
+ }
+
+ // 设备节点信息
+ async function loadDetail(record) {
+ const resp = await apiDeviceStatusInfo({ id: record?.id });
+ if (isSuccessApi(resp) && resp?.data) {
+ setCurrentRow({
+ ...resp?.data,
+ id: record?.id,
+ progressData: toProgressListByItem(resp?.data),
+ });
+ }
+ }
// 将数据组装成reactDom
function toListDomByData(record) {
let startList = [...record];
+ startList = startList.map((item) => {
+ item.progressData = toProgressListByItem(item);
+ return item;
+ });
+
let finalList = startList.map((item) => ({
content: (
{
- setCurrentRow(item);
+ loadDetail(item);
setDetailOpen(true);
}}
renderActions={[
@@ -107,33 +176,38 @@ const DeviceSate: React.FC = () => {
// 企业列表数据api
async function fetchData() {
- const resp = await getDeviceStateList({
+ const resp = await apiDeviceStatusList({
pageNo: currentPage,
pageSize: currentPageSize,
- status: tabKey,
+ status: Number(tabKey),
+ entity_id: commInfo.id,
...querysData,
});
if (isSuccessApi(resp)) {
toListDomByData(resp.data.data);
+ const currCounts = { ...resp.data.status_count };
+ const currTotalCount = mathSumByNumberArr(Object.values(currCounts));
setTabs(() => {
const finalArr = [];
JSON.parse(JSON.stringify(deviceStateEnums)).forEach((item) => {
switch (item.key) {
- case '1':
- item.label = `${deviceStateEnums[1].label}(${resp.data.onlineCount})`;
+ case '1001':
+ item.label = `${deviceStateEnums[1].label}(${currCounts[deviceStateEnums[1].key]})`;
break;
- case '2':
- item.label = `${deviceStateEnums[2].label}(${resp.data.outlineCount})`;
+ case '1002':
+ item.label = `${deviceStateEnums[2].label}(${currCounts[deviceStateEnums[2].key]})`;
break;
- case '3':
- item.label = `${deviceStateEnums[3].label}(${resp.data.processCount})`;
+ case '1003':
+ item.label = `${deviceStateEnums[3].label}(${
+ currCounts[deviceStateEnums[3].key]
+ }})`;
break;
- case '4':
- item.label = `${deviceStateEnums[4].label}(${resp.data.errorCount})`;
+ case '1004':
+ item.label = `${deviceStateEnums[4].label}(${currCounts[deviceStateEnums[4].key]})`;
break;
- case '0':
+ case '1000':
default:
- item.label = `${deviceStateEnums[0].label}(${resp.data.count})`;
+ item.label = `${deviceStateEnums[0].label}(${currTotalCount})`;
break;
}
finalArr.push(item);
@@ -142,13 +216,13 @@ const DeviceSate: React.FC = () => {
});
setTotal(() => {
switch (tabKey) {
- case '1':
+ case '1001':
return resp.data.onlineCount;
- case '2':
+ case '1002':
return resp.data.outlineCount;
- case '3':
+ case '1003':
return resp.data.processCount;
- case '4':
+ case '1004':
return resp.data.errorCount;
default:
return resp.data.count;
@@ -156,7 +230,6 @@ const DeviceSate: React.FC = () => {
});
}
}
- // TODO 切换时页码没有显示第一页
const changeTabMode = (key: string) => {
setTabKey(key);
setCurrentPage(1);
@@ -167,11 +240,23 @@ const DeviceSate: React.FC = () => {
// setCurrentPage(1);
// }
+ // 设备节点树
+ async function loadDeviceTree() {
+ const resp = await apiEntityNodes({ entity_id: commInfo.id });
+ if (isSuccessApi(resp)) {
+ setDeviceTreeList(resp?.data?.data);
+ }
+ }
+
// 初始化加载 & 筛选查询
useEffect(() => {
fetchData();
}, [tabKey, currentPageSize, currentPage, querysData]);
+ useEffect(() => {
+ loadDeviceTree();
+ }, []);
+
return (
@@ -211,10 +296,44 @@ const DeviceSate: React.FC = () => {
return true;
}}
>
- {/* //TODO 缺失筛选条件设备组 树形选择*/}
+
+ }
+ placeholder={`${intl.formatMessage({
+ id: 'common.please_select',
+ defaultMessage: '$$$',
+ })}${intl.formatMessage({
+ id: 'device_group_list.table.list.deviceNode',
+ defaultMessage: '节点',
+ })}`}
+ // treeData={deviceTreeList}
+ // fieldNames= {{
+ // label: 'name',
+ // value: 'id',
+ // children: 'children',
+ // }}
+
+ fieldProps={{
+ multiple: true,
+ treeData: deviceTreeList,
+ style: { marginRight: 12 },
+ treeDefaultExpandAll: true,
+ fieldNames: {
+ label: 'name',
+ value: 'id',
+ children: 'children',
+ },
+ }}
+ />
{
showSearch
debounceTime={500}
request={async () => {
- const { data } = await getDictDeviceType();
+ const { data } = await apiDeviceClassification();
return data?.data?.map((v: Record) => {
return { ...v, label: v.name, value: v.id };
});
@@ -289,6 +408,7 @@ const DeviceSate: React.FC = () => {
{
setDetailOpen(false);
}}
diff --git a/src/pages/Business/DeviceGroup/components/deviceList.tsx b/src/pages/Business/DeviceGroup/components/deviceList.tsx
index c1bcde7..c00c6dc 100644
--- a/src/pages/Business/DeviceGroup/components/deviceList.tsx
+++ b/src/pages/Business/DeviceGroup/components/deviceList.tsx
@@ -2,7 +2,7 @@
* @Author: donghao donghao@supervision.ltd
* @Date: 2024-04-22 15:23:36
* @LastEditors: donghao donghao@supervision.ltd
- * @LastEditTime: 2024-06-04 16:33:16
+ * @LastEditTime: 2024-06-19 11:42:02
* @FilePath: \general-ai-platform-web\src\pages\Business\DeviceGroup\components\deviceList.tsx
* @Description: 设备节点设置 关键词 deviceGroup(dg)
* @交互说明
@@ -95,6 +95,7 @@ const DeviceList: React.FC = (props) => {
useEffect(() => {
if (actionRef && props?.nodeInfo) {
reloadList();
+ setIsSettingOpen(false);
}
}, [actionRef, props.nodeInfo]);
diff --git a/src/pages/Business/DeviceGroup/components/modelDeploy.tsx b/src/pages/Business/DeviceGroup/components/modelDeploy.tsx
index a99137c..52b9341 100644
--- a/src/pages/Business/DeviceGroup/components/modelDeploy.tsx
+++ b/src/pages/Business/DeviceGroup/components/modelDeploy.tsx
@@ -2,7 +2,7 @@
* @Author: donghao donghao@supervision.ltd
* @Date: 2024-04-30 10:02:29
* @LastEditors: donghao donghao@supervision.ltd
- * @LastEditTime: 2024-06-12 10:08:58
+ * @LastEditTime: 2024-06-19 15:23:58
* @FilePath: \general-ai-platform-web\src\pages\Business\DeviceGroup\components\modelDeploy.tsx
* @Description: 业务模型部署
* @交互说明
@@ -11,8 +11,9 @@
*/
import { TextButton } from '@/components/Button';
import TableActionCard from '@/components/TableActionCard';
-import { apiEntityNodesBusimodel } from '@/services/business/entity';
+import { apiEntityNodesBusimodel, apiEntityNodesBusimodelInfo } from '@/services/business/entity';
+import { isSuccessApi } from '@/utils/forApi';
import { ExclamationCircleFilled } from '@ant-design/icons';
import type { ActionType, ProColumns } from '@ant-design/pro-components';
import { ProTable } from '@ant-design/pro-components';
@@ -28,7 +29,7 @@ type ModelDeployProps = {
nodeInfo: Record;
};
-const ModelDeploy: React.FC = (props) => {
+const ModelDeploy: React.FC = ({ nodeInfo }) => {
// const intl = useIntl();
const actionRef = useRef();
@@ -40,9 +41,21 @@ const ModelDeploy: React.FC = (props) => {
// 部署参数配置展示
const [detailOpen, setDetailOpen] = useState(false);
/**配置参数 */
- // function reloadList() {
- // actionRef.current?.reload();
- // }
+ function reloadList() {
+ actionRef.current?.reload();
+ }
+
+ // 详情 apiEntityNodesBusimodelInfo
+ async function loadDetail(record) {
+ const resp = await apiEntityNodesBusimodelInfo({
+ node_id: nodeInfo?.node_id,
+ busi_model_id: record?.busi_model_id,
+ });
+ if (isSuccessApi(resp) && resp?.data) {
+ setCurrentRow({ ...resp?.data, busi_model_id: record?.busi_model_id });
+ }
+ }
+
// 业务模型列表信息
const columns: ProColumns>[] = [
{
@@ -54,18 +67,18 @@ const ModelDeploy: React.FC = (props) => {
},
{
title: ,
- dataIndex: 'isEnable',
+ dataIndex: 'deployed',
hideInSearch: true,
render: (dom, record) => {
return (
- {record.isEnable ? (
+ {record.deployed === 1 ? (
= (props) => {
renderDom: (
{
- setCurrentRow(record);
+ loadDetail(record);
setDetailOpen(true);
}}
>
@@ -170,7 +183,7 @@ const ModelDeploy: React.FC = (props) => {
const { current, ...rest } = params;
const reqParams = {
pageNo: current,
- node_id: props.nodeInfo.id,
+ node_id: nodeInfo.id,
...rest,
};
if (!reqParams.node_id) {
@@ -192,9 +205,11 @@ const ModelDeploy: React.FC = (props) => {
{
+ nodeInfo={nodeInfo}
+ handleModal={() => {
setDetailOpen(false);
}}
+ reload={reloadList}
/>
);
diff --git a/src/pages/Business/DeviceGroup/components/modelDeployConfig.tsx b/src/pages/Business/DeviceGroup/components/modelDeployConfig.tsx
index bf4ac44..73e3fc6 100644
--- a/src/pages/Business/DeviceGroup/components/modelDeployConfig.tsx
+++ b/src/pages/Business/DeviceGroup/components/modelDeployConfig.tsx
@@ -2,29 +2,45 @@
* @Author: donghao donghao@supervision.ltd
* @Date: 2024-04-08 16:57:30
* @LastEditors: donghao donghao@supervision.ltd
- * @LastEditTime: 2024-05-21 15:51:41
+ * @LastEditTime: 2024-06-19 15:23:06
* @FilePath: \general-ai-manage\src\pages\Project\BusinessProject\components\detailServerState.tsx
* @Description: 服务器详情
* @交互说明
*
*/
-import { getAllDeviceList } from '@/services/testApi/device';
+import {
+ apiEntityNodesBusimodelDeploy,
+ apiEntityNodesDeviceListSimple,
+} from '@/services/business/entity';
+import { isSuccessApi } from '@/utils/forApi';
+import { mathConvertCommaSeparatedStringToArray, mathExtractIds } from '@/utils/forMath';
+import { isArrayAndNotEmpty } from '@/utils/is';
import { ProCard, ProColumns, ProDescriptions, ProTable } from '@ant-design/pro-components';
import { FormattedMessage, useIntl } from '@umijs/max';
-import { Modal } from 'antd';
+import { Modal, message } from 'antd';
import { useEffect, useRef, useState } from 'react';
import { proFormSmallModelWidth } from '../../../../../config/defaultForm';
type ModelDeployConfigProps = {
info: Record;
+ nodeInfo: Record;
detailOpen: boolean;
- closeModal: () => void;
+ handleModal: () => void;
+ reload: () => void;
};
-const ModelDeployConfig: React.FC = ({ info, detailOpen, closeModal }) => {
+const ModelDeployConfig: React.FC = ({
+ info,
+ nodeInfo,
+ detailOpen,
+ reload,
+ handleModal,
+}) => {
/**state */
const intl = useIntl();
const [selectedRows, setSelectedRows] = useState[]>([]);
+ const [selectedRowKeys, setSelectedRowKeys] = useState([]);
+
const actionRef = useRef();
// 基础配置信息
const detailColumns = [
@@ -35,11 +51,11 @@ const ModelDeployConfig: React.FC = ({ info, detailOpen,
defaultMessage="业务名称"
/>
),
- dataIndex: 'bussnessName',
+ dataIndex: 'busi_model_name',
},
{
title: ,
- dataIndex: 'remark',
+ dataIndex: 'busi_model_comment',
},
{
title: (
@@ -52,15 +68,15 @@ const ModelDeployConfig: React.FC = ({ info, detailOpen,
render: (_, record) => {
return (
- {record?.linkModels?.map((item, index) => {
+ {mathConvertCommaSeparatedStringToArray(record?.base_models)?.map((item, index) => {
return (
-
- {item.name}
+ {item}
);
})}
@@ -89,22 +105,35 @@ const ModelDeployConfig: React.FC = ({ info, detailOpen,
defaultMessage="设备类型"
/>
),
- dataIndex: 'deviceType',
+ dataIndex: 'classification_name',
hideInSearch: true,
},
];
// 基础模型列表数据api
- function loadData() {}
+ function loadData() {
+ console.log(info?.devices, 'loadData_devices');
+ if (isArrayAndNotEmpty(info?.devices)) {
+ const selectArr = [];
+ info?.devices.forEach((item) => {
+ selectArr.push(item.device_id);
+ });
+ setSelectedRowKeys(selectArr);
+ }
+ }
+
+ useEffect(() => {
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
+ info?.busi_model_id && loadData();
+ }, [info]);
// 初始化加载
useEffect(() => {
console.log('modelDeployConfig_detailOpen', detailOpen);
- if (detailOpen) {
- loadData();
- } else {
+ if (!detailOpen) {
actionRef?.current?.clearSelected();
setSelectedRows([]);
+ setSelectedRowKeys([]);
}
}, [detailOpen]);
@@ -117,12 +146,27 @@ const ModelDeployConfig: React.FC = ({ info, detailOpen,
})}`}
open={detailOpen}
onCancel={() => {
- closeModal();
+ handleModal();
}}
- onOk={() => {
- console.log('onOk_selectedRows', selectedRows);
- // TODO 选择完成后再关闭弹框
- closeModal();
+ onOk={async () => {
+ console.log(info, 'onOk_selectedRows', selectedRows);
+ let resp = await apiEntityNodesBusimodelDeploy({
+ node_id: nodeInfo?.node_id,
+ busi_model_id: info?.busi_model_id,
+ device_ids: mathExtractIds(selectedRows)?.join(','),
+ });
+ if (isSuccessApi(resp)) {
+ message.success(
+ intl.formatMessage({ id: 'common.action.success', defaultMessage: '$$$' }),
+ );
+ reload();
+ handleModal();
+ } else {
+ message.error(
+ resp?.meta?.message ||
+ intl.formatMessage({ id: 'common.action.failure', defaultMessage: '$$$' }),
+ );
+ }
}}
okText={}
cancelText={}
@@ -153,13 +197,14 @@ const ModelDeployConfig: React.FC = ({ info, detailOpen,
rowKey="id"
pagination={false}
rowSelection={{
+ selectedRowKeys,
onChange: (_, selectedRowsData) => {
setSelectedRows(selectedRowsData);
},
}}
tableAlertRender={false}
request={async () => {
- let resp = await getAllDeviceList();
+ let resp = await apiEntityNodesDeviceListSimple({ node_id: nodeInfo?.node_id });
console.log(resp, 'getAllDeviceList_resp');
return {
data: resp.data?.data,
diff --git a/src/pages/Business/DeviceGroup/components/modelSetting.tsx b/src/pages/Business/DeviceGroup/components/modelSetting.tsx
index 68d0cdd..911cadd 100644
--- a/src/pages/Business/DeviceGroup/components/modelSetting.tsx
+++ b/src/pages/Business/DeviceGroup/components/modelSetting.tsx
@@ -2,7 +2,7 @@
* @Author: donghao donghao@supervision.ltd
* @Date: 2024-04-30 10:02:29
* @LastEditors: donghao donghao@supervision.ltd
- * @LastEditTime: 2024-06-12 10:04:30
+ * @LastEditTime: 2024-06-19 16:07:50
* @FilePath: \general-ai-platform-web\src\pages\Business\DeviceGroup\components\modelSetting.tsx
* @Description: 业务模型部署
* @交互说明
@@ -44,7 +44,7 @@ const ModelSetting: React.FC = (props) => {
const columns: ProColumns>[] = [
{
title: ,
- dataIndex: 'name',
+ dataIndex: 'model_name',
hideInSearch: true,
key: 'fixedName',
fixed: 'left',
@@ -52,7 +52,7 @@ const ModelSetting: React.FC = (props) => {
},
{
title: ,
- dataIndex: 'version',
+ dataIndex: 'model_version',
hideInSearch: true,
width: '20%',
},
@@ -60,12 +60,12 @@ const ModelSetting: React.FC = (props) => {
title: (
),
- dataIndex: 'runtimeLibFile',
+ dataIndex: 'model_hub_image',
hideInSearch: true,
render: (dom, record) => {
return (
- {record.runtimeLibFile ? (
+ {record.model_hub_image ? (
dom
) : (
@@ -125,7 +125,7 @@ const ModelSetting: React.FC
= (props) => {
- {item.name}
+ {item?.busi_model_name}
= (props) => {
// 标题栏
search={false}
options={{ fullScreen: false, setting: false, density: false, reload: false }}
- rowKey="id"
+ rowKey="model_id"
onDataSourceChange={(data) => {
console.log(data, 'onDataSourceChange_data');
}}
@@ -150,7 +150,7 @@ const ModelSetting: React.FC = (props) => {
persistenceKey: 'algorithm_model_list',
persistenceType: 'localStorage',
}}
- dataSource={item.list}
+ dataSource={item.base_models}
columns={columns}
/>
@@ -168,7 +168,7 @@ const ModelSetting: React.FC = (props) => {
device_id: props.info.device_id,
});
if (isSuccessApi(resp)) {
- // toListDomByData(resp.data.data);
+ toListDomByData(resp.data.data);
}
}
diff --git a/src/pages/Business/DeviceGroup/index.tsx b/src/pages/Business/DeviceGroup/index.tsx
index 262ddc3..f97d454 100644
--- a/src/pages/Business/DeviceGroup/index.tsx
+++ b/src/pages/Business/DeviceGroup/index.tsx
@@ -2,7 +2,7 @@
* @Author: donghao donghao@supervision.ltd
* @Date: 2024-04-22 15:23:36
* @LastEditors: donghao donghao@supervision.ltd
- * @LastEditTime: 2024-06-11 13:30:14
+ * @LastEditTime: 2024-06-19 15:44:38
* @FilePath: \general-ai-platform-web\src\pages\Business\DeviceGroup\index.tsx
* @Description: 设备节点设置 关键词 deviceGroup(dg)
* @交互说明
@@ -156,6 +156,7 @@ const DeviceGroup: React.FC = () => {
}}
selectTree={(selectedKeys, info) => {
if (selectedKeys && Array.isArray(selectedKeys) && selectedKeys.length) {
+ setTabKey('1'); // 重置到设备列表
loadDeviceDetail({ id: selectedKeys[0] });
}
console.log('selectTree_selected', selectedKeys, info);
diff --git a/src/pages/Log/index.tsx b/src/pages/Log/index.tsx
index e70937f..e93be33 100644
--- a/src/pages/Log/index.tsx
+++ b/src/pages/Log/index.tsx
@@ -2,7 +2,7 @@
* @Author: donghao donghao@supervision.ltd
* @Date: 2024-04-07 14:02:00
* @LastEditors: donghao donghao@supervision.ltd
- * @LastEditTime: 2024-06-11 17:41:25
+ * @LastEditTime: 2024-06-18 15:05:13
* @FilePath: \general-ai-manage\src\pages\Log\index.tsx
* @Description: 系统日志
* @交互说明
@@ -185,63 +185,64 @@ const LogIndex: React.FC = () => {
}
>
- {/* // TODO 需要控制表格溢出滚动高度 */}
-
{
- console.log(data, 'onDataSourceChange_data');
- // let CategoryFkIdIds: any = data.map((v) => {
- // return v.categoryFkId;
- // });
- // setCategoryFkIdIds(CategoryFkIdIds);
- }}
- pagination={{
- ...proTablePaginationOptions,
- pageSize: currentPageSize,
- onChange: (pageNo, pageSize) => setCurrentPageSize(pageSize),
- }}
- columnsState={{
- persistenceKey: 'algorithm_model_list',
- persistenceType: 'localStorage',
- }}
- request={async (params = {}, sort) => {
- const { current, ...rest } = params;
- const reqParams = {
- pageNo: current,
- desc: false,
- orderKey: '',
- ...rest,
- };
- if (sort && Object.keys(sort).length) {
- reqParams.orderKey = Object.keys(sort)[0];
- let sort_select = sort[reqParams.orderKey];
- reqParams.desc = sort_select === 'descend';
- }
- let resp = await getServerLogList({ ...reqParams, ...querysData });
- console.log(resp, 'getServerLogList_resp');
- if (!isSuccessApi(resp)) {
- return { data: [], success: true };
- }
- return {
- data: resp.data.data,
- success: resp.success,
- total: resp.data.count,
- current: current,
+
+
{
+ console.log(data, 'onDataSourceChange_data');
+ // let CategoryFkIdIds: any = data.map((v) => {
+ // return v.categoryFkId;
+ // });
+ // setCategoryFkIdIds(CategoryFkIdIds);
+ }}
+ pagination={{
+ ...proTablePaginationOptions,
pageSize: currentPageSize,
- };
- }}
- columns={columns}
- />
+ onChange: (pageNo, pageSize) => setCurrentPageSize(pageSize),
+ }}
+ columnsState={{
+ persistenceKey: 'algorithm_model_list',
+ persistenceType: 'localStorage',
+ }}
+ request={async (params = {}, sort) => {
+ const { current, ...rest } = params;
+ const reqParams = {
+ pageNo: current,
+ desc: false,
+ orderKey: '',
+ ...rest,
+ };
+ if (sort && Object.keys(sort).length) {
+ reqParams.orderKey = Object.keys(sort)[0];
+ let sort_select = sort[reqParams.orderKey];
+ reqParams.desc = sort_select === 'descend';
+ }
+ let resp = await getServerLogList({ ...reqParams, ...querysData });
+ console.log(resp, 'getServerLogList_resp');
+ if (!isSuccessApi(resp)) {
+ return { data: [], success: true };
+ }
+ return {
+ data: resp.data.data,
+ success: resp.success,
+ total: resp.data.count,
+ current: current,
+ pageSize: currentPageSize,
+ };
+ }}
+ columns={columns}
+ />
+
);
diff --git a/src/pages/Model/ModelIndex/index.tsx b/src/pages/Model/ModelIndex/index.tsx
index 74771f9..95031d3 100644
--- a/src/pages/Model/ModelIndex/index.tsx
+++ b/src/pages/Model/ModelIndex/index.tsx
@@ -2,7 +2,7 @@
* @Author: donghao donghao@supervision.ltd
* @Date: 2024-04-07 14:02:00
* @LastEditors: donghao donghao@supervision.ltd
- * @LastEditTime: 2024-05-31 14:36:33
+ * @LastEditTime: 2024-06-14 14:08:11
* @FilePath: \general-ai-manage\src\pages\ModelIndex\ModelIndex.tsx
* @Description: 模型列表首页
* @交互说明
@@ -252,7 +252,6 @@ const ModelIndex: React.FC = () => {
onFinish={async (values) => {
console.log(values, 'filter_finish_values');
setQuerysData(() => values);
-
return true;
}}
>
diff --git a/src/requestErrorConfig.ts b/src/requestErrorConfig.ts
index e71a91e..6332c27 100644
--- a/src/requestErrorConfig.ts
+++ b/src/requestErrorConfig.ts
@@ -70,7 +70,7 @@ export const errorConfig: RequestConfig = {
});
break;
case ErrorShowType.REDIRECT:
- // TODO: redirect
+ // redirect
break;
default:
message.error(errorMessage);
diff --git a/src/services/business/device.ts b/src/services/business/device.ts
index e90cdb3..c296868 100644
--- a/src/services/business/device.ts
+++ b/src/services/business/device.ts
@@ -2,7 +2,7 @@
* @Author: donghao donghao@supervision.ltd
* @Date: 2024-05-24 17:57:19
* @LastEditors: donghao donghao@supervision.ltd
- * @LastEditTime: 2024-05-27 14:54:19
+ * @LastEditTime: 2024-06-18 13:50:25
* @FilePath: \general-ai-platform-web\src\services\business\device.ts
* @Description: 设备
*/
@@ -58,3 +58,51 @@ export async function apiDeviceClassificationDelete(body: any, options?: { [key:
},
);
}
+
+// 设备状态列表
+export async function apiDeviceStatusList(body: any, options?: { [key: string]: any }) {
+ return request(
+ `/api/v1/enterprise/device/status/list`,
+ {
+ method: 'POST',
+ headers: {
+ // 'Content-Type': 'application/json',
+ // "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
+ },
+ data: body,
+ ...(options || {}),
+ },
+ );
+}
+
+// 设备状态 - 设备详情
+export async function apiDeviceStatusInfo(body: any, options?: { [key: string]: any }) {
+ return request(
+ `/api/v1/enterprise/device/status/info`,
+ {
+ method: 'POST',
+ headers: {
+ // 'Content-Type': 'application/json',
+ // "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
+ },
+ data: body,
+ ...(options || {}),
+ },
+ );
+}
+
+// 设备状态日志
+export async function apiDeviceStatusLog(body: any, options?: { [key: string]: any }) {
+ return request(
+ `/api/v1/enterprise/device/status/log`,
+ {
+ method: 'POST',
+ headers: {
+ // 'Content-Type': 'application/json',
+ // "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
+ },
+ data: body,
+ ...(options || {}),
+ },
+ );
+}
diff --git a/src/services/testApi/deviceGroup.ts b/src/services/testApi/deviceGroup.ts
index 60ff8d2..cb212c5 100644
--- a/src/services/testApi/deviceGroup.ts
+++ b/src/services/testApi/deviceGroup.ts
@@ -30,7 +30,7 @@ export async function getDeviceGroupList(
);
}
-/** 获取设备组树 GET /device_group/getDeviceGroupTree */
+/** 获取节点树 GET /device_group/getDeviceGroupTree */
export async function getDeviceGroupTree(
body: Record, //
options?: { [key: string]: any },
diff --git a/src/utils/forMath.ts b/src/utils/forMath.ts
new file mode 100644
index 0000000..cc12f22
--- /dev/null
+++ b/src/utils/forMath.ts
@@ -0,0 +1,58 @@
+/*
+ * @Author: donghao donghao@supervision.ltd
+ * @Date: 2024-06-18 13:36:03
+ * @LastEditors: donghao donghao@supervision.ltd
+ * @LastEditTime: 2024-06-19 14:34:55
+ * @FilePath: \general-ai-platform-web\src\utils\math.ts
+ * @Description: 数学方法库
+ */
+
+import { isNotEmptyString } from './is';
+
+/**
+ *
+ * @param arr number类型一维数组
+ * @returns 数组求和
+ */
+export function mathSumByNumberArr(arr: number[]) {
+ return arr.reduce(function (prev, curr) {
+ return prev + curr;
+ });
+}
+
+/**
+ *
+ * @param inputString - The comma-separated string.
+ * @returns An array of strings.
+ */
+export function mathConvertCommaSeparatedStringToArray(inputString: string): string[] {
+ if (isNotEmptyString(inputString)) {
+ return inputString.split(',');
+ }
+ return [];
+}
+
+/**
+ * Function to extract 'id' properties from an array of objects.
+ *
+ * @param objectsArray - The array of objects, each containing an 'id' property.
+ * @returns An array of 'id' values, or an empty array if input is invalid.
+ */
+export function mathExtractIds(objectsArray: any): (number | string)[] {
+ // Check if the input is an array
+ if (!Array.isArray(objectsArray)) {
+ console.error('Input is not an array');
+ return [];
+ }
+
+ // Check if every item in the array is an object and has an 'id' property
+ for (const obj of objectsArray) {
+ if (typeof obj !== 'object' || obj === null || !('id' in obj)) {
+ console.error("Invalid object in array or missing 'id' property");
+ return [];
+ }
+ }
+
+ // Map the array to extract 'id' properties
+ return objectsArray.map((obj) => obj.id);
+}
diff --git a/src/utils/is.ts b/src/utils/is.ts
index 6373ae9..7724172 100644
--- a/src/utils/is.ts
+++ b/src/utils/is.ts
@@ -2,7 +2,7 @@
* @Author: donghao donghao@supervision.ltd
* @Date: 2024-06-05 13:32:31
* @LastEditors: donghao donghao@supervision.ltd
- * @LastEditTime: 2024-06-07 16:10:52
+ * @LastEditTime: 2024-06-19 15:27:28
* @FilePath: \general-ai-platform-web\src\utils\is.ts
* @Description: 校验方法库
*/
@@ -29,3 +29,23 @@ export function isValidJson(jsonString) {
export function isArrayAndNotEmpty(obj) {
return Array.isArray(obj) && obj.length > 0;
}
+
+/**
+ * Function to check if a given string is not empty.
+ * An empty string is defined as a string that is either null, undefined, or consists only of whitespace.
+ *
+ * @param inputString - The string to check.
+ * @returns A boolean indicating whether the string is not empty.
+ */
+export function isNotEmptyString(inputString: string | null | undefined): boolean {
+ // Check if the string is null or undefined
+ if (inputString === null || inputString === undefined) {
+ return false;
+ }
+
+ // Trim the input string to remove any leading or trailing whitespace
+ const trimmedString = inputString.trim();
+
+ // Check if the trimmed string is not empty
+ return trimmedString !== '';
+}