66 lines
2.5 KiB
HTML
66 lines
2.5 KiB
HTML
{extend name="public/base" /}
|
|
|
|
{block name="body"}
|
|
<form method="post" class="layui-form admin-main" action="__SELF__">
|
|
<table class="layui-table">
|
|
<tbody>
|
|
{volist name="node_list" id="vo"}
|
|
<tr class="main_{$vo.id}">
|
|
<td width="200" rowspan="{:count($vo['children']??'') ?: 1}">
|
|
<input name="rules[{$vo.id}]" type="checkbox" lay-filter="status" title="{$vo.title}" value="{$vo.id}" {$vo.checked} data-id="{$vo.id}" />
|
|
</td>
|
|
{eq name="vo['children']??''|count" value="0"}
|
|
<td></td>
|
|
<td></td>
|
|
{/eq}
|
|
{volist name="vo.children|default=''" id="c1" key="row"}
|
|
{gt name="row" value="1"}
|
|
<tr class="main_{$vo.id}">
|
|
{/gt}
|
|
<td width="200">
|
|
<input name="rules[{$c1.id}]" type="checkbox" lay-filter="status" title="{$c1.title}" value="{$c1.id}" {$c1.checked} data-id="{$c1.id}" />
|
|
</td>
|
|
<td class="left two_{$c1.id}">
|
|
{volist name="c1.children|default=''" id="s1"}
|
|
<input name="rules[{$s1.id}]" type="checkbox" lay-filter="status" title="{$s1.title}" value="{$s1.id}" {$s1.checked}>
|
|
{/volist}
|
|
</td>
|
|
</tr>
|
|
{/volist}
|
|
{/volist}
|
|
</tbody>
|
|
</table>
|
|
<button class="layui-btn" lay-submit lay-filter="submit">保存授权</button>
|
|
</form>
|
|
{/block}
|
|
|
|
{block name="layui"}
|
|
<script>
|
|
layui.use(['form'], function(){
|
|
var $ = layui.jquery, form = layui.form();
|
|
|
|
form.on('checkbox(status)', function(data) {
|
|
var $this = $(this);
|
|
var id = $this.attr('data-id');
|
|
$(".main_" + id).find('input').prop('checked', $this.prop('checked'))
|
|
$(".two_" + id).find('input').prop('checked', $this.prop('checked'))
|
|
form.render('checkbox');
|
|
});
|
|
|
|
form.on('submit(submit)', function(data) {
|
|
$.post(data.form.action, data.field, function(data) {
|
|
if (data.code == 1) {
|
|
layer.msg(data.msg, {icon: data.code, time: 1000}, function() {
|
|
var index = parent.layer.getFrameIndex(window.name);
|
|
parent.layer.close(index);
|
|
});
|
|
} else {
|
|
layer.msg(data.msg, {icon: 2, time: 1000});
|
|
}
|
|
});
|
|
return false;
|
|
});
|
|
});
|
|
</script>
|
|
{/block}
|