react项目表格要增加批量删除功能,但是页面原本是前端点击删除按钮之后,清除单条数据直接吧剩下的发给后端接口,没有专门的删除接口,现在怎么实现在页面上多选后,点击批量删除后删除选中的数据,然后吧剩下的数据发给后端?
function handleDelete(index) {
list.splice(index, 1);
handleSave(1, list)
}
function handleSave(type, list) {
updateDetails({
taskFid: info.taskCode,
taskType: info.taskFid,
code: type,
data: {
salist: list.map(item => {
return {
}
}),
},
}).then(res => {
if (res.code === '0') {
message.success('操作成功');
getList()
}
})
}
<Button type='link' danger onClick={() => { handleDelete(index) }}>删除</Button>