You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
1.0 KiB
32 lines
1.0 KiB
import { Button, Popconfirm } from 'antd'
|
|
import { useAtomValue } from 'jotai'
|
|
import { batchIdsAtom, deleteMenuAtom } from '../store.ts'
|
|
import { useTranslation } from '@/i18n.ts'
|
|
|
|
const BatchButton = () => {
|
|
|
|
const { t } = useTranslation()
|
|
const { isPending, mutate, } = useAtomValue(deleteMenuAtom)
|
|
const ids = useAtomValue(batchIdsAtom)
|
|
if (ids.length === 0) {
|
|
return null
|
|
}
|
|
|
|
return (
|
|
<Popconfirm
|
|
onConfirm={()=>{
|
|
mutate(ids as number[])
|
|
}}
|
|
title={t('system.menus.batchDel.confirm', '确定要删除所选数据吗?')}>
|
|
<Button
|
|
type="primary"
|
|
danger={true}
|
|
size={'small'}
|
|
disabled={ids.length === 0}
|
|
loading={isPending}
|
|
>{t('t.system.menus.batchDel', '批量删除')}</Button>
|
|
</Popconfirm>
|
|
)
|
|
}
|
|
|
|
export default BatchButton
|