From 7fb0fad3c3a0e6103998f8b84bd79cb4ae0929c2 Mon Sep 17 00:00:00 2001 From: chunquansang <916920620@è¯@qq.com> Date: Fri, 3 Nov 2023 10:56:16 +0800 Subject: [PATCH] =?UTF-8?q?=C3=A2=C2=80=C3=AF=E6=A8=A1=E5=9E=8B=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Analysis/ActionDetectionList/index.tsx | 1 + .../components/ModelVersionListDrawer.tsx | 354 ++++++++++++++++++ .../Resource/AlgorithmModelList/index.tsx | 14 +- .../components/MyCreateForm.tsx | 4 +- 4 files changed, 369 insertions(+), 4 deletions(-) create mode 100644 src/pages/Resource/AlgorithmModelList/components/ModelVersionListDrawer.tsx diff --git a/src/pages/Analysis/ActionDetectionList/index.tsx b/src/pages/Analysis/ActionDetectionList/index.tsx index 1d21e60..d3b0d6c 100644 --- a/src/pages/Analysis/ActionDetectionList/index.tsx +++ b/src/pages/Analysis/ActionDetectionList/index.tsx @@ -128,6 +128,7 @@ const columns: ProColumns[] = [ }, render: (_, record)=>{ if (record.imagesPath){ + // return return } diff --git a/src/pages/Resource/AlgorithmModelList/components/ModelVersionListDrawer.tsx b/src/pages/Resource/AlgorithmModelList/components/ModelVersionListDrawer.tsx new file mode 100644 index 0000000..9e6f439 --- /dev/null +++ b/src/pages/Resource/AlgorithmModelList/components/ModelVersionListDrawer.tsx @@ -0,0 +1,354 @@ +import React, {useEffect, useRef, useState} from "react"; +import {Button, Drawer, message, Popconfirm} from "antd"; +import { + ProColumns, + ProDescriptions, + ProDescriptionsItemProps, + ProCard, + ProTable, + TableDropdown, + ProFormSelect, ActionType +} from "@ant-design/pro-components"; +import ModelVersionList from "@/pages/Resource/ModelVersionList"; +import {Access, FormattedMessage, history, useAccess} from "@@/exports"; +import { + postAlgorithmModelGetAlgorithmModelFkSelect, + putAlgorithmModelUpdateAlgorithmModel +} from "@/services/resource/AlgorithmModel"; +import {postModelVersionGetModelVersionList} from "@/services/resource/ModelVersion"; +import {PlusOutlined} from "@ant-design/icons"; +import MyCreateForm from "@/pages/Resource/ModelVersionList/components/MyCreateForm"; + +export type ColumnDrawProps = { + handleDrawer: (id?: any)=>void; + isShowDetail: boolean; + columns: any; + currentRow: API.AlgorithmModel | undefined; +}; + +type GithubIssueItem = { + url: string; + id: number; + number: number; + title: string; + labels: { + name: string; + color: string; + }[]; + state: string; + comments: number; + created_at: string; + updated_at: string; + closed_at?: string; +}; + +const columns: ProColumns[] = [ + + { + title: (), + dataIndex: "id", + sorter: true, + }, + + { + title: (), + dataIndex: "modelFkId", + hideInSearch: false, + }, + + + { + title: (), + dataIndex: "version", + hideInSearch: true, + }, + + + { + title: (), + dataIndex: "path", + hideInSearch: true, + }, + + + { + title: (), + dataIndex: "startCode", + hideInSearch: true, + }, + + + { + title: (), + dataIndex: "isEnable", + filters: true, onFilter: true, + hideInSearch: true, + valueType: 'switch', + }, + + + { + title: (), + dataIndex: "remark", + hideInSearch: true, + }, + { + title: (), + dataIndex: "status", + hideInSearch: true, + valueEnum: { + 1: { text: '已创建', status: 'Default' }, + 2: { text: '已发布', status: 'Processing' }, + 3: { text: '已上架', status: 'Success' }, + 4: { text: '已下架', status: 'Default' }, + 5: { text: '已关闭', status: 'Error' }, + }, + }, + + { + title: (), + dataIndex: "createTime", + sorter: true, + hideInSearch: true, + valueType: 'dateTime', + }, + + + { + title: (), + dataIndex: "updateTime", + sorter: true, + hideInSearch: true, + valueType: 'dateTime', + }, + + + { + title: , + dataIndex: 'option', + valueType: 'option', + fixed:'right', + // render: (_, record) => [ + // + // { + // setUpdateModalOpen(true); + // setCurrentRow(record); + // }} + // > + // + // + // { + // handleDestroy(record).then(()=>{}) + // }}> + // + // + // {}} + // onCancel={()=>{}} + // okText="Yes" + // cancelText="No" + // > + // { + // setPublishModalOpen(true); + // setCurrentRow(record); + // }}> + // + // + // + // { + // putAlgorithmModelUpdateAlgorithmModel({id: record.modelFkId, defaultVersionFkId: record.id}).then(()=>{ + // message.success(intl.formatMessage({id: 'common.success', defaultMessage: '$$$'})) + // }).catch(()=>{ + // message.error(intl.formatMessage({id: 'common.failure', defaultMessage: '$$$'})) + // }) + // }} + // onCancel={()=>{}} + // okText="Yes" + // cancelText="No" + // > + // { + // + // }}> + // + // + // + // + // ], + },]; +const ModelVersionListDrawer: React.FC = (props) => { + const access = useAccess(); + const actionRef = useRef(); + const [createModalOpen, setCreateModalOpen] = useState(false); + const [currentRow, setCurrentRow] = useState(); + + const handleCreateModal = ()=>{ + if (createModalOpen) { + setCreateModalOpen(false) + setCurrentRow(undefined) + } else { + setCreateModalOpen(true) + } + } + + useEffect(() => { + if (props.isShowDetail) { + actionRef.current?.reload(); + } + }, [props.isShowDetail]); + + return ( + { + props.handleDrawer(); + }} + closable={true} + > + + + + + + + { + const {current, ...rest} = params + const reqParams = { + page: current, + desc: false, + orderKey: "", + modelFkId: props.currentRow?.id, + ...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 postModelVersionGetModelVersionList({...reqParams}) + return { + data: resp.data.list.map((v: API.ModelVersion)=>{ + return {...v, key: v.id} + }), + success: resp.success, + total: resp.data.total, + current: resp.data.page, + pageSize: resp.data.pageSize + }; + + }} + editable={{ + type: 'multiple', + }} + columnsState={{ + persistenceKey: 'pro-table-singe-demos', + persistenceType: 'localStorage', + onChange(value) { + console.log('value: ', value); + }, + }} + rowKey="id" + search={false} + options={{ + setting: { + listsHeight: 400, + }, + }} + form={{ + // 由于配置了 transform,提交的参与与定义的不同这里需要转化一下 + syncToUrl: (values, type) => { + if (type === 'get') { + return { + ...values, + created_at: [values.startTime, values.endTime], + }; + } + return values; + }, + }} + pagination={{ + pageSize: 5, + onChange: (page) => console.log(page), + }} + dateFormatter="string" + headerTitle="模型版本列表" + toolBarRender={() => [ + + + + ]} + /> + + + + + ) +} +export {ModelVersionListDrawer} + diff --git a/src/pages/Resource/AlgorithmModelList/index.tsx b/src/pages/Resource/AlgorithmModelList/index.tsx index 88c290e..f3ab69f 100644 --- a/src/pages/Resource/AlgorithmModelList/index.tsx +++ b/src/pages/Resource/AlgorithmModelList/index.tsx @@ -23,6 +23,7 @@ import { Access, FormattedMessage, history, useAccess, useIntl } from '@umijs/ma import { Button, Popconfirm, message } from 'antd'; import React, { useRef, useState } from 'react'; import { ColumnDrawer } from './components/ColumnDrawer'; +import {ModelVersionListDrawer} from "./components/ModelVersionListDrawer"; import CreateForm from './components/CreateForm'; import UpdateForm from './components/UpdateForm'; const AlgorithmModelList: React.FC = () => { @@ -146,7 +147,7 @@ const AlgorithmModelList: React.FC = () => { id: 'common.please_input', defaultMessage: '$$$', })}`} - + required={false} /> @@ -279,6 +280,15 @@ const AlgorithmModelList: React.FC = () => { accessible={access.canUpdate(history.location.pathname)} key={`${history.location.pathname}-add`} > + { + setCurrentRow(record) + setShowDetail(true); + }} + > + 详情 + { @@ -443,7 +453,7 @@ const AlgorithmModelList: React.FC = () => { reload={actionRef.current?.reload} /> - = (props) => { }> name="base" formRef={formRef} - title="创建项目数据" + title="创建模型版本数据" stepProps={{ - description: '这里填入项目基本信息', + description: '填入模型版本基本信息', }} onFinish={async () => { // setFormData(formRef.current?.getFieldsValue());