main.js
2.5 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
45
46
47
48
49
50
51
52
53
layui.config({
base: "/js/"
}).use(['form', 'I18nPage', 'vue', 'ztree', 'layer', 'jquery', 'table', 'droptree', 'hhweb', 'utils'], function () {
var form = layui.form,
layer = layui.layer,
$ = layui.jquery,
I18nPage = layui.I18nPage;
var table = layui.table;
var hhweb = layui.hhweb;
var toplayer = (top == undefined || top.layer === undefined) ? layer : top.layer; //顶层的LAYER
//给按钮添加快捷键
//Ctrl+I键添加,Ctrl+R键刷新,Ctrl+D键删除,Ctrl+E键编辑,Ctrl+F查询,Ctrl+S保存,Ctrl+A全选,Ctrl+Shift+A取消全选,左 上一页 右 下一页
$(document).bind("keydown", function (e) {
//禁用页面F5刷新
if (e.which == 116) {
e.preventDefault(); //Skip default behavior of the enter key
}
});
$(document).ready(function () {
$.ajax({
url: "/Home/GetQuickFunc",
type: "post",
dataType: "json",
success: function (data) {
if (data.code === 200) {
var shtml = '';
for (var i = 0; i < data.count; i++) {
shtml += '<div class="col-md-2 col-sm-3 col-xs-6">';
shtml += ' <div class = "quickClick" data-url = "' + data.data[i].Url + '">';
shtml += ' <i class="layui-icon" data-icon="" style="font-size:60px;color:blue;background-color:rgb(84,167,152);border-radius:10px 10px;border:2px solid yellow;">' + data.data[i].IconName + '</i>';
shtml += ' <br />';
shtml += ' <span style="font-size:16px;font-weight: bold;color:white;">' + data.data[i].Name + '</span>';
shtml += ' </div>';
shtml += '</div>';
}
$('#QuickIcon').html(shtml);
$('.quickClick').on('click', function () {
var tab = '<a href="javascript:;" data-url="' + $(this).data('url') + '"><i class="layui-icon" data-icon="">' + $(this).find('i').html() + '</i><cite>' + $(this).find('span').html() + '</cite></a>';
parent.tab.tabAdd($(tab));
});
} else {
layer.msg(data.msg);
}
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
layer.alert(errorThrown, { icon: 2, shadeClose: true, title: "错误信息" });
}
});
})
});