feat: 模型列表固定表头设置批量按钮完成,遍历Vnode比对刷新节点key添加,分步表单整体样式初步完成调整

develop
zhoux 2 years ago
parent 7fb0fad3c3
commit 5cea7c19a5

@ -1,3 +1,11 @@
<!--
* @Author: zhoux zhouxia@supervision.ltd
* @Date: 2023-11-01 13:56:33
* @LastEditors: zhoux zhouxia@supervision.ltd
* @LastEditTime: 2023-11-03 11:09:56
* @FilePath: \general-ai-platform-web\README.md
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
# General-AI-Platform-Web # General-AI-Platform-Web
通用算法平台前端仓库 develop 通用算法平台前端仓库 develop
@ -17,6 +25,11 @@
### 具体实现 ### 具体实现
1. 筛选表单区: 列表在columns配置初始数据时需要筛选的表单项统一使用renderFormItem属性基于renderFormItem去配置表单项field, 【searchFormItemProps】属性统一配置自定义业务 1. 筛选表单区: 列表在columns配置初始数据时需要筛选的表单项统一使用renderFormItem属性基于renderFormItem去配置表单项field, 【searchFormItemProps】属性统一配置自定义业务
{ {
@ -31,4 +44,15 @@
3. 列表action有多个按钮显示更多 3. 列表action有多个按钮显示更多
暂时使用默认超过3个显示更多如需统一处理或者权限控制下的按钮显示隐藏导致的按钮数量不一致可根据需要独立封装TableActionComp 暂时使用默认超过3个显示更多如需统一处理或者权限控制下的按钮显示隐藏导致的按钮数量不一致可根据需要独立封装TableActionComp
4. 列表多选悬浮展示在底部,顶部隐藏处理 【待处理】
## ProTable 固定列表
1. 固定表头 scroll={{ y: 500 }}
批量选择确认按钮固定,列表头内容固定
2. 批量选择 tableAlertOptionRender
配置多选操作选项区
## ProForm 表单

@ -1,3 +1,11 @@
/*
* @Author: zhoux zhouxia@supervision.ltd
* @Date: 2023-11-01 13:56:33
* @LastEditors: zhoux zhouxia@supervision.ltd
* @LastEditTime: 2023-11-03 14:24:30
* @FilePath: \general-ai-platform-web\src\locales\zh-CN\menu.ts
* @Description: ,`customMade`, koroFileHeader : https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
export default { export default {
'menu.welcome': '欢迎', 'menu.welcome': '欢迎',
'menu.more-blocks': '更多区块', 'menu.more-blocks': '更多区块',
@ -60,5 +68,6 @@ export default {
'menu.list.system.dictionary-list': '字典列表', 'menu.list.system.dictionary-list': '字典列表',
'menu.list.system.department-list': '部门列表', 'menu.list.system.department-list': '部门列表',
'menu.list.staff': '人力资源', 'menu.list.staff': '人力资源',
'menu.list.staff.employee-list': '员工列表' 'menu.list.staff.employee-list': '员工列表',
'menu.device.device-relation-list': '设备版本列表',
}; };

@ -1,19 +1,22 @@
import {ModalForm, ProForm, ProFormList, ProFormUploadButton} from '@ant-design/pro-components'; import { postDeviceGroupGetDeviceGroupTree } from '@/services/device/DeviceGroup';
import {ProFormText, StepsForm, ProFormTreeSelect, ProFormUploadDragger} from '@ant-design/pro-components'; import { postProjectCreateProject } from '@/services/project/Project';
import { postAlgorithmModelGetAlgorithmModelFkSelect } from '@/services/resource/AlgorithmModel';
import { beforeUploadFile } from '@/utils/common';
import { CloseOutlined, SnippetsOutlined } from '@ant-design/icons';
import type { ProFormInstance } from '@ant-design/pro-components'; import type { ProFormInstance } from '@ant-design/pro-components';
import {postAlgorithmModelGetAlgorithmModelFkSelect} from "@/services/resource/AlgorithmModel"; import {
import {ProFormSwitch} from '@ant-design/pro-components'; ProForm,
ProFormList,
ProFormSwitch,
ProFormText,
ProFormUploadDragger,
StepsForm,
} from '@ant-design/pro-components';
import { FormattedMessage, useIntl } from '@umijs/max'; import { FormattedMessage, useIntl } from '@umijs/max';
import {postProjectCreateProject, putProjectUpdateProjectGroup} from "@/services/project/Project"; import { Modal, Switch, Transfer, Tree, message } from 'antd';
import React, {useState, useRef, useEffect} from 'react';
import {Button, Form, message, Modal, Transfer, Tree} from 'antd';
import {Switch} from 'antd';
import type { TransferDirection } from 'antd/es/transfer'; import type { TransferDirection } from 'antd/es/transfer';
import {DataNode} from "antd/es/tree"; import { DataNode } from 'antd/es/tree';
import {postMenuGetMenuTree} from "@/services/system/Menu"; import React, { useEffect, useRef, useState } from 'react';
import {postDeviceGroupGetDeviceGroupTree} from "@/services/device/DeviceGroup";
import {CloseOutlined, SnippetsOutlined} from "@ant-design/icons";
import {beforeUploadFile, imageInit} from "@/utils/common";
// @ts-ignore // @ts-ignore
import cookie from 'react-cookies'; import cookie from 'react-cookies';
interface RecordType { interface RecordType {
@ -47,6 +50,11 @@ const waitTime = (time: number = 100) => {
}); });
}; };
/**styles 配置 */
const formContainerWidth: number = 755
const stepFormItemStyleProps: Record<string, any> = {
width: formContainerWidth,
};
const treeData1: any[] = [ const treeData1: any[] = [
{ {
@ -102,7 +110,6 @@ const treeData1: any[] = [
{ title: '0-0-1-0', key: '0-0-1-33' }, { title: '0-0-1-0', key: '0-0-1-33' },
{ title: '0-0-1-1', key: '0-0-1-34' }, { title: '0-0-1-1', key: '0-0-1-34' },
{ title: '0-0-1-2', key: '0-0-1-35' }, { title: '0-0-1-2', key: '0-0-1-35' },
], ],
}, },
{ {
@ -126,13 +133,12 @@ const treeData1: any[] = [
}, },
]; ];
const MyCreateForm: React.FC<CreateFormProps> = (props) => { const MyCreateForm: React.FC<CreateFormProps> = (props) => {
const [treeData, setTreeData] = React.useState<DataNode[]>([]); const [treeData, setTreeData] = React.useState<DataNode[]>([]);
const [modalData, setModalData] = useState<RecordType[]>([]); const [modalData, setModalData] = useState<RecordType[]>([]);
const [targetKeys, setTargetKeys] = useState<string[]>([]); const [targetKeys, setTargetKeys] = useState<string[]>([]);
const [selectKeys, setSelectKeys] = useState([]); const [selectKeys, setSelectKeys] = useState([]);
const [filePath, setFilePath] = useState('') const [filePath, setFilePath] = useState('');
const [configData, setConfigData] = useState<ProjectConfig>({ params: [] }); const [configData, setConfigData] = useState<ProjectConfig>({ params: [] });
const intl = useIntl(); const intl = useIntl();
const [isAuto, setIsAuto] = useState(true); const [isAuto, setIsAuto] = useState(true);
@ -147,10 +153,10 @@ const MyCreateForm: React.FC<CreateFormProps> = (props) => {
key: v.id, key: v.id,
title: v.name, title: v.name,
chosen: false, chosen: false,
} };
}) });
setModalData(result); setModalData(result);
}) });
// setMockData(tempMockData); // setMockData(tempMockData);
// setTargetKeys(tempTargetKeys); // setTargetKeys(tempTargetKeys);
}; };
@ -159,16 +165,18 @@ const MyCreateForm: React.FC<CreateFormProps> = (props) => {
setTargetKeys(newTargetKeys); setTargetKeys(newTargetKeys);
}; };
useEffect(() => { useEffect(() => {
setTargetKeys([]) setTargetKeys([]);
if (props.createModalOpen) { if (props.createModalOpen) {
getModelData(); getModelData();
postDeviceGroupGetDeviceGroupTree().then((resp: API.Response)=>{ postDeviceGroupGetDeviceGroupTree()
setTreeData(resp.data.tree) .then((resp: API.Response) => {
}).catch(()=>{}) setTreeData(resp.data.tree);
})
.catch(() => {});
} else { } else {
formRef.current?.resetFields() formRef.current?.resetFields();
} }
}, [props.createModalOpen]) }, [props.createModalOpen]);
const handleSearch = (dir: TransferDirection, value: string) => { const handleSearch = (dir: TransferDirection, value: string) => {
postAlgorithmModelGetAlgorithmModelFkSelect({ keyword: value }).then((res) => { postAlgorithmModelGetAlgorithmModelFkSelect({ keyword: value }).then((res) => {
console.log(444, res); console.log(444, res);
@ -177,16 +185,18 @@ const MyCreateForm: React.FC<CreateFormProps> = (props) => {
key: v.id, key: v.id,
title: v.name, title: v.name,
chosen: false, chosen: false,
} };
}) });
setModalData(result); setModalData(result);
}) });
}; };
return ( return (
<StepsForm<{ <StepsForm<{
name: string; name: string;
}> }>
stepsProps={{}} stepsProps={{
labelPlacement: 'vertical',
}}
current={current} current={current}
onCurrentChange={setCurrent} onCurrentChange={setCurrent}
onFinish={async () => { onFinish={async () => {
@ -195,14 +205,16 @@ const MyCreateForm: React.FC<CreateFormProps> = (props) => {
formData.inferConfig = { models: targetKeys, params: configData?.params || [] }; formData.inferConfig = { models: targetKeys, params: configData?.params || [] };
formData.groupIds = selectKeys; formData.groupIds = selectKeys;
formData.projectFilePath = filePath; formData.projectFilePath = filePath;
postProjectCreateProject(formData).then(()=>{ postProjectCreateProject(formData)
message.success(intl.formatMessage({id: 'common.success', defaultMessage: '$$$'})) .then(() => {
message.success(intl.formatMessage({ id: 'common.success', defaultMessage: '$$$' }));
props.handleModal(); props.handleModal();
props.reload() props.reload();
}).catch(()=>{
message.error(intl.formatMessage({id: 'common.failure', defaultMessage: '$$$'}))
return false
}) })
.catch(() => {
message.error(intl.formatMessage({ id: 'common.failure', defaultMessage: '$$$' }));
return false;
});
} }
return true; return true;
}} }}
@ -215,11 +227,11 @@ const MyCreateForm: React.FC<CreateFormProps> = (props) => {
return ( return (
<Modal <Modal
title="分步表单" title="分步表单"
width={1000} width={803}
onCancel={() => { onCancel={() => {
setCurrent(0) setCurrent(0);
formRef.current?.resetFields() formRef.current?.resetFields();
formRef3.current?.resetFields() formRef3.current?.resetFields();
props.handleModal(); props.handleModal();
}} }}
open={props.createModalOpen} open={props.createModalOpen}
@ -231,7 +243,7 @@ const MyCreateForm: React.FC<CreateFormProps> = (props) => {
); );
}} }}
> >
{/* 创建项目数据 */}
<StepsForm.StepForm<{ <StepsForm.StepForm<{
name: string; name: string;
}> }>
@ -248,7 +260,18 @@ const MyCreateForm: React.FC<CreateFormProps> = (props) => {
}} }}
> >
<ProForm.Group> <ProForm.Group>
<ProFormText width="md" name="name" label={<FormattedMessage id="project.project.table.list.name" defaultMessage="$$$"/>} placeholder={`${intl.formatMessage({id: 'common.please_input', defaultMessage: '$$$'})}${intl.formatMessage({id: 'project.project.table.list.name', defaultMessage: '$$$'})}`} required={true} <ProFormText
{...stepFormItemStyleProps}
name="name"
label={<FormattedMessage id="project.project.table.list.name" defaultMessage="$$$" />}
placeholder={`${intl.formatMessage({
id: 'common.please_input',
defaultMessage: '$$$',
})}${intl.formatMessage({
id: 'project.project.table.list.name',
defaultMessage: '$$$',
})}`}
required={true}
rules={[ rules={[
{ {
required: true, required: true,
@ -261,8 +284,24 @@ const MyCreateForm: React.FC<CreateFormProps> = (props) => {
}, },
]} ]}
/> />
<ProFormText width="md" name="code" label={<FormattedMessage id="project.project.table.list.code" defaultMessage="$$$"/>} placeholder={`${intl.formatMessage({id: 'common.please_input', defaultMessage: '$$$'})}${intl.formatMessage({id: 'project.project.table.list.code', defaultMessage: '$$$'})}`} required={!isAuto} initialValue='' disabled={isAuto} <ProFormText
rules={isAuto?[]:[ width={680}
name="code"
label={<FormattedMessage id="project.project.table.list.code" defaultMessage="$$$" />}
placeholder={`${intl.formatMessage({
id: 'common.please_input',
defaultMessage: '$$$',
})}${intl.formatMessage({
id: 'project.project.table.list.code',
defaultMessage: '$$$',
})}`}
required={!isAuto}
initialValue=""
disabled={isAuto}
rules={
isAuto
? []
: [
{ {
required: true, required: true,
message: ( message: (
@ -272,14 +311,29 @@ const MyCreateForm: React.FC<CreateFormProps> = (props) => {
/> />
), ),
}, },
]} ]
addonAfter={<Switch }
addonAfter={
<Switch
checked={isAuto} checked={isAuto}
checkedChildren={<FormattedMessage id="common.auto" defaultMessage="$$$" />} checkedChildren={<FormattedMessage id="common.auto" defaultMessage="$$$" />}
unCheckedChildren={<FormattedMessage id="common.edit" defaultMessage="$$$" />} unCheckedChildren={<FormattedMessage id="common.edit" defaultMessage="$$$" />}
onChange={setIsAuto} onChange={setIsAuto}
/>}/> />
<ProFormText width="md" name="info" label={<FormattedMessage id="project.project.table.list.info" defaultMessage="$$$"/>} placeholder={`${intl.formatMessage({id: 'common.please_input', defaultMessage: '$$$'})}${intl.formatMessage({id: 'project.project.table.list.info', defaultMessage: '$$$'})}`} required={true} }
/>
<ProFormText
{...stepFormItemStyleProps}
name="info"
label={<FormattedMessage id="project.project.table.list.info" defaultMessage="$$$" />}
placeholder={`${intl.formatMessage({
id: 'common.please_input',
defaultMessage: '$$$',
})}${intl.formatMessage({
id: 'project.project.table.list.info',
defaultMessage: '$$$',
})}`}
required={true}
rules={[ rules={[
{ {
required: true, required: true,
@ -292,13 +346,32 @@ const MyCreateForm: React.FC<CreateFormProps> = (props) => {
}, },
]} ]}
/> />
<ProFormText width="md" name="remark" label={<FormattedMessage id="project.project.table.list.remark" defaultMessage="$$$"/>} placeholder={`${intl.formatMessage({id: 'common.please_input', defaultMessage: '$$$'})}${intl.formatMessage({id: 'project.project.table.list.remark', defaultMessage: '$$$'})}`} required={false}/> <ProFormText
{...stepFormItemStyleProps}
name="remark"
label={<FormattedMessage id="project.project.table.list.remark" defaultMessage="$$$" />}
placeholder={`${intl.formatMessage({
id: 'common.please_input',
defaultMessage: '$$$',
})}${intl.formatMessage({
id: 'project.project.table.list.remark',
defaultMessage: '$$$',
})}`}
required={false}
/>
</ProForm.Group> </ProForm.Group>
<ProForm.Group> <ProForm.Group>
<ProFormSwitch width="md" name="isEnable" label={<FormattedMessage id="project.project.table.list.isEnable" defaultMessage="$$$"/>} initialValue={true}/> <ProFormSwitch
width="lg"
name="isEnable"
label={
<FormattedMessage id="project.project.table.list.isEnable" defaultMessage="$$$" />
}
initialValue={true}
/>
</ProForm.Group> </ProForm.Group>
</StepsForm.StepForm> </StepsForm.StepForm>
{/* 关联算法模型 */}
<StepsForm.StepForm<{ <StepsForm.StepForm<{
model: string; model: string;
}> }>
@ -311,38 +384,56 @@ const MyCreateForm: React.FC<CreateFormProps> = (props) => {
return true; return true;
}} }}
> >
<Transfer <Transfer
dataSource={modalData} dataSource={modalData}
showSearch showSearch
titles={['未选模型', '已选模型']}
locale={{ itemUnit: '项', itemsUnit: '项', searchPlaceholder: '请输入搜索内容' }} locale={{ itemUnit: '项', itemsUnit: '项', searchPlaceholder: '请输入搜索内容' }}
targetKeys={targetKeys} targetKeys={targetKeys}
onChange={handleChange} onChange={handleChange}
onSearch={handleSearch} onSearch={handleSearch}
style={{ marginBottom: '20px' }} style={{ marginBottom: '20px' }}
listStyle={{width: 289, height: 300}}
operationStyle={{width: 100, alignItems: 'center'}}
render={(item) => item.title} render={(item) => item.title}
/> />
</StepsForm.StepForm> </StepsForm.StepForm>
{/* 上传业务代码 */}
<StepsForm.StepForm<{ <StepsForm.StepForm<{
project_file: string; project_file: string;
}> }>
name="project_file" name="project_file"
title="上传业务代码" title="上传业务代码"
style={{width: stepFormItemStyleProps.width}}
stepProps={{ stepProps={{
description: '上传业务代码格式为(.zip,.tar.gz)', description: '上传业务代码格式为(.zip,.tar.gz)',
}} }}
onFinish={async (values: any) => { onFinish={async (values: any) => {
if ('projectFilePath' in values && values['projectFilePath'].length > 0) { if ('projectFilePath' in values && values['projectFilePath'].length > 0) {
let projectFilePath = values['projectFilePath'][0]?.response?.data?.path || '' let projectFilePath = values['projectFilePath'][0]?.response?.data?.path || '';
setFilePath(projectFilePath) } setFilePath(projectFilePath);
}
return true; return true;
}} }}
> >
<ProFormUploadDragger label="上传文件" name="projectFilePath" action="/api/v1/file/uploadFile" max={1} <ProFormUploadDragger
fieldProps={{name: 'file', beforeUpload: beforeUploadFile, data: {path: 'project/files'}, label="上传文件"
headers: { 'X-CSRFToken': cookie.load('csrftoken') , Authorization: `Bearer ${localStorage.getItem('access') || ''}`},}} name="projectFilePath"
action="/api/v1/file/uploadFile"
max={1}
fieldProps={{
name: 'file',
beforeUpload: beforeUploadFile,
data: { path: 'project/files' },
headers: {
'X-CSRFToken': cookie.load('csrftoken'),
Authorization: `Bearer ${localStorage.getItem('access') || ''}`,
},
}}
/> />
</StepsForm.StepForm> </StepsForm.StepForm>
{/* 业务参数配置 */}
<StepsForm.StepForm<{ <StepsForm.StepForm<{
config: string; config: string;
}> }>
@ -352,11 +443,14 @@ const MyCreateForm: React.FC<CreateFormProps> = (props) => {
description: '业务参数配置', description: '业务参数配置',
}} }}
onFinish={async (values: any) => { onFinish={async (values: any) => {
setConfigData(values) setConfigData(values);
return true; return true;
}} }}
> >
{/* <Icon type="delete" /> */}
{/* TODO 图标需要替换 */}
<ProFormList <ProFormList
style={{width: stepFormItemStyleProps.width}}
copyIconProps={{ copyIconProps={{
Icon: SnippetsOutlined, Icon: SnippetsOutlined,
}} }}
@ -365,17 +459,16 @@ const MyCreateForm: React.FC<CreateFormProps> = (props) => {
}} }}
name="params" name="params"
label="模型参数" label="模型参数"
initialValue={[ initialValue={[]}
]}
> >
<ProForm.Group> <ProForm.Group>
<ProFormText key="name" name="name" label="键名" /> <ProFormText key="name" name="name" label="键名" />
<ProFormText key="default" name="default" label="默认值" /> <ProFormText key="default" name="default" label="默认值" />
<ProFormText key="remark" name="remark" label="备注" /> <ProFormText key="remark" name="remark" label="备注" />
</ProForm.Group> </ProForm.Group>
</ProFormList> </ProFormList>
</StepsForm.StepForm> </StepsForm.StepForm>
{/* 关联网点 */}
<StepsForm.StepForm<{ <StepsForm.StepForm<{
group: string; group: string;
}> }>
@ -387,8 +480,10 @@ const MyCreateForm: React.FC<CreateFormProps> = (props) => {
onFinish={async () => { onFinish={async () => {
return true; return true;
}} }}
style={{width: stepFormItemStyleProps.width}}
formRef={formRef3} formRef={formRef3}
> >
<div style={{paddingBottom: 10}}>{'选择网点'}</div>
<Tree <Tree
checkable checkable
defaultExpandAll={true} defaultExpandAll={true}
@ -396,7 +491,7 @@ const MyCreateForm: React.FC<CreateFormProps> = (props) => {
autoExpandParent={true} autoExpandParent={true}
onCheck={(checkedKeys: any) => { onCheck={(checkedKeys: any) => {
// form.setFieldsValue({menuIds: checkedKeys}) // form.setFieldsValue({menuIds: checkedKeys})
setSelectKeys(checkedKeys) setSelectKeys(checkedKeys);
// formRef3.current?.setFieldValue('groupIds', checkedKeys) // formRef3.current?.setFieldValue('groupIds', checkedKeys)
}} }}
treeData={treeData} treeData={treeData}
@ -406,6 +501,6 @@ const MyCreateForm: React.FC<CreateFormProps> = (props) => {
/> />
</StepsForm.StepForm> </StepsForm.StepForm>
</StepsForm> </StepsForm>
) );
} };
export default MyCreateForm; export default MyCreateForm;

@ -1,18 +1,17 @@
import {deleteProjectDeleteProject, postProjectGetProjectList, deleteProjectDeleteProjectByIds} from '@/services/project/Project'; import {
deleteProjectDeleteProject,
deleteProjectDeleteProjectByIds,
postProjectGetProjectList,
} from '@/services/project/Project';
import { PlusOutlined } from '@ant-design/icons'; import { PlusOutlined } from '@ant-design/icons';
import type { ActionType, ProColumns } from '@ant-design/pro-components'; import type { ActionType, ProColumns } from '@ant-design/pro-components';
import { import { FooterToolbar, PageContainer, ProTable } from '@ant-design/pro-components';
FooterToolbar, import { Access, FormattedMessage, history, useAccess, useIntl } from '@umijs/max';
PageContainer,
ProTable,
ProFormSelect,
} from '@ant-design/pro-components';
import { FormattedMessage, useIntl, useAccess, Access, history } from '@umijs/max';
import { Button, message } from 'antd'; import { Button, message } from 'antd';
import React, { useRef, useState } from 'react'; import React, { useRef, useState } from 'react';
import { ColumnDrawer } from './components/ColumnDrawer';
import MyCreateForm from './components/MyCreateForm';
import UpdateForm from './components/UpdateForm'; import UpdateForm from './components/UpdateForm';
import MyCreateForm from "./components/MyCreateForm";
import {ColumnDrawer} from "./components/ColumnDrawer";
const ProjectList: React.FC = () => { const ProjectList: React.FC = () => {
/** /**
* @en-US Pop-up window of new window * @en-US Pop-up window of new window
@ -37,44 +36,43 @@ const ProjectList: React.FC = () => {
const handleUpdateModal = () => { const handleUpdateModal = () => {
if (updateModalOpen) { if (updateModalOpen) {
setUpdateModalOpen(false) setUpdateModalOpen(false);
setCurrentRow(undefined) setCurrentRow(undefined);
} else { } else {
setUpdateModalOpen(true) setUpdateModalOpen(true);
}
} }
};
const handleCreateModal = () => { const handleCreateModal = () => {
if (createModalOpen) { if (createModalOpen) {
setCreateModalOpen(false) setCreateModalOpen(false);
setCurrentRow(undefined) setCurrentRow(undefined);
} else { } else {
setCreateModalOpen(true) setCreateModalOpen(true);
}
} }
};
const handleColumnDrawer = () => { const handleColumnDrawer = () => {
if (showDetail) { if (showDetail) {
setShowDetail(false) setShowDetail(false);
setCurrentRow(undefined) setCurrentRow(undefined);
} else { } else {
setShowDetail(true) setShowDetail(true);
}
} }
};
const handleDestroy = async (selectedRow: API.Project) => { const handleDestroy = async (selectedRow: API.Project) => {
deleteProjectDeleteProject({id: selectedRow.id}).then(()=>{ deleteProjectDeleteProject({ id: selectedRow.id })
message.success(intl.formatMessage({id: 'common.success', defaultMessage: '$$$'})) .then(() => {
actionRef.current?.reload() message.success(intl.formatMessage({ id: 'common.success', defaultMessage: '$$$' }));
}).catch(()=>{ actionRef.current?.reload();
message.error(intl.formatMessage({id: 'common.failure', defaultMessage: '$$$'}))
}) })
.catch(() => {
message.error(intl.formatMessage({ id: 'common.failure', defaultMessage: '$$$' }));
});
}; };
const columns: ProColumns<API.Project>[] = [ const columns: ProColumns<API.Project>[] = [
{ {
title: (<FormattedMessage title: <FormattedMessage id="project.project.table.list.id" defaultMessage="id" />,
id="project.project.table.list.id" dataIndex: 'id',
defaultMessage="id"/>),
dataIndex: "id",
sorter: true, sorter: true,
render: (dom, entity) => { render: (dom, entity) => {
return ( return (
@ -91,92 +89,72 @@ const columns: ProColumns<API.Project>[] = [
}, },
{ {
title: (<FormattedMessage title: <FormattedMessage id="project.project.table.list.name" defaultMessage="$$$" />,
id="project.project.table.list.name" dataIndex: 'name',
defaultMessage="$$$"/>),
dataIndex: "name",
hideInSearch: true, hideInSearch: true,
}, },
{ {
title: (<FormattedMessage title: <FormattedMessage id="project.project.table.list.code" defaultMessage="$$$" />,
id="project.project.table.list.code" dataIndex: 'code',
defaultMessage="$$$"/>),
dataIndex: "code",
hideInSearch: true, hideInSearch: true,
}, },
{ {
title: (<FormattedMessage title: <FormattedMessage id="project.project.table.list.info" defaultMessage="$$$" />,
id="project.project.table.list.info" dataIndex: 'info',
defaultMessage="$$$"/>),
dataIndex: "info",
hideInSearch: true, hideInSearch: true,
}, },
{ {
title: (<FormattedMessage title: <FormattedMessage id="project.project.table.list.inferConfig" defaultMessage="$$$" />,
id="project.project.table.list.inferConfig" dataIndex: 'inferConfig',
defaultMessage="$$$"/>),
dataIndex: "inferConfig",
hideInSearch: true, hideInSearch: true,
hideInTable: true, hideInTable: true,
hideInDescriptions: true, hideInDescriptions: true,
}, },
{ {
title: (<FormattedMessage title: <FormattedMessage id="project.project.table.list.isEnable" defaultMessage="$$$" />,
id="project.project.table.list.isEnable" dataIndex: 'isEnable',
defaultMessage="$$$"/>), filters: true,
dataIndex: "isEnable", onFilter: true,
filters: true, onFilter: true,
hideInSearch: true, hideInSearch: true,
valueType: 'switch', valueType: 'switch',
}, },
{ {
title: (<FormattedMessage title: <FormattedMessage id="project.project.table.list.remark" defaultMessage="$$$" />,
id="project.project.table.list.remark" dataIndex: 'remark',
defaultMessage="$$$"/>),
dataIndex: "remark",
hideInSearch: true, hideInSearch: true,
}, },
{ {
title: (<FormattedMessage title: <FormattedMessage id="project.project.table.list.createTime" defaultMessage="$$$" />,
id="project.project.table.list.createTime" dataIndex: 'createTime',
defaultMessage="$$$"/>),
dataIndex: "createTime",
sorter: true, sorter: true,
hideInSearch: true, hideInSearch: true,
valueType: 'dateTime', valueType: 'dateTime',
}, },
{ {
title: (<FormattedMessage title: <FormattedMessage id="project.project.table.list.updateTime" defaultMessage="$$$" />,
id="project.project.table.list.updateTime" dataIndex: 'updateTime',
defaultMessage="$$$"/>),
dataIndex: "updateTime",
sorter: true, sorter: true,
hideInSearch: true, hideInSearch: true,
valueType: 'dateTime', valueType: 'dateTime',
}, },
{ {
title: <FormattedMessage id="pages.searchTable.titleOption" defaultMessage="Operating" />, title: <FormattedMessage id="pages.searchTable.titleOption" defaultMessage="Operating" />,
dataIndex: 'option', dataIndex: 'option',
valueType: 'option', valueType: 'option',
fixed: 'right', fixed: 'right',
render: (_, record) => [ render: (_, record) => [
<Access accessible={access.canUpdate(history.location.pathname)} key={`${history.location.pathname}-add`}> <Access
accessible={access.canUpdate(history.location.pathname)}
key={`${history.location.pathname}-add`}
>
<a <a
key="update" key="update"
onClick={() => { onClick={() => {
@ -189,16 +167,15 @@ const columns: ProColumns<API.Project>[] = [
<a <a
key="destroy" key="destroy"
onClick={() => { onClick={() => {
handleDestroy(record).then(()=>{}) handleDestroy(record).then(() => {});
}}> }}
<FormattedMessage >
id="pages.searchTable.destroy" <FormattedMessage id="pages.searchTable.destroy" defaultMessage="Destroy" />
defaultMessage="Destroy"
/>
</a> </a>
</Access> </Access>,
], ],
},]; },
];
return ( return (
<PageContainer> <PageContainer>
<ProTable<API.Project> <ProTable<API.Project>
@ -212,20 +189,20 @@ return (
search={{ search={{
labelWidth: 120, labelWidth: 120,
}} }}
onDataSourceChange={(data)=>{ onDataSourceChange={() => {}}
}}
pagination={{ pagination={{
showSizeChanger: true, showSizeChanger: true,
pageSize: 10, pageSize: 10,
}} }}
columnsState={{ columnsState={{
persistenceKey: 'project_list', persistenceKey: 'project_list',
persistenceType: 'localStorage' persistenceType: 'localStorage',
}} }}
toolBarRender={() => [ toolBarRender={() => [
<Access accessible={access.canUpdate(history.location.pathname)} key={`${history.location.pathname}-add`}> <Access
accessible={access.canUpdate(history.location.pathname)}
key={`${history.location.pathname}-add`}
>
<Button <Button
type="primary" type="primary"
key="primary" key="primary"
@ -235,32 +212,31 @@ return (
> >
<PlusOutlined /> <FormattedMessage id="pages.searchTable.new" defaultMessage="New" /> <PlusOutlined /> <FormattedMessage id="pages.searchTable.new" defaultMessage="New" />
</Button> </Button>
</Access> </Access>,
]} ]}
request={async (params = {}, sort) => { request={async (params = {}, sort) => {
const {current, ...rest} = params const { current, ...rest } = params;
const reqParams = { const reqParams = {
page: current, page: current,
desc: false, desc: false,
orderKey: "", orderKey: '',
...rest, ...rest,
} };
if (sort && Object.keys(sort).length) { if (sort && Object.keys(sort).length) {
reqParams.orderKey = Object.keys(sort)[0] reqParams.orderKey = Object.keys(sort)[0];
let sort_select = sort[reqParams.orderKey] let sort_select = sort[reqParams.orderKey];
reqParams.desc = sort_select === 'descend'; reqParams.desc = sort_select === 'descend';
} }
let resp = await postProjectGetProjectList({...reqParams}) let resp = await postProjectGetProjectList({ ...reqParams });
return { return {
data: resp.data.list.map((v: API.Project) => { data: resp.data.list.map((v: API.Project) => {
return {...v, key: v.id} return { ...v, key: v.id };
}), }),
success: resp.success, success: resp.success,
total: resp.data.total, total: resp.data.total,
current: resp.data.page, current: resp.data.page,
pageSize: resp.data.pageSize pageSize: resp.data.pageSize,
}; };
}} }}
columns={columns} columns={columns}
rowSelection={{ rowSelection={{
@ -281,9 +257,13 @@ return (
> >
<Button <Button
onClick={async () => { onClick={async () => {
deleteProjectDeleteProjectByIds({ids: selectedRowsState.map((v: API.Project)=>{return v.id as number})}).then(()=>{ deleteProjectDeleteProjectByIds({
ids: selectedRowsState.map((v: API.Project) => {
return v.id as number;
}),
}).then(() => {
actionRef.current?.reloadAndRest?.(); actionRef.current?.reloadAndRest?.();
}) });
}} }}
> >
<FormattedMessage <FormattedMessage
@ -312,7 +292,6 @@ return (
columns={columns} columns={columns}
currentRow={currentRow} currentRow={currentRow}
/> />
</PageContainer> </PageContainer>
); );
}; };

@ -0,0 +1,493 @@
import { ColumnDrawer as ModelCategoryColumnDrawer } from '@/pages/Resource/ModelCategoryList/components/ColumnDrawer';
import { ModelCategoryColumns } from '@/pages/Resource/ModelCategoryList/components/Columns';
import {
deleteAlgorithmModelDeleteAlgorithmModel,
deleteAlgorithmModelDeleteAlgorithmModelByIds,
postAlgorithmModelGetAlgorithmModelList,
} from '@/services/resource/AlgorithmModel';
import {
postModelCategoryGetModelCategoryById,
postModelCategoryGetModelCategoryFkSelect,
postModelCategoryGetModelCategoryNames,
} from '@/services/resource/ModelCategory';
import { ExclamationCircleOutlined, PlusOutlined } from '@ant-design/icons';
import type { ActionType, ProColumns } from '@ant-design/pro-components';
import { PageContainer, ProFormSelect, ProFormText, ProTable } from '@ant-design/pro-components';
import { Access, FormattedMessage, history, useAccess, useIntl } from '@umijs/max';
import { Button, Modal, Popconfirm, message } from 'antd';
import React, { useRef, useState } from 'react';
import { ColumnDrawer } from './components/ColumnDrawer';
import CreateForm from './components/CreateForm';
import UpdateForm from './components/UpdateForm';
const AlgorithmModelList: React.FC = () => {
/**
* @en-US Pop-up window of new window
* @zh-CN
* */
const [createModalOpen, setCreateModalOpen] = useState<boolean>(false);
/**
* @en-US The pop-up window of the distribution update window
* @zh-CN
* */
const [updateModalOpen, setUpdateModalOpen] = useState<boolean>(false);
const [showDetail, setShowDetail] = useState<boolean>(false);
/**
* @en-US International configuration
* @zh-CN
* */
const access = useAccess();
const intl = useIntl();
const actionRef = useRef<ActionType>();
// TODO 动态设置每页数量
const [currentPageSize, setCurrentPageSize] = useState<number>(10);
const [currentRow, setCurrentRow] = useState<API.AlgorithmModel>();
const [selectedRowsState, setSelectedRows] = useState<API.AlgorithmModel[]>([]);
const [category_fk_id_open, set_category_fk_id_open] = useState(false);
const [category_fk_id, set_category_fk_id] = useState<API.ModelCategory>();
const [category_fk_id_column_open, set_category_fk_id_column_open] = useState(false);
const [categoryFkIdIds, setCategoryFkIdIds] = useState([]);
const [categoryFkIdMap, setCategoryFkIdMap] = useState<{ [key: number]: string }>({});
const handle_category_fk_id = (id: any) => {
if (category_fk_id_open) {
set_category_fk_id(undefined);
set_category_fk_id_open(false);
} else {
postModelCategoryGetModelCategoryById({ id: id }).then((resp) => {
set_category_fk_id(resp.data.modelCategory);
set_category_fk_id_open(true);
});
}
};
const handle_category_fk_id_column_open = () => {
if (category_fk_id_column_open) {
set_category_fk_id_column_open(false);
} else {
postModelCategoryGetModelCategoryNames({ ids: categoryFkIdIds }).then((resp) => {
let a: any = {};
resp.data.list.forEach((v: any) => {
if (v.id) {
a[v.id] = v.name;
}
});
setCategoryFkIdMap(a);
});
set_category_fk_id_column_open(true);
}
};
const handleUpdateModal = () => {
if (updateModalOpen) {
setUpdateModalOpen(false);
setCurrentRow(undefined);
} else {
setUpdateModalOpen(true);
}
};
const handleCreateModal = () => {
if (createModalOpen) {
setCreateModalOpen(false);
setCurrentRow(undefined);
} else {
setCreateModalOpen(true);
}
};
const handleColumnDrawer = () => {
if (showDetail) {
setShowDetail(false);
setCurrentRow(undefined);
} else {
setShowDetail(true);
}
};
const handleDestroy = async (selectedRow: API.AlgorithmModel) => {
deleteAlgorithmModelDeleteAlgorithmModel({ id: selectedRow.id })
.then(() => {
message.success(intl.formatMessage({ id: 'common.success', defaultMessage: '$$$' }));
actionRef.current?.reload();
})
.catch(() => {
message.error(intl.formatMessage({ id: 'common.failure', defaultMessage: '$$$' }));
});
};
const columns: ProColumns<API.AlgorithmModel>[] = [
{
title: <FormattedMessage id="resource.algorithm_model.table.list.id" defaultMessage="id" />,
dataIndex: 'id',
sorter: true,
render: (dom, entity) => {
return (
<a
onClick={() => {
setCurrentRow(entity);
setShowDetail(true);
}}
>
{dom}
</a>
);
},
//TODO 默认使用renderFormItem update1101
renderFormItem: () => {
return (
<>
<ProFormText
width="md"
labelCol={{ span: 4 }}
wrapperCol={{ span: 22 }}
name="id"
placeholder={`${intl.formatMessage({
id: 'common.please_input',
defaultMessage: '$$$',
})}`}
required={false}
/>
</>
);
},
},
{
title: (
<FormattedMessage id="resource.algorithm_model.table.list.name" defaultMessage="$$$" />
),
dataIndex: 'name',
hideInSearch: true,
},
{
title: (
<FormattedMessage
id="resource.algorithm_model.table.list.categoryFkId"
defaultMessage="$$$"
/>
),
dataIndex: 'categoryFkId',
hideInSearch: false,
render: (text, record) => {
if (category_fk_id_column_open) {
return (
<a
onClick={() => {
handle_category_fk_id(record.categoryFkId);
}}
>
{record?.categoryFkId ? categoryFkIdMap[record.categoryFkId] : undefined}
</a>
);
} else {
return (
<a
onClick={() => {
handle_category_fk_id(record.categoryFkId);
}}
>
{record.categoryFkId}
</a>
);
}
},
renderFormItem: () => {
return (
// value 和 onchange 会通过 form 自动注入。
<ProFormSelect
width="md"
labelCol={{ span: 4 }}
wrapperCol={{ span: 22 }}
placeholder={`${intl.formatMessage({
id: 'common.please_select',
defaultMessage: '$$$',
})}`}
required={false}
showSearch
debounceTime={1000}
request={async (keyWord) => {
const resp = await postModelCategoryGetModelCategoryFkSelect({
keyword: keyWord?.keyWords || '',
});
return resp.data.list.map((v: any) => {
return {
label: v.name,
value: v.id,
};
});
}}
/>
);
},
},
{
title: (
<FormattedMessage
id="resource.algorithm_model.table.list.defaultVersionFkId"
defaultMessage="$$$"
/>
),
dataIndex: 'defaultVersionFkId',
hideInSearch: true,
},
{
title: (
<FormattedMessage id="resource.algorithm_model.table.list.remark" defaultMessage="$$$" />
),
dataIndex: 'remark',
hideInSearch: true,
},
{
title: (
<FormattedMessage
id="resource.algorithm_model.table.list.createTime"
defaultMessage="$$$"
/>
),
dataIndex: 'createTime',
sorter: true,
hideInSearch: true,
valueType: 'dateTime',
},
{
title: (
<FormattedMessage
id="resource.algorithm_model.table.list.updateTime"
defaultMessage="$$$"
/>
),
dataIndex: 'updateTime',
sorter: true,
hideInSearch: true,
valueType: 'dateTime',
},
{
title: <FormattedMessage id="pages.searchTable.titleOption" defaultMessage="Operating" />,
dataIndex: 'option',
valueType: 'option',
fixed: 'right',
render: (_, record) => [
<Access
accessible={access.canUpdate(history.location.pathname)}
key={`${history.location.pathname}-add`}
>
<a
key="update"
onClick={() => {
setUpdateModalOpen(true);
setCurrentRow(record);
}}
>
<FormattedMessage id="pages.searchTable.update" defaultMessage="Update" />
</a>
{/* update1101 */}
<Popconfirm
placement="topLeft"
title={'提示'}
description={`确认要删除么?`}
okText="确定"
cancelText="取消"
onConfirm={() => {
handleDestroy(record).then(() => {});
}}
>
<Button key="destroy" type="text" danger>
<FormattedMessage id="pages.searchTable.destroy" defaultMessage="Destroy" />
</Button>
</Popconfirm>
</Access>,
],
},
];
return (
<PageContainer>
<ProTable<API.AlgorithmModel>
headerTitle={intl.formatMessage({
id: 'pages.searchTable.title',
defaultMessage: '$$$',
})}
scroll={{ y: 500 }}
options={{ fullScreen: true, setting: true, density: true, reload: true }}
actionRef={actionRef}
rowKey="key"
search={{
labelWidth: 120,
}}
onDataSourceChange={(data) => {
let CategoryFkIdIds: any = data.map((v) => {
return v.categoryFkId;
});
setCategoryFkIdIds(CategoryFkIdIds);
}}
pagination={{
showSizeChanger: true,
pageSize: currentPageSize,
onChange: (page, pageSize) => setCurrentPageSize(pageSize),
}}
columnsState={{
persistenceKey: 'algorithm_model_list',
persistenceType: 'localStorage',
}}
tableAlertOptionRender={() => {
return (
<>
{selectedRowsState?.length > 0 && (
<Button
danger
onClick={async () => {
Modal.confirm({
icon: <ExclamationCircleOutlined />,
title: "确定要删除此模型吗?",
content: ("确定删除这个模型吗,删除后将无法找回,请谨慎操作"),
cancelText: '',
onOk() {
// TODO 未对接批量删除接口
deleteAlgorithmModelDeleteAlgorithmModelByIds({
ids: selectedRowsState.map((v: API.AlgorithmModel) => {
return v.id as number;
}),
}).then(() => {
actionRef.current?.reloadAndRest?.();
});
},
onCancel() {
console.log('Cancel');
},
});
}}
>
<FormattedMessage
id="pages.searchTable.batchDeletion"
defaultMessage="Batch deletion"
/>
</Button>
)}
</>
);
}}
toolBarRender={() => [
<Access
accessible={access.canUpdate(history.location.pathname)}
key={`${history.location.pathname}-add`}
>
<Button
type="primary"
key="category_fk_id_show"
onClick={() => {
handle_category_fk_id_column_open();
}}
>
{category_fk_id_column_open ? (
<FormattedMessage id="common.hide" defaultMessage="$$$" />
) : (
<FormattedMessage id="common.show" defaultMessage="$$$" />
)}
<FormattedMessage
id="resource.algorithm_model.table.list.categoryFkId"
defaultMessage="$$$"
/>
</Button>
<Button
type="primary"
key="primary"
onClick={() => {
setCreateModalOpen(true);
}}
>
<PlusOutlined /> <FormattedMessage id="pages.searchTable.new" defaultMessage="New" />
</Button>
</Access>,
]}
request={async (params = {}, sort) => {
const { current, ...rest } = params;
const reqParams = {
page: 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 postAlgorithmModelGetAlgorithmModelList({ ...reqParams });
return {
data: resp.data.list.map((v: API.AlgorithmModel) => {
return { ...v, key: v.id };
}),
success: resp.success,
total: resp.data.total,
current: resp.data.page,
pageSize: resp.data.pageSize,
};
}}
columns={columns}
rowSelection={{
onChange: (_, selectedRows) => {
setSelectedRows(selectedRows);
},
}}
/>
{/* TODO 不明显需要重新设计 底部已选项操作固定栏 */}
{/* {selectedRowsState?.length > 0 && (
<FooterToolbar
extra={
<div>
<FormattedMessage id="pages.searchTable.chosen" defaultMessage="Chosen" />{' '}
<a style={{ fontWeight: 600 }}>{selectedRowsState.length}</a>{' '}
<FormattedMessage id="pages.searchTable.item" defaultMessage="$$$" />
</div>
}
>
<Button
onClick={async () => {
deleteAlgorithmModelDeleteAlgorithmModelByIds({
ids: selectedRowsState.map((v: API.AlgorithmModel) => {
return v.id as number;
}),
}).then(() => {
actionRef.current?.reloadAndRest?.();
});
}}
>
<FormattedMessage
id="pages.searchTable.batchDeletion"
defaultMessage="Batch deletion"
/>
</Button>
</FooterToolbar>
)} */}
{/* 列表关联操作项组件 */}
<CreateForm
createModalOpen={createModalOpen}
values={currentRow || {}}
handleModal={handleCreateModal}
reload={actionRef.current?.reload}
/>
<UpdateForm
updateModalOpen={updateModalOpen}
values={currentRow || {}}
handleModal={handleUpdateModal}
reload={actionRef.current?.reload}
/>
<ColumnDrawer
handleDrawer={handleColumnDrawer}
isShowDetail={showDetail}
columns={columns}
currentRow={currentRow}
/>
<ModelCategoryColumnDrawer
handleDrawer={handle_category_fk_id}
isShowDetail={category_fk_id_open}
columns={ModelCategoryColumns}
currentRow={category_fk_id}
/>
</PageContainer>
);
};
export default AlgorithmModelList;

@ -10,7 +10,7 @@ import {
postModelCategoryGetModelCategoryFkSelect, postModelCategoryGetModelCategoryFkSelect,
postModelCategoryGetModelCategoryNames, postModelCategoryGetModelCategoryNames,
} from '@/services/resource/ModelCategory'; } from '@/services/resource/ModelCategory';
import { PlusOutlined } from '@ant-design/icons'; import { ExclamationCircleOutlined, PlusOutlined } from '@ant-design/icons';
import type { ActionType, ProColumns } from '@ant-design/pro-components'; import type { ActionType, ProColumns } from '@ant-design/pro-components';
import { import {
FooterToolbar, FooterToolbar,
@ -20,7 +20,7 @@ import {
ProTable, ProTable,
} from '@ant-design/pro-components'; } from '@ant-design/pro-components';
import { Access, FormattedMessage, history, useAccess, useIntl } from '@umijs/max'; import { Access, FormattedMessage, history, useAccess, useIntl } from '@umijs/max';
import { Button, Popconfirm, message } from 'antd'; import { Button, Modal, Popconfirm, message } from 'antd';
import React, { useRef, useState } from 'react'; import React, { useRef, useState } from 'react';
import { ColumnDrawer } from './components/ColumnDrawer'; import { ColumnDrawer } from './components/ColumnDrawer';
import {ModelVersionListDrawer} from "./components/ModelVersionListDrawer"; import {ModelVersionListDrawer} from "./components/ModelVersionListDrawer";
@ -324,6 +324,7 @@ const AlgorithmModelList: React.FC = () => {
id: 'pages.searchTable.title', id: 'pages.searchTable.title',
defaultMessage: '$$$', defaultMessage: '$$$',
})} })}
scroll={{ y: 500 }}
options={{ fullScreen: true, setting: true, density: true, reload: true }} options={{ fullScreen: true, setting: true, density: true, reload: true }}
actionRef={actionRef} actionRef={actionRef}
rowKey="key" rowKey="key"
@ -345,6 +346,44 @@ const AlgorithmModelList: React.FC = () => {
persistenceKey: 'algorithm_model_list', persistenceKey: 'algorithm_model_list',
persistenceType: 'localStorage', persistenceType: 'localStorage',
}} }}
tableAlertOptionRender={() => {
return (
<>
{selectedRowsState?.length > 0 && (
<Button
danger
onClick={async () => {
Modal.confirm({
icon: <ExclamationCircleOutlined />,
title: "确定要删除此模型吗?",
content: ("确定删除这个模型吗,删除后将无法找回,请谨慎操作"),
cancelText: '',
onOk() {
// TODO 未对接批量删除接口
deleteAlgorithmModelDeleteAlgorithmModelByIds({
ids: selectedRowsState.map((v: API.AlgorithmModel) => {
return v.id as number;
}),
}).then(() => {
actionRef.current?.reloadAndRest?.();
});
},
onCancel() {
console.log('Cancel');
},
});
}}
>
<FormattedMessage
id="pages.searchTable.batchDeletion"
defaultMessage="Batch deletion"
/>
</Button>
)}
</>
);
}}
toolBarRender={() => [ toolBarRender={() => [
<Access <Access
accessible={access.canUpdate(history.location.pathname)} accessible={access.canUpdate(history.location.pathname)}
@ -410,35 +449,6 @@ const AlgorithmModelList: React.FC = () => {
}, },
}} }}
/> />
{/* TODO 不明显需要重新设计 底部已选项操作固定栏 */}
{selectedRowsState?.length > 0 && (
<FooterToolbar
extra={
<div>
<FormattedMessage id="pages.searchTable.chosen" defaultMessage="Chosen" />{' '}
<a style={{ fontWeight: 600 }}>{selectedRowsState.length}</a>{' '}
<FormattedMessage id="pages.searchTable.item" defaultMessage="$$$" />
</div>
}
>
<Button
onClick={async () => {
deleteAlgorithmModelDeleteAlgorithmModelByIds({
ids: selectedRowsState.map((v: API.AlgorithmModel) => {
return v.id as number;
}),
}).then(() => {
actionRef.current?.reloadAndRest?.();
});
}}
>
<FormattedMessage
id="pages.searchTable.batchDeletion"
defaultMessage="Batch deletion"
/>
</Button>
</FooterToolbar>
)}
{/* 列表关联操作项组件 */} {/* 列表关联操作项组件 */}
<CreateForm <CreateForm
createModalOpen={createModalOpen} createModalOpen={createModalOpen}

@ -148,8 +148,8 @@ const ModelVersionList: React.FC = () => {
}); });
return ( return (
<> <>
{prevActions.map((item) => { {prevActions.map((item,index) => {
return <>{item}</>; return <div key={index}>{item}</div>;
})} })}
<Dropdown menu={{items: moreActions}}> <Dropdown menu={{items: moreActions}}>
<a><DownOutlined/></a> <a><DownOutlined/></a>

Loading…
Cancel
Save