1.页面弹框带庶照
//角色全选中的js===放到 layui.use里
<div id="complex" style="display: none">
<table class="layui-table">
<thead>
<tr>
<th>选择<input type="checkbox" class = "allchoose" ></th>
<th>子集权限名称</th>
</tr>
</thead>
<tbody class="result-file role-module">
<?php foreach($this->child as $k=> $v):?>
<tr class="stage " >
<td>
<input type="checkbox" class = "fux" name = "form[complex][<?=$k?>][id]" value="<?=$k?>" <?php if(in_array($k,$childM)){echo "checked";}?>>
</td>
<td>
<?=$v?>
</td>
</tr>
<?php endforeach;?>
</tbody>
</table>
</div>
//关闭弹出框
<!-- //关闭弹出框
function closeTab_f(){
layer.close(layer.index);
}
//关闭弹出框
function closeTab(){
layer.close(layer.index);
} -->
//页面打开遮照
<!-- $(document).on('click', '.flag', function() {
console.log($(this).attr('status'));
var status = $(this).attr('status');
if (status == 69){
var id = $('#complex');
} else{
var id = $('#gallery');
}
//先赋值勾选再打开页面
layer.open({
type: 1,
area: ['80%', '80%'],
title: '选择子集权限',
content: id,
shade: 0.8,
btn: ['确 定', '取消'],
btn1: saveChoiceData,
btn3: closeTab_f
});
}); -->
<!-- $(function () {
$('.allchoose').next().children().addClass('allchecked');//全选中
$('.allchoose1').next().children().addClass('allchecked1');//全选中
$('.child_menu').each(function () {
var y1 = 0;
if ($(this).is(':checked')) {
y1=1;
}
if ($(this).attr('flag') ==1){
if (y1==0){
$(this).next().next().next().removeClass('layui-btn flag')
} else{
$(this).next().next().next().addClass('layui-btn flag')
}
}
});
});
$flag = true;
$(document).on('click', '.allchecked', function() {
$('.role-module tr input[type=checkbox].fux').prop('checked', $flag);
form.render();
$('.allchoose').next().children().addClass('allchecked');
if($flag == true){
$flag = false;
}else{
$flag = true;
}
$('.allchoose1').next().children().addClass('allchecked1');
});
$flag1 = true;
$(document).on('click', '.allchecked1', function() {
$('.role-module1 tr input[type=checkbox].fux1').prop('checked', $flag1);
form.render();
$('.allchoose1').next().children().addClass('allchecked1');
if($flag1 == true){
$flag1 = false;
}else{
$flag1 = true;
}
$('.allchoose').next().children().addClass('allchecked');
}); -->