1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
| * @Method: * @Description: 复选框用的是iCheck的插件,这是iCheck的初始化 * @Param: * @return: * @Author: Mr.Vincent * @Date: 2019/6/1 */ $(function () { $('input[type="checkbox"].minimal').iCheck({ checkboxClass: 'icheckbox_minimal-blue', radioClass : 'iradio_minimal-blue' });
var _masterCheckbox = $('input[type="checkbox"].minimal.iCheckMaster');
var _checkbox = $('input[type="checkbox"].minimal');
_masterCheckbox.on("ifClicked", function (e) { if (e.target.checked) { _checkbox.iCheck("uncheck"); } else { _checkbox.iCheck("check"); } });
* @Method: 批量删除 * @Description: * @Param: * @return: * @Author: Mr.Vincent * @Date: 2019/6/1 */ $("#batchDelete").click(function () { var _idArray = new Array();
_checkbox.each(function () { var _id = $(this).attr("id"); if (_id != null && _id != "undefine" && $(this).is(":checked")) { _idArray.push(_id); } });
if (_idArray.length === 0) { swal("请先选择复选框!!!") } else { swal({ title: "你确定要删除吗?", text: "一旦删除,将无法恢复!!!", icon: "warning", buttons: ["取消", "确定删除!"], dangerMode: true, }) .then((willDelete) => { if (willDelete) {
$.post("/batchDelete", {ids: _idArray.toString()}, function (data) { debugger if (data.message != '数据删除失败!!!') { swal( "删除成功!!!", data.message, { icon: "success", }) } else { swal( "删除失败!!", data.message, { buttons: false, timer: 2000, }) } }) } }) } }) })
|