fix: 模型版本列表按钮统一使用button,项目管理新增数据表单默认同行展示

develop
zhoux 1 year ago
parent dfc7495975
commit 6b542454a3

@ -2,7 +2,7 @@
* @Author: zhoux zhouxia@supervision.ltd * @Author: zhoux zhouxia@supervision.ltd
* @Date: 2023-11-01 13:56:33 * @Date: 2023-11-01 13:56:33
* @LastEditors: zhoux zhouxia@supervision.ltd * @LastEditors: zhoux zhouxia@supervision.ltd
* @LastEditTime: 2023-11-03 11:09:56 * @LastEditTime: 2023-11-06 09:43:02
* @FilePath: \general-ai-platform-web\README.md * @FilePath: \general-ai-platform-web\README.md
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
--> -->
@ -22,6 +22,7 @@
* 展示抽屉内容时需要有关闭按钮,排版需和谐 * 展示抽屉内容时需要有关闭按钮,排版需和谐
* 使用stepForm的时候最后的提交写在最后一步的onfinish里面而不是总的stepForm里 * 使用stepForm的时候最后的提交写在最后一步的onfinish里面而不是总的stepForm里
* table操作栏按钮统一使用button合理间距
@ -56,3 +57,13 @@
## ProForm 表单 ## ProForm 表单
### git提交修饰
feat: 新功能
fix: bug修复
docs: 仅文档更改
style: 不影响代码含义的更改(空白、格式设置、缺失 分号等)
refactor: 既不修复bug也不添加特性的代码更改
perf: 改进性能的代码更改
test: 添加缺少的测试或更正现有测试
chore: 对构建过程或辅助工具和库(如文档)的更改(无法确认内容可使用)

@ -1,10 +1,11 @@
import {postDeviceGroupGetDeviceGroupTree} from '@/services/device/DeviceGroup'; import { postDeviceGroupGetDeviceGroupTree } from '@/services/device/DeviceGroup';
import {postProjectCreateProject} from '@/services/project/Project'; import { postProjectCreateProject } from '@/services/project/Project';
import {postAlgorithmModelGetAlgorithmModelFkSelect} from '@/services/resource/AlgorithmModel'; import { postAlgorithmModelGetAlgorithmModelFkSelect } from '@/services/resource/AlgorithmModel';
import {beforeUploadFile} from '@/utils/common'; import { beforeUploadFile } from '@/utils/common';
import {CloseOutlined, SnippetsOutlined} from '@ant-design/icons'; import { CloseOutlined, SnippetsOutlined } from '@ant-design/icons';
import type {ProFormInstance} from '@ant-design/pro-components'; import type { ProFormInstance } from '@ant-design/pro-components';
import { import {
ProCard,
ProForm, ProForm,
ProFormList, ProFormList,
ProFormSwitch, ProFormSwitch,
@ -12,15 +13,15 @@ import {
ProFormUploadDragger, ProFormUploadDragger,
StepsForm, StepsForm,
} from '@ant-design/pro-components'; } from '@ant-design/pro-components';
import {FormattedMessage, useIntl} from '@umijs/max'; import { FormattedMessage, useIntl } from '@umijs/max';
import {Modal, Switch, Transfer, Tree, message, UploadFile} from 'antd'; import { Modal, Switch, Transfer, Tree, UploadFile, message } 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 React, {useEffect, useRef, useState} from 'react'; import React, { useEffect, useRef, useState } from 'react';
// @ts-ignore // @ts-ignore
import { FormListActionType } from '@ant-design/pro-form/lib';
import yaml from 'js-yaml';
import cookie from 'react-cookies'; import cookie from 'react-cookies';
import {FormListActionType} from "@ant-design/pro-form/lib";
import yaml from "js-yaml";
interface RecordType { interface RecordType {
key: string; key: string;
@ -56,7 +57,7 @@ const waitTime = (time: number = 100) => {
}; };
/**styles 配置 */ /**styles 配置 */
const formContainerWidth: number = 755 const formContainerWidth: number = 755;
const stepFormItemStyleProps: Record<string, any> = { const stepFormItemStyleProps: Record<string, any> = {
width: formContainerWidth, width: formContainerWidth,
}; };
@ -70,51 +71,51 @@ const treeData1: any[] = [
title: '0-0-0', title: '0-0-0',
key: '0-0-0', key: '0-0-0',
children: [ children: [
{title: '0-0-0-0', key: '0-0-0-0'}, { title: '0-0-0-0', key: '0-0-0-0' },
{title: '0-0-0-1', key: '0-0-0-1'}, { title: '0-0-0-1', key: '0-0-0-1' },
{title: '0-0-0-2', key: '0-0-0-2'}, { title: '0-0-0-2', key: '0-0-0-2' },
], ],
}, },
{ {
title: '0-0-1', title: '0-0-1',
key: '0-0-1', key: '0-0-1',
children: [ children: [
{title: '0-0-1-0', key: '0-0-1-0'}, { title: '0-0-1-0', key: '0-0-1-0' },
{title: '0-0-1-1', key: '0-0-1-1'}, { title: '0-0-1-1', key: '0-0-1-1' },
{title: '0-0-1-2', key: '0-0-1-2'}, { title: '0-0-1-2', key: '0-0-1-2' },
{title: '0-0-1-0', key: '0-0-1-3'}, { title: '0-0-1-0', key: '0-0-1-3' },
{title: '0-0-1-1', key: '0-0-1-4'}, { title: '0-0-1-1', key: '0-0-1-4' },
{title: '0-0-1-2', key: '0-0-1-5'}, { title: '0-0-1-2', key: '0-0-1-5' },
{title: '0-0-1-0', key: '0-0-1-6'}, { title: '0-0-1-0', key: '0-0-1-6' },
{title: '0-0-1-1', key: '0-0-1-7'}, { title: '0-0-1-1', key: '0-0-1-7' },
{title: '0-0-1-2', key: '0-0-1-8'}, { title: '0-0-1-2', key: '0-0-1-8' },
{title: '0-0-1-0', key: '0-0-1-9'}, { title: '0-0-1-0', key: '0-0-1-9' },
{title: '0-0-1-1', key: '0-0-1-10'}, { title: '0-0-1-1', key: '0-0-1-10' },
{title: '0-0-1-2', key: '0-0-1-11'}, { title: '0-0-1-2', key: '0-0-1-11' },
{title: '0-0-1-0', key: '0-0-1-12'}, { title: '0-0-1-0', key: '0-0-1-12' },
{title: '0-0-1-1', key: '0-0-1-13'}, { title: '0-0-1-1', key: '0-0-1-13' },
{title: '0-0-1-2', key: '0-0-1-14'}, { title: '0-0-1-2', key: '0-0-1-14' },
{title: '0-0-1-0', key: '0-0-1-15'}, { title: '0-0-1-0', key: '0-0-1-15' },
{title: '0-0-1-1', key: '0-0-1-16'}, { title: '0-0-1-1', key: '0-0-1-16' },
{title: '0-0-1-2', key: '0-0-1-17'}, { title: '0-0-1-2', key: '0-0-1-17' },
{title: '0-0-1-0', key: '0-0-1-18'}, { title: '0-0-1-0', key: '0-0-1-18' },
{title: '0-0-1-1', key: '0-0-1-19'}, { title: '0-0-1-1', key: '0-0-1-19' },
{title: '0-0-1-2', key: '0-0-1-20'}, { title: '0-0-1-2', key: '0-0-1-20' },
{title: '0-0-1-0', key: '0-0-1-21'}, { title: '0-0-1-0', key: '0-0-1-21' },
{title: '0-0-1-1', key: '0-0-1-22'}, { title: '0-0-1-1', key: '0-0-1-22' },
{title: '0-0-1-2', key: '0-0-1-23'}, { title: '0-0-1-2', key: '0-0-1-23' },
{title: '0-0-1-0', key: '0-0-1-24'}, { title: '0-0-1-0', key: '0-0-1-24' },
{title: '0-0-1-1', key: '0-0-1-25'}, { title: '0-0-1-1', key: '0-0-1-25' },
{title: '0-0-1-2', key: '0-0-1-26'}, { title: '0-0-1-2', key: '0-0-1-26' },
{title: '0-0-1-0', key: '0-0-1-27'}, { title: '0-0-1-0', key: '0-0-1-27' },
{title: '0-0-1-1', key: '0-0-1-28'}, { title: '0-0-1-1', key: '0-0-1-28' },
{title: '0-0-1-2', key: '0-0-1-29'}, { title: '0-0-1-2', key: '0-0-1-29' },
{title: '0-0-1-0', key: '0-0-1-30'}, { title: '0-0-1-0', key: '0-0-1-30' },
{title: '0-0-1-1', key: '0-0-1-31'}, { title: '0-0-1-1', key: '0-0-1-31' },
{title: '0-0-1-2', key: '0-0-1-32'}, { title: '0-0-1-2', key: '0-0-1-32' },
{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' },
], ],
}, },
{ {
@ -127,9 +128,9 @@ const treeData1: any[] = [
title: '0-1', title: '0-1',
key: '0-1', key: '0-1',
children: [ children: [
{title: '0-1-0-0', key: '0-1-0-0'}, { title: '0-1-0-0', key: '0-1-0-0' },
{title: '0-1-0-1', key: '0-1-0-1'}, { title: '0-1-0-1', key: '0-1-0-1' },
{title: '0-1-0-2', key: '0-1-0-2'}, { title: '0-1-0-2', key: '0-1-0-2' },
], ],
}, },
{ {
@ -144,7 +145,7 @@ const MyCreateForm: React.FC<CreateFormProps> = (props) => {
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);
const formRef = useRef<ProFormInstance>(); const formRef = useRef<ProFormInstance>();
@ -152,7 +153,7 @@ const MyCreateForm: React.FC<CreateFormProps> = (props) => {
const [current, setCurrent] = useState(0); const [current, setCurrent] = useState(0);
const [dataFormList, setDataFormList] = useState<any>([]); const [dataFormList, setDataFormList] = useState<any>([]);
const dataFormListRef = useRef(dataFormList) const dataFormListRef = useRef(dataFormList);
const [fileList, setFileList] = useState<UploadFile<any>[]>([]); const [fileList, setFileList] = useState<UploadFile<any>[]>([]);
const actionFormListRef = useRef< const actionFormListRef = useRef<
@ -160,7 +161,7 @@ const MyCreateForm: React.FC<CreateFormProps> = (props) => {
name: string; name: string;
}> }>
>(); >();
const handleFileChange = ({file}: { file: UploadFile }) => { const handleFileChange = ({ file }: { file: UploadFile }) => {
let curFile: any; let curFile: any;
switch (file.status) { switch (file.status) {
@ -176,11 +177,10 @@ const MyCreateForm: React.FC<CreateFormProps> = (props) => {
} }
setFileList([...curFile]); setFileList([...curFile]);
} };
const getModelData = () => { const getModelData = () => {
postAlgorithmModelGetAlgorithmModelFkSelect({keyword: ''}).then((res) => { postAlgorithmModelGetAlgorithmModelFkSelect({ keyword: '' }).then((res) => {
let result = (res.data?.list || []).map((v: any) => { let result = (res.data?.list || []).map((v: any) => {
return { return {
key: v.id, key: v.id,
@ -205,14 +205,13 @@ const MyCreateForm: React.FC<CreateFormProps> = (props) => {
.then((resp: API.Response) => { .then((resp: API.Response) => {
setTreeData(resp.data.tree); setTreeData(resp.data.tree);
}) })
.catch(() => { .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) => {
let result = (res.data?.list || []).map((v: any) => { let result = (res.data?.list || []).map((v: any) => {
return { return {
key: v.id, key: v.id,
@ -233,20 +232,20 @@ const MyCreateForm: React.FC<CreateFormProps> = (props) => {
current={current} current={current}
onCurrentChange={setCurrent} onCurrentChange={setCurrent}
onFinish={async () => { onFinish={async () => {
setFileList([]) setFileList([]);
let formData = formRef.current?.getFieldsValue(); let formData = formRef.current?.getFieldsValue();
if (formData?.name) { if (formData?.name) {
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) postProjectCreateProject(formData)
.then(() => { .then(() => {
message.success(intl.formatMessage({id: 'common.success', defaultMessage: '$$$'})); message.success(intl.formatMessage({ id: 'common.success', defaultMessage: '$$$' }));
props.handleModal(); props.handleModal();
props.reload(); props.reload();
}) })
.catch(() => { .catch(() => {
message.error(intl.formatMessage({id: 'common.failure', defaultMessage: '$$$'})); message.error(intl.formatMessage({ id: 'common.failure', defaultMessage: '$$$' }));
return false; return false;
}); });
} }
@ -264,7 +263,7 @@ const MyCreateForm: React.FC<CreateFormProps> = (props) => {
width={803} width={803}
onCancel={() => { onCancel={() => {
setCurrent(0); setCurrent(0);
setFileList([]) setFileList([]);
formRef.current?.resetFields(); formRef.current?.resetFields();
formRef3.current?.resetFields(); formRef3.current?.resetFields();
props.handleModal(); props.handleModal();
@ -298,7 +297,7 @@ const MyCreateForm: React.FC<CreateFormProps> = (props) => {
<ProFormText <ProFormText
{...stepFormItemStyleProps} {...stepFormItemStyleProps}
name="name" name="name"
label={<FormattedMessage id="project.project.table.list.name" defaultMessage="$$$"/>} label={<FormattedMessage id="project.project.table.list.name" defaultMessage="$$$" />}
placeholder={`${intl.formatMessage({ placeholder={`${intl.formatMessage({
id: 'common.please_input', id: 'common.please_input',
defaultMessage: '$$$', defaultMessage: '$$$',
@ -322,7 +321,7 @@ const MyCreateForm: React.FC<CreateFormProps> = (props) => {
<ProFormText <ProFormText
width={680} width={680}
name="code" name="code"
label={<FormattedMessage id="project.project.table.list.code" defaultMessage="$$$"/>} label={<FormattedMessage id="project.project.table.list.code" defaultMessage="$$$" />}
placeholder={`${intl.formatMessage({ placeholder={`${intl.formatMessage({
id: 'common.please_input', id: 'common.please_input',
defaultMessage: '$$$', defaultMessage: '$$$',
@ -337,22 +336,22 @@ const MyCreateForm: React.FC<CreateFormProps> = (props) => {
isAuto isAuto
? [] ? []
: [ : [
{ {
required: true, required: true,
message: ( message: (
<FormattedMessage <FormattedMessage
id="project.project.table.rule.required.code" id="project.project.table.rule.required.code"
defaultMessage="code is required" defaultMessage="code is required"
/> />
), ),
}, },
] ]
} }
addonAfter={ addonAfter={
<Switch <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}
/> />
} }
@ -360,7 +359,7 @@ const MyCreateForm: React.FC<CreateFormProps> = (props) => {
<ProFormText <ProFormText
{...stepFormItemStyleProps} {...stepFormItemStyleProps}
name="info" name="info"
label={<FormattedMessage id="project.project.table.list.info" defaultMessage="$$$"/>} label={<FormattedMessage id="project.project.table.list.info" defaultMessage="$$$" />}
placeholder={`${intl.formatMessage({ placeholder={`${intl.formatMessage({
id: 'common.please_input', id: 'common.please_input',
defaultMessage: '$$$', defaultMessage: '$$$',
@ -384,7 +383,7 @@ const MyCreateForm: React.FC<CreateFormProps> = (props) => {
<ProFormText <ProFormText
{...stepFormItemStyleProps} {...stepFormItemStyleProps}
name="remark" name="remark"
label={<FormattedMessage id="project.project.table.list.remark" defaultMessage="$$$"/>} label={<FormattedMessage id="project.project.table.list.remark" defaultMessage="$$$" />}
placeholder={`${intl.formatMessage({ placeholder={`${intl.formatMessage({
id: 'common.please_input', id: 'common.please_input',
defaultMessage: '$$$', defaultMessage: '$$$',
@ -400,7 +399,7 @@ const MyCreateForm: React.FC<CreateFormProps> = (props) => {
width="lg" width="lg"
name="isEnable" name="isEnable"
label={ label={
<FormattedMessage id="project.project.table.list.isEnable" defaultMessage="$$$"/> <FormattedMessage id="project.project.table.list.isEnable" defaultMessage="$$$" />
} }
initialValue={true} initialValue={true}
/> />
@ -423,14 +422,13 @@ const MyCreateForm: React.FC<CreateFormProps> = (props) => {
dataSource={modalData} dataSource={modalData}
showSearch showSearch
titles={['未选模型', '已选模型']} 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}} listStyle={{ width: 289, height: 300 }}
operationStyle={{width: 100, alignItems: 'center'}} operationStyle={{ width: 100, alignItems: 'center' }}
render={(item) => item.title} render={(item) => item.title}
/> />
</StepsForm.StepForm> </StepsForm.StepForm>
@ -440,7 +438,7 @@ const MyCreateForm: React.FC<CreateFormProps> = (props) => {
}> }>
name="project_file" name="project_file"
title="上传业务代码" title="上传业务代码"
style={{width: stepFormItemStyleProps.width}} style={{ width: stepFormItemStyleProps.width }}
stepProps={{ stepProps={{
description: '上传业务代码格式为(.zip,.tar.gz)', description: '上传业务代码格式为(.zip,.tar.gz)',
}} }}
@ -460,7 +458,7 @@ const MyCreateForm: React.FC<CreateFormProps> = (props) => {
fieldProps={{ fieldProps={{
name: 'file', name: 'file',
beforeUpload: beforeUploadFile, beforeUpload: beforeUploadFile,
data: {path: 'project/files'}, data: { path: 'project/files' },
headers: { headers: {
'X-CSRFToken': cookie.load('csrftoken'), 'X-CSRFToken': cookie.load('csrftoken'),
Authorization: `Bearer ${localStorage.getItem('access') || ''}`, Authorization: `Bearer ${localStorage.getItem('access') || ''}`,
@ -485,7 +483,8 @@ const MyCreateForm: React.FC<CreateFormProps> = (props) => {
{/* <Icon type="delete" /> */} {/* <Icon type="delete" /> */}
{/* TODO 图标需要替换 */} {/* TODO 图标需要替换 */}
<ProFormUploadDragger max={1} <ProFormUploadDragger
max={1}
label="配置文件上传" label="配置文件上传"
value={fileList} value={fileList}
name="dragger" name="dragger"
@ -493,44 +492,50 @@ const MyCreateForm: React.FC<CreateFormProps> = (props) => {
onChange: handleFileChange, onChange: handleFileChange,
onRemove: () => { onRemove: () => {
let index_ids = actionFormListRef.current?.getList()?.map((v, i) => { let index_ids = actionFormListRef.current?.getList()?.map((v, i) => {
return i return i;
}) });
actionFormListRef.current?.remove(index_ids || []) actionFormListRef.current?.remove(index_ids || []);
}, },
beforeUpload: (file, fileList) => { beforeUpload: (file, fileList) => {
if (!file.name.endsWith('.yaml') && !file.name.endsWith('.yml') && !file.name.endsWith('.json')) { if (
message.error('请上传yaml或json文件').then(() => { !file.name.endsWith('.yaml') &&
}) !file.name.endsWith('.yml') &&
return false !file.name.endsWith('.json')
) {
message.error('请上传yaml或json文件').then(() => {});
return false;
} else { } else {
let parsedData = {} let parsedData = {};
file.text().then((text) => { file
if (file.name.endsWith('.yaml') || file.name.endsWith('.yml')) { .text()
parsedData = yaml.load(text) as Record<string, unknown>; .then((text) => {
} if (file.name.endsWith('.yaml') || file.name.endsWith('.yml')) {
if (file.name.endsWith('.json')) { parsedData = yaml.load(text) as Record<string, unknown>;
parsedData = JSON.parse(text) as Record<string, unknown>; }
} if (file.name.endsWith('.json')) {
if (Object.keys(parsedData).length > 0) { parsedData = JSON.parse(text) as Record<string, unknown>;
dataFormListRef.current = Object.entries(parsedData).map(([key, value]) => ({ }
name: key, if (Object.keys(parsedData).length > 0) {
default: value dataFormListRef.current = Object.entries(parsedData).map(([key, value]) => ({
})) name: key,
default: value,
}));
dataFormListRef.current.forEach((v: any, i: number) => { dataFormListRef.current.forEach((v: any, i: number) => {
actionFormListRef.current?.add(v, i) actionFormListRef.current?.add(v, i);
}) });
} }
return true return true;
}).catch(() => { })
return false .catch(() => {
}) return false;
});
} }
}, },
}} }}
/> />
<ProFormList <ProFormList
style={{width: stepFormItemStyleProps.width}} style={{ width: stepFormItemStyleProps.width }}
actionRef={actionFormListRef} actionRef={actionFormListRef}
copyIconProps={{ copyIconProps={{
Icon: SnippetsOutlined, Icon: SnippetsOutlined,
@ -543,11 +548,17 @@ const MyCreateForm: React.FC<CreateFormProps> = (props) => {
> >
{(f, index, action) => { {(f, index, action) => {
return ( return (
<> <ProCard style={{padding: 0, margin: 0}} bodyStyle={{padding: 0, margin: 0 }}>
<ProFormText key="name" name="name" label="键名"/> <ProCard style={{padding: 0, margin: 0}} bodyStyle={{padding: 0, marginRight: 10}}>
<ProFormText key="default" name="default" label="默认值"/> <ProFormText key="name" name="name" label="键名" />
<ProFormText key="remark" name="remark" label="备注"/> </ProCard>
</> <ProCard style={{padding: 0, margin: 0}} bodyStyle={{padding: 0, marginRight: 10}}>
<ProFormText key="default" name="default" label="默认值" />
</ProCard>
<ProCard style={{padding: 0, margin: 0}} bodyStyle={{padding: 0, marginRight: 10}}>
<ProFormText key="remark" name="remark" label="备注" />
</ProCard>
</ProCard>
); );
}} }}
</ProFormList> </ProFormList>
@ -564,10 +575,10 @@ const MyCreateForm: React.FC<CreateFormProps> = (props) => {
onFinish={async () => { onFinish={async () => {
return true; return true;
}} }}
style={{width: stepFormItemStyleProps.width}} style={{ width: stepFormItemStyleProps.width }}
formRef={formRef3} formRef={formRef3}
> >
<div style={{paddingBottom: 10}}>{'选择网点'}</div> <div style={{ paddingBottom: 10 }}>{'选择网点'}</div>
<Tree <Tree
checkable checkable
defaultExpandAll={true} defaultExpandAll={true}

@ -237,7 +237,7 @@ const ModelVersionListDrawer: React.FC<ColumnDrawProps> = (props) => {
actionRef.current?.reload(); actionRef.current?.reload();
} }
}, [props.isShowDetail]); }, [props.isShowDetail]);
return ( return (
<Drawer <Drawer
width={"80%"} width={"80%"}
@ -254,8 +254,7 @@ const ModelVersionListDrawer: React.FC<ColumnDrawProps> = (props) => {
dataSource={props.currentRow} dataSource={props.currentRow}
title="模型详细信息" title="模型详细信息"
tooltip="包含了模型详细信息" tooltip="包含了模型详细信息"
columns={props.columns} columns={props.columns.filter((item: Record<string,any>) => !['option'].includes(item.dataIndex))}
> >
</ProDescriptions> </ProDescriptions>
</ProCard> </ProCard>

@ -271,45 +271,43 @@ const AlgorithmModelList: React.FC = () => {
accessible={access.canUpdate(history.location.pathname)} accessible={access.canUpdate(history.location.pathname)}
key={`${history.location.pathname}-add`} key={`${history.location.pathname}-add`}
> >
<a <Button
key="detail" key="detail"
type="link"
size="small"
onClick={() => { onClick={() => {
setCurrentRow(record); setCurrentRow(record);
setShowDetail(true); setShowDetail(true);
}} }}
> >
</a> </Button>
<a <Button
key="update" key="update"
type="link"
size="small"
onClick={() => { onClick={() => {
setUpdateModalOpen(true); setUpdateModalOpen(true);
setCurrentRow(record); setCurrentRow(record);
}} }}
> >
<FormattedMessage id="pages.searchTable.update" defaultMessage="Update" /> <FormattedMessage id="pages.searchTable.update" defaultMessage="Update" />
</a> </Button>
{/* update1101 */} {/* update1101 */}
<Popconfirm <Popconfirm
placement="topLeft" placement="topLeft"
title={( title={intl.formatMessage({ id: 'common.tip.title', defaultMessage: '$$$' })}
intl.formatMessage({ id: 'common.tip.title', defaultMessage: '$$$' }) description={intl.formatMessage({
)} id: 'common.modal.table.delete.content',
description={( defaultMessage: '$$$',
intl.formatMessage({ id: 'common.modal.table.delete.content', defaultMessage: '$$$' }) })}
)} okText={intl.formatMessage({ id: 'common.yes', defaultMessage: '$$$' })}
okText={( cancelText={intl.formatMessage({ id: 'common.no', defaultMessage: '$$$' })}
intl.formatMessage({ id: 'common.yes', defaultMessage: '$$$' })
)}
cancelText={(
intl.formatMessage({ id: 'common.no', defaultMessage: '$$$' })
)}
onConfirm={() => { onConfirm={() => {
handleDestroy(record).then(() => {}); handleDestroy(record).then(() => {});
}} }}
> >
<Button key="destroy" type="text" danger> <Button key="destroy" type="link" size="small" danger>
<FormattedMessage id="pages.searchTable.destroy" defaultMessage="Destroy" /> <FormattedMessage id="pages.searchTable.destroy" defaultMessage="Destroy" />
</Button> </Button>
</Popconfirm> </Popconfirm>
@ -355,18 +353,16 @@ const AlgorithmModelList: React.FC = () => {
onClick={async () => { onClick={async () => {
Modal.confirm({ Modal.confirm({
icon: <ExclamationCircleOutlined />, icon: <ExclamationCircleOutlined />,
title: ( title: intl.formatMessage({
intl.formatMessage({ id: 'common.modal.table.delete.title', defaultMessage: '$$$' }) id: 'common.modal.table.delete.title',
), defaultMessage: '$$$',
content:( }),
intl.formatMessage({ id: 'common.modal.table.delete.content', defaultMessage: '$$$' }) content: intl.formatMessage({
), id: 'common.modal.table.delete.content',
okText: ( defaultMessage: '$$$',
intl.formatMessage({ id: 'common.yes', defaultMessage: '$$$' }) }),
), okText: intl.formatMessage({ id: 'common.yes', defaultMessage: '$$$' }),
cancelText: ( cancelText: intl.formatMessage({ id: 'common.no', defaultMessage: '$$$' }),
intl.formatMessage({ id: 'common.no', defaultMessage: '$$$' })
),
onOk() { onOk() {
// TODO 未对接批量删除接口 // TODO 未对接批量删除接口
deleteAlgorithmModelDeleteAlgorithmModelByIds({ deleteAlgorithmModelDeleteAlgorithmModelByIds({

@ -15,7 +15,7 @@ import { DownOutlined, PlusOutlined } from '@ant-design/icons';
import type { ActionType, ProColumns } from '@ant-design/pro-components'; import type { ActionType, ProColumns } from '@ant-design/pro-components';
import { FooterToolbar, PageContainer, ProFormSelect, ProTable } from '@ant-design/pro-components'; import { FooterToolbar, PageContainer, ProFormSelect, ProTable } 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 , Dropdown} from 'antd'; import { Button, Dropdown, Popconfirm, message } from 'antd';
// import { MenuProps } from 'rc-menu'; // import { MenuProps } from 'rc-menu';
import React, { useRef, useState } from 'react'; import React, { useRef, useState } from 'react';
import { ColumnDrawer } from './components/ColumnDrawer'; import { ColumnDrawer } from './components/ColumnDrawer';
@ -134,26 +134,29 @@ const ModelVersionList: React.FC = () => {
}); });
} }
const prevActions: any[] = []; const prevActions: any[] = [];
const moreActions: { key: string; label: any; }[] = []; const moreActions: { key: string; label: any }[] = [];
renderActions.map((item, index) => { renderActions.map((item, index) => {
if (index < maxActionCount - 1) { if (index < maxActionCount - 1) {
prevActions.push(item); prevActions.push(item);
} else { } else {
moreActions.push({ moreActions.push({
key: index+"", key: index + '',
label: item label: item,
}); });
} }
// eslint-disable-next-line react/jsx-key // eslint-disable-next-line react/jsx-key
}); });
return ( return (
<> <>
{prevActions.map((item,index) => { {prevActions.map((item, index) => {
return <div key={index}>{item}</div>; return <div key={index}>{item}</div>;
})} })}
<Dropdown menu={{items: moreActions}}> <Dropdown menu={{ items: moreActions }}>
<a><DownOutlined/></a> <a>
</Dropdown>
<DownOutlined />
</a>
</Dropdown>
</> </>
); );
}; };
@ -320,23 +323,28 @@ const ModelVersionList: React.FC = () => {
> >
<TableActionCard <TableActionCard
renderActions={[ renderActions={[
<a <Button
key="update" key="update"
type="link"
size="small"
onClick={() => { onClick={() => {
setUpdateModalOpen(true); setUpdateModalOpen(true);
setCurrentRow(record); setCurrentRow(record);
}} }}
> >
<FormattedMessage id="pages.searchTable.update" defaultMessage="Update" /> <FormattedMessage id="pages.searchTable.update" defaultMessage="Update" />
</a>, </Button>,
<a <Button
key="destroy" key="destroy"
type="link"
size="small"
danger
onClick={() => { onClick={() => {
handleDestroy(record).then(() => {}); handleDestroy(record).then(() => {});
}} }}
> >
<FormattedMessage id="pages.searchTable.destroy" defaultMessage="Destroy" /> <FormattedMessage id="pages.searchTable.destroy" defaultMessage="Destroy" />
</a>, </Button>,
// eslint-disable-next-line react/jsx-key // eslint-disable-next-line react/jsx-key
<Popconfirm <Popconfirm
title="发布模型" title="发布模型"
@ -346,15 +354,17 @@ const ModelVersionList: React.FC = () => {
okText="Yes" okText="Yes"
cancelText="No" cancelText="No"
> >
<a <Button
key="confirm_publish" key="confirm_publish"
type="link"
size="small"
onClick={() => { onClick={() => {
setPublishModalOpen(true); setPublishModalOpen(true);
setCurrentRow(record); setCurrentRow(record);
}} }}
> >
<FormattedMessage id="common.confirm_publish" defaultMessage="confirm_publish" /> <FormattedMessage id="common.confirm_publish" defaultMessage="confirm_publish" />
</a> </Button>
</Popconfirm>, </Popconfirm>,
// eslint-disable-next-line react/jsx-key // eslint-disable-next-line react/jsx-key
<Popconfirm <Popconfirm
@ -377,12 +387,12 @@ const ModelVersionList: React.FC = () => {
}); });
}} }}
onCancel={() => {}} onCancel={() => {}}
okText="Yes" okText={intl.formatMessage({ id: 'common.yes', defaultMessage: '$$$' })}
cancelText="No" cancelText={intl.formatMessage({ id: 'common.no', defaultMessage: '$$$' })}
> >
<a key="set_default" onClick={() => {}}> <Button key="set_default" type="link" size="small">
<FormattedMessage id="common.set_default" defaultMessage="$$$" /> <FormattedMessage id="common.set_default" defaultMessage="$$$" />
</a> </Button>
</Popconfirm>, </Popconfirm>,
]} ]}
></TableActionCard> ></TableActionCard>

Loading…
Cancel
Save