|
|
@ -28,7 +28,6 @@ |
|
|
<script src="/static/lib/layui-v2.6.3/layui.js" charset="utf-8"></script> |
|
|
<script src="/static/lib/layui-v2.6.3/layui.js" charset="utf-8"></script> |
|
|
<script src="/static/js/lay-config.js?v=1.0.4" charset="utf-8"></script> |
|
|
<script src="/static/js/lay-config.js?v=1.0.4" charset="utf-8"></script> |
|
|
<script> |
|
|
<script> |
|
|
|
|
|
|
|
|
layui.use(['layer', 'miniTab', 'echarts', 'element'], function () { |
|
|
layui.use(['layer', 'miniTab', 'echarts', 'element'], function () { |
|
|
var $ = layui.jquery, |
|
|
var $ = layui.jquery, |
|
|
layer = layui.layer, |
|
|
layer = layui.layer, |
|
|
@ -36,7 +35,7 @@ |
|
|
miniTab = layui.miniTab; |
|
|
miniTab = layui.miniTab; |
|
|
|
|
|
|
|
|
miniTab.listen(); |
|
|
miniTab.listen(); |
|
|
$(function () { |
|
|
/*$(function () { |
|
|
$.ajax({ |
|
|
$.ajax({ |
|
|
url: "/index/menus", |
|
|
url: "/index/menus", |
|
|
type: 'get', |
|
|
type: 'get', |
|
|
@ -52,7 +51,7 @@ |
|
|
let resultChild = '<div class="layui-collapse"> ' + |
|
|
let resultChild = '<div class="layui-collapse"> ' + |
|
|
'<div class="layui-colla-item">' + |
|
|
'<div class="layui-colla-item">' + |
|
|
'<h2 class="layui-colla-title">' + menuInfoElement.title + '</h2>' + |
|
|
'<h2 class="layui-colla-title">' + menuInfoElement.title + '</h2>' + |
|
|
'<div class="layui-colla-content" >'; |
|
|
'<div class="layui-colla-content layui-show" >'; |
|
|
resultChild += menuItem; |
|
|
resultChild += menuItem; |
|
|
resultChild += '</div></div></div>'; |
|
|
resultChild += '</div></div></div>'; |
|
|
menuItem = resultChild; |
|
|
menuItem = resultChild; |
|
|
@ -97,7 +96,7 @@ |
|
|
let resultChild = '<div class="layui-collapse"> ' + |
|
|
let resultChild = '<div class="layui-collapse"> ' + |
|
|
'<div class="layui-colla-item">' + |
|
|
'<div class="layui-colla-item">' + |
|
|
'<h2 class="layui-colla-title">' + data.title + '</h2>' + |
|
|
'<h2 class="layui-colla-title">' + data.title + '</h2>' + |
|
|
'<div class="layui-colla-content" >'; |
|
|
'<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 = createChildMenuList(childList[i]); |
|
|
resultChild += childMenuList; |
|
|
resultChild += childMenuList; |
|
|
@ -115,6 +114,150 @@ |
|
|
result = childItem_out + childItem_a + childItem_i + childItem_cite; |
|
|
result = childItem_out + childItem_a + childItem_i + childItem_cite; |
|
|
} |
|
|
} |
|
|
return result; |
|
|
return result; |
|
|
|
|
|
}*/ |
|
|
|
|
|
|
|
|
|
|
|
$(function () { |
|
|
|
|
|
$.ajax({ |
|
|
|
|
|
url: "/index/menus", |
|
|
|
|
|
type: 'get', |
|
|
|
|
|
dataType: 'json', |
|
|
|
|
|
contentType: "application/json;charset=utf-8", |
|
|
|
|
|
success: function (data) { |
|
|
|
|
|
let menuInfo = data.menuInfo; |
|
|
|
|
|
for (let i = 0; i < menuInfo.length; i++) { |
|
|
|
|
|
let menuInfoElement = menuInfo[i]; |
|
|
|
|
|
if (menuInfoElement.href === '') { |
|
|
|
|
|
let menuItem = createMenuList(menuInfoElement); |
|
|
|
|
|
if (menuInfoElement.title.indexOf("辅助管理") !== -1) { |
|
|
|
|
|
let resultChild = '<div class="layui-collapse"> ' + |
|
|
|
|
|
'<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(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 用于构造菜单列表 |
|
|
|
|
|
function createMenuList(data) { |
|
|
|
|
|
|
|
|
|
|
|
// 获取子菜单 |
|
|
|
|
|
let childList = data.child; |
|
|
|
|
|
// 如果存在子菜单 |
|
|
|
|
|
if (childList.length > 0) { |
|
|
|
|
|
// 循环子菜单 |
|
|
|
|
|
|
|
|
|
|
|
// 定义结果 |
|
|
|
|
|
let result = ''; |
|
|
|
|
|
// 设置添加</div>标志 |
|
|
|
|
|
let addEndDiv = true; |
|
|
|
|
|
// 设置刷新标志 |
|
|
|
|
|
let flush = false; |
|
|
|
|
|
// 定义暂存结果 |
|
|
|
|
|
let tempItem = ''; |
|
|
|
|
|
for (let i = 0; i < childList.length; i++) { |
|
|
|
|
|
// 遍历子菜单 |
|
|
|
|
|
let childListElement = childList[i]; |
|
|
|
|
|
if (childListElement.href.indexOf("my_") !== -1) { |
|
|
|
|
|
// 如果是我的任务,我的申请跳过 |
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
|
|
|
if (childListElement.title === "申请提交") { |
|
|
|
|
|
// 如果是申请提交,直接添加</div>并完成本次循环 |
|
|
|
|
|
result += createChildMenuList(childListElement, result); |
|
|
|
|
|
result += '</div></div></div>'; |
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
|
|
|
if (childListElement.title.indexOf("入") !== -1 || childListElement.title.indexOf("出") !== -1) { |
|
|
|
|
|
// 如果是出入库管理 |
|
|
|
|
|
tempItem = createChildMenuList(childListElement, tempItem); |
|
|
|
|
|
// 暂时不需要添加结尾div |
|
|
|
|
|
addEndDiv = false; |
|
|
|
|
|
} else { |
|
|
|
|
|
// 如果不是,根据刷新标志判断是否添加结尾div |
|
|
|
|
|
addEndDiv = !flush; |
|
|
|
|
|
} |
|
|
|
|
|
if (addEndDiv) { |
|
|
|
|
|
// 如果需要添加 |
|
|
|
|
|
if (tempItem !== "") { |
|
|
|
|
|
// 如果暂存项目不为空 |
|
|
|
|
|
tempItem += '</div></div></div>'; |
|
|
|
|
|
} |
|
|
|
|
|
// 将暂存结果添加到结果中 |
|
|
|
|
|
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; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 用于构造子菜单列表 |
|
|
|
|
|
function createChildMenuList(data, result) { |
|
|
|
|
|
// 获取当前子菜单 |
|
|
|
|
|
let childList = data.child; |
|
|
|
|
|
// 定义返回结果 |
|
|
|
|
|
// 如果存在子菜单 |
|
|
|
|
|
if (childList !== undefined && childList !== null && childList.length > 0) { |
|
|
|
|
|
let title = ''; |
|
|
|
|
|
if(data.title.indexOf("入") !== -1 || data.title.indexOf("出") !== -1){ |
|
|
|
|
|
title = "出入库管理"; |
|
|
|
|
|
}else if(data.title.indexOf("申请提交") !== -1){ |
|
|
|
|
|
title = "申请提交" |
|
|
|
|
|
}else{ |
|
|
|
|
|
title = "仓库管理"; |
|
|
|
|
|
} |
|
|
|
|
|
let resultChild = '<div class="layui-collapse"> ' + |
|
|
|
|
|
'<div class="layui-colla-item">' + |
|
|
|
|
|
'<h2 class="layui-colla-title">' + title + '</h2>' + |
|
|
|
|
|
'<div class="layui-colla-content layui-show" >'; |
|
|
|
|
|
if (result.indexOf("layui-collapse") === -1) { |
|
|
|
|
|
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; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|