/* * @Author: donghao donghao@supervision.ltd * @Date: 2024-04-30 10:02:29 * @LastEditors: donghao donghao@supervision.ltd * @LastEditTime: 2024-05-13 10:44:23 * @FilePath: \general-ai-platform-web\src\pages\Business\DeviceGroup\components\modelSetting.tsx * @Description: 业务模型部署 * @交互说明 * 1、业务模型部署列表的分页展示 * 2、配置参数功能 */ import TableActionCard from '@/components/TableActionCard'; import { getModelGroupBaseModelList } from '@/services/testApi/model'; import type { ProColumns } from '@ant-design/pro-components'; import { ProList, ProTable } from '@ant-design/pro-components'; import { FormattedMessage } from '@umijs/max'; import { Button } from 'antd'; import { useEffect, useState } from 'react'; // import CreateForm from './components/createForm'; import { isSuccessApi } from '@/utils/forApi'; import CreateModelParams from './createModelParams'; type ModelSettingProps = { info: Record; }; const ModelSetting: React.FC = () => { /**state */ const [modelData, setModelData] = useState[]>([]); // 列表数据 // const intl = useIntl(); const [createModalOpen, setCreateModalOpen] = useState(false); // const [categoryFkIdIds, setCategoryFkIdIds] = useState([]); // 动态设置每页数量 // const [currentRow, setCurrentRow] = useState>({}); /**配置参数 */ const handleCreateModal = () => { setCreateModalOpen(!createModalOpen); }; // 业务模型列表信息 const columns: ProColumns>[] = [ { title: , dataIndex: 'name', hideInSearch: true, key: 'fixedName', fixed: 'left', }, { title: , dataIndex: 'version', hideInSearch: true, width: '20%', }, { title: ( ), dataIndex: 'runtimeLibFile', hideInSearch: true, render: (dom, record) => { return (
{record.runtimeLibFile ? ( dom ) : (
)}
); }, }, { title: , dataIndex: 'option', valueType: 'option', fixed: 'right', key: 'option', render: () => [ { handleCreateModal(); }} > ), }, ]} >, ], }, ]; // 将数据组装成reactDom function toListDomByData(record) { let startList = [...record]; let finalList = startList.map((item) => ({ content: (
{item.name}
// // {item.name} //
// } cardProps={{ bodyStyle: { padding: 0, margin: 0 }, }} // 标题栏 search={false} options={{ fullScreen: false, setting: false, density: false, reload: false }} rowKey="id" onDataSourceChange={(data) => { console.log(data, 'onDataSourceChange_data'); }} pagination={false} columnsState={{ persistenceKey: 'algorithm_model_list', persistenceType: 'localStorage', }} 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.results); } } function reloadList() { fetchData(); } // 初始化加载 useEffect(() => { fetchData(); }, []); return (
itemLayout="vertical" itemCardProps={{ ghost: true, bodyStyle: { padding: 0, margin: 0 }, style: { width: '100%', border: 0, }, }} cardProps={{ style: { padding: 0, margin: 0 }, // 设置卡片的内外边距为 0 bodyStyle: { padding: 0, margin: 0, height: 'calc(100vh - 400px)', overflow: 'scroll', }, }} rowKey="id" dataSource={modelData} pagination={false} rowSelection={false} metas={{ content: { style: { margin: 0, padding: 0 }, }, }} />
); }; export default ModelSetting;