function piShen() { layer.confirm('真的要批量审核吗', function(index){ var getSelectRows = $("#tablelist").bootstrapTable('getSelections', function (row) { // console.log(row); return row; }); var record_id = ''; if(getSelectRows.length>=1){ for(let i in getSelectRows){ //console.log(getSelectRows[i].id); // aa bb cc dd if(i ==0){ record_id += getSelectRows[i].id; }else{ record_id += ","+getSelectRows[i].id; } } }else{ layer.msg('请勾选最少一行数据', {icon:6,time: 3000,skin: 'layer-ext-moon'}); //1是勾,2是X,3是?,4琐,5不开心笑脸,6笑脸表情 return false; } var token = $("input[name='_token']").val(); $.ajax({ type: 'post', url: "{{URL::route('admin.user.borrow.pishen')}}", data: {_token:token,record_id:record_id}, cache: false, success: function (res) { console.log(res); if( res.code == 200 ){ layer.msg(res.msg, {icon: 4,time: 1000,skin: 'layer-ext-moon',offset: '230px'}); //1是勾,2是X,3是?,4琐,5不开心笑脸,6笑脸表情 $('#tablelist').bootstrapTable('refresh', ''); }else{ layer.msg(res.msg, {icon: 6,time: 1000,skin: 'layer-ext-moon',offset: '230px'}); //1是勾,2是X,3是?,4琐,5不开心笑脸,6笑脸表情 } layer.close(index); }, error: function (res) { layer.msg(res.msg, {icon: 6,time: 1000,skin: 'layer-ext-moon',offset: '230px'}); //1是勾,2是X,3是?,4琐,5不开心笑脸,6笑脸表情 } }); }); }
弹窗页面JS
function piZhuan() { //获取选中的ID var getSelectRows = $("#tablelist").bootstrapTable('getSelections', function (row) { console.log(row); return row; }); var record_id = ''; if(getSelectRows.length>=1){ for(let i in getSelectRows){ //console.log(getSelectRows[i].id); // aa bb cc dd if(i ==0){ record_id += getSelectRows[i].id; }else{ record_id += ","+getSelectRows[i].id; } } }else{ layer.msg('请勾选一行数据', {icon:6,time: 3000,skin: 'layer-ext-moon'}); //1是勾,2是X,3是?,4琐,5不开心笑脸,6笑脸表情 return false; } layer.open({ type: 2 ,title: '批量记录转回访专员(请谨慎操作)' //弹窗标题 ,content:["{{route('admin.yun.problem.piZhuan')}}",'yes'] //弹窗页面,如果不下出现滚动条['http://xxxx.com', 'no'] ,area:['400px','500px'] //尺寸 ,offset: 't' //offset - 坐标/t顶部 r右边缘 b底部 l左边缘 lt左上角 lb左下角 rt右上角 rb右下角 ,btn: ['确定', '取消'] ,btnAlign:'r' //按钮排列 l左 r右边 c 居中 ,closeBtn:1 //0关闭按钮,1在标题栏展示关闭按钮,2在右上角外展示按钮 ,shade:0.4 //遮罩:默认是0.3透明度的黑色背景('#000') shade: [0.8, '#393D49']; ,shadeClose:false //是否点击遮罩关闭 ,anim:1 //弹出动画 0平滑放大。默认;1从上掉落;2从最底部往上滑入;3从左滑入;4从左翻滚;5渐显;6抖动 -1不设置 ,isOutAnim:true //关闭动画 ,maxmin:false //最大最小化按钮 ,fixed:true //固定 ,resize:true //是否允许拉伸 //,scrollbar:false //是否允许浏览器出现滚动条 ,maxWidth:500 //最大宽度,只有当area: 'auto'时,maxWidth的设定才有效 ,maxHeight:500 //最大高度,只有当高度自适应时,maxHeight的设定才有效。 ,time:0 ,yes: function(index, layero){ console.log(index); console.log('确定了'); var obj = layer.getChildFrame('#Anson-forms', index); console.log(obj); console.log(obj.serialize()); $.ajax({ type: 'post', url: "{{URL::route('admin.yun.problem.piZhuan')}}?record_id="+record_id, data: obj.serialize(), cache: false, success: function (res) { console.log(res); if( res.code == 200 ){ layer.close(index); //如果设定了yes回调,需进行手工关闭 layer.msg(res.msg, {icon: 1,time: 1000,skin: 'layer-ext-moon',offset: '230px'}); //1是勾,2是X,3是?,4琐,5不开心笑脸,6笑脸表情 $('#tablelist').bootstrapTable('refresh', ''); }else{ layer.msg(res.msg, {icon: 6,time: 1000,skin: 'layer-ext-moon',offset: '230px'}); //1是勾,2是X,3是?,4琐,5不开心笑脸,6笑脸表情 } }, error: function (res) { layer.msg(res.msg, {icon: 6,time: 1000,skin: 'layer-ext-moon',offset: '230px'}); //1是勾,2是X,3是?,4琐,5不开心笑脸,6笑脸表情 } }); // body.find('input').val('Hi,我是从父页来的') } ,cancel: function(index, layero){ // if(confirm('确定要关闭么')){ //只有当点击confirm框的确定时,该层才会关闭 // layer.close(index) // } // console.log('右上角关闭回调') //return false 开启该代码可禁止点击该按钮关闭 } }); }