若依 2.4
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">部门名称:</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" type="text" name="deptName">
|
||||
<input class="form-control" type="text" name="deptName" id="deptName">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
@@ -73,6 +73,9 @@
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: {
|
||||
"parentId": function() {
|
||||
return $("input[name='parentId']").val();
|
||||
},
|
||||
"deptName" : function() {
|
||||
return $.common.trim($("#deptName").val());
|
||||
}
|
||||
@@ -105,9 +108,21 @@
|
||||
|
||||
/*部门管理-新增-选择父部门树*/
|
||||
function selectDeptTree() {
|
||||
var deptId = $("#treeId").val();
|
||||
var url = prefix + "/selectDeptTree/" + deptId;
|
||||
$.modal.open("选择部门", url, '380', '380');
|
||||
var options = {
|
||||
title: '部门选择',
|
||||
width: "380",
|
||||
height: "380",
|
||||
url: prefix + "/selectDeptTree/" + $("#treeId").val(),
|
||||
callBack: doSubmit
|
||||
};
|
||||
$.modal.openOptions(options);
|
||||
}
|
||||
|
||||
function doSubmit(index, layero){
|
||||
var body = layer.getChildFrame('body', index);
|
||||
$("#treeId").val(body.find('#treeId').val());
|
||||
$("#treeName").val(body.find('#treeName').val());
|
||||
layer.close(index);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
@@ -16,7 +16,7 @@
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">部门名称:</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" type="text" name="deptName" th:field="*{deptName}">
|
||||
<input class="form-control" type="text" name="deptName" th:field="*{deptName}" id="deptName">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
@@ -74,7 +74,10 @@
|
||||
dataType: "json",
|
||||
data: {
|
||||
"deptId": function() {
|
||||
return $.common.trim($("#deptId").val());
|
||||
return $("#deptId").val();
|
||||
},
|
||||
"parentId": function() {
|
||||
return $("input[name='parentId']").val();
|
||||
},
|
||||
"deptName": function() {
|
||||
return $.common.trim($("#deptName").val());
|
||||
@@ -108,9 +111,21 @@
|
||||
|
||||
/*部门管理-修改-选择部门树*/
|
||||
function selectDeptTree() {
|
||||
var deptId = $("#treeId").val();
|
||||
var url = prefix + "/selectDeptTree/" + deptId;
|
||||
$.modal.open("选择部门", url, '380', '380');
|
||||
var options = {
|
||||
title: '部门选择',
|
||||
width: "380",
|
||||
height: "380",
|
||||
url: prefix + "/selectDeptTree/" + $("#treeId").val(),
|
||||
callBack: doSubmit
|
||||
};
|
||||
$.modal.openOptions(options);
|
||||
}
|
||||
|
||||
function doSubmit(index, layero){
|
||||
var body = layer.getChildFrame('body', index);
|
||||
$("#treeId").val(body.find('#treeId').val());
|
||||
$("#treeName").val(body.find('#treeName').val());
|
||||
layer.close(index);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
@@ -10,173 +10,38 @@ button{font-family: "SimSun","Helvetica Neue",Helvetica,Arial;}
|
||||
<body class="hold-transition box box-main">
|
||||
<input id="treeId" name="treeId" type="hidden" th:value="${dept.deptId}"/>
|
||||
<input id="treeName" name="treeName" type="hidden" th:value="${dept.deptName}"/>
|
||||
<div class="wrapper"><div class="treeShowHideButton" onclick="search();">
|
||||
<div class="wrapper"><div class="treeShowHideButton" onclick="$.tree.toggleSearch();">
|
||||
<label id="btnShow" title="显示搜索" style="display:none;">︾</label>
|
||||
<label id="btnHide" title="隐藏搜索">︽</label>
|
||||
</div>
|
||||
<div class="treeSearchInput" id="search">
|
||||
<label for="keyword">关键字:</label><input type="text" class="empty" id="keyword" maxlength="50">
|
||||
<button class="btn" id="btn" onclick="searchNode()"> 搜索 </button>
|
||||
<button class="btn" id="btn" onclick="$.tree.searchNode()"> 搜索 </button>
|
||||
</div>
|
||||
<div class="treeExpandCollapse">
|
||||
<a href="javascript:" id="btnExpand">展开</a> /
|
||||
<a href="javascript:" id="btnCollapse">折叠</a>
|
||||
<a href="#" onclick="$.tree.expand()">展开</a> /
|
||||
<a href="#" onclick="$.tree.collapse()">折叠</a>
|
||||
</div>
|
||||
<div id="tree" class="ztree treeselect"></div>
|
||||
</div>
|
||||
<div class="layui-layer-btn">
|
||||
<a class="layui-layer-btn0" th:onclick="'javascript:loadObj()'"><i class="fa fa-check"></i> 确定</a>
|
||||
<a class="layui-layer-btn1" onclick="$.modal.close()"><i class="fa fa-close"></i> 关闭</a>
|
||||
</div>
|
||||
<div th:include="include::footer"></div>
|
||||
<script th:src="@{/ajax/libs/jquery-ztree/3.5/js/jquery.ztree.all-3.5.js}"></script>
|
||||
<script th:inline="javascript">
|
||||
// 树结构初始化加载
|
||||
var setting = {view:{selectedMulti:false},data:{key:{title:"title"},simpleData:{enable:true}},
|
||||
callback:{onClick:function(event, treeId, treeNode){
|
||||
var treeId = treeNode.id;
|
||||
var treeName = treeNode.name;
|
||||
$("#treeId").val(treeId);
|
||||
$("#treeName").val(treeName);
|
||||
}}
|
||||
}, tree, loadTree = function(){
|
||||
$.get(ctx + "system/dept/treeData", function(data) {
|
||||
var treeName = $("#treeName").val();
|
||||
tree = $.fn.zTree.init($("#tree"), setting, data);
|
||||
// 展开第一级节点
|
||||
var nodes = tree.getNodesByParam("level", 0);
|
||||
for (var i = 0; i < nodes.length; i++) {
|
||||
tree.expandNode(nodes[i], true, false, false);
|
||||
selectCheckNode(treeName,nodes[i]);
|
||||
}
|
||||
// 展开第二级节点
|
||||
nodes = tree.getNodesByParam("level", 1);
|
||||
for (var i = 0; i < nodes.length; i++) {
|
||||
tree.expandNode(nodes[i], true, false, false);
|
||||
selectCheckNode(treeName,nodes[i]);
|
||||
}
|
||||
// 展开第二级节点
|
||||
nodes = tree.getNodesByParam("level", 2);
|
||||
for (var i = 0; i < nodes.length; i++) {
|
||||
tree.expandNode(nodes[i], true, false, false);
|
||||
selectCheckNode(treeName,nodes[i]);
|
||||
}
|
||||
}, null, null, "正在加载,请稍后...");
|
||||
};
|
||||
|
||||
$(function() {
|
||||
loadTree();
|
||||
var url = ctx + "system/dept/treeData";
|
||||
var options = {
|
||||
url: url,
|
||||
expandLevel: 2,
|
||||
onClick : zOnClick
|
||||
};
|
||||
$.tree.init(options);
|
||||
});
|
||||
|
||||
function selectCheckNode(treeName, node) {
|
||||
if(treeName == node.name){
|
||||
tree.selectNode(node, true);
|
||||
}
|
||||
}
|
||||
|
||||
$('#btnExpand').click(function() {
|
||||
tree.expandAll(true);
|
||||
});
|
||||
$('#btnCollapse').click(function() {
|
||||
tree.expandAll(false);
|
||||
});
|
||||
|
||||
function loadObj(){
|
||||
var treeId = $("#treeId").val();
|
||||
var treeName = $("#treeName").val();
|
||||
parent.$("#treeId").val(treeId);
|
||||
parent.$("#treeName").val(treeName);
|
||||
var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引
|
||||
parent.layer.close(index);
|
||||
}
|
||||
|
||||
var lastValue = "", nodeList = [], key = $("#keyword");
|
||||
key.bind("focus", focusKey).bind("blur", blurKey).bind("change cut input propertychange", searchNode);
|
||||
key.bind("keydown", function (e){if(e.which == 13){searchNode();}});
|
||||
|
||||
function focusKey(e) {
|
||||
if (key.hasClass("empty")) {
|
||||
key.removeClass("empty");
|
||||
}
|
||||
}
|
||||
|
||||
function blurKey(e) {
|
||||
if (key.get(0).value === "") {
|
||||
key.addClass("empty");
|
||||
}
|
||||
searchNode(e);
|
||||
}
|
||||
|
||||
function searchNode() {
|
||||
var value = $.trim(key.get(0).value);
|
||||
var keyType = "name";
|
||||
if (lastValue === value) {
|
||||
return;
|
||||
}
|
||||
lastValue = value;
|
||||
var nodes = tree.getNodes();
|
||||
if (value == "") {
|
||||
showAllNode(nodes);
|
||||
return;
|
||||
}
|
||||
hideAllNode(nodes);
|
||||
nodeList = tree.getNodesByParamFuzzy(keyType, value);
|
||||
updateNodes(nodeList);
|
||||
}
|
||||
|
||||
function hideAllNode(nodes){
|
||||
var tree = $.fn.zTree.getZTreeObj("tree");
|
||||
nodes = tree.transformToArray(nodes);
|
||||
for(var i=nodes.length-1; i>=0; i--) {
|
||||
tree.hideNode(nodes[i]);
|
||||
}
|
||||
}
|
||||
|
||||
function showAllNode(nodes){
|
||||
nodes = tree.transformToArray(nodes);
|
||||
for(var i=nodes.length-1; i>=0; i--) {
|
||||
if(nodes[i].getParentNode()!=null){
|
||||
tree.expandNode(nodes[i],false,false,false,false);
|
||||
}else{
|
||||
tree.expandNode(nodes[i],true,true,false,false);
|
||||
}
|
||||
tree.showNode(nodes[i]);
|
||||
showAllNode(nodes[i].children);
|
||||
}
|
||||
}
|
||||
|
||||
function updateNodes(nodeList) {
|
||||
tree.showNodes(nodeList);
|
||||
for(var i=0, l=nodeList.length; i<l; i++) {
|
||||
var treeNode = nodeList[i];
|
||||
showChildren(treeNode);
|
||||
showParent(treeNode)
|
||||
}
|
||||
}
|
||||
|
||||
function showChildren(treeNode){
|
||||
if (treeNode.isParent){
|
||||
for(var idx in treeNode.children){
|
||||
var node = treeNode.children[idx];
|
||||
tree.showNode(node);
|
||||
showChildren(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
function showParent(treeNode){
|
||||
var parentNode;
|
||||
while((parentNode = treeNode.getParentNode()) != null){
|
||||
tree.showNode(parentNode);
|
||||
tree.expandNode(parentNode, true, false, false);
|
||||
treeNode = parentNode;
|
||||
}
|
||||
}
|
||||
|
||||
function search($this) {
|
||||
$('#search').slideToggle(200);
|
||||
$('#btnShow').toggle();
|
||||
$('#btnHide').toggle();
|
||||
$('#keyword').focus();
|
||||
|
||||
function zOnClick(event, treeId, treeNode) {
|
||||
var treeId = treeNode.id;
|
||||
var treeName = treeNode.name;
|
||||
$("#treeId").val(treeId);
|
||||
$("#treeName").val(treeName);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
@@ -121,7 +121,12 @@
|
||||
|
||||
function queryParams(params) {
|
||||
return {
|
||||
dictType: $("#dictType").val()
|
||||
dictType: $("#dictType").val(),
|
||||
pageSize: params.limit,
|
||||
pageNum: params.offset / params.limit + 1,
|
||||
searchValue: params.search,
|
||||
orderByColumn: params.sort,
|
||||
isAsc: params.order
|
||||
};
|
||||
}
|
||||
</script>
|
||||
|
@@ -2,7 +2,6 @@
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
||||
<meta charset="utf-8">
|
||||
<head th:include="include :: header"></head>
|
||||
<link href="/ajax/libs/iCheck/custom.css" th:href="@{/ajax/libs/iCheck/custom.css}" rel="stylesheet"/>
|
||||
<body class="white-bg">
|
||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||
<form class="form-horizontal m" id="form-menu-add">
|
||||
@@ -16,9 +15,9 @@
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">菜单类型:</label>
|
||||
<div class="col-sm-8">
|
||||
<label class="checkbox-inline i-checks"> <input type="radio" name="menuType" value="M" /> 目录 </label>
|
||||
<label class="checkbox-inline i-checks"> <input type="radio" name="menuType" value="C" /> 菜单 </label>
|
||||
<label class="checkbox-inline i-checks"> <input type="radio" name="menuType" value="F" /> 按钮 </label>
|
||||
<label class="radio-box"> <input type="radio" name="menuType" value="M" /> 目录 </label>
|
||||
<label class="radio-box"> <input type="radio" name="menuType" value="C" /> 菜单 </label>
|
||||
<label class="radio-box"> <input type="radio" name="menuType" value="F" /> 按钮 </label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
@@ -74,7 +73,6 @@
|
||||
</form>
|
||||
</div>
|
||||
<div th:include="include::footer"></div>
|
||||
<script th:src="@{/ajax/libs/iCheck/icheck.min.js}"></script>
|
||||
<script>
|
||||
var prefix = ctx + "system/menu"
|
||||
$("#form-menu-add").validate({
|
||||
@@ -89,6 +87,9 @@
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: {
|
||||
"parentId": function() {
|
||||
return $("input[name='parentId']").val();
|
||||
},
|
||||
"menuName" : function() {
|
||||
return $.common.trim($("#menuName").val());
|
||||
}
|
||||
@@ -146,16 +147,25 @@
|
||||
|
||||
/*菜单管理-新增-选择菜单树*/
|
||||
function selectMenuTree() {
|
||||
var menuId = $("#treeId").val();
|
||||
if(menuId > 0) {
|
||||
var url = prefix + "/selectMenuTree/" + menuId;
|
||||
$.modal.open("选择菜单", url, '380', '380');
|
||||
}
|
||||
else {
|
||||
var url = prefix + "/selectMenuTree/1";
|
||||
$.modal.open("选择菜单", url, '380', '380');
|
||||
}
|
||||
}
|
||||
var treeId = $("#treeId").val();
|
||||
var menuId = treeId > 0 ? treeId : 1;
|
||||
var url = prefix + "/selectMenuTree/" + menuId;
|
||||
var options = {
|
||||
title: '菜单选择',
|
||||
width: "380",
|
||||
height: "380",
|
||||
url: url,
|
||||
callBack: doSubmit
|
||||
};
|
||||
$.modal.openOptions(options);
|
||||
}
|
||||
|
||||
function doSubmit(index, layero){
|
||||
var body = layer.getChildFrame('body', index);
|
||||
$("#treeId").val(body.find('#treeId').val());
|
||||
$("#treeName").val(body.find('#treeName').val());
|
||||
layer.close(index);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
@@ -2,7 +2,6 @@
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
||||
<meta charset="utf-8">
|
||||
<head th:include="include :: header"></head>
|
||||
<link href="/ajax/libs/iCheck/custom.css" th:href="@{/ajax/libs/iCheck/custom.css}" rel="stylesheet"/>
|
||||
<body class="white-bg">
|
||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||
<form class="form-horizontal m" id="form-menu-edit" th:object="${menu}">
|
||||
@@ -17,9 +16,9 @@
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">菜单类型:</label>
|
||||
<div class="col-sm-8">
|
||||
<label class="checkbox-inline i-checks"> <input type="radio" th:field="*{menuType}" name="menuType" value="M" /> 目录 </label>
|
||||
<label class="checkbox-inline i-checks"> <input type="radio" th:field="*{menuType}" name="menuType" value="C" /> 菜单 </label>
|
||||
<label class="checkbox-inline i-checks"> <input type="radio" th:field="*{menuType}" name="menuType" value="F" /> 按钮 </label>
|
||||
<label class="radio-box"> <input type="radio" th:field="*{menuType}" name="menuType" value="M" /> 目录 </label>
|
||||
<label class="radio-box"> <input type="radio" th:field="*{menuType}" name="menuType" value="C" /> 菜单 </label>
|
||||
<label class="radio-box"> <input type="radio" th:field="*{menuType}" name="menuType" value="F" /> 按钮 </label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
@@ -75,11 +74,10 @@
|
||||
</form>
|
||||
</div>
|
||||
<div th:include="include::footer"></div>
|
||||
<script th:src="@{/ajax/libs/iCheck/icheck.min.js}"></script>
|
||||
<script>
|
||||
var prefix = ctx + "system/menu"
|
||||
|
||||
$(document).ready(function() {
|
||||
$(function() {
|
||||
var menuType = $('input[name="menuType"]:checked').val();
|
||||
menuVisible(menuType);
|
||||
});
|
||||
@@ -99,6 +97,9 @@
|
||||
"menuId": function() {
|
||||
return $("#menuId").val();
|
||||
},
|
||||
"parentId": function() {
|
||||
return $("input[name='parentId']").val();
|
||||
},
|
||||
"menuName": function() {
|
||||
return $.common.trim($("#menuName").val());
|
||||
}
|
||||
@@ -171,6 +172,31 @@
|
||||
$.modal.alertError("主菜单不能选择");
|
||||
}
|
||||
}
|
||||
|
||||
function selectMenuTree() {
|
||||
var menuId = $("#treeId").val();
|
||||
if(menuId > 0) {
|
||||
var url = prefix + "/selectMenuTree/" + menuId;
|
||||
var options = {
|
||||
title: '菜单选择',
|
||||
width: "380",
|
||||
height: "380",
|
||||
url: url,
|
||||
callBack: doSubmit
|
||||
};
|
||||
$.modal.openOptions(options);
|
||||
}
|
||||
else {
|
||||
$.modal.alertError("主菜单不能选择");
|
||||
}
|
||||
}
|
||||
|
||||
function doSubmit(index, layero){
|
||||
var body = layer.getChildFrame('body', index);
|
||||
$("#treeId").val(body.find('#treeId').val());
|
||||
$("#treeName").val(body.find('#treeName').val());
|
||||
layer.close(index);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
@@ -62,7 +62,7 @@
|
||||
field: 'menuName',
|
||||
width: '20%',
|
||||
formatter: function(value, row, index) {
|
||||
if (row.icon == null || row == "") {
|
||||
if ($.common.isEmpty(row.icon)) {
|
||||
return row.menuName;
|
||||
} else {
|
||||
return '<i class="' + row.icon + '"></i> <span class="nav-label">' + row.menuName + '</span>';
|
||||
|
@@ -10,161 +10,38 @@ button{font-family: "SimSun","Helvetica Neue",Helvetica,Arial;}
|
||||
<body class="hold-transition box box-main">
|
||||
<input id="treeId" name="treeId" type="hidden" th:value="${menu.menuId}"/>
|
||||
<input id="treeName" name="treeName" type="hidden" th:value="${menu.menuName}"/>
|
||||
<div class="wrapper"><div class="treeShowHideButton" onclick="search();">
|
||||
<div class="wrapper"><div class="treeShowHideButton" onclick="$.tree.toggleSearch();">
|
||||
<label id="btnShow" title="显示搜索" style="display:none;">︾</label>
|
||||
<label id="btnHide" title="隐藏搜索">︽</label>
|
||||
</div>
|
||||
<div class="treeSearchInput" id="search">
|
||||
<label for="keyword">关键字:</label><input type="text" class="empty" id="keyword" maxlength="50">
|
||||
<button class="btn" id="btn" onclick="searchNode()"> 搜索 </button>
|
||||
<button class="btn" id="btn" onclick="$.tree.searchNode()"> 搜索 </button>
|
||||
</div>
|
||||
<div class="treeExpandCollapse">
|
||||
<a href="javascript:" id="btnExpand">展开</a> /
|
||||
<a href="javascript:" id="btnCollapse">折叠</a>
|
||||
<a href="#" onclick="$.tree.expand()">展开</a> /
|
||||
<a href="#" onclick="$.tree.collapse()">折叠</a>
|
||||
</div>
|
||||
<div id="tree" class="ztree treeselect"></div>
|
||||
</div>
|
||||
<div class="layui-layer-btn">
|
||||
<a class="layui-layer-btn0" th:onclick="'javascript:loadObj()'"><i class="fa fa-check"></i> 确定</a>
|
||||
<a class="layui-layer-btn1" onclick="$.modal.close()"><i class="fa fa-close"></i> 关闭</a>
|
||||
</div>
|
||||
<div th:include="include::footer"></div>
|
||||
<script th:src="@{/ajax/libs/jquery-ztree/3.5/js/jquery.ztree.all-3.5.js}"></script>
|
||||
<script th:inline="javascript">
|
||||
// 树结构初始化加载
|
||||
var setting = {view:{selectedMulti:false},data:{key:{title:"title"},simpleData:{enable:true}},
|
||||
callback:{onClick:function(event, treeId, treeNode){
|
||||
var treeId = treeNode.id;
|
||||
var treeName = treeNode.name;
|
||||
$("#treeId").val(treeId);
|
||||
$("#treeName").val(treeName);
|
||||
}}
|
||||
}, tree, loadTree = function(){
|
||||
$.get(ctx + "system/menu/menuTreeData", function(data) {
|
||||
var treeName = $("#treeName").val();
|
||||
tree = $.fn.zTree.init($("#tree"), setting, data);
|
||||
// 展开第一级节点
|
||||
var nodes = tree.getNodesByParam("level", 0);
|
||||
for (var i = 0; i < nodes.length; i++) {
|
||||
tree.expandNode(nodes[i], false, false, false);
|
||||
selectCheckNode(treeName,nodes[i]);
|
||||
}
|
||||
}, null, null, "正在加载,请稍后...");
|
||||
};
|
||||
|
||||
$(function() {
|
||||
loadTree();
|
||||
var url = ctx + "system/menu/menuTreeData";
|
||||
var options = {
|
||||
url: url,
|
||||
expandLevel: 1,
|
||||
onClick : zOnClick
|
||||
};
|
||||
$.tree.init(options);
|
||||
});
|
||||
|
||||
function selectCheckNode(treeName, node) {
|
||||
if(treeName == node.name){
|
||||
tree.selectNode(node, true);
|
||||
}
|
||||
}
|
||||
|
||||
$('#btnExpand').click(function() {
|
||||
tree.expandAll(true);
|
||||
});
|
||||
$('#btnCollapse').click(function() {
|
||||
tree.expandAll(false);
|
||||
});
|
||||
|
||||
function loadObj(){
|
||||
var treeId = $("#treeId").val();
|
||||
var treeName = $("#treeName").val();
|
||||
parent.$("#treeId").val(treeId);
|
||||
parent.$("#treeName").val(treeName);
|
||||
var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引
|
||||
parent.layer.close(index);
|
||||
}
|
||||
|
||||
var lastValue = "", nodeList = [], key = $("#keyword");
|
||||
key.bind("focus", focusKey).bind("blur", blurKey).bind("change cut input propertychange", searchNode);
|
||||
key.bind("keydown", function (e){if(e.which == 13){searchNode();}});
|
||||
|
||||
function focusKey(e) {
|
||||
if (key.hasClass("empty")) {
|
||||
key.removeClass("empty");
|
||||
}
|
||||
}
|
||||
|
||||
function blurKey(e) {
|
||||
if (key.get(0).value === "") {
|
||||
key.addClass("empty");
|
||||
}
|
||||
searchNode(e);
|
||||
}
|
||||
|
||||
function searchNode() {
|
||||
var value = $.trim(key.get(0).value);
|
||||
var keyType = "name";
|
||||
if (lastValue === value) {
|
||||
return;
|
||||
}
|
||||
lastValue = value;
|
||||
var nodes = tree.getNodes();
|
||||
if (value == "") {
|
||||
showAllNode(nodes);
|
||||
return;
|
||||
}
|
||||
hideAllNode(nodes);
|
||||
nodeList = tree.getNodesByParamFuzzy(keyType, value);
|
||||
updateNodes(nodeList);
|
||||
}
|
||||
|
||||
function hideAllNode(nodes){
|
||||
var tree = $.fn.zTree.getZTreeObj("tree");
|
||||
nodes = tree.transformToArray(nodes);
|
||||
for(var i=nodes.length-1; i>=0; i--) {
|
||||
tree.hideNode(nodes[i]);
|
||||
}
|
||||
}
|
||||
|
||||
function showAllNode(nodes){
|
||||
nodes = tree.transformToArray(nodes);
|
||||
for(var i=nodes.length-1; i>=0; i--) {
|
||||
if(nodes[i].getParentNode()!=null){
|
||||
tree.expandNode(nodes[i],false,false,false,false);
|
||||
}else{
|
||||
tree.expandNode(nodes[i],true,true,false,false);
|
||||
}
|
||||
tree.showNode(nodes[i]);
|
||||
showAllNode(nodes[i].children);
|
||||
}
|
||||
}
|
||||
|
||||
function updateNodes(nodeList) {
|
||||
tree.showNodes(nodeList);
|
||||
for(var i=0, l=nodeList.length; i<l; i++) {
|
||||
var treeNode = nodeList[i];
|
||||
showChildren(treeNode);
|
||||
showParent(treeNode)
|
||||
}
|
||||
}
|
||||
|
||||
function showChildren(treeNode){
|
||||
if (treeNode.isParent){
|
||||
for(var idx in treeNode.children){
|
||||
var node = treeNode.children[idx];
|
||||
tree.showNode(node);
|
||||
showChildren(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
function showParent(treeNode){
|
||||
var parentNode;
|
||||
while((parentNode = treeNode.getParentNode()) != null){
|
||||
tree.showNode(parentNode);
|
||||
tree.expandNode(parentNode, true, false, false);
|
||||
treeNode = parentNode;
|
||||
}
|
||||
}
|
||||
|
||||
function search($this) {
|
||||
$('#search').slideToggle(200);
|
||||
$('#btnShow').toggle();
|
||||
$('#btnHide').toggle();
|
||||
$('#keyword').focus();
|
||||
|
||||
function zOnClick(event, treeId, treeNode) {
|
||||
var treeId = treeNode.id;
|
||||
var treeName = treeNode.name;
|
||||
$("#treeId").val(treeId);
|
||||
$("#treeName").val(treeName);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
@@ -2,7 +2,7 @@
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
||||
<meta charset="utf-8">
|
||||
<head th:include="include :: header"></head>
|
||||
<link href="/ajax/libs/jquery-ztree/3.5/css/metro/zTreeStyle.css" th:href="@{/ajax/libs/jquery-ztree/3.5/css/metro/zTreeStyle.css}" rel="stylesheet"/>
|
||||
<link th:href="@{/ajax/libs/jquery-ztree/3.5/css/metro/zTreeStyle.css}" rel="stylesheet"/>
|
||||
<body class="white-bg">
|
||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||
<form class="form-horizontal m" id="form-role-add">
|
||||
@@ -59,24 +59,17 @@
|
||||
<div th:include="include::footer"></div>
|
||||
<script th:src="@{/ajax/libs/jquery-ztree/3.5/js/jquery.ztree.all-3.5.js}"></script>
|
||||
<script type="text/javascript">
|
||||
// 树结构初始化加载
|
||||
var setting = {
|
||||
check:{enable:true,nocheckInherit:true,chkboxType:{"Y":"ps","N":"ps"}},
|
||||
view:{selectedMulti:false,nameIsHTML: true},
|
||||
data:{simpleData:{enable:true},key:{title:"title"}},
|
||||
callback:{
|
||||
beforeClick: function (treeId, treeNode, clickFlag) {
|
||||
var menuTrees = $.fn.zTree.getZTreeObj(treeId);
|
||||
menuTrees.checkNode(treeNode, !treeNode.checked, true, true);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}, menuTrees, loadTree = function(){
|
||||
$.get(ctx + "system/menu/roleMenuTreeData", function(data) {
|
||||
menuTrees = $.fn.zTree.init($("#menuTrees"), setting, data); //.expandAll(true);
|
||||
}, null, null, "正在加载,请稍后...");
|
||||
};loadTree();
|
||||
|
||||
$(function() {
|
||||
var url = ctx + "system/menu/roleMenuTreeData";
|
||||
var options = {
|
||||
id: "menuTrees",
|
||||
url: url,
|
||||
check: { enable: true, nocheckInherit: true, chkboxType: { "Y": "ps", "N": "ps" } },
|
||||
expandLevel: 0
|
||||
};
|
||||
$.tree.init(options);
|
||||
});
|
||||
|
||||
$("#form-role-add").validate({
|
||||
rules:{
|
||||
roleName:{
|
||||
@@ -129,26 +122,13 @@
|
||||
}
|
||||
});
|
||||
|
||||
function selectCheckeds() {
|
||||
var menuIds = "";
|
||||
var treeNodes = menuTrees.getCheckedNodes(true);
|
||||
for (var i = 0; i < treeNodes.length; i++) {
|
||||
if (0 == i) {
|
||||
menuIds = treeNodes[i].id;
|
||||
} else {
|
||||
menuIds += ("," + treeNodes[i].id);
|
||||
}
|
||||
}
|
||||
return menuIds;
|
||||
}
|
||||
|
||||
function add() {
|
||||
var roleName = $("input[name='roleName']").val();
|
||||
var roleKey = $("input[name='roleKey']").val();
|
||||
var roleSort = $("input[name='roleSort']").val();
|
||||
var status = $("input[name='status']").is(':checked') == true ? 0 : 1;
|
||||
var remark = $("input[name='remark']").val();
|
||||
var menuIds = selectCheckeds();
|
||||
var menuIds = $.tree.getCheckedNodes();
|
||||
$.ajax({
|
||||
cache : true,
|
||||
type : "POST",
|
||||
|
@@ -2,7 +2,7 @@
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
||||
<meta charset="utf-8">
|
||||
<head th:include="include :: header"></head>
|
||||
<link href="/ajax/libs/jquery-ztree/3.5/css/metro/zTreeStyle.css" th:href="@{/ajax/libs/jquery-ztree/3.5/css/metro/zTreeStyle.css}" rel="stylesheet"/>
|
||||
<link th:href="@{/ajax/libs/jquery-ztree/3.5/css/metro/zTreeStyle.css}" rel="stylesheet"/>
|
||||
<body class="white-bg">
|
||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||
<form class="form-horizontal m" id="form-role-edit" th:object="${role}">
|
||||
@@ -60,23 +60,16 @@
|
||||
<div th:include="include::footer"></div>
|
||||
<script th:src="@{/ajax/libs/jquery-ztree/3.5/js/jquery.ztree.all-3.5.js}"></script>
|
||||
<script type="text/javascript">
|
||||
// 树结构初始化加载
|
||||
var setting = {
|
||||
check:{enable:true,nocheckInherit:true,chkboxType:{"Y":"ps","N":"ps"}},
|
||||
view:{selectedMulti:false,nameIsHTML: true},
|
||||
data:{simpleData:{enable:true},key:{title:"title"}},
|
||||
callback:{
|
||||
beforeClick: function (treeId, treeNode, clickFlag) {
|
||||
var menuTrees = $.fn.zTree.getZTreeObj(treeId);
|
||||
menuTrees.checkNode(treeNode, !treeNode.checked, true, true);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}, menuTrees, loadTree = function(){
|
||||
$.get(ctx + "system/menu/roleMenuTreeData?roleId=" + $("#roleId").val(), function(data) {
|
||||
menuTrees = $.fn.zTree.init($("#menuTrees"), setting, data); //.expandAll(true);
|
||||
}, null, null, "正在加载,请稍后...");
|
||||
};loadTree();
|
||||
$(function() {
|
||||
var url = ctx + "system/menu/roleMenuTreeData?roleId=" + $("#roleId").val();
|
||||
var options = {
|
||||
id: "menuTrees",
|
||||
url: url,
|
||||
check: { enable: true, nocheckInherit: true, chkboxType: { "Y": "ps", "N": "ps" } },
|
||||
expandLevel: 0
|
||||
};
|
||||
$.tree.init(options);
|
||||
});
|
||||
|
||||
$("#form-role-edit").validate({
|
||||
rules:{
|
||||
@@ -135,20 +128,7 @@
|
||||
edit();
|
||||
}
|
||||
});
|
||||
|
||||
function selectCheckeds() {
|
||||
var menuIds = "";
|
||||
var treeNodes = menuTrees.getCheckedNodes(true);
|
||||
for (var i = 0; i < treeNodes.length; i++) {
|
||||
if (0 == i) {
|
||||
menuIds = treeNodes[i].id;
|
||||
} else {
|
||||
menuIds += ("," + treeNodes[i].id);
|
||||
}
|
||||
}
|
||||
return menuIds;
|
||||
}
|
||||
|
||||
|
||||
function edit() {
|
||||
var roleId = $("input[name='roleId']").val();
|
||||
var roleName = $("input[name='roleName']").val();
|
||||
@@ -156,7 +136,7 @@
|
||||
var roleSort = $("input[name='roleSort']").val();
|
||||
var status = $("input[name='status']").is(':checked') == true ? 0 : 1;
|
||||
var remark = $("input[name='remark']").val();
|
||||
var menuIds = selectCheckeds();
|
||||
var menuIds = $.tree.getCheckedNodes();
|
||||
$.ajax({
|
||||
cache : true,
|
||||
type : "POST",
|
||||
|
@@ -112,6 +112,7 @@
|
||||
formatter: function(value, row, index) {
|
||||
var actions = [];
|
||||
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.roleId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
|
||||
actions.push('<a class="btn btn-primary btn-xs ' + removeFlag + '" href="#" onclick="rule(\'' + row.roleId + '\')"><i class="fa fa-check-square-o"></i>权限</a> ');
|
||||
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.roleId + '\')"><i class="fa fa-remove"></i>删除</a>');
|
||||
return actions.join('');
|
||||
}
|
||||
@@ -119,6 +120,12 @@
|
||||
};
|
||||
$.table.init(options);
|
||||
});
|
||||
|
||||
/*角色管理-分配数据权限*/
|
||||
function rule(roleId) {
|
||||
var url = prefix + '/rule/' + roleId;
|
||||
$.modal.open("分配数据权限", url);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
110
src/main/resources/templates/system/role/rule.html
Normal file
110
src/main/resources/templates/system/role/rule.html
Normal file
@@ -0,0 +1,110 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
||||
<meta charset="utf-8">
|
||||
<head th:include="include :: header"></head>
|
||||
<link th:href="@{/ajax/libs/jquery-ztree/3.5/css/metro/zTreeStyle.css}" rel="stylesheet"/>
|
||||
<body class="white-bg">
|
||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||
<form class="form-horizontal m" id="form-role-edit" th:object="${role}">
|
||||
<input id="roleId" name="roleId" type="hidden" th:field="*{roleId}"/>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label ">角色名称:</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" type="text" name="roleName" id="roleName" th:field="*{roleName}" readonly="true"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">权限字符:</label>
|
||||
<div class="col-sm-8">
|
||||
<input class="form-control" type="text" name="roleKey" id="roleKey" th:field="*{roleKey}" readonly="true">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">数据范围:</label>
|
||||
<div class="col-sm-8">
|
||||
<select id="dataScope" name="dataScope" class="form-control m-b">
|
||||
<option value="1" th:field="*{dataScope}">全部数据权限</option>
|
||||
<option value="2" th:field="*{dataScope}">自定数据权限</option>
|
||||
</select>
|
||||
<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 特殊情况下,设置为“自定数据权限”</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" id="roleRule" style="display: none">
|
||||
<label class="col-sm-3 control-label">数据权限</label>
|
||||
<div class="col-sm-8">
|
||||
<div id="deptTrees" class="ztree"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="form-control-static col-sm-offset-9">
|
||||
<button type="submit" class="btn btn-primary">提交</button>
|
||||
<button onclick="$.modal.close()" class="btn btn-danger" type="button">关闭</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div th:include="include::footer"></div>
|
||||
<script th:src="@{/ajax/libs/jquery-ztree/3.5/js/jquery.ztree.all-3.5.js}"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
$(function() {
|
||||
var url = ctx + "system/dept/roleDeptTreeData?roleId=" + $("#roleId").val();
|
||||
var options = {
|
||||
id: "deptTrees",
|
||||
url: url,
|
||||
check: { enable: true, nocheckInherit: true, chkboxType: { "Y": "ps", "N": "ps" } },
|
||||
expandLevel: 2
|
||||
};
|
||||
$.tree.init(options);
|
||||
$("#dataScope").change();
|
||||
});
|
||||
|
||||
$("#form-role-edit").validate({
|
||||
submitHandler:function(form){
|
||||
edit();
|
||||
}
|
||||
});
|
||||
|
||||
function edit() {
|
||||
var roleId = $("input[name='roleId']").val();
|
||||
var roleName = $("input[name='roleName']").val();
|
||||
var roleKey = $("input[name='roleKey']").val();
|
||||
var dataScope = $("#dataScope").val();
|
||||
var deptIds = $.tree.getCheckedNodes();
|
||||
$.ajax({
|
||||
cache : true,
|
||||
type : "POST",
|
||||
url : ctx + "system/role/rule",
|
||||
data : {
|
||||
"roleId": roleId,
|
||||
"roleName": roleName,
|
||||
"roleKey": roleKey,
|
||||
"dataScope": dataScope,
|
||||
"deptIds": deptIds
|
||||
},
|
||||
async : false,
|
||||
error : function(request) {
|
||||
$.modal.alertError("系统错误");
|
||||
},
|
||||
success : function(data) {
|
||||
$.operate.saveSuccess(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$("#dataScope").change(function(event){
|
||||
var dataScope = $(event.target).val();
|
||||
dataScopeVisible(dataScope);
|
||||
});
|
||||
|
||||
function dataScopeVisible(dataScope) {
|
||||
if (dataScope == 2) {
|
||||
$("#roleRule").show();
|
||||
} else {
|
||||
$._tree.checkAllNodes(false);
|
||||
$("#roleRule").hide();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@@ -2,7 +2,6 @@
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
||||
<meta charset="utf-8">
|
||||
<head th:include="include :: header"></head>
|
||||
<link th:href="@{/ajax/libs/iCheck/custom.css}" rel="stylesheet"/>
|
||||
<body class="white-bg">
|
||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||
<form class="form-horizontal m" id="form-user-add">
|
||||
@@ -75,7 +74,7 @@
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">角色:</label>
|
||||
<div class="col-sm-8">
|
||||
<label th:each="role:${roles}" class="checkbox-inline i-checks">
|
||||
<label th:each="role:${roles}" class="check-box">
|
||||
<input name="role" type="checkbox" th:value="${role.roleId}" th:text="${role.roleName}" th:disabled="${role.status == '1'}">
|
||||
</label>
|
||||
</div>
|
||||
@@ -90,7 +89,6 @@
|
||||
</form>
|
||||
</div>
|
||||
<div th:include="include::footer"></div>
|
||||
<script th:src="@{/ajax/libs/iCheck/icheck.min.js}"></script>
|
||||
<script th:src="@{/ajax/libs/select/select2.js}"></script>
|
||||
<script>
|
||||
$("#form-user-add").validate({
|
||||
@@ -217,10 +215,27 @@
|
||||
/*用户管理-新增-选择部门树*/
|
||||
function selectDeptTree() {
|
||||
var treeId = $("#treeId").val();
|
||||
var deptId = treeId == null || treeId == "" ? "100" : treeId;
|
||||
var deptId = $.common.isEmpty(treeId) ? "100" : $("#treeId").val();
|
||||
var url = ctx + "system/dept/selectDeptTree/" + deptId;
|
||||
$.modal.open("选择部门", url, '380', '380');
|
||||
}
|
||||
var options = {
|
||||
title: '选择部门',
|
||||
width: "380",
|
||||
height: "380",
|
||||
url: ctx + "system/dept/selectDeptTree/" + deptId,
|
||||
callBack: doSubmit
|
||||
};
|
||||
$.modal.openOptions(options);
|
||||
}
|
||||
|
||||
function doSubmit(index, layero){
|
||||
var tree = layero.find("iframe")[0].contentWindow.$._tree;
|
||||
if ($.tree.notAllowParents(tree)) {
|
||||
var body = layer.getChildFrame('body', index);
|
||||
$("#treeId").val(body.find('#treeId').val());
|
||||
$("#treeName").val(body.find('#treeName').val());
|
||||
layer.close(index);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
@@ -2,7 +2,6 @@
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
||||
<meta charset="utf-8">
|
||||
<head th:include="include :: header"></head>
|
||||
<link href="/ajax/libs/iCheck/custom.css" th:href="@{/ajax/libs/iCheck/custom.css}" rel="stylesheet"/>
|
||||
<body class="white-bg">
|
||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||
<form class="form-horizontal m" id="form-user-edit" th:object="${user}">
|
||||
@@ -70,7 +69,7 @@
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">角色:</label>
|
||||
<div class="col-sm-8">
|
||||
<label th:each="role:${roles}" class="checkbox-inline i-checks">
|
||||
<label th:each="role:${roles}" class="check-box">
|
||||
<input name="role" type="checkbox" th:value="${role.roleId}" th:text="${role.roleName}" th:checked="${role.flag}" th:disabled="${role.status == '1'}">
|
||||
</label>
|
||||
</div>
|
||||
@@ -85,7 +84,6 @@
|
||||
</form>
|
||||
</div>
|
||||
<div th:include="include::footer"></div>
|
||||
<script th:src="@{/ajax/libs/iCheck/icheck.min.js}"></script>
|
||||
<script th:src="@{/ajax/libs/select/select2.js}"></script>
|
||||
<script>
|
||||
$("#form-user-edit").validate({
|
||||
@@ -189,8 +187,25 @@
|
||||
function selectDeptTree() {
|
||||
var deptId = $("#treeId").val();
|
||||
var url = ctx + "system/dept/selectDeptTree/" + deptId;
|
||||
$.modal.open("选择部门", url, '380', '380');
|
||||
}
|
||||
var options = {
|
||||
title: '选择部门',
|
||||
width: "380",
|
||||
height: "380",
|
||||
url: url,
|
||||
callBack: doSubmit
|
||||
};
|
||||
$.modal.openOptions(options);
|
||||
}
|
||||
|
||||
function doSubmit(index, layero){
|
||||
var tree = layero.find("iframe")[0].contentWindow.$._tree;
|
||||
if ($.tree.notAllowParents(tree)) {
|
||||
var body = layer.getChildFrame('body', index);
|
||||
$("#treeId").val(body.find('#treeId').val());
|
||||
$("#treeName").val(body.find('#treeName').val());
|
||||
layer.close(index);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
@@ -2,7 +2,7 @@
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
||||
<meta charset="utf-8">
|
||||
<title>用户头像修改</title>
|
||||
<link href="/ajax/libs/cropbox/cropbox.css" th:href="@{/ajax/libs/cropbox/cropbox.css}" rel="stylesheet"/>
|
||||
<link th:href="@{/ajax/libs/cropbox/cropbox.css}" rel="stylesheet"/>
|
||||
<body class="white-bg">
|
||||
<input name="userId" id="userId" type="hidden" th:value="${user.userId}" />
|
||||
<div class="container">
|
||||
|
@@ -6,10 +6,10 @@
|
||||
<!--360浏览器优先以webkit内核解析-->
|
||||
<title>个人信息</title>
|
||||
<link rel="shortcut icon" href="favicon.ico">
|
||||
<link href="../static/css/bootstrap.min.css" th:href="@{/css/bootstrap.min.css}" rel="stylesheet"/>
|
||||
<link href="../static/css/font-awesome.min.css" th:href="@{/css/font-awesome.css}" rel="stylesheet"/>
|
||||
<link href="../static/css/main/animate.min.css" th:href="@{/css/main/animate.min.css}" rel="stylesheet"/>
|
||||
<link href="../static/css/main/style.min862f.css" th:href="@{/css/main/style.min862f.css}" rel="stylesheet"/>
|
||||
<link th:href="@{/css/bootstrap.min.css}" rel="stylesheet"/>
|
||||
<link th:href="@{/css/font-awesome.min.css}" rel="stylesheet"/>
|
||||
<link th:href="@{/css/main/animate.min.css}" rel="stylesheet"/>
|
||||
<link th:href="@{/css/main/style.min862f.css}" rel="stylesheet"/>
|
||||
</head>
|
||||
|
||||
<body class="gray-bg">
|
||||
|
@@ -3,8 +3,8 @@
|
||||
xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
|
||||
<meta charset="utf-8">
|
||||
<head th:include="include :: header"></head>
|
||||
<link href="/ajax/libs/jquery-layout/jquery.layout-latest.css" th:href="@{/ajax/libs/jquery-layout/jquery.layout-latest.css}" rel="stylesheet"/>
|
||||
<link href="/ajax/libs/jquery-ztree/3.5/css/metro/zTreeStyle.css" th:href="@{/ajax/libs/jquery-ztree/3.5/css/metro/zTreeStyle.css}" rel="stylesheet"/>
|
||||
<link th:href="@{/ajax/libs/jquery-layout/jquery.layout-latest.css}" rel="stylesheet"/>
|
||||
<link th:href="@{/ajax/libs/jquery-ztree/3.5/css/metro/zTreeStyle.css}" rel="stylesheet"/>
|
||||
|
||||
<body class="gray-bg">
|
||||
<div class="ui-layout-west">
|
||||
@@ -15,10 +15,10 @@
|
||||
<i class="fa icon-grid"></i> 组织机构
|
||||
</div>
|
||||
<div class="box-tools pull-right">
|
||||
<a type="button" class="btn btn-box-tool menuItem" href="#" onclick="dept()" title="管理机构"><i class="fa fa-edit"></i></a>
|
||||
<a type="button" class="btn btn-box-tool menuItem" href="#" onclick="dept()" title="管理部门"><i class="fa fa-edit"></i></a>
|
||||
<button type="button" class="btn btn-box-tool" id="btnExpand" title="展开" style="display:none;"><i class="fa fa-chevron-up"></i></button>
|
||||
<button type="button" class="btn btn-box-tool" id="btnCollapse" title="折叠"><i class="fa fa-chevron-down"></i></button>
|
||||
<button type="button" class="btn btn-box-tool" id="btnRefresh" title="刷新机构"><i class="fa fa-refresh"></i></button>
|
||||
<button type="button" class="btn btn-box-tool" id="btnRefresh" title="刷新部门"><i class="fa fa-refresh"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ui-layout-content">
|
||||
@@ -87,10 +87,10 @@
|
||||
var datas = [[${@dict.getType('sys_normal_disable')}]];
|
||||
var prefix = ctx + "system/user"
|
||||
|
||||
$(document).ready(function(){
|
||||
$(function() {
|
||||
$('body').layout({ west__size: 185 });
|
||||
queryUserList();
|
||||
queryDeptTreeDaTa();
|
||||
queryDeptTree();
|
||||
});
|
||||
|
||||
function queryUserList() {
|
||||
@@ -161,46 +161,39 @@
|
||||
};
|
||||
$.table.init(options);
|
||||
}
|
||||
|
||||
function queryDeptTreeDaTa()
|
||||
|
||||
function queryDeptTree()
|
||||
{
|
||||
// 树结构初始化加载
|
||||
var setting = {view:{selectedMulti:false},data:{key:{title:"title"},simpleData:{enable:true}},
|
||||
callback:{onClick:function(event, treeId, treeNode){
|
||||
$("#deptId").val(treeNode.id);
|
||||
$("#parentId").val(treeNode.pId);
|
||||
$.table.search();
|
||||
}}
|
||||
}, tree, loadTree = function(){
|
||||
$.get(ctx + "system/dept/treeData", function(data) {
|
||||
tree = $.fn.zTree.init($("#tree"), setting, data); //.expandAll(true);
|
||||
// 展开第一级节点
|
||||
var nodes = tree.getNodesByParam("level", 0);
|
||||
for (var i = 0; i < nodes.length; i++) {
|
||||
tree.expandNode(nodes[i], true, false, false);
|
||||
}
|
||||
// 展开第二级节点
|
||||
nodes = tree.getNodesByParam("level", 1);
|
||||
for (var i = 0; i < nodes.length; i++) {
|
||||
tree.expandNode(nodes[i], true, false, false);
|
||||
}
|
||||
}, null, null, "正在加载,请稍后...");
|
||||
};loadTree();
|
||||
var url = ctx + "system/dept/treeData";
|
||||
var options = {
|
||||
url: url,
|
||||
expandLevel: 2,
|
||||
onClick : zOnClick
|
||||
};
|
||||
$.tree.init(options);
|
||||
|
||||
$('#btnExpand').click(function() {
|
||||
tree.expandAll(true);
|
||||
$(this).hide();
|
||||
$('#btnCollapse').show();
|
||||
});
|
||||
$('#btnCollapse').click(function() {
|
||||
tree.expandAll(false);
|
||||
$(this).hide();
|
||||
$('#btnExpand').show();
|
||||
});
|
||||
$('#btnRefresh').click(function() {
|
||||
loadTree();
|
||||
});
|
||||
function zOnClick(event, treeId, treeNode) {
|
||||
$("#deptId").val(treeNode.id);
|
||||
$("#parentId").val(treeNode.pId);
|
||||
$.table.search();
|
||||
}
|
||||
}
|
||||
|
||||
$('#btnExpand').click(function() {
|
||||
$._tree.expandAll(true);
|
||||
$(this).hide();
|
||||
$('#btnCollapse').show();
|
||||
});
|
||||
|
||||
$('#btnCollapse').click(function() {
|
||||
$._tree.expandAll(false);
|
||||
$(this).hide();
|
||||
$('#btnExpand').show();
|
||||
});
|
||||
|
||||
$('#btnRefresh').click(function() {
|
||||
queryDeptTree();
|
||||
});
|
||||
|
||||
/*用户管理-部门*/
|
||||
function dept() {
|
||||
|
Reference in New Issue
Block a user