• layui表格的批量删除功能


     1     // 批量删除功能
     2     // 1.得到table选中行内容
     3     // 2.得到删除需要的唯一值,一般是id;
     4     // 3.将所要删除的项加入到数组中;
     5     // 4.判断是否选中;
     6     // 5.发送ajax请求,并附带参数id;
     7      var $=layui.$,active={
     8          deLink:function () {
     9              var checkStatus=table.checkStatus('idTest'),
    10                  data=checkStatus.data,
    11                  deList=[];
    12              data.forEach(function(n,i){
    13                  delList.push(n.id);
    14              });
    15              if(delList!=''){
    16                  layer.comfirm('确定删除所选项吗?',function (index) {
    17                      $.ajax({
    18                          url: '/cd/workPlatform/tool/remove.afca',
    19                          type:'post',
    20                          dataType:'json',
    21                          data:"id="+delList,
    22                          success:function (data,statusText) {
    23                              if(data.code==='0'){
    24                                  layer.msg('删除成功');
    25                                  table.reload('idTest',{});
    26                              }else{
    27                                  layer.msg('删除失败');
    28                              }
    29                          },
    30                          'error':function () {
    31                              layer.msg('系统错误');
    32                          }
    33                      })
    34                  })
    35              }else{
    36                  layer.tips('请选择需要删除的行',$('#batchDel'),{
    37                      tips:[3,'#5fb878']
    38                  })
    39              }
    40          }
    41      }
  • 相关阅读:
    例解 Linux 下 Make 命令
    linux使用bin文件安装jdk
    Linux查看及设置系统字符集
    FTP的两种主动模式和被动模式
    Mongodb之主从复制
    Nginx配置认证登录
    AWK
    Redis+Keepalived实现高可用
    Redis哨兵配置
    Keepalived指定文件接收日志
  • 原文地址:https://www.cnblogs.com/yangguoe/p/8955445.html
Copyright © 2020-2023  润新知