diff --git a/react-ui/src/pages/System/Approval/components/ApprovalModal/index.tsx b/react-ui/src/pages/System/Approval/components/ApprovalModal/index.tsx index 6e629a90..e34815bd 100644 --- a/react-ui/src/pages/System/Approval/components/ApprovalModal/index.tsx +++ b/react-ui/src/pages/System/Approval/components/ApprovalModal/index.tsx @@ -1,4 +1,4 @@ -import BasicInfo from '@/components/BasicInfo'; +import BasicInfo, { type BasicInfoData } from '@/components/BasicInfo'; import KFModal from '@/components/KFModal'; import SubAreaTitle from '@/components/SubAreaTitle'; import { ApprovalData, ApprovalType } from '@/pages/System/Approval'; @@ -16,46 +16,108 @@ interface ApprovalModalProps extends Omit { function ApprovalModal({ record, onOk, ...rest }: ApprovalModalProps) { const [form] = Form.useForm(); const content = parseJsonText(record.content); - const recordTypeName = record.type === ApprovalType.Dataset ? '数据集' : '模型'; + let recordTypeName = ''; + const dataType = record.type; + switch (dataType) { + case ApprovalType.Dataset: + recordTypeName = '数据集'; + break; + case ApprovalType.Model: + recordTypeName = '模型'; + break; + case ApprovalType.IMAGE: + recordTypeName = '图片'; + break; + case ApprovalType.CODE: + recordTypeName = '代码'; + break; + default: + recordTypeName = '未知'; + break; + } - const items = - record.type === ApprovalType.Dataset - ? [ - { - label: '数据集名称', - value: content.name, - }, - { - label: '数据集分类', - value: content.dataType, - }, - { - label: '研究方向', - value: content.dataTag, - }, - { - label: '数据集描述', - value: content.description, - }, - ] - : [ - { - label: '模型名称', - value: content.name, - }, - { - label: '模型框架', - value: content.model_type, - }, - { - label: '模型能力', - value: content.model_tag, - }, - { - label: '模型描述', - value: content.description, - }, - ]; + let items: BasicInfoData[] = []; + switch (dataType) { + case ApprovalType.Dataset: + items = [ + { + label: '数据集名称', + value: content.name, + }, + { + label: '数据集分类', + value: content.dataType, + }, + { + label: '数据集标签', + value: content.dataTag, + }, + { + label: '数据集描述', + value: content.description, + }, + ]; + break; + case ApprovalType.Model: + items = [ + { + label: '模型名称', + value: content.name, + }, + { + label: '模型类型', + value: content.model_type, + }, + { + label: '模型标签', + value: content.model_tag, + }, + { + label: '模型描述', + value: content.description, + }, + ]; + break; + case ApprovalType.IMAGE: + items = [ + { + label: '镜像名称', + value: content.name, + }, + { + label: '镜像描述', + value: content.description, + }, + { + label: '版本数量', + value: content.versionCount, + }, + ]; + break; + case ApprovalType.CODE: + items = [ + { + label: '代码名称', + value: content.codeRepoName, + }, + { + label: '代码地址', + value: content.gitUrl, + format: (value) => ({ + value: value, + url: value, + }), + }, + { + label: '代码分支', + value: content.gitBranch, + }, + ]; + break; + default: + items = []; + break; + } // 审批通过 const agreeApproval = async (remark?: string) => { @@ -128,16 +190,12 @@ function ApprovalModal({ record, onOk, ...rest }: ApprovalModalProps) { , ]} > - +
(
- + */} {record.status === ApprovalStatus.Pending ? ( <> - {' '} + {/* {' '} */}