Common.js
1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
var sbList = {};
function loadMenus(modulecode, AreaMenus) {
var sb = '';
if (sbList[AreaMenus] != undefined) { return sbList[AreaMenus]; }
layui.jquery.ajax("/base/SysModule/LoadAuthorizedMenus?modulecode=" + modulecode + "&AreaMenus=" + AreaMenus,
{
async: false
, success: function (data) {
if (data == "") { return };
var obj = JSON.parse(data);
layui.jquery.each(obj,
function () {
var element = this;
sb += ("<a herf='javascript:;' " + " lay-event='" + element.DomId +
"' " + " class='layui-btn layui-btn-sm " + element.Class +
"' " + ">");
if (element.Icon != null && element.Icon != '') {
sb += ("<i class='layui-icon'>" + element.Icon + "</i>");
}
sb += (element.Name + "</a>");
});
sbList[AreaMenus] = sb;
}
});
loadMenusFlag = true;
return sb;
}
Array.prototype.indexOf = function (val) {
for (var i = 0; i < this.length; i++) {
if (this[i] == val) return i;
}
return -1;
};
Array.prototype.remove = function (val) {
var index = this.indexOf(val);
if (index > -1) {
this.splice(index, 1);
}
};