|
|
@ -18,17 +18,19 @@ |
|
|
clear: both; |
|
|
clear: both; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
.layuimini-container{ |
|
|
.layuimini-container { |
|
|
background-color: #efefef ; |
|
|
background-color: #efefef; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
.layuimini-authority-content-item a i{ |
|
|
.layuimini-authority-content-item a i { |
|
|
background-color: #efefef; |
|
|
background-color: #efefef; |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
.first a i { |
|
|
.first a i { |
|
|
color: #993333; |
|
|
color: #993333; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
.second a i { |
|
|
.second a i { |
|
|
color: #6699CC; |
|
|
color: #6699CC; |
|
|
} |
|
|
} |
|
|
@ -42,8 +44,6 @@ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</style> |
|
|
</style> |
|
|
<div class="layuimini-container"> |
|
|
<div class="layuimini-container"> |
|
|
<a id="refresh" href="javascript:" data-refresh="刷新"><i class="fa fa-refresh"></i></a> |
|
|
<a id="refresh" href="javascript:" data-refresh="刷新"><i class="fa fa-refresh"></i></a> |
|
|
@ -107,7 +107,7 @@ |
|
|
if (childListElement.href.indexOf("my_")!== -1) { |
|
|
if (childListElement.href.indexOf("my_")!== -1) { |
|
|
continue; |
|
|
continue; |
|
|
} |
|
|
} |
|
|
result += createChildMenuList(childListElement); |
|
|
result += createChildMenuItem(childListElement); |
|
|
} |
|
|
} |
|
|
return result; |
|
|
return result; |
|
|
} |
|
|
} |
|
|
@ -115,7 +115,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 用于构造子菜单列表 |
|
|
// 用于构造子菜单列表 |
|
|
function createChildMenuList(data) { |
|
|
function createChildMenuItem(data) { |
|
|
// 获取当前子菜单 |
|
|
// 获取当前子菜单 |
|
|
let childList = data.child; |
|
|
let childList = data.child; |
|
|
// 定义返回结果 |
|
|
// 定义返回结果 |
|
|
@ -127,7 +127,7 @@ |
|
|
'<h2 class="layui-colla-title">' + data.title + '</h2>' + |
|
|
'<h2 class="layui-colla-title">' + data.title + '</h2>' + |
|
|
'<div class="layui-colla-content layui-show" >'; |
|
|
'<div class="layui-colla-content layui-show" >'; |
|
|
for (let i = 0; i < childList.length; i++) { |
|
|
for (let i = 0; i < childList.length; i++) { |
|
|
let childMenuList = createChildMenuList(childList[i]); |
|
|
let childMenuList = createChildMenuItem(childList[i]); |
|
|
resultChild += childMenuList; |
|
|
resultChild += childMenuList; |
|
|
} |
|
|
} |
|
|
resultChild += '</div></div></div>'; |
|
|
resultChild += '</div></div></div>'; |
|
|
@ -147,29 +147,16 @@ |
|
|
|
|
|
|
|
|
$(function () { |
|
|
$(function () { |
|
|
$.ajax({ |
|
|
$.ajax({ |
|
|
url: "/index/menus", |
|
|
url: "/getUserAuthorization", |
|
|
type: 'get', |
|
|
type: 'get', |
|
|
dataType: 'json', |
|
|
dataType: 'json', |
|
|
contentType: "application/json;charset=utf-8", |
|
|
contentType: "application/json;charset=utf-8", |
|
|
success: function (data) { |
|
|
success: function (res) { |
|
|
let menuInfo = data.menuInfo; |
|
|
let menuList = res.data; |
|
|
for (let i = 0; i < menuInfo.length; i++) { |
|
|
let menuItem = createMenuList(menuList); |
|
|
let menuInfoElement = menuInfo[i]; |
|
|
$("#layuimini-authority").append(menuItem); |
|
|
if (menuInfoElement.href === '') { |
|
|
element.render(); |
|
|
let menuItem = createMenuList(menuInfoElement); |
|
|
|
|
|
if (menuInfoElement.title.indexOf("辅助管理") !== -1) { |
|
|
|
|
|
let resultChild = '<div class="layui-collapse fourthly"> ' + |
|
|
|
|
|
'<div class="layui-colla-item">' + |
|
|
|
|
|
'<h2 class="layui-colla-title">' + menuInfoElement.title + '</h2>' + |
|
|
|
|
|
'<div class="layui-colla-content layui-show" >'; |
|
|
|
|
|
resultChild += menuItem; |
|
|
|
|
|
resultChild += '</div></div></div>'; |
|
|
|
|
|
menuItem = resultChild; |
|
|
|
|
|
} |
|
|
|
|
|
$("#layuimini-authority").append(menuItem); |
|
|
|
|
|
element.render(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
}); |
|
|
}); |
|
|
@ -177,72 +164,40 @@ |
|
|
|
|
|
|
|
|
// 用于构造菜单列表 |
|
|
// 用于构造菜单列表 |
|
|
function createMenuList(data) { |
|
|
function createMenuList(data) { |
|
|
|
|
|
// 如果存在菜单 |
|
|
// 获取子菜单 |
|
|
if (data.length > 0) { |
|
|
let childList = data.child; |
|
|
|
|
|
// 如果存在子菜单 |
|
|
|
|
|
if (childList.length > 0) { |
|
|
|
|
|
// 循环子菜单 |
|
|
|
|
|
|
|
|
|
|
|
// 定义结果 |
|
|
// 定义结果 |
|
|
let result = ''; |
|
|
let result = ''; |
|
|
// 设置添加</div>标志 |
|
|
|
|
|
let addEndDiv = true; |
|
|
|
|
|
// 设置刷新标志 |
|
|
|
|
|
let flush = false; |
|
|
|
|
|
// 定义暂存结果 |
|
|
// 定义暂存结果 |
|
|
let tempItem = ''; |
|
|
let tempItemForApplication = ''; |
|
|
for (let i = 0; i < childList.length; i++) { |
|
|
let tempItemForAnalyse = ''; |
|
|
|
|
|
let tempItemForCreate = ''; |
|
|
|
|
|
let tempItemForSystem = ''; |
|
|
|
|
|
for (let i = 0; i < data.length; i++) { |
|
|
// 遍历子菜单 |
|
|
// 遍历子菜单 |
|
|
let childListElement = childList[i]; |
|
|
let childListElement = data[i]; |
|
|
if (childListElement.href.indexOf("my_") !== -1) { |
|
|
if (childListElement.url.indexOf("my_") !== -1) { |
|
|
// 如果是我的任务,我的申请跳过 |
|
|
// 如果是我的任务,我的申请跳过 |
|
|
continue; |
|
|
continue; |
|
|
} |
|
|
} |
|
|
if (childListElement.title === "申请提交") { |
|
|
if (childListElement.name.indexOf("申请") !== -1) { |
|
|
// 如果是申请提交,直接添加</div>并完成本次循环 |
|
|
// 如果是申请相关操作 |
|
|
result += createChildMenuList(childListElement, result); |
|
|
tempItemForApplication = createChildMenuItem(childListElement, tempItemForApplication, '业务操作','first'); |
|
|
result += '</div></div></div>'; |
|
|
} else if (childListElement.name.indexOf("查询") !== -1 || childListElement.name.indexOf("可视化") !== -1) { |
|
|
continue; |
|
|
// 如果是查询可视化等操作 |
|
|
} |
|
|
tempItemForAnalyse = createChildMenuItem(childListElement, tempItemForAnalyse, '查询分析','second'); |
|
|
if (childListElement.title.indexOf("入") !== -1 || childListElement.title.indexOf("出") !== -1) { |
|
|
} else if (childListElement.name.indexOf("创建") !== -1) { |
|
|
// 如果是出入库管理 |
|
|
// 如果是创建相关操作 |
|
|
tempItem = createChildMenuList(childListElement, tempItem); |
|
|
tempItemForCreate = createChildMenuItem(childListElement, tempItemForCreate, '基础设置','third'); |
|
|
// 暂时不需要添加结尾div |
|
|
} else if (childListElement.name.indexOf("赋权") !== -1 || childListElement.name.indexOf("发布") !== -1) { |
|
|
addEndDiv = false; |
|
|
tempItemForSystem = createChildMenuItem(childListElement, tempItemForSystem, '系统管理','fourthly'); |
|
|
} else { |
|
|
|
|
|
// 如果不是,根据刷新标志判断是否添加结尾div |
|
|
|
|
|
addEndDiv = !flush; |
|
|
|
|
|
} |
|
|
} |
|
|
if (addEndDiv) { |
|
|
if (i === data.length - 1) { |
|
|
// 如果需要添加 |
|
|
tempItemForApplication += "</div></div></div>"; |
|
|
if (tempItem !== "") { |
|
|
tempItemForAnalyse += "</div></div></div>"; |
|
|
// 如果暂存项目不为空 |
|
|
tempItemForCreate += "</div></div></div>"; |
|
|
tempItem += '</div></div></div>'; |
|
|
tempItemForSystem += "</div></div></div>"; |
|
|
} |
|
|
result = tempItemForApplication+tempItemForAnalyse+tempItemForCreate+tempItemForSystem; |
|
|
// 将暂存结果添加到结果中 |
|
|
|
|
|
result += tempItem; |
|
|
|
|
|
// 将暂存设置为空 |
|
|
|
|
|
tempItem = ''; |
|
|
|
|
|
// 设置刷新标志为真 |
|
|
|
|
|
flush = true; |
|
|
|
|
|
} |
|
|
|
|
|
if (flush) { |
|
|
|
|
|
|
|
|
|
|
|
// 设置添加结尾div标志为假 |
|
|
|
|
|
addEndDiv = false; |
|
|
|
|
|
if (data.title === "辅助管理") { |
|
|
|
|
|
// 如果是辅助管理菜单 |
|
|
|
|
|
tempItem += createChildMenuList(childListElement, tempItem); |
|
|
|
|
|
} else { |
|
|
|
|
|
// 如果不是辅助管理菜单 |
|
|
|
|
|
tempItem = createChildMenuList(childListElement, tempItem); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
if (i === childList.length - 1) { |
|
|
|
|
|
// 如果到结尾 |
|
|
|
|
|
result += (tempItem + '</div></div></div>'); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
return result; |
|
|
return result; |
|
|
@ -250,47 +205,24 @@ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 用于构造子菜单列表 |
|
|
// 用于构造子菜单按钮 |
|
|
function createChildMenuList(data, result) { |
|
|
function createChildMenuItem(data, result, title,classItem) { |
|
|
// 获取当前子菜单 |
|
|
if (result.indexOf("layui-collapse") === -1) { |
|
|
let childList = data.child; |
|
|
// 如果没有面板 |
|
|
// 定义返回结果 |
|
|
let resultChild = '<div class="layui-collapse '+classItem+'"> ' + |
|
|
// 如果存在子菜单 |
|
|
|
|
|
if (childList !== undefined && childList !== null && childList.length > 0) { |
|
|
|
|
|
let title = ''; |
|
|
|
|
|
let ItemClass = ''; |
|
|
|
|
|
if(data.title.indexOf("入") !== -1 || data.title.indexOf("出") !== -1){ |
|
|
|
|
|
title = "出入库管理"; |
|
|
|
|
|
ItemClass = 'second'; |
|
|
|
|
|
}else if(data.title.indexOf("申请提交") !== -1){ |
|
|
|
|
|
title = "申请提交"; |
|
|
|
|
|
ItemClass = 'first' |
|
|
|
|
|
}else{ |
|
|
|
|
|
title = "仓库管理"; |
|
|
|
|
|
ItemClass = 'third'; |
|
|
|
|
|
} |
|
|
|
|
|
let resultChild = '<div class="layui-collapse '+ItemClass+'"> ' + |
|
|
|
|
|
'<div class="layui-colla-item">' + |
|
|
'<div class="layui-colla-item">' + |
|
|
'<h2 class="layui-colla-title">' + title + '</h2>' + |
|
|
'<h2 class="layui-colla-title">' + title + '</h2>' + |
|
|
'<div class="layui-colla-content layui-show" >'; |
|
|
'<div class="layui-colla-content layui-show" >'; |
|
|
if (result.indexOf("layui-collapse") === -1) { |
|
|
result += resultChild; |
|
|
result += resultChild; |
|
|
|
|
|
} |
|
|
|
|
|
for (let i = 0; i < childList.length; i++) { |
|
|
|
|
|
let childMenuList = createChildMenuList(childList[i], result); |
|
|
|
|
|
result += childMenuList; |
|
|
|
|
|
} |
|
|
|
|
|
return result; |
|
|
|
|
|
} else { |
|
|
|
|
|
// 如果不存在子菜单 |
|
|
|
|
|
|
|
|
|
|
|
// 构造标签 |
|
|
|
|
|
let childItem_out = '<div class="layuimini-authority-content-item layuimini-qiuck-module">'; |
|
|
|
|
|
let childItem_a = '<a href="javascript:;" layuimini-content-href="' + data.href + '" data-title="' + data.title + '" data-icon="' + data.icon + '">'; |
|
|
|
|
|
let childItem_i = '<i class="' + data.icon + '"></i>'; |
|
|
|
|
|
let childItem_cite = ' <cite>' + data.title + '</cite></a></div>'; |
|
|
|
|
|
return childItem_out + childItem_a + childItem_i + childItem_cite; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
// 构造标签 |
|
|
|
|
|
let childItem_out = '<div class="layuimini-authority-content-item layuimini-qiuck-module">'; |
|
|
|
|
|
let childItem_a = '<a href="javascript:;" layuimini-content-href="' + data.url + '" data-title="' + data.name + '" data-icon="' + data.icon + '">'; |
|
|
|
|
|
let childItem_i = '<i class="' + data.icon + '"></i>'; |
|
|
|
|
|
let childItem_cite = ' <cite>' + data.name + '</cite></a></div>'; |
|
|
|
|
|
result += childItem_out + childItem_a + childItem_i + childItem_cite; |
|
|
|
|
|
return result; |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
$('body').on('click', '[data-refresh]', function () { |
|
|
$('body').on('click', '[data-refresh]', function () { |
|
|
|