layui table表格批量删除

tech2025-07-29  7

//批量删除 $(document).on('click', '[data-role="batchdelbtn"]', function() { var checkbox = []; $("[name=selectbooks]:checkbox").each(function(i) { if ($(this).prop("checked") == true) { checkbox.push($(this).val()); //获取值 } }) if (checkbox == '') { layer.msg('没有选择书籍~'); return; } batchDeletes(checkbox); }) //批量删除-接口 function batchDeletes(bookids) { var para = { book_ids: bookids }; layer.confirm('确认删除该书籍吗?', function() { api_books.batchDelete(para).then(function(res) { if (res.code == 0) { layer.msg(common.msg(res.msg), { time: 2000, icon: 6 }, function() { layer.closeAll(); bookslist(start); }); } else { layer.msg(common.msg(res.msg), { time: 2000, icon: 5 }); } }) }) }
最新回复(0)