|
|
|
@ -2,7 +2,7 @@
|
|
|
|
|
* @Author: donghao donghao@supervision.ltd
|
|
|
|
|
* @Date: 2024-04-08 10:36:06
|
|
|
|
|
* @LastEditors: donghao donghao@supervision.ltd
|
|
|
|
|
* @LastEditTime: 2024-05-13 10:44:32
|
|
|
|
|
* @LastEditTime: 2024-05-14 17:02:41
|
|
|
|
|
* @FilePath: \general-ai-manage\src\pages\Model\ModelDetail\index.tsx
|
|
|
|
|
* @Description: 模型详情(基础信息展示、模型版本列表)
|
|
|
|
|
* @交互说明
|
|
|
|
@ -11,13 +11,14 @@
|
|
|
|
|
* 3、编辑模型基本信息
|
|
|
|
|
*/
|
|
|
|
|
import InnerPageBack from '@/components/Back/innerPageBack';
|
|
|
|
|
import { CommButton } from '@/components/Button';
|
|
|
|
|
import TableActionCard from '@/components/TableActionCard';
|
|
|
|
|
import IsDelete from '@/components/TableActionCard/isDelete';
|
|
|
|
|
import { getModelDetail, getModelVersionList } from '@/services/testApi/model';
|
|
|
|
|
import { PlusOutlined } from '@ant-design/icons';
|
|
|
|
|
|
|
|
|
|
import type { ActionType, ProColumns } from '@ant-design/pro-components';
|
|
|
|
|
import { ProCard, ProDescriptions, ProTable } from '@ant-design/pro-components';
|
|
|
|
|
import { Access, FormattedMessage, history, useAccess, useParams } from '@umijs/max';
|
|
|
|
|
import { FormattedMessage, useParams } from '@umijs/max';
|
|
|
|
|
import { Button } from 'antd';
|
|
|
|
|
import { useRef, useState } from 'react';
|
|
|
|
|
import { proTableCommonOptions, proTablePaginationOptions } from '../../../../config/defaultTable';
|
|
|
|
@ -25,7 +26,7 @@ import CreateForm from './components/createForm';
|
|
|
|
|
|
|
|
|
|
const ModelDetail: React.FC = () => {
|
|
|
|
|
const routeParams = useParams(); // 路由参数读取
|
|
|
|
|
const access = useAccess();
|
|
|
|
|
// const access = useAccess();
|
|
|
|
|
// const intl = useIntl();
|
|
|
|
|
const actionRef = useRef<ActionType>();
|
|
|
|
|
|
|
|
|
@ -102,7 +103,10 @@ const ModelDetail: React.FC = () => {
|
|
|
|
|
}}
|
|
|
|
|
className="default_version_tag"
|
|
|
|
|
>
|
|
|
|
|
默认版本
|
|
|
|
|
<FormattedMessage
|
|
|
|
|
id="model_detail.version.table.list.tag.defaultVersion"
|
|
|
|
|
defaultMessage="默认版本"
|
|
|
|
|
/>
|
|
|
|
|
</span>
|
|
|
|
|
)}
|
|
|
|
|
</span>
|
|
|
|
@ -149,7 +153,9 @@ const ModelDetail: React.FC = () => {
|
|
|
|
|
{
|
|
|
|
|
key: 'setDefault',
|
|
|
|
|
renderDom: record.isEnable ? (
|
|
|
|
|
<span style={{ color: '#ccc' }}>设为默认</span>
|
|
|
|
|
<span style={{ color: '#ccc' }}>
|
|
|
|
|
<FormattedMessage id="pages.searchTable.setDefault" defaultMessage="设为默认" />
|
|
|
|
|
</span>
|
|
|
|
|
) : (
|
|
|
|
|
<Button
|
|
|
|
|
key="setDefault"
|
|
|
|
@ -208,7 +214,7 @@ const ModelDetail: React.FC = () => {
|
|
|
|
|
bodyStyle={{ padding: 0, margin: 0, backgroundColor: 'transparent' }}
|
|
|
|
|
>
|
|
|
|
|
<InnerPageBack title=""></InnerPageBack>
|
|
|
|
|
<div className="gn_active_descriptions mb-[20px]">
|
|
|
|
|
<div className="gn_descriptions mb-[20px]">
|
|
|
|
|
<ProDescriptions
|
|
|
|
|
column={3}
|
|
|
|
|
columns={ModelDetailColumns}
|
|
|
|
@ -226,68 +232,82 @@ const ModelDetail: React.FC = () => {
|
|
|
|
|
}}
|
|
|
|
|
></ProDescriptions>
|
|
|
|
|
</div>
|
|
|
|
|
<ProTable
|
|
|
|
|
className="gn_pro_table"
|
|
|
|
|
headerTitle={<span>版本列表</span>}
|
|
|
|
|
// 标题栏
|
|
|
|
|
toolBarRender={() => [
|
|
|
|
|
<Access
|
|
|
|
|
accessible={access.canUpdate(history.location.pathname)}
|
|
|
|
|
key={`${history.location.pathname}-add`}
|
|
|
|
|
>
|
|
|
|
|
<div className="my-[16px]">
|
|
|
|
|
<Button
|
|
|
|
|
type="primary"
|
|
|
|
|
key="primary"
|
|
|
|
|
onClick={() => {
|
|
|
|
|
setCreateModalOpen(true);
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<PlusOutlined />
|
|
|
|
|
<FormattedMessage id="pages.searchTable.new" defaultMessage="New" />
|
|
|
|
|
</Button>
|
|
|
|
|
</div>
|
|
|
|
|
</Access>,
|
|
|
|
|
]}
|
|
|
|
|
search={false}
|
|
|
|
|
scroll={{ y: proTableCommonOptions.commscrollY, x: proTableCommonOptions.commscrollX }}
|
|
|
|
|
options={{ fullScreen: false, setting: false, density: false, reload: false }}
|
|
|
|
|
actionRef={actionRef}
|
|
|
|
|
rowKey="id"
|
|
|
|
|
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 getModelVersionList({ ...reqParams });
|
|
|
|
|
console.log(resp, 'getModelVersionList_resp');
|
|
|
|
|
return {
|
|
|
|
|
data: resp.data?.results,
|
|
|
|
|
success: resp.success,
|
|
|
|
|
total: resp.data.count,
|
|
|
|
|
current: current,
|
|
|
|
|
pageSize: currentPageSize,
|
|
|
|
|
};
|
|
|
|
|
}}
|
|
|
|
|
columns={columns}
|
|
|
|
|
/>
|
|
|
|
|
<div className="gn_head_card" style={{ padding: 0 }}>
|
|
|
|
|
<ProCard
|
|
|
|
|
className="gn_card"
|
|
|
|
|
title={
|
|
|
|
|
<span className="head3">
|
|
|
|
|
<FormattedMessage
|
|
|
|
|
id="model_detail.version.table.list.title"
|
|
|
|
|
defaultMessage="版本列表"
|
|
|
|
|
/>
|
|
|
|
|
</span>
|
|
|
|
|
}
|
|
|
|
|
extra={
|
|
|
|
|
<CommButton
|
|
|
|
|
type="primary"
|
|
|
|
|
buttonLabel={
|
|
|
|
|
<FormattedMessage
|
|
|
|
|
id="model_detail.version.table.list.action.add"
|
|
|
|
|
defaultMessage="新建版本信息"
|
|
|
|
|
/>
|
|
|
|
|
}
|
|
|
|
|
onClick={() => {
|
|
|
|
|
handleCreateModal();
|
|
|
|
|
}}
|
|
|
|
|
></CommButton>
|
|
|
|
|
}
|
|
|
|
|
>
|
|
|
|
|
<ProTable
|
|
|
|
|
className="gn_pro_table"
|
|
|
|
|
cardProps={{
|
|
|
|
|
bodyStyle: { padding: 0 },
|
|
|
|
|
}}
|
|
|
|
|
// 标题栏
|
|
|
|
|
search={false}
|
|
|
|
|
scroll={{
|
|
|
|
|
y: 420,
|
|
|
|
|
x: proTableCommonOptions.commscrollX,
|
|
|
|
|
}}
|
|
|
|
|
options={{ fullScreen: false, setting: false, density: false, reload: false }}
|
|
|
|
|
actionRef={actionRef}
|
|
|
|
|
rowKey="id"
|
|
|
|
|
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 getModelVersionList({ ...reqParams });
|
|
|
|
|
console.log(resp, 'getModelVersionList_resp');
|
|
|
|
|
return {
|
|
|
|
|
data: resp.data?.results,
|
|
|
|
|
success: resp.success,
|
|
|
|
|
total: resp.data.count,
|
|
|
|
|
current: current,
|
|
|
|
|
pageSize: currentPageSize,
|
|
|
|
|
};
|
|
|
|
|
}}
|
|
|
|
|
columns={columns}
|
|
|
|
|
/>
|
|
|
|
|
</ProCard>
|
|
|
|
|
</div>
|
|
|
|
|
</ProCard>
|
|
|
|
|
<CreateForm
|
|
|
|
|
createModalOpen={createModalOpen}
|
|
|
|
|