feat: 新增确认单个操作、批量操作的全局交互组件,统一修改资源管理列表模块
parent
bd2c1ede98
commit
4fc102c7d6
@ -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<IsBatchDeleteProps> = (props) => {
|
||||
const intl = useIntl();
|
||||
|
||||
return (
|
||||
<Button
|
||||
danger
|
||||
onClick={async () => {
|
||||
Modal.confirm({
|
||||
icon: <ExclamationCircleOutlined />,
|
||||
title: intl.formatMessage({
|
||||
id: 'common.modal.table.delete.title',
|
||||
defaultMessage: '$$$',
|
||||
}),
|
||||
content: intl.formatMessage({
|
||||
id: 'common.modal.table.delete.content',
|
||||
defaultMessage: '$$$',
|
||||
}),
|
||||
okText: intl.formatMessage({ id: 'common.yes', defaultMessage: '$$$' }),
|
||||
cancelText: intl.formatMessage({ id: 'common.no', defaultMessage: '$$$' }),
|
||||
onOk() {
|
||||
// TODO 未对接批量删除接口
|
||||
props.deleteApi();
|
||||
},
|
||||
onCancel() {
|
||||
console.log('Cancel');
|
||||
},
|
||||
});
|
||||
}}
|
||||
>
|
||||
<FormattedMessage id="pages.searchTable.batchDeletion" defaultMessage="Batch deletion" />
|
||||
</Button>
|
||||
);
|
||||
};
|
||||
|
||||
export default IsBatchDelete;
|
@ -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
|
||||
|
||||
|
||||
|
||||
|
@ -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<isConfirmActionProps> = (props) => {
|
||||
const intl = useIntl();
|
||||
const description = props.description || `确认${props.title}吗?`;
|
||||
return (
|
||||
<Popconfirm
|
||||
title={props.title}
|
||||
description={description}
|
||||
onConfirm={() => {
|
||||
props.confirmAction();
|
||||
}}
|
||||
onCancel={() => {}}
|
||||
okText={intl.formatMessage({ id: 'common.yes', defaultMessage: '$$$' })}
|
||||
cancelText={intl.formatMessage({ id: 'common.no', defaultMessage: '$$$' })}
|
||||
>
|
||||
<Button
|
||||
type="link"
|
||||
size="small"
|
||||
onClick={() => {
|
||||
// setPublishModalOpen(true);
|
||||
}}
|
||||
>
|
||||
{/* 自定义文案优先 */}
|
||||
{props.buttonText ? (
|
||||
props.buttonText
|
||||
) : (
|
||||
<FormattedMessage id={props.buttonFormatText} defaultMessage="$$$" />
|
||||
)}
|
||||
</Button>
|
||||
</Popconfirm>
|
||||
);
|
||||
};
|
||||
|
||||
export default IsConfirmAction;
|
@ -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<IsDeleteProps> = (props) => {
|
||||
const intl = useIntl();
|
||||
|
||||
return (
|
||||
<Popconfirm
|
||||
key="destroy"
|
||||
placement="topLeft"
|
||||
title={intl.formatMessage({ id: 'common.tip.title', defaultMessage: '$$$' })}
|
||||
description={intl.formatMessage({
|
||||
id: 'common.modal.table.delete.content',
|
||||
defaultMessage: '$$$',
|
||||
})}
|
||||
okText={intl.formatMessage({ id: 'common.yes', defaultMessage: '$$$' })}
|
||||
cancelText={intl.formatMessage({ id: 'common.no', defaultMessage: '$$$' })}
|
||||
onConfirm={() => {
|
||||
props.deleteApi();
|
||||
}}
|
||||
>
|
||||
<Button type="link" size="small" danger>
|
||||
<FormattedMessage id="pages.searchTable.destroy" defaultMessage="Destroy" />
|
||||
</Button>
|
||||
</Popconfirm>
|
||||
);
|
||||
};
|
||||
|
||||
export default IsDelete;
|
Loading…
Reference in New Issue