feat: 完善设备节点设置的基础模型模块
parent
1eb526d45d
commit
d8590ee313
@ -0,0 +1,184 @@
|
||||
/*
|
||||
* @Author: donghao donghao@supervision.ltd
|
||||
* @Date: 2024-04-30 10:02:29
|
||||
* @LastEditors: donghao donghao@supervision.ltd
|
||||
* @LastEditTime: 2024-05-06 16:58:57
|
||||
* @FilePath: \general-ai-platform-web\src\pages\Business\DeviceGroup\components\modelDeploy.tsx
|
||||
* @Description: 业务模型部署
|
||||
* @交互说明
|
||||
* 1、业务模型部署列表的分页展示
|
||||
* 2、配置参数功能
|
||||
*/
|
||||
import TableActionCard from '@/components/TableActionCard';
|
||||
import { getBusinessModelList } from '@/services/testApi/businessModel';
|
||||
import { ExclamationCircleFilled } from '@ant-design/icons';
|
||||
import type { ActionType, ProColumns } from '@ant-design/pro-components';
|
||||
import { 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 ModelDeploy: React.FC = () => {
|
||||
// const intl = useIntl();
|
||||
const actionRef = useRef<ActionType>();
|
||||
|
||||
// const [createModalOpen, setCreateModalOpen] = useState<boolean>(false);
|
||||
// const [categoryFkIdIds, setCategoryFkIdIds] = useState([]);
|
||||
// 动态设置每页数量
|
||||
const [currentPageSize, setCurrentPageSize] = useState<number>(10);
|
||||
// const [currentRow, setCurrentRow] = useState<Record<string, any>>({});
|
||||
|
||||
/**配置参数 */
|
||||
|
||||
// function reloadList() {
|
||||
// actionRef.current?.reload();
|
||||
// }
|
||||
|
||||
// 业务模型列表信息
|
||||
const columns: ProColumns<Record<string, any>>[] = [
|
||||
{
|
||||
title: <FormattedMessage id="business_model.table.list.name" defaultMessage="业务模型名称" />,
|
||||
dataIndex: 'name',
|
||||
hideInSearch: true,
|
||||
key: 'fixedName',
|
||||
fixed: 'left',
|
||||
},
|
||||
{
|
||||
title: <FormattedMessage id="business_model.table.list.isEnable" defaultMessage="部署状态" />,
|
||||
dataIndex: 'isEnable',
|
||||
hideInSearch: true,
|
||||
// width: 80,
|
||||
render: (dom, record) => {
|
||||
return (
|
||||
<div
|
||||
className={`model_index_type_tag flex items-center justify-center ${
|
||||
record.isEnable ? 'active1' : 'active2'
|
||||
}`}
|
||||
>
|
||||
<span className="dot"></span>
|
||||
<span>
|
||||
{record.isEnable ? (
|
||||
<FormattedMessage
|
||||
id="business_model.table.list.deployed.isEnable"
|
||||
defaultMessage="已部署"
|
||||
/>
|
||||
) : (
|
||||
<FormattedMessage
|
||||
id="business_model.table.list.undeployed.isEnable"
|
||||
defaultMessage="未部署"
|
||||
/>
|
||||
)}
|
||||
</span>
|
||||
</div>
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
title: (
|
||||
<FormattedMessage id="business_model.table.list.createTime" defaultMessage="创建时间" />
|
||||
),
|
||||
dataIndex: 'createTime',
|
||||
hideInSearch: true,
|
||||
valueType: 'dateTime',
|
||||
},
|
||||
|
||||
{
|
||||
title: <FormattedMessage id="pages.searchTable.titleOption" defaultMessage="操作" />,
|
||||
dataIndex: 'option',
|
||||
valueType: 'option',
|
||||
fixed: 'right',
|
||||
key: 'option',
|
||||
render: () => [
|
||||
<TableActionCard
|
||||
key="TableActionCardRef"
|
||||
renderActions={[
|
||||
{
|
||||
key: 'updateDetail',
|
||||
renderDom: (
|
||||
<Button
|
||||
key="updateDetail"
|
||||
type="link"
|
||||
size="small"
|
||||
onClick={() => {
|
||||
// TODO 编辑在新增联调后实现
|
||||
// setCurrentRow(record);
|
||||
}}
|
||||
>
|
||||
<FormattedMessage id="pages.searchTable.updateDetail" defaultMessage="配置参数" />
|
||||
</Button>
|
||||
),
|
||||
},
|
||||
]}
|
||||
></TableActionCard>,
|
||||
],
|
||||
},
|
||||
];
|
||||
return (
|
||||
<div className="dg_modelDeploy_page">
|
||||
<div
|
||||
className="pb-[12px]"
|
||||
style={{
|
||||
color: '#FAAD14',
|
||||
}}
|
||||
>
|
||||
<ExclamationCircleFilled />
|
||||
<span className="pl-[8px]">配置参数需关联具体设备请先至设备列表添加设备后再进行配置</span>
|
||||
</div>
|
||||
<ProTable
|
||||
className="gn_pro_table"
|
||||
cardProps={{
|
||||
bodyStyle: { padding: 0 },
|
||||
}}
|
||||
// 标题栏
|
||||
search={false}
|
||||
scroll={{ y: proTableCommonOptions.commscrollY }}
|
||||
options={{ fullScreen: false, setting: false, density: false, reload: false }}
|
||||
actionRef={actionRef}
|
||||
rowKey="key"
|
||||
onDataSourceChange={(data) => {
|
||||
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<string, any>) => {
|
||||
return { ...v, key: v.id };
|
||||
}),
|
||||
success: resp.success,
|
||||
total: resp.data.count,
|
||||
current: current,
|
||||
pageSize: currentPageSize,
|
||||
};
|
||||
}}
|
||||
columns={columns}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default ModelDeploy;
|
Loading…
Reference in New Issue