From 51428ac97a57620278d80a0016e59210440f7622 Mon Sep 17 00:00:00 2001 From: xiaochong0302 Date: Sat, 9 Dec 2023 09:01:18 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E5=85=85=E9=81=97=E6=BC=8F=E7=9A=84?= =?UTF-8?q?=E6=89=B9=E9=87=8F=E5=88=A0=E9=99=A4=E7=82=B9=E5=87=BB=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/static/admin/js/common.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/public/static/admin/js/common.js b/public/static/admin/js/common.js index 36a916f4..d363faea 100644 --- a/public/static/admin/js/common.js +++ b/public/static/admin/js/common.js @@ -147,6 +147,38 @@ layui.use(['jquery', 'form', 'element', 'layer', 'kgDropdown'], function () { }); }); + $('.kg-batch').on('click', function () { + var url = $(this).data('url'); + var tips = $(this).data('tips'); + var defaultTips = '确定要执行批量操作吗?'; + var ids = []; + $('input:checkbox[class="item"]:checked').each(function (index, item) { + ids.push(item.value); + }); + if (ids.length === 0) { + layer.msg('没有选中任何条目', {icon: 2}); + return false; + } + tips = tips || defaultTips; + layer.confirm(tips, function () { + $.ajax({ + type: 'POST', + url: url, + data: {'ids': ids}, + success: function (res) { + layer.msg(res.msg, {icon: 1}); + if (res.location) { + setTimeout(function () { + window.location.href = res.location; + }, 1500); + } else { + window.location.reload(); + } + } + }); + }); + }); + $('.kg-delete,.kg-restore').on('click', function () { var url = $(this).data('url'); var tips = $(this).hasClass('kg-delete') ? '确定要删除吗?' : '确定要还原吗?';