50 lines
1.4 KiB
Plaintext
50 lines
1.4 KiB
Plaintext
|
|
@{
|
|
ViewBag.Title = "Index";
|
|
Layout = "~/Views/Shared/_Layout.cshtml";
|
|
}
|
|
|
|
<div class="x-body">
|
|
<div class="layui-btn-group" style="padding-bottom:10px;">
|
|
<button class="layui-btn" data-method="init">初始化数据</button>
|
|
</div>
|
|
<ul id="rightGroup"></ul>
|
|
</div>
|
|
<script>
|
|
var selectRow = {};
|
|
|
|
layui.use(['tree','layer'], function () {
|
|
var layer = layui.layer
|
|
, $ = layui.jquery;
|
|
|
|
$.get('/RightGroup/GetRightTreeList', function (data) {
|
|
//alert(data);
|
|
//console.log(data);
|
|
layui.tree({
|
|
elem: '#rightGroup' //指定元素
|
|
, click: function (item) { //点击节点回调
|
|
layer.msg('当前节名称:' + item.name + '<br>全部参数:' + JSON.stringify(item));
|
|
console.log(item);
|
|
}
|
|
, nodes: data
|
|
});
|
|
});
|
|
|
|
var active = {
|
|
init: function () {
|
|
$.get('/RightGroup/Init', function (data) {
|
|
alert(data);
|
|
console.log(data);
|
|
});
|
|
}
|
|
};
|
|
|
|
|
|
$('.layui-btn-group .layui-btn').on('click', function () {
|
|
var othis = $(this), method = othis.data('method');
|
|
active[method] ? active[method].call(this, othis) : '';
|
|
});
|
|
|
|
});
|
|
|
|
</script> |