提交 1b08ec14 编写于 作者: doc_wei's avatar doc_wei

角色PC端菜单权限整改完成

上级 300dcf07
layui.config({
base: basePath,
version: skyeyeVersion
}).extend({
window: 'js/winui.window'
}).define(['window', 'table', 'jquery', 'winui', 'fsCommon', 'fsTree', 'form'], function (exports) {
winui.renderColor();
var index = parent.layer.getFrameIndex(window.name);
var $ = layui.$,
form = layui.form,
fsTree = layui.fsTree,
fsCommon = layui.fsCommon;
var checkeRows = '';
matchingLanguage();
form.render();
form.on('submit(formEditBean)', function (data) {
if (winui.verifyForm(data.elem)) {
var tree = $.fn.zTree.getZTreeObj("treeDemo");
var nodes = tree.getCheckedNodes(true);
var menuIds = new Array();
for(var i = 0; i < nodes.length; i++){
menuIds.push(nodes[i].id);
}
var params = {
roleName: $("#roleName").html(),
roleDesc: $("#roleDesc").html(),
menuIds: JSON.stringify(menuIds),
rowId: parent.rowId
};
AjaxPostUtil.request({url: reqBasePath + "editSysRolePCAuth", params: params, type: 'json', method: "PUT", callback: function(json){
if(json.returnCode == 0){
parent.layer.close(index);
parent.refreshCode = '0';
}else{
winui.window.msg(json.returnMessage, {icon: 2, time: 2000});
}
}});
}
return false;
});
/********* tree 处理 start *************/
var trees = {};
var treeDoms = $("ul.fsTree");
AjaxPostUtil.request({url: reqBasePath + "sys016", params: {rowId: parent.rowId}, type: 'json', method: "GET", callback: function(json){
if(json.returnCode == 0){
$("#roleName").text(json.bean.roleName);
$("#roleDesc").text(json.bean.roleDesc);
checkeRows = json.rows;
if(treeDoms.length > 0) {
$(treeDoms).each(function(i) {
var treeId = $(this).attr("id");
var funcNo = $(this).attr("funcNo");
var url = $(this).attr("url");
var tree = fsTree.render({
id: treeId,
funcNo: funcNo,
url: url + "?userToken=" + getCookie('userToken') + "&loginPCIp=" + returnCitySN["cip"],
getTree: getTree,
checkEnable: true,
loadEnable: false,
showLine: false,
showIcon: false,
addDiyDom: addDiyDom,
fontCss: setFontCss
}, function(id){
var zTreeObj = $.fn.zTree.getZTreeObj(id);
var zTree = zTreeObj.getCheckedNodes(false);
for (var i = 0; i < zTree.length; i++) {
for(var j = 0; j < checkeRows.length; j++){
if(zTree[i].id == checkeRows[j].menuId){
zTreeObj.checkNode(zTree[i], true);
}
}
}
var li_head = ' <li class="head"><a><div class="diy">所属系统</div><div class="diy">菜单权限</div><div class="diy">菜单类型</div></a></li>';
var rows = $("#" + treeId).find('li');
if(rows.length > 0) {
rows.eq(0).before(li_head)
} else {
$("#" + treeId).append(li_head);
$("#" + treeId).append('<li ><div style="text-align: center;line-height: 30px;" >无符合条件数据</div></li>')
}
});
if(treeDoms.length == 1) {
trees[treeId] = tree;
} else {
//深度拷贝对象
trees[treeId] = $.extend(true, {}, tree);
}
});
//绑定按钮事件
fsCommon.buttonEvent("tree", getTree);
}
}else{
winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
function getTree(treeId) {
if($.isEmpty(trees)) {
fsCommon.warnMsg("未配置tree!");
return;
}
if($.isEmpty(treeId)) {
treeId = "treeDemo";
}
return trees[treeId];
}
/********* tree 处理 end *************/
/**
* 自定义DOM节点
*/
function addDiyDom(treeId, treeNode) {
var spaceWidth = 15;
var liObj = $("#" + treeNode.tId);
var aObj = $("#" + treeNode.tId + "_a");
var switchObj = $("#" + treeNode.tId + "_switch");
var icoObj = $("#" + treeNode.tId + "_ico");
var spanObj = $("#" + treeNode.tId + "_span");
aObj.attr('title', '');
aObj.append('<div class="diy swich"></div>');
var div = $(liObj).find('div').eq(0);
switchObj.remove();
spanObj.remove();
icoObj.remove();
div.append(switchObj);
div.append(spanObj);
var spaceStr = "<span style='height:1px;display: inline-block;width:" + (spaceWidth * treeNode.level) + "px'></span>";
switchObj.before(spaceStr);
var editStr = '';
editStr = '<div class="diy">' + (treeNode.sysName == null ? ' ' : treeNode.sysName) + '</div>';
aObj.before(editStr);
editStr = '<div class="diy">' + (treeNode.appType == null ? ' ' : treeNode.appType) + '</div>';
aObj.append(editStr);
editStr = '<div class="diy layui-hide">' + (treeNode.type == null ? ' ' : treeNode.type) + '</div>';
aObj.append(editStr);
}
var lastValue = "", nodeList = [], fontCss = {}, hiddenNodes = [];
$("#menuName").val('');
var key = $("#menuName");
key.bind("focus", focusKey)
.bind("blur", blurKey)
.bind("propertychange", searchNode) //property(属性)change(改变)的时候,触发事件
.bind("input", searchNode);
function focusKey(e) {
if (key.hasClass("empty")) {
key.removeClass("empty");
}
}
function blurKey(e) {
if (key.get(0).value === "") {
key.addClass("empty");
}
}
//搜索树
function searchNode(e) {
var zTreeObj = $.fn.zTree.getZTreeObj("treeDemo");
var value = $.trim(key.get(0).value);
var keyType = "name";
if (key.hasClass("empty")) {
value = "";
}
//显示上次搜索后背隐藏的结点
zTreeObj.showNodes(hiddenNodes);
//查找不符合条件的叶子节点
function filterFunc(node){
var _keywords = $("#menuName").val();
if(node.name.indexOf(_keywords) != -1)
return false;
if(node.isParent) {
//是父节点时需要判断子节点是否符合条件,是的话则父节点需要保留
var bl = CheckChildNodesIsContainKeyword(node);
return bl;
} else {
//是子节点时,需要判断父节点是否符合条件,是的话则子节点需要保留
var bl2 = CheckParentNodesIsContainKeyword(node);
return bl2;
}
return true;
};
//获取不符合条件的叶子结点
hiddenNodes = zTreeObj.getNodesByFilter(filterFunc);
//隐藏不符合条件的叶子结点
zTreeObj.hideNodes(hiddenNodes);
if (lastValue === value) return;
lastValue = value;
if (value === ""){
updateNodes(false);
return;
};
updateNodes(false);
nodeList = zTreeObj.getNodesByParamFuzzy(keyType, value); //调用ztree的模糊查询功能,得到符合条件的节点
updateNodes(true); //更新节点
};
//tree搜索时:是父节点时需要判断子节点是否符合条件,是的话则父节点需要保留
function CheckChildNodesIsContainKeyword(pNode) {
var childs = pNode.children;
var isexit = true;
if(!isNull(childs)){
for(var i = 0; i < childs.length; i++) {
if(childs[i].isParent) {
isexit = CheckChildNodesIsContainKeyword(childs[i]);
if(!isexit)
return isexit;
} else {
var _keywords = $("#menuName").val();
if(childs[i].name.indexOf(_keywords) != -1)
return false;
}
}
}
return true;
}
//tree 搜索时:子节点时,需要判断父节点是否符合条件,是的话则子节点需要保留
function CheckParentNodesIsContainKeyword(cNode) {
var pnode = cNode.getParentNode();
if(pnode != null) {
var _keywords = $("#menuName").val();
if(pnode.name.indexOf(_keywords) != -1)
return false;
else {
return CheckParentNodesIsContainKeyword(pnode)
}
}
return true;
}
//高亮显示被搜索到的节点
function updateNodes(highlight) {
var zTree = $.fn.zTree.getZTreeObj("treeDemo");
for( var i = 0; i < nodeList.length; i++) {
nodeList[i].highlight = highlight;//高亮显示搜索到的节点(highlight是自己设置的一个属性)
zTree.expandNode(nodeList[i].getParentNode(), true, false, false);//将搜索到的节点的父节点展开
zTree.updateNode(nodeList[i]);//更新节点数据,主要用于该节点显示属性的更新
}
}
function setFontCss(treeId, treeNode) {
return (!!treeNode.highlight) ? {color:"#00ff66", "font-weight":"bold"} : {color:"#333", "font-weight":"normal"};
}
// 取消
$("body").on("click", "#cancle", function(){
parent.layer.close(index);
});
});
\ No newline at end of file
...@@ -4,36 +4,26 @@ layui.config({ ...@@ -4,36 +4,26 @@ layui.config({
version: skyeyeVersion version: skyeyeVersion
}).extend({ }).extend({
window: 'js/winui.window' window: 'js/winui.window'
}).define(['window', 'table', 'jquery', 'winui', 'fsCommon', 'fsTree', 'textool', 'form'], function (exports) { }).define(['window', 'table', 'jquery', 'winui', 'textool', 'form'], function (exports) {
winui.renderColor(); winui.renderColor();
var index = parent.layer.getFrameIndex(window.name); var index = parent.layer.getFrameIndex(window.name);
var $ = layui.$, var $ = layui.$,
form = layui.form, form = layui.form,
fsTree = layui.fsTree,
fsCommon = layui.fsCommon,
textool = layui.textool; textool = layui.textool;
matchingLanguage();
form.render();
textool.init({ textool.init({
eleId: 'roleDesc', eleId: 'roleDesc',
maxlength: 250, maxlength: 250,
tools: ['count', 'copy', 'reset', 'clear'] tools: ['count', 'copy', 'reset', 'clear']
}); });
matchingLanguage();
form.render();
form.on('submit(formAddBean)', function (data) { form.on('submit(formAddBean)', function (data) {
if (winui.verifyForm(data.elem)) { if (winui.verifyForm(data.elem)) {
var tree = $.fn.zTree.getZTreeObj("treeDemo");
var nodes = tree.getCheckedNodes(true);
var menuIds = new Array();
for(var i = 0; i < nodes.length; i++){
menuIds.push(nodes[i].id);
}
var params = { var params = {
roleName: $("#roleName").val(), roleName: $("#roleName").val(),
roleDesc: $("#roleDesc").val(), roleDesc: $("#roleDesc").val()
menuIds: JSON.stringify(menuIds)
}; };
AjaxPostUtil.request({url: reqBasePath + "sys015", params: params, type: 'json', method: "POST", callback: function(json){ AjaxPostUtil.request({url: reqBasePath + "sys015", params: params, type: 'json', method: "POST", callback: function(json){
...@@ -48,202 +38,6 @@ layui.config({ ...@@ -48,202 +38,6 @@ layui.config({
return false; return false;
}); });
/********* tree 处理 start *************/
var trees = {};
var treeDoms = $("ul.fsTree");
if(treeDoms.length > 0) {
$(treeDoms).each(function(i) {
var treeId = $(this).attr("id");
var funcNo = $(this).attr("funcNo");
var url = $(this).attr("url");
var tree = fsTree.render({
id: treeId,
funcNo: funcNo,
url: url + "?userToken=" + getCookie('userToken') + "&loginPCIp=" + returnCitySN["cip"],
getTree: getTree,
checkEnable: true,
loadEnable: false,
showLine: false,
showIcon: false,
addDiyDom: addDiyDom,
fontCss: setFontCss,
expandSpeed: 'speed'
}, function(id){
var li_head = ' <li class="head"><a><div class="diy">所属系统</div><div class="diy">菜单权限</div><div class="diy">菜单类型</div></a></li>';
var rows = $("#" + treeId).find('li');
if(rows.length > 0) {
rows.eq(0).before(li_head)
} else {
$("#" + treeId).append(li_head);
$("#" + treeId).append('<li ><div style="text-align: center;line-height: 30px;" >无符合条件数据</div></li>')
}
});
if(treeDoms.length == 1) {
trees[treeId] = tree;
} else {
//深度拷贝对象
trees[treeId] = $.extend(true, {}, tree);
}
});
//绑定按钮事件
fsCommon.buttonEvent("tree", getTree);
}
function getTree(treeId) {
if($.isEmpty(trees)) {
fsCommon.warnMsg("未配置tree!");
return;
}
if($.isEmpty(treeId)) {
treeId = "treeDemo";
}
return trees[treeId];
}
/********* tree 处理 end *************/
/**
* 自定义DOM节点
*/
function addDiyDom(treeId, treeNode) {
var spaceWidth = 15;
var liObj = $("#" + treeNode.tId);
var aObj = $("#" + treeNode.tId + "_a");
var switchObj = $("#" + treeNode.tId + "_switch");
var icoObj = $("#" + treeNode.tId + "_ico");
var spanObj = $("#" + treeNode.tId + "_span");
aObj.attr('title', '');
aObj.append('<div class="diy swich"></div>');
var div = $(liObj).find('div').eq(0);
switchObj.remove();
spanObj.remove();
icoObj.remove();
div.append(switchObj);
div.append(spanObj);
var spaceStr = "<span style='height:1px;display: inline-block;width:" + (spaceWidth * treeNode.level) + "px'></span>";
switchObj.before(spaceStr);
var editStr = '';
editStr = '<div class="diy">' + (treeNode.sysName == null ? ' ' : treeNode.sysName) + '</div>';
aObj.before(editStr);
editStr = '<div class="diy">' + (treeNode.pageType == null ? ' ' : treeNode.pageType) + '</div>';
aObj.append(editStr);
}
var lastValue = "", nodeList = [], fontCss = {}, hiddenNodes = [];
$("#menuName").val('');
var key = $("#menuName");
key.bind("focus", focusKey)
.bind("blur", blurKey)
.bind("propertychange", searchNode) //property(属性)change(改变)的时候,触发事件
.bind("input", searchNode);
function focusKey(e) {
if (key.hasClass("empty")) {
key.removeClass("empty");
}
}
function blurKey(e) {
if (key.get(0).value === "") {
key.addClass("empty");
}
}
//搜索树
function searchNode(e) {
var zTreeObj = $.fn.zTree.getZTreeObj("treeDemo");
var value = $.trim(key.get(0).value);
var keyType = "name";
if (key.hasClass("empty")) {
value = "";
}
//显示上次搜索后背隐藏的结点
zTreeObj.showNodes(hiddenNodes);
//查找不符合条件的叶子节点
function filterFunc(node){
var _keywords = $("#menuName").val();
if(node.name.indexOf(_keywords) != -1)
return false;
if(node.isParent) {
//是父节点时需要判断子节点是否符合条件,是的话则父节点需要保留
var bl = CheckChildNodesIsContainKeyword(node);
return bl;
} else {
//是子节点时,需要判断父节点是否符合条件,是的话则子节点需要保留
var bl2 = CheckParentNodesIsContainKeyword(node);
return bl2;
}
return true;
};
//获取不符合条件的叶子结点
hiddenNodes = zTreeObj.getNodesByFilter(filterFunc);
//隐藏不符合条件的叶子结点
zTreeObj.hideNodes(hiddenNodes);
if (lastValue === value) return;
lastValue = value;
if (value === ""){
updateNodes(false);
return;
};
updateNodes(false);
nodeList = zTreeObj.getNodesByParamFuzzy(keyType, value); //调用ztree的模糊查询功能,得到符合条件的节点
updateNodes(true); //更新节点
};
//tree搜索时:是父节点时需要判断子节点是否符合条件,是的话则父节点需要保留
function CheckChildNodesIsContainKeyword(pNode) {
var childs = pNode.children;
var isexit = true;
if(!isNull(childs)){
for(var i = 0; i < childs.length; i++) {
if(childs[i].isParent) {
isexit = CheckChildNodesIsContainKeyword(childs[i]);
if(!isexit)
return isexit;
} else {
var _keywords = $("#menuName").val();
if(childs[i].name.indexOf(_keywords) != -1)
return false;
}
}
}
return true;
}
//tree 搜索时:子节点时,需要判断父节点是否符合条件,是的话则子节点需要保留
function CheckParentNodesIsContainKeyword(cNode) {
var pnode = cNode.getParentNode();
if(pnode != null) {
var _keywords = $("#menuName").val();
if(pnode.name.indexOf(_keywords) != -1)
return false;
else {
return CheckParentNodesIsContainKeyword(pnode)
}
}
return true;
}
//高亮显示被搜索到的节点
function updateNodes(highlight) {
var zTree = $.fn.zTree.getZTreeObj("treeDemo");
for( var i = 0; i < nodeList.length; i++) {
nodeList[i].highlight = highlight;//高亮显示搜索到的节点(highlight是自己设置的一个属性)
zTree.expandNode(nodeList[i].getParentNode(), true, false, false);//将搜索到的节点的父节点展开
zTree.updateNode(nodeList[i]);//更新节点数据,主要用于该节点显示属性的更新
}
}
function setFontCss(treeId, treeNode) {
return (!!treeNode.highlight) ? {color:"#00ff66", "font-weight":"bold"} : {color:"#333", "font-weight":"normal"};
}
// 取消 // 取消
$("body").on("click", "#cancle", function(){ $("body").on("click", "#cancle", function(){
parent.layer.close(index); parent.layer.close(index);
......
...@@ -4,31 +4,34 @@ layui.config({ ...@@ -4,31 +4,34 @@ layui.config({
version: skyeyeVersion version: skyeyeVersion
}).extend({ }).extend({
window: 'js/winui.window' window: 'js/winui.window'
}).define(['window', 'table', 'jquery', 'winui', 'fsCommon', 'fsTree', 'textool', 'form'], function (exports) { }).define(['window', 'table', 'jquery', 'winui', 'textool', 'form'], function (exports) {
winui.renderColor(); winui.renderColor();
var index = parent.layer.getFrameIndex(window.name); var index = parent.layer.getFrameIndex(window.name);
var $ = layui.$, var $ = layui.$,
form = layui.form, form = layui.form,
fsTree = layui.fsTree,
fsCommon = layui.fsCommon,
textool = layui.textool; textool = layui.textool;
var checkeRows = ''; AjaxPostUtil.request({url: reqBasePath + "sys016", params: {rowId: parent.rowId}, type: 'json', method: "GET", callback: function(json){
if(json.returnCode == 0){
$("#roleName").val(json.bean.roleName);
$("#roleDesc").val(json.bean.roleDesc);
textool.init({
eleId: 'roleDesc',
maxlength: 250,
tools: ['count', 'copy', 'reset', 'clear']
});
}else{
winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
matchingLanguage(); matchingLanguage();
form.render(); form.render();
form.on('submit(formEditBean)', function (data) { form.on('submit(formEditBean)', function (data) {
if (winui.verifyForm(data.elem)) { if (winui.verifyForm(data.elem)) {
var tree = $.fn.zTree.getZTreeObj("treeDemo");
var nodes = tree.getCheckedNodes(true);
var menuIds = new Array();
for(var i = 0; i < nodes.length; i++){
menuIds.push(nodes[i].id);
}
var params = { var params = {
roleName: $("#roleName").val(), roleName: $("#roleName").val(),
roleDesc: $("#roleDesc").val(), roleDesc: $("#roleDesc").val(),
menuIds: JSON.stringify(menuIds),
rowId: parent.rowId rowId: parent.rowId
}; };
...@@ -44,227 +47,6 @@ layui.config({ ...@@ -44,227 +47,6 @@ layui.config({
return false; return false;
}); });
/********* tree 处理 start *************/
var trees = {};
var treeDoms = $("ul.fsTree");
AjaxPostUtil.request({url: reqBasePath + "sys016", params: {rowId: parent.rowId}, type: 'json', method: "GET", callback: function(json){
if(json.returnCode == 0){
$("#roleName").val(json.bean.roleName);
$("#roleDesc").val(json.bean.roleDesc);
textool.init({
eleId: 'roleDesc',
maxlength: 250,
tools: ['count', 'copy', 'reset', 'clear']
});
checkeRows = json.rows;
if(treeDoms.length > 0) {
$(treeDoms).each(function(i) {
var treeId = $(this).attr("id");
var funcNo = $(this).attr("funcNo");
var url = $(this).attr("url");
var tree = fsTree.render({
id: treeId,
funcNo: funcNo,
url: url + "?userToken=" + getCookie('userToken') + "&loginPCIp=" + returnCitySN["cip"],
getTree: getTree,
checkEnable: true,
loadEnable: false,
showLine: false,
showIcon: false,
addDiyDom: addDiyDom,
fontCss: setFontCss,
expandSpeed: 'speed'
}, function(id){
var zTreeObj = $.fn.zTree.getZTreeObj(id);
var zTree = zTreeObj.getCheckedNodes(false);
for (var i = 0; i < zTree.length; i++) {
for(var j = 0; j < checkeRows.length; j++){
if(zTree[i].id == checkeRows[j].menuId){
zTreeObj.checkNode(zTree[i], true);
checkeRows.splice(j, 1);
}
}
}
var li_head = ' <li class="head"><a><div class="diy">所属系统</div><div class="diy">菜单权限</div><div class="diy">菜单类型</div></a></li>';
var rows = $("#" + treeId).find('li');
if(rows.length > 0) {
rows.eq(0).before(li_head)
} else {
$("#" + treeId).append(li_head);
$("#" + treeId).append('<li ><div style="text-align: center;line-height: 30px;" >无符合条件数据</div></li>')
}
});
if(treeDoms.length == 1) {
trees[treeId] = tree;
} else {
//深度拷贝对象
trees[treeId] = $.extend(true, {}, tree);
}
});
//绑定按钮事件
fsCommon.buttonEvent("tree", getTree);
}
}else{
winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
function getTree(treeId) {
if($.isEmpty(trees)) {
fsCommon.warnMsg("未配置tree!");
return;
}
if($.isEmpty(treeId)) {
treeId = "treeDemo";
}
return trees[treeId];
}
/********* tree 处理 end *************/
/**
* 自定义DOM节点
*/
function addDiyDom(treeId, treeNode) {
var spaceWidth = 15;
var liObj = $("#" + treeNode.tId);
var aObj = $("#" + treeNode.tId + "_a");
var switchObj = $("#" + treeNode.tId + "_switch");
var icoObj = $("#" + treeNode.tId + "_ico");
var spanObj = $("#" + treeNode.tId + "_span");
aObj.attr('title', '');
aObj.append('<div class="diy swich"></div>');
var div = $(liObj).find('div').eq(0);
switchObj.remove();
spanObj.remove();
icoObj.remove();
div.append(switchObj);
div.append(spanObj);
var spaceStr = "<span style='height:1px;display: inline-block;width:" + (spaceWidth * treeNode.level) + "px'></span>";
switchObj.before(spaceStr);
var editStr = '';
editStr = '<div class="diy">' + (treeNode.sysName == null ? ' ' : treeNode.sysName) + '</div>';
aObj.before(editStr);
editStr = '<div class="diy">' + (treeNode.pageType == null ? ' ' : treeNode.pageType) + '</div>';
aObj.append(editStr);
}
var lastValue = "", nodeList = [], fontCss = {}, hiddenNodes = [];
$("#menuName").val('');
var key = $("#menuName");
key.bind("focus", focusKey)
.bind("blur", blurKey)
.bind("propertychange", searchNode) //property(属性)change(改变)的时候,触发事件
.bind("input", searchNode);
function focusKey(e) {
if (key.hasClass("empty")) {
key.removeClass("empty");
}
}
function blurKey(e) {
if (key.get(0).value === "") {
key.addClass("empty");
}
}
//搜索树
function searchNode(e) {
var zTreeObj = $.fn.zTree.getZTreeObj("treeDemo");
var value = $.trim(key.get(0).value);
var keyType = "name";
if (key.hasClass("empty")) {
value = "";
}
//显示上次搜索后背隐藏的结点
zTreeObj.showNodes(hiddenNodes);
//查找不符合条件的叶子节点
function filterFunc(node){
var _keywords = $("#menuName").val();
if(node.name.indexOf(_keywords) != -1)
return false;
if(node.isParent) {
//是父节点时需要判断子节点是否符合条件,是的话则父节点需要保留
var bl = CheckChildNodesIsContainKeyword(node);
return bl;
} else {
//是子节点时,需要判断父节点是否符合条件,是的话则子节点需要保留
var bl2 = CheckParentNodesIsContainKeyword(node);
return bl2;
}
return true;
};
//获取不符合条件的叶子结点
hiddenNodes = zTreeObj.getNodesByFilter(filterFunc);
//隐藏不符合条件的叶子结点
zTreeObj.hideNodes(hiddenNodes);
if (lastValue === value) return;
lastValue = value;
if (value === ""){
updateNodes(false);
return;
};
updateNodes(false);
nodeList = zTreeObj.getNodesByParamFuzzy(keyType, value); //调用ztree的模糊查询功能,得到符合条件的节点
updateNodes(true); //更新节点
};
//tree搜索时:是父节点时需要判断子节点是否符合条件,是的话则父节点需要保留
function CheckChildNodesIsContainKeyword(pNode) {
var childs = pNode.children;
var isexit = true;
if(!isNull(childs)){
for(var i = 0; i < childs.length; i++) {
if(childs[i].isParent) {
isexit = CheckChildNodesIsContainKeyword(childs[i]);
if(!isexit)
return isexit;
} else {
var _keywords = $("#menuName").val();
if(childs[i].name.indexOf(_keywords) != -1)
return false;
}
}
}
return true;
}
//tree 搜索时:子节点时,需要判断父节点是否符合条件,是的话则子节点需要保留
function CheckParentNodesIsContainKeyword(cNode) {
var pnode = cNode.getParentNode();
if(pnode != null) {
var _keywords = $("#menuName").val();
if(pnode.name.indexOf(_keywords) != -1)
return false;
else {
return CheckParentNodesIsContainKeyword(pnode)
}
}
return true;
}
//高亮显示被搜索到的节点
function updateNodes(highlight) {
var zTree = $.fn.zTree.getZTreeObj("treeDemo");
for( var i = 0; i < nodeList.length; i++) {
nodeList[i].highlight = highlight;//高亮显示搜索到的节点(highlight是自己设置的一个属性)
zTree.expandNode(nodeList[i].getParentNode(), true, false, false);//将搜索到的节点的父节点展开
zTree.updateNode(nodeList[i]);//更新节点数据,主要用于该节点显示属性的更新
}
}
function setFontCss(treeId, treeNode) {
return (!!treeNode.highlight) ? {color:"#00ff66", "font-weight":"bold"} : {color:"#333", "font-weight":"normal"};
}
// 取消 // 取消
$("body").on("click", "#cancle", function(){ $("body").on("click", "#cancle", function(){
parent.layer.close(index); parent.layer.close(index);
......
...@@ -30,7 +30,7 @@ layui.config({ ...@@ -30,7 +30,7 @@ layui.config({
{ field: 'userNum', title: '使用用户数量', width: 150 }, { field: 'userNum', title: '使用用户数量', width: 150 },
{ field: 'parentName', title: '父角色', width: 150 }, { field: 'parentName', title: '父角色', width: 150 },
{ field: 'createTime', title: systemLanguage["com.skyeye.createTime"][languageType], align: 'center', width: 150 }, { field: 'createTime', title: systemLanguage["com.skyeye.createTime"][languageType], align: 'center', width: 150 },
{ title: systemLanguage["com.skyeye.operation"][languageType], fixed: 'right', align: 'center', width: 220, toolbar: '#tableBar'} { title: systemLanguage["com.skyeye.operation"][languageType], fixed: 'right', align: 'center', width: 300, toolbar: '#tableBar'}
]], ]],
done: function(){ done: function(){
matchingLanguage(); matchingLanguage();
...@@ -40,13 +40,15 @@ layui.config({ ...@@ -40,13 +40,15 @@ layui.config({
table.on('tool(messageTable)', function (obj) { table.on('tool(messageTable)', function (obj) {
var data = obj.data; var data = obj.data;
var layEvent = obj.event; var layEvent = obj.event;
if (layEvent === 'del') { //删除 if (layEvent === 'del') { // 删除
del(data, obj); del(data, obj);
}else if (layEvent === 'edit') { //编辑 }else if (layEvent === 'edit') { // 编辑
edit(data); edit(data);
}else if (layEvent === 'appmenu') { //手机端菜单授权 }else if (layEvent === 'appmenu') { // 手机端菜单授权
appmenu(data); appmenu(data);
} }else if (layEvent === 'pcMenu') { // PC端菜单授权
pcMenu(data);
}
}); });
form.render(); form.render();
...@@ -99,14 +101,20 @@ layui.config({ ...@@ -99,14 +101,20 @@ layui.config({
pageId: "syseveroleappmenu", pageId: "syseveroleappmenu",
area: ['90vw', '90vh'], area: ['90vw', '90vh'],
callBack: function(refreshCode){ callBack: function(refreshCode){
if (refreshCode == '0') {
winui.window.msg(systemLanguage["com.skyeye.successfulOperation"][languageType], {icon: 1,time: 2000});
loadTable();
} else if (refreshCode == '-9999') {
winui.window.msg(systemLanguage["com.skyeye.operationFailed"][languageType], {icon: 2,time: 2000});
}
}}); }});
} }
// PC端菜单授权
function pcMenu(data){
rowId = data.id;
_openNewWindows({
url: "../../tpl/syseverole/sysEveRolePCMenu.html",
title: "PC端菜单授权",
pageId: "sysEveRolePCMenu",
area: ['90vw', '90vh'],
callBack: function(refreshCode){
}});
}
//刷新数据 //刷新数据
$("body").on("click", "#reloadTable", function(){ $("body").on("click", "#reloadTable", function(){
......
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<link href="../../assets/lib/layui/css/layui.css" rel="stylesheet" />
<link href="../../assets/lib/winui/css/winui.css" rel="stylesheet" />
<link href="../../assets/lib/layui/lay/modules/ztree/css/zTreeStyle/zTreeStyle.css" rel="stylesheet" />
<link href="../../assets/lib/layui/css/tree-table.css" rel="stylesheet" />
<link href="../../assets/lib/layui/lay/modules/contextMenu/jquery.contextMenu.min.css" rel="stylesheet" />
</head>
<body>
<div style="margin:0 auto;padding:20px;">
<form class="layui-form" action="" id="showForm" autocomplete="off">
<div class="layui-form-item">
<label class="layui-form-label">角色名称:</label>
<div class="layui-input-block ver-center">
<span id="roleName"></span>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">角色描述:</label>
<div class="layui-input-block ver-center">
<span id="roleDesc"></span>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">权限分配:</label>
<div class="layui-input-block winui-radio">
<div class="layui-form-item power-box">
<input type="text" id="menuName" name="menuName" placeholder="请输入菜单名称" class="layui-input empty" />
</div>
<ul id="treeDemo" class="ztree fsTree" method="get" isRoot="0" url="sys014"
treeIdKey="id" inputs="parentId" treePIdKey="pId" clickCallbackInputs="parentId:$id" treeName="name"></ul>
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button class="winui-btn" id="cancle"><language showName="com.skyeye.cancel"></language></button>
<button class="winui-btn" lay-submit lay-filter="formEditBean"><language showName="com.skyeye.save"></language></button>
</div>
</div>
</form>
</div>
<script src="../../assets/lib/layui/layui.js"></script>
<script src="../../assets/lib/layui/custom.js"></script>
<script type="text/javascript" src="../../assets/lib/layui/lay/modules/jquery-min.js"></script>
<script type="text/javascript" src="../../assets/lib/layui/lay/modules/contextMenu/jquery.contextMenu.min.js"></script>
<script type="text/javascript" src="../../assets/lib/layui/lay/modules/ztree/js/jquery.ztree.all.min.js"></script>
<script type="text/javascript" src="../../assets/lib/layui/lay/modules/ztree/js/jquery.ztree.exhide.min.js"></script>
<script type="text/javascript">
layui.config({base: '../../js/syseverole/'}).use('sysEveRolePCMenu');
</script>
</body>
</html>
\ No newline at end of file
...@@ -5,9 +5,6 @@ ...@@ -5,9 +5,6 @@
<title></title> <title></title>
<link href="../../assets/lib/layui/css/layui.css" rel="stylesheet" /> <link href="../../assets/lib/layui/css/layui.css" rel="stylesheet" />
<link href="../../assets/lib/winui/css/winui.css" rel="stylesheet" /> <link href="../../assets/lib/winui/css/winui.css" rel="stylesheet" />
<link href="../../assets/lib/layui/lay/modules/ztree/css/zTreeStyle/zTreeStyle.css" rel="stylesheet" />
<link href="../../assets/lib/layui/css/tree-table.css" rel="stylesheet" />
<link href="../../assets/lib/layui/lay/modules/contextMenu/jquery.contextMenu.min.css" rel="stylesheet" />
</head> </head>
<body> <body>
<div style="margin:0 auto;padding:20px;"> <div style="margin:0 auto;padding:20px;">
...@@ -24,16 +21,6 @@ ...@@ -24,16 +21,6 @@
<textarea id="roleDesc" name="roleDesc" class="layui-textarea" style="height: 100px;"></textarea> <textarea id="roleDesc" name="roleDesc" class="layui-textarea" style="height: 100px;"></textarea>
</div> </div>
</div> </div>
<div class="layui-form-item">
<label class="layui-form-label">权限分配<i class="red">*</i></label>
<div class="layui-input-block winui-radio">
<div class="layui-form-item power-box">
<input type="text" id="menuName" name="menuName" placeholder="请输入菜单名称" class="layui-input empty" />
</div>
<ul id="treeDemo" class="ztree fsTree" method="get" isRoot="0" url="sys014"
treeIdKey="id" inputs="parentId" treePIdKey="pId" clickCallbackInputs="parentId:$id" treeName="name"></ul>
</div>
</div>
<div class="layui-form-item"> <div class="layui-form-item">
<div class="layui-input-block"> <div class="layui-input-block">
<button class="winui-btn" id="cancle"><language showName="com.skyeye.cancel"></language></button> <button class="winui-btn" id="cancle"><language showName="com.skyeye.cancel"></language></button>
...@@ -44,10 +31,6 @@ ...@@ -44,10 +31,6 @@
</div> </div>
<script src="../../assets/lib/layui/layui.js"></script> <script src="../../assets/lib/layui/layui.js"></script>
<script src="../../assets/lib/layui/custom.js"></script> <script src="../../assets/lib/layui/custom.js"></script>
<script type="text/javascript" src="../../assets/lib/layui/lay/modules/jquery-min.js"></script>
<script type="text/javascript" src="../../assets/lib/layui/lay/modules/contextMenu/jquery.contextMenu.min.js"></script>
<script type="text/javascript" src="../../assets/lib/layui/lay/modules/ztree/js/jquery.ztree.all.min.js"></script>
<script type="text/javascript" src="../../assets/lib/layui/lay/modules/ztree/js/jquery.ztree.exhide.min.js"></script>
<script type="text/javascript"> <script type="text/javascript">
layui.config({base: '../../js/syseverole/'}).use('syseveroleadd'); layui.config({base: '../../js/syseverole/'}).use('syseveroleadd');
</script> </script>
......
...@@ -5,9 +5,6 @@ ...@@ -5,9 +5,6 @@
<title></title> <title></title>
<link href="../../assets/lib/layui/css/layui.css" rel="stylesheet" /> <link href="../../assets/lib/layui/css/layui.css" rel="stylesheet" />
<link href="../../assets/lib/winui/css/winui.css" rel="stylesheet" /> <link href="../../assets/lib/winui/css/winui.css" rel="stylesheet" />
<link href="../../assets/lib/layui/lay/modules/ztree/css/zTreeStyle/zTreeStyle.css" rel="stylesheet" />
<link href="../../assets/lib/layui/css/tree-table.css" rel="stylesheet" />
<link href="../../assets/lib/layui/lay/modules/contextMenu/jquery.contextMenu.min.css" rel="stylesheet" />
</head> </head>
<body> <body>
<div style="margin:0 auto;padding:20px;"> <div style="margin:0 auto;padding:20px;">
...@@ -24,16 +21,6 @@ ...@@ -24,16 +21,6 @@
<textarea id="roleDesc" name="roleDesc" class="layui-textarea" style="height: 100px;"></textarea> <textarea id="roleDesc" name="roleDesc" class="layui-textarea" style="height: 100px;"></textarea>
</div> </div>
</div> </div>
<div class="layui-form-item">
<label class="layui-form-label">权限分配<i class="red">*</i></label>
<div class="layui-input-block winui-radio">
<div class="layui-form-item power-box">
<input type="text" id="menuName" name="menuName" placeholder="请输入菜单名称" class="layui-input empty" />
</div>
<ul id="treeDemo" class="ztree fsTree" method="get" isRoot="0" url="sys014"
treeIdKey="id" inputs="parentId" treePIdKey="pId" clickCallbackInputs="parentId:$id" treeName="name"></ul>
</div>
</div>
<div class="layui-form-item"> <div class="layui-form-item">
<div class="layui-input-block"> <div class="layui-input-block">
<button class="winui-btn" id="cancle"><language showName="com.skyeye.cancel"></language></button> <button class="winui-btn" id="cancle"><language showName="com.skyeye.cancel"></language></button>
...@@ -44,10 +31,6 @@ ...@@ -44,10 +31,6 @@
</div> </div>
<script src="../../assets/lib/layui/layui.js"></script> <script src="../../assets/lib/layui/layui.js"></script>
<script src="../../assets/lib/layui/custom.js"></script> <script src="../../assets/lib/layui/custom.js"></script>
<script type="text/javascript" src="../../assets/lib/layui/lay/modules/jquery-min.js"></script>
<script type="text/javascript" src="../../assets/lib/layui/lay/modules/contextMenu/jquery.contextMenu.min.js"></script>
<script type="text/javascript" src="../../assets/lib/layui/lay/modules/ztree/js/jquery.ztree.all.min.js"></script>
<script type="text/javascript" src="../../assets/lib/layui/lay/modules/ztree/js/jquery.ztree.exhide.min.js"></script>
<script type="text/javascript"> <script type="text/javascript">
layui.config({base: '../../js/syseverole/'}).use('syseveroleedit'); layui.config({base: '../../js/syseverole/'}).use('syseveroleedit');
</script> </script>
......
...@@ -31,11 +31,16 @@ ...@@ -31,11 +31,16 @@
<table id="messageTable" lay-filter="messageTable"></table> <table id="messageTable" lay-filter="messageTable"></table>
<script type="text/html" id="tableBar"> <script type="text/html" id="tableBar">
{{# if(auth('1552900944072')){ }} {{# if(auth('1552900944072')){ }}
<a class="layui-btn layui-btn-xs" lay-event="edit"><language showName="com.skyeye.editBtn"></language></a> <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit"><language showName="com.skyeye.editBtn"></language></a>
{{# } }} {{# } }}
{{# if(d.userNum == 0 && auth('1552877034665')){ }} {{# if(d.userNum == 0 && auth('1552877034665')){ }}
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><language showName="com.skyeye.deleteBtn"></language></a> <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><language showName="com.skyeye.deleteBtn"></language></a>
{{# } }} {{# } }}
{{# if(auth('1644726632357')){ }}
<a class="layui-btn layui-btn-xs" lay-event="pcMenu">PC菜单授权</a>
{{# } }}
<!-- {{# if(auth('1644726632357')){ }}-->
<!-- {{# } }}-->
{{# if(auth('1563605807171')){ }} {{# if(auth('1563605807171')){ }}
<a class="layui-btn layui-btn-xs" lay-event="appmenu">APP菜单授权</a> <a class="layui-btn layui-btn-xs" lay-event="appmenu">APP菜单授权</a>
{{# } }} {{# } }}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册