diff --git a/config/defaultForm.ts b/config/defaultForm.ts index 3e908a0..d1b3ca3 100644 --- a/config/defaultForm.ts +++ b/config/defaultForm.ts @@ -2,7 +2,7 @@ * @Author: zhoux zhouxia@supervision.ltd * @Date: 2023-11-13 14:19:57 * @LastEditors: zhoux zhouxia@supervision.ltd - * @LastEditTime: 2023-11-15 17:22:54 + * @LastEditTime: 2023-11-16 16:30:31 * @FilePath: \general-ai-platform-web\config\defaultForm.ts * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE2 */ @@ -13,7 +13,7 @@ export const proFormCommonOptions: Record = { } const formBoxMargin = 2 * 24 - +const formItemGap = 16 // Small 560 export const proFormSmallModelWidth: number = 560; export const proFormSmallItemStyleProps: Record = { @@ -25,12 +25,12 @@ export const proFormSmallItemStyleProps: Record = { export const proFormModelWidth: number = 804; export const proFormItemStyleProps: Record = { width: proFormModelWidth - formBoxMargin, // 一列 - column2Width: (proFormModelWidth - formBoxMargin - 32)/2 , // 两列 + column2Width: (proFormModelWidth - formBoxMargin - formItemGap)/2 , // 两列 }; // max 968 export const proFormMaxModelWidth: number = 968; export const proFormMaxItemStyleProps: Record = { width: proFormMaxModelWidth - formBoxMargin, - column2Width: (proFormMaxModelWidth - formBoxMargin - 32)/2 , // 两列 + column2Width: (proFormMaxModelWidth - formBoxMargin - formItemGap)/2 , // 两列 }; \ No newline at end of file diff --git a/config/defaultTable.ts b/config/defaultTable.ts index 0f28d22..94cd9a5 100644 --- a/config/defaultTable.ts +++ b/config/defaultTable.ts @@ -2,11 +2,12 @@ * @Author: zhoux zhouxia@supervision.ltd * @Date: 2023-11-13 11:32:26 * @LastEditors: zhoux zhouxia@supervision.ltd - * @LastEditTime: 2023-11-14 16:20:49 + * @LastEditTime: 2023-11-16 13:30:09 * @FilePath: \general-ai-platform-web\config\defaultTable.ts * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE */ import { ProColumns } from "@ant-design/pro-components"; +import { PaginationProps } from "antd"; // 通用列表配置 export const proTableCommonOptions: Record = { scrollX: 'max-content', // 保证左右侧列的固定,并能保证没列标题不换行 @@ -24,6 +25,13 @@ export const proTableActionColumnOptions: Record = { fixed: 'right', } +// 分页器配置 +export const proTablePaginationOptions: PaginationProps = { + showSizeChanger: true, + // showQuickJumper: true, + showTotal: (total) => `共${total}条`, +} + // 默认索引列配置 // export const proTableIndexColumnOptions : ProColumns = { // title: '序号', diff --git a/src/components/BatchOperation/isBatchDelete.tsx b/src/components/BatchOperation/isBatchDelete.tsx new file mode 100644 index 0000000..30f384b --- /dev/null +++ b/src/components/BatchOperation/isBatchDelete.tsx @@ -0,0 +1,54 @@ +/* + * @Author: zhoux zhouxia@supervision.ltd + * @Date: 2023-11-16 14:30:15 + * @LastEditors: zhoux zhouxia@supervision.ltd + * @LastEditTime: 2023-11-16 14:35:20 + * @FilePath: \general-ai-platform-web\src\components\BatchOperation\isBatchDelete.tsx + * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE + */ +import { ExclamationCircleOutlined } from '@ant-design/icons'; +// import { useIntl } from '@ant-design/pro-components'; +import { useIntl } from '@umijs/max'; +import { Button, Modal } from 'antd'; +import { FormattedMessage } from 'react-intl'; + +type IsBatchDeleteProps = { + // eslint-disable-next-line @typescript-eslint/ban-types + deleteApi: Function; +}; + +const IsBatchDelete: React.FC = (props) => { + const intl = useIntl(); + + return ( + + ); +}; + +export default IsBatchDelete; diff --git a/src/components/DictionaryBox/isEnable.tsx b/src/components/DictionaryBox/isEnable.tsx index 09e6ab7..4d94f4f 100644 --- a/src/components/DictionaryBox/isEnable.tsx +++ b/src/components/DictionaryBox/isEnable.tsx @@ -1,3 +1,11 @@ +/* + * @Author: zhoux zhouxia@supervision.ltd + * @Date: 2023-11-15 15:01:34 + * @LastEditors: zhoux zhouxia@supervision.ltd + * @LastEditTime: 2023-11-16 17:22:16 + * @FilePath: \general-ai-platform-web\src\components\DictionaryBox\isEnable.tsx + * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE + */ import { isEnableEnum } from '@/enums/common'; import { Badge } from 'antd'; import { FormattedMessage } from 'react-intl'; @@ -12,7 +20,7 @@ const IsEnableBox: React.FC = (props) => { const currentItem = isEnableEnum[isEnable ? '1' : '0'] return ( -
+
diff --git a/src/components/OperateConfirm/delete.tsx b/src/components/OperateConfirm/delete.tsx deleted file mode 100644 index 8520a7b..0000000 --- a/src/components/OperateConfirm/delete.tsx +++ /dev/null @@ -1,15 +0,0 @@ -/* - * @Author: zhoux zhouxia@supervision.ltd - * @Date: 2023-11-13 15:05:27 - * @LastEditors: zhoux zhouxia@supervision.ltd - * @LastEditTime: 2023-11-13 15:05:35 - * @FilePath: \general-ai-platform-web\src\components\OperateConfirm\delete.tsx - * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE - */ - -// TODO 统一设置确实删除弹框,抛出确认的方法参数供业务层使用 -// const DeleteConfirm - - - - diff --git a/src/components/TableActionCard/index.tsx b/src/components/TableActionCard/index.tsx index dbaaa13..8729d05 100644 --- a/src/components/TableActionCard/index.tsx +++ b/src/components/TableActionCard/index.tsx @@ -2,7 +2,7 @@ * @Author: zhoux zhouxia@supervision.ltd * @Date: 2023-11-14 15:49:36 * @LastEditors: zhoux zhouxia@supervision.ltd - * @LastEditTime: 2023-11-15 16:47:40 + * @LastEditTime: 2023-11-16 15:10:41 * @FilePath: \general-ai-platform-web\src\components\TableActionCard\index.tsx * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE */ @@ -12,8 +12,13 @@ import { Dropdown } from 'antd'; import React from 'react'; //TODO 表单的操作按钮集合 key的报错未解决 -type TableActionItemProps = { - renderActions: any[]; +type actionsProps = { + key: string; + renderDom: any +} + +export type TableActionItemProps = { + renderActions: actionsProps[]; }; const TableActionCard: React.FC = (props) => { @@ -41,14 +46,14 @@ const TableActionCard: React.FC = (props) => {
{prevActions.map((item) => { return ( - + {item.renderDom} ); })} {moreActions.length ? ( - + 更多 diff --git a/src/components/TableActionCard/isConfirmAction.tsx b/src/components/TableActionCard/isConfirmAction.tsx new file mode 100644 index 0000000..fea2ee7 --- /dev/null +++ b/src/components/TableActionCard/isConfirmAction.tsx @@ -0,0 +1,55 @@ +/* + * @Author: zhoux zhouxia@supervision.ltd + * @Date: 2023-11-16 14:30:15 + * @LastEditors: zhoux zhouxia@supervision.ltd + * @LastEditTime: 2023-11-16 16:22:15 + * @FilePath: \general-ai-platform-web\src\components\BatchOperation\isBatchDelete.tsx + * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE + */ +// import { useIntl } from '@ant-design/pro-components'; +import { useIntl } from '@umijs/max'; +import { Button, Popconfirm } from 'antd'; +import { FormattedMessage } from 'react-intl'; + +type isConfirmActionProps = { + // eslint-disable-next-line @typescript-eslint/ban-types + confirmAction: Function; + title: string; + description?: string; + buttonText?: string; + buttonFormatText?: string; +}; + +const IsConfirmAction: React.FC = (props) => { + const intl = useIntl(); + const description = props.description || `确认${props.title}吗?`; + return ( + { + props.confirmAction(); + }} + onCancel={() => {}} + okText={intl.formatMessage({ id: 'common.yes', defaultMessage: '$$$' })} + cancelText={intl.formatMessage({ id: 'common.no', defaultMessage: '$$$' })} + > + + + ); +}; + +export default IsConfirmAction; diff --git a/src/components/TableActionCard/isDelete.tsx b/src/components/TableActionCard/isDelete.tsx new file mode 100644 index 0000000..649cb9c --- /dev/null +++ b/src/components/TableActionCard/isDelete.tsx @@ -0,0 +1,44 @@ +/* + * @Author: zhoux zhouxia@supervision.ltd + * @Date: 2023-11-16 14:30:15 + * @LastEditors: zhoux zhouxia@supervision.ltd + * @LastEditTime: 2023-11-16 14:56:27 + * @FilePath: \general-ai-platform-web\src\components\BatchOperation\isBatchDelete.tsx + * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE + */ +// import { useIntl } from '@ant-design/pro-components'; +import { useIntl } from '@umijs/max'; +import { Button, Popconfirm } from 'antd'; +import { FormattedMessage } from 'react-intl'; + +type IsDeleteProps = { + // eslint-disable-next-line @typescript-eslint/ban-types + deleteApi: Function; +}; + +const IsDelete: React.FC = (props) => { + const intl = useIntl(); + + return ( + { + props.deleteApi(); + }} + > + + + ); +}; + +export default IsDelete; diff --git a/src/components/TablePaginationCard/index.tsx b/src/components/TablePaginationCard/index.tsx index 95aec6c..179f36d 100644 --- a/src/components/TablePaginationCard/index.tsx +++ b/src/components/TablePaginationCard/index.tsx @@ -1,10 +1,5 @@ -/* - * @Author: zhoux zhouxia@supervision.ltd - * @Date: 2023-11-14 17:03:13 - * @LastEditors: zhoux zhouxia@supervision.ltd - * @LastEditTime: 2023-11-15 13:27:35 - * @FilePath: \general-ai-platform-web\src\components\TablePaginationCard\index.tsx - * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE +/** + * 未使用 验证中 */ import { TableDropdown } from '@ant-design/pro-components'; import React from 'react'; diff --git a/src/global.css b/src/global.css index 4ad33d0..68f4d9f 100644 --- a/src/global.css +++ b/src/global.css @@ -115,13 +115,20 @@ ol { .theme_bg_color { background-color: #155BD4; } -.ant-btn-link.ant-btn-dangerous { +.ant-btn-link.ant-btn-dangerous, +.ant-btn-default.ant-btn-dangerous { color: #E80D0D; } +.ant-btn-default.ant-btn-dangerous { + border-color: #E80D0D; +} .ant-menu-light .ant-menu-item-selected, .ant-menu-light > .ant-menu .ant-menu-item-selected { background-color: rgba(21, 91, 212, 0.1); } +.ant-select-dropdown .ant-select-item-option-active:not(.ant-select-item-option-disabled) { + background-color: rgba(21, 91, 212, 0.1); +} /* 表单 */ .ant-form-item { margin-bottom: 16px; @@ -130,6 +137,9 @@ ol { background-color: rgba(21, 91, 212, 0.1); border-color: #155BD4; } +.ant-pro-form-group-container { + gap: 0px 16px !important; +} .flex-cc { display: flex; align-items: center; @@ -143,3 +153,5 @@ ol { .w100 { width: 100%; } +/* UI 规范表 // TODO 11-17启动 +*/ diff --git a/src/global.less b/src/global.less index f411dfc..e9ce90a 100644 --- a/src/global.less +++ b/src/global.less @@ -139,14 +139,19 @@ ol { background-color: #155BD4; } -.ant-btn-link.ant-btn-dangerous { +.ant-btn-link.ant-btn-dangerous, .ant-btn-default.ant-btn-dangerous { color: #E80D0D; } +.ant-btn-default.ant-btn-dangerous{ + border-color: #E80D0D; +} .ant-menu-light .ant-menu-item-selected, .ant-menu-light>.ant-menu .ant-menu-item-selected { - // color: red; background-color: rgba(#155BD4, 0.1); +} +.ant-select-dropdown .ant-select-item-option-active:not(.ant-select-item-option-disabled) { + background-color: rgba(#155BD4, 0.1); } @@ -159,6 +164,10 @@ ol { background-color: rgba(#155BD4, 0.1); border-color: #155BD4; } +// 表单项之间间距 +.ant-pro-form-group-container{ + gap: 0px 16px !important; +} // .gn .ant-steps-item-finish .ant-steps-item-icon .flex-cc{ @@ -175,4 +184,20 @@ ol { .w100{ width: 100%; -} \ No newline at end of file +} + + +/* UI 规范表 // TODO 11-17启动 +*/ +.gn { + .p1 { + // line-height: ; + } +} +// .p1{ + +// } + + + + diff --git a/src/pages/Resource/AlgorithmModelList/index.tsx b/src/pages/Resource/AlgorithmModelList/index.tsx index 718fb6b..aa9b448 100644 --- a/src/pages/Resource/AlgorithmModelList/index.tsx +++ b/src/pages/Resource/AlgorithmModelList/index.tsx @@ -1,4 +1,6 @@ +import IsBatchDelete from '@/components/BatchOperation/isBatchDelete'; import TableActionCard from '@/components/TableActionCard'; +import IsDelete from '@/components/TableActionCard/isDelete'; import { ColumnDrawer as ModelCategoryColumnDrawer } from '@/pages/Resource/ModelCategoryList/components/ColumnDrawer'; import { ModelCategoryColumns } from '@/pages/Resource/ModelCategoryList/components/Columns'; import { @@ -11,13 +13,13 @@ import { postModelCategoryGetModelCategoryFkSelect, postModelCategoryGetModelCategoryNames, } from '@/services/resource/ModelCategory'; -import { ExclamationCircleOutlined, PlusOutlined } from '@ant-design/icons'; +import { PlusOutlined } from '@ant-design/icons'; import type { ActionType, ProColumns } from '@ant-design/pro-components'; import { PageContainer, ProFormSelect, ProTable } from '@ant-design/pro-components'; import { Access, FormattedMessage, history, useAccess, useIntl } from '@umijs/max'; -import { Button, Modal, Popconfirm, message } from 'antd'; +import { Button, message } from 'antd'; import React, { useRef, useState } from 'react'; -import { proTableCommonOptions } from '../../../../config/defaultTable'; +import { proTableCommonOptions, proTablePaginationOptions } from '../../../../config/defaultTable'; import CreateForm from './components/CreateForm'; import UpdateForm from './components/UpdateForm'; // import TablePaginationCard, { TablePaginationCardProps } from '@/components/TablePaginationCard'; @@ -256,14 +258,9 @@ const AlgorithmModelList: React.FC = () => { valueType: 'option', fixed: 'right', key: 'option', - // width: 140, render: (_, record) => [ - // - // eslint-disable-next-line react/jsx-key { { key: 'destroy', renderDom: ( - { + { handleDestroy(record).then(() => {}); }} - > - - + > ), }, ]} >, - // , ], }, ]; @@ -348,14 +331,9 @@ const AlgorithmModelList: React.FC = () => { setCategoryFkIdIds(CategoryFkIdIds); }} pagination={{ - showSizeChanger: true, - // showQuickJumper: true, + ...proTablePaginationOptions, pageSize: currentPageSize, onChange: (page, pageSize) => setCurrentPageSize(pageSize), - showTotal: (total) => `共${total}条`, - // pageSize: 10, - // showSizeChanger: true, - // pageSizeOptions: ['10', '20', '30', '40'], }} // components={{ // pagination: TablePaginationCard as React.FC, @@ -368,42 +346,17 @@ const AlgorithmModelList: React.FC = () => { return ( <> {selectedRowsState?.length > 0 && ( - + /> )} ); @@ -496,4 +449,4 @@ const AlgorithmModelList: React.FC = () => { ); }; -export default AlgorithmModelList; +export default AlgorithmModelList; \ No newline at end of file diff --git a/src/pages/Resource/BusinessImageList/index.tsx b/src/pages/Resource/BusinessImageList/index.tsx index c43ce15..2e3c710 100644 --- a/src/pages/Resource/BusinessImageList/index.tsx +++ b/src/pages/Resource/BusinessImageList/index.tsx @@ -1,3 +1,6 @@ +import IsBatchDelete from '@/components/BatchOperation/isBatchDelete'; +import TableActionCard from '@/components/TableActionCard'; +import IsDelete from '@/components/TableActionCard/isDelete'; import { ColumnDrawer as ProjectColumnDrawer } from '@/pages/Project/ProjectList/components/ColumnDrawer'; import { ProjectColumns } from '@/pages/Project/ProjectList/components/Columns'; import { @@ -7,19 +10,18 @@ import { } from '@/services/project/Project'; import { deleteBusinessImageDeleteBusinessImage, - deleteBusinessImageDeleteBusinessImageByIds, postBusinessImageGetBusinessImageList, } from '@/services/resource/BusinessImage'; import { PlusOutlined } from '@ant-design/icons'; import type { ActionType, ProColumns } from '@ant-design/pro-components'; -import { FooterToolbar, PageContainer, ProFormSelect, ProTable } from '@ant-design/pro-components'; +import { PageContainer, ProFormSelect, ProTable } from '@ant-design/pro-components'; import { Access, FormattedMessage, history, useAccess, useIntl } from '@umijs/max'; -import { Button, Popconfirm, message } from 'antd'; +import { Button, message } from 'antd'; import React, { useRef, useState } from 'react'; +import { proTableCommonOptions } from '../../../../config/defaultTable'; import { ColumnDrawer } from './components/ColumnDrawer'; import CreateForm from './components/CreateForm'; import UpdateForm from './components/UpdateForm'; -import { proTableCommonOptions } from '../../../../config/defaultTable'; const BusinessImageList: React.FC = () => { /** * @en-US Pop-up window of new window @@ -268,39 +270,37 @@ const BusinessImageList: React.FC = () => { valueType: 'option', fixed: 'right', render: (_, record) => [ - - - { - handleDestroy(record).then(() => {}); - }} - > - - - , + { + setUpdateModalOpen(true); + setCurrentRow(record); + }} + > + + + ), + }, + { + key: 'destroy', + renderDom: ( + { + handleDestroy(record).then(() => {}); + }} + > + ), + }, + ]} + >, ], }, ]; @@ -319,7 +319,6 @@ const BusinessImageList: React.FC = () => { }} search={{ labelWidth: 'auto', - }} onDataSourceChange={(data) => { let ProjectFkIdIds: any = data.map((v) => { @@ -335,7 +334,19 @@ const BusinessImageList: React.FC = () => { persistenceKey: 'business_image_list', persistenceType: 'localStorage', }} - // TODO 此处需要补一个批量删除 + tableAlertOptionRender={() => { + return ( + <> + {selectedRowsState?.length > 0 && ( + { + // TODO 未对接批量删除接口 + }} + /> + )} + + ); + }} toolBarRender={() => [ { }, }} /> - {/* {selectedRowsState?.length > 0 && ( - - {' '} - {selectedRowsState.length}{' '} - -
- } - > - - - )} */} { /** * @en-US Pop-up window of new window @@ -135,39 +138,37 @@ const ModelCategoryList: React.FC = () => { valueType: 'option', fixed: 'right', render: (_, record) => [ - - - { - handleDestroy(record).then(() => {}); - }} - > - - - , + { + setUpdateModalOpen(true); + setCurrentRow(record); + }} + > + + + ), + }, + { + key: 'destroy', + renderDom: ( + { + handleDestroy(record).then(() => {}); + }} + > + ), + }, + ]} + >, ], }, ]; @@ -193,6 +194,26 @@ const ModelCategoryList: React.FC = () => { persistenceKey: 'model_category_list', persistenceType: 'localStorage', }} + tableAlertOptionRender={() => { + return ( + <> + {selectedRowsState?.length > 0 && ( + { + // TODO 需要联调批量删除 + deleteModelCategoryDeleteModelCategoryByIds({ + ids: selectedRowsState.map((v: API.ModelCategory) => { + return v.id as number; + }), + }).then(() => { + actionRef.current?.reloadAndRest?.(); + }); + }} + /> + )} + + ); + }} toolBarRender={() => [ { }, }} /> - {selectedRowsState?.length > 0 && ( - - {' '} - {selectedRowsState.length}{' '} - -
- } - > - - - )} + { /** @@ -111,6 +114,13 @@ const ModelImageList: React.FC = () => { }; const columns: ProColumns[] = [ + { + title: , + dataIndex: 'name', + hideInSearch: true, + key: 'fixedName', + fixed: 'left', + }, { title: , dataIndex: 'id', @@ -129,12 +139,6 @@ const ModelImageList: React.FC = () => { }, }, - { - title: , - dataIndex: 'name', - hideInSearch: true, - }, - { title: ( { valueType: 'option', fixed: 'right', render: (_, record) => [ - - - { - handleDestroy(record).then(() => {}); - }} - > - - - , + { + setUpdateModalOpen(true); + setCurrentRow(record); + }} + > + + + ), + }, + { + key: 'destroy', + renderDom: ( + { + handleDestroy(record).then(() => {}); + }} + > + ), + }, + ]} + >, ], }, ]; @@ -304,6 +306,26 @@ const ModelImageList: React.FC = () => { persistenceKey: 'model_image_list', persistenceType: 'localStorage', }} + tableAlertOptionRender={() => { + return ( + <> + {selectedRowsState?.length > 0 && ( + { + // TODO 需要;联调删除接口 + deleteModelImageDeleteModelImageByIds({ + ids: selectedRowsState.map((v: API.ModelImage) => { + return v.id as number; + }), + }).then(() => { + actionRef.current?.reloadAndRest?.(); + }); + }} + /> + )} + + ); + }} toolBarRender={() => [ { }, }} /> - {selectedRowsState?.length > 0 && ( - - {' '} - {selectedRowsState.length}{' '} - -
- } - > - - - )} = (props) => { }, }} /> + {/* // TODO label字重与上面统一, 操作按钮需要与输入框对齐 */} { - return {doms}; + return {doms}; }} alwaysShowItemLabel > diff --git a/src/pages/Resource/ModelVersionList/index.tsx b/src/pages/Resource/ModelVersionList/index.tsx index 0b16fdb..2a081ad 100644 --- a/src/pages/Resource/ModelVersionList/index.tsx +++ b/src/pages/Resource/ModelVersionList/index.tsx @@ -13,11 +13,14 @@ import { } from '@/services/resource/ModelVersion'; import { PlusOutlined } from '@ant-design/icons'; import type { ActionType, ProColumns } from '@ant-design/pro-components'; -import { FooterToolbar, PageContainer, ProFormSelect, ProTable } from '@ant-design/pro-components'; +import { PageContainer, ProFormSelect, ProTable } from '@ant-design/pro-components'; import { Access, FormattedMessage, history, useAccess, useIntl } from '@umijs/max'; -import { Button, Popconfirm, message } from 'antd'; +import { Button, message } from 'antd'; // import { MenuProps } from 'rc-menu'; +import IsBatchDelete from '@/components/BatchOperation/isBatchDelete'; import TableActionCard from '@/components/TableActionCard'; +import IsConfirmAction from '@/components/TableActionCard/isConfirmAction'; +import IsDelete from '@/components/TableActionCard/isDelete'; import React, { useRef, useState } from 'react'; import { proTableCommonOptions } from '../../../../config/defaultTable'; import { ColumnDrawer } from './components/ColumnDrawer'; @@ -281,117 +284,77 @@ const ModelVersionList: React.FC = () => { valueType: 'option', fixed: 'right', render: (_, record) => [ - - { - setUpdateModalOpen(true); - setCurrentRow(record); - }} - > - - - ), - }, - { - key: 'setDefault', - renderDom: ( - { - putAlgorithmModelUpdateAlgorithmModel({ - id: record.modelFkId, - defaultVersionFkId: record.id, + { + setUpdateModalOpen(true); + setCurrentRow(record); + }} + > + + + ), + }, + { + key: 'setDefault', + renderDom: ( + { + // setPublishModalOpen(true); + putAlgorithmModelUpdateAlgorithmModel({ + id: record.modelFkId, + defaultVersionFkId: record.id, + }) + .then(() => { + message.success( + intl.formatMessage({ id: 'common.success', defaultMessage: '$$$' }), + ); }) - .then(() => { - message.success( - intl.formatMessage({ id: 'common.success', defaultMessage: '$$$' }), - ); - }) - .catch(() => { - message.error( - intl.formatMessage({ id: 'common.failure', defaultMessage: '$$$' }), - ); - }); - }} - onCancel={() => {}} - okText={intl.formatMessage({ id: 'common.yes', defaultMessage: '$$$' })} - cancelText={intl.formatMessage({ id: 'common.no', defaultMessage: '$$$' })} - > - - - ), - }, - { - key: 'publishModel', - renderDom: ( - {}} - onCancel={() => {}} - okText="Yes" - cancelText="No" - > - - - ), - }, - { - key: 'destroy', - renderDom: ( - { - handleDestroy(record).then(() => {}); - }} - > - - - ), - }, - ]} - > - , + .catch(() => { + message.error( + intl.formatMessage({ id: 'common.failure', defaultMessage: '$$$' }), + ); + }); + }} + > + ), + }, + { + key: 'publishModel', + renderDom: ( + { + // setPublishModalOpen(true); + // TODO 对接发布模型方法 + setCurrentRow(record); + }} + > + ), + }, + { + key: 'destroy', + renderDom: ( + { + handleDestroy(record).then(() => {}); + }} + > + ), + }, + ]} + >, ], }, ]; @@ -423,6 +386,25 @@ const ModelVersionList: React.FC = () => { persistenceKey: 'model_version_list', persistenceType: 'localStorage', }} + tableAlertOptionRender={() => { + return ( + <> + {selectedRowsState?.length > 0 && ( + { + deleteModelVersionDeleteModelVersionByIds({ + ids: selectedRowsState.map((v: API.ModelVersion) => { + return v.id as number; + }), + }).then(() => { + actionRef.current?.reloadAndRest?.(); + }); + }} + /> + )} + + ); + }} toolBarRender={() => [ { }, }} /> - {selectedRowsState?.length > 0 && ( - - {' '} - {selectedRowsState.length}{' '} - - - } - > - - - )} { {/* values={currentRow || {}}*/} {/* reload={actionRef.current?.reload}*/} {/*>*/} -