1、将原来单页版的界面改为多页版
This commit is contained in:
parent
0dd32364ec
commit
b9378cc524
4
sec-beidou/src/main/resources/static/api/clear.json
Normal file
4
sec-beidou/src/main/resources/static/api/clear.json
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"code": 1,
|
||||
"msg": "服务端清理缓存成功"
|
||||
}
|
||||
143
sec-beidou/src/main/resources/static/api/init.json
Normal file
143
sec-beidou/src/main/resources/static/api/init.json
Normal file
@ -0,0 +1,143 @@
|
||||
{
|
||||
"homeInfo": {
|
||||
"title": "首页",
|
||||
"href": "page/device_overview"
|
||||
},
|
||||
"logoInfo": {
|
||||
"title": "形变监测平台",
|
||||
"image": "images/logo.png",
|
||||
"href": ""
|
||||
},
|
||||
"menuInfo": [
|
||||
{
|
||||
"title": "设备管理",
|
||||
"icon": "fa fa-address-book",
|
||||
"href": "",
|
||||
"target": "_self",
|
||||
"child": [
|
||||
{
|
||||
"title": "设备总览",
|
||||
"href": "page/device_overview",
|
||||
"icon": "fa fa-home",
|
||||
"target": "_self"
|
||||
},
|
||||
{
|
||||
"title": "运行状态",
|
||||
"href": "page/gnss_status",
|
||||
"icon": "fa fa-tachometer",
|
||||
"target": "_self"
|
||||
},
|
||||
{
|
||||
"title": "告警管理",
|
||||
"href": "",
|
||||
"icon": "fa fa-bell-o",
|
||||
"target": "",
|
||||
"child": [
|
||||
{
|
||||
"title": "告警消息",
|
||||
"href": "page/warning",
|
||||
"icon": "fa fa-minus",
|
||||
"target": "_self"
|
||||
},
|
||||
{
|
||||
"title": "告警参数",
|
||||
"href": "page/warning_cfg",
|
||||
"icon": "fa fa-minus",
|
||||
"target": "_self"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "解算结果",
|
||||
"href": "page/gnss_data_calc",
|
||||
"icon": "fa fa-calculator",
|
||||
"target": "_self"
|
||||
},
|
||||
{
|
||||
"title": "配置管理",
|
||||
"href": "",
|
||||
"icon": "fa fa-gear",
|
||||
"target": "_self",
|
||||
"child": [
|
||||
{
|
||||
"title": "通用参数",
|
||||
"href": "page/gnss_group_cfg",
|
||||
"icon": "fa fa-minus",
|
||||
"target": "_self"
|
||||
},
|
||||
{
|
||||
"title": "设备参数",
|
||||
"href": "page/gnss_dev_cfg",
|
||||
"icon": "fa fa-minus",
|
||||
"target": "_self"
|
||||
},
|
||||
{
|
||||
"title": "命令行",
|
||||
"href": "page/cmd_line",
|
||||
"icon": "fa fa-minus",
|
||||
"target": "_self"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "设备消息",
|
||||
"href": "",
|
||||
"icon": "fa fa-file-text-o",
|
||||
"target": "_self",
|
||||
"child": [
|
||||
{
|
||||
"title": "消息摘要",
|
||||
"href": "page/gnss_msg",
|
||||
"icon": "fa fa-minus",
|
||||
"target": "_self"
|
||||
},
|
||||
{
|
||||
"title": "状态消息",
|
||||
"href": "page/gnss_msg_status",
|
||||
"icon": "fa fa-minus",
|
||||
"target": "_self"
|
||||
},
|
||||
{
|
||||
"title": "统计消息",
|
||||
"href": "page/gnss_msg_trx",
|
||||
"icon": "fa fa-minus",
|
||||
"target": "_self"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "系统管理",
|
||||
"icon": "fa fa-lemon-o",
|
||||
"href": "",
|
||||
"target": "_self",
|
||||
"child": [
|
||||
{
|
||||
"title": "系统参数",
|
||||
"href": "",
|
||||
"icon": "fa fa-gears",
|
||||
"target": "_self"
|
||||
},
|
||||
{
|
||||
"title": "组织管理",
|
||||
"href": "sys/tenant",
|
||||
"icon": "fa fa-university",
|
||||
"target": "_self"
|
||||
},
|
||||
{
|
||||
"title": "用户管理",
|
||||
"href": "",
|
||||
"icon": "fa fa-user",
|
||||
"target": "_self"
|
||||
},
|
||||
{
|
||||
"title": "操作日志",
|
||||
"href": "",
|
||||
"icon": "fa fa-pencil-square-o",
|
||||
"target": "_self"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
254
sec-beidou/src/main/resources/static/api/menus.json
Normal file
254
sec-beidou/src/main/resources/static/api/menus.json
Normal file
@ -0,0 +1,254 @@
|
||||
{
|
||||
"code": 0,
|
||||
"msg": "",
|
||||
"count": 19,
|
||||
"data": [
|
||||
{
|
||||
"authorityId": 1,
|
||||
"authorityName": "系统管理",
|
||||
"orderNumber": 1,
|
||||
"menuUrl": null,
|
||||
"menuIcon": "layui-icon-set",
|
||||
"createTime": "2018/06/29 11:05:41",
|
||||
"authority": null,
|
||||
"checked": 0,
|
||||
"updateTime": "2018/07/13 09:13:42",
|
||||
"isMenu": 0,
|
||||
"parentId": -1
|
||||
},
|
||||
{
|
||||
"authorityId": 2,
|
||||
"authorityName": "用户管理",
|
||||
"orderNumber": 2,
|
||||
"menuUrl": "system/user",
|
||||
"menuIcon": null,
|
||||
"createTime": "2018/06/29 11:05:41",
|
||||
"authority": null,
|
||||
"checked": 0,
|
||||
"updateTime": "2018/07/13 09:13:42",
|
||||
"isMenu": 0,
|
||||
"parentId": 1
|
||||
},
|
||||
{
|
||||
"authorityId": 3,
|
||||
"authorityName": "查询用户",
|
||||
"orderNumber": 3,
|
||||
"menuUrl": "",
|
||||
"menuIcon": "",
|
||||
"createTime": "2018/07/21 13:54:16",
|
||||
"authority": "user:view",
|
||||
"checked": 0,
|
||||
"updateTime": "2018/07/21 13:54:16",
|
||||
"isMenu": 1,
|
||||
"parentId": 2
|
||||
},
|
||||
{
|
||||
"authorityId": 4,
|
||||
"authorityName": "添加用户",
|
||||
"orderNumber": 4,
|
||||
"menuUrl": null,
|
||||
"menuIcon": null,
|
||||
"createTime": "2018/06/29 11:05:41",
|
||||
"authority": "user:add",
|
||||
"checked": 0,
|
||||
"updateTime": "2018/07/13 09:13:42",
|
||||
"isMenu": 1,
|
||||
"parentId": 2
|
||||
},
|
||||
{
|
||||
"authorityId": 5,
|
||||
"authorityName": "修改用户",
|
||||
"orderNumber": 5,
|
||||
"menuUrl": null,
|
||||
"menuIcon": null,
|
||||
"createTime": "2018/06/29 11:05:41",
|
||||
"authority": "user:edit",
|
||||
"checked": 0,
|
||||
"updateTime": "2018/07/13 09:13:42",
|
||||
"isMenu": 1,
|
||||
"parentId": 2
|
||||
},
|
||||
{
|
||||
"authorityId": 6,
|
||||
"authorityName": "删除用户",
|
||||
"orderNumber": 6,
|
||||
"menuUrl": null,
|
||||
"menuIcon": null,
|
||||
"createTime": "2018/06/29 11:05:41",
|
||||
"authority": "user:delete",
|
||||
"checked": 0,
|
||||
"updateTime": "2018/07/13 09:13:42",
|
||||
"isMenu": 1,
|
||||
"parentId": 2
|
||||
},
|
||||
{
|
||||
"authorityId": 7,
|
||||
"authorityName": "角色管理",
|
||||
"orderNumber": 7,
|
||||
"menuUrl": "system/role",
|
||||
"menuIcon": null,
|
||||
"createTime": "2018/06/29 11:05:41",
|
||||
"authority": null,
|
||||
"checked": 0,
|
||||
"updateTime": "2018/07/13 09:13:42",
|
||||
"isMenu": 0,
|
||||
"parentId": 1
|
||||
},
|
||||
{
|
||||
"authorityId": 8,
|
||||
"authorityName": "查询角色",
|
||||
"orderNumber": 8,
|
||||
"menuUrl": "",
|
||||
"menuIcon": "",
|
||||
"createTime": "2018/07/21 13:54:59",
|
||||
"authority": "role:view",
|
||||
"checked": 0,
|
||||
"updateTime": "2018/07/21 13:54:58",
|
||||
"isMenu": 1,
|
||||
"parentId": 7
|
||||
},
|
||||
{
|
||||
"authorityId": 9,
|
||||
"authorityName": "添加角色",
|
||||
"orderNumber": 9,
|
||||
"menuUrl": "",
|
||||
"menuIcon": "",
|
||||
"createTime": "2018/06/29 11:05:41",
|
||||
"authority": "role:add",
|
||||
"checked": 0,
|
||||
"updateTime": "2018/07/13 09:13:42",
|
||||
"isMenu": 1,
|
||||
"parentId": 7
|
||||
},
|
||||
{
|
||||
"authorityId": 10,
|
||||
"authorityName": "修改角色",
|
||||
"orderNumber": 10,
|
||||
"menuUrl": "",
|
||||
"menuIcon": "",
|
||||
"createTime": "2018/06/29 11:05:41",
|
||||
"authority": "role:edit",
|
||||
"checked": 0,
|
||||
"updateTime": "2018/07/13 09:13:42",
|
||||
"isMenu": 1,
|
||||
"parentId": 7
|
||||
},
|
||||
{
|
||||
"authorityId": 11,
|
||||
"authorityName": "删除角色",
|
||||
"orderNumber": 11,
|
||||
"menuUrl": "",
|
||||
"menuIcon": "",
|
||||
"createTime": "2018/06/29 11:05:41",
|
||||
"authority": "role:delete",
|
||||
"checked": 0,
|
||||
"updateTime": "2018/07/13 09:13:42",
|
||||
"isMenu": 1,
|
||||
"parentId": 7
|
||||
},
|
||||
{
|
||||
"authorityId": 12,
|
||||
"authorityName": "角色权限管理",
|
||||
"orderNumber": 12,
|
||||
"menuUrl": "",
|
||||
"menuIcon": "",
|
||||
"createTime": "2018/06/29 11:05:41",
|
||||
"authority": "role:auth",
|
||||
"checked": 0,
|
||||
"updateTime": "2018/07/13 15:27:18",
|
||||
"isMenu": 1,
|
||||
"parentId": 7
|
||||
},
|
||||
{
|
||||
"authorityId": 13,
|
||||
"authorityName": "权限管理",
|
||||
"orderNumber": 13,
|
||||
"menuUrl": "system/authorities",
|
||||
"menuIcon": null,
|
||||
"createTime": "2018/06/29 11:05:41",
|
||||
"authority": null,
|
||||
"checked": 0,
|
||||
"updateTime": "2018/07/13 15:45:13",
|
||||
"isMenu": 0,
|
||||
"parentId": 1
|
||||
},
|
||||
{
|
||||
"authorityId": 14,
|
||||
"authorityName": "查询权限",
|
||||
"orderNumber": 14,
|
||||
"menuUrl": "",
|
||||
"menuIcon": "",
|
||||
"createTime": "2018/07/21 13:55:57",
|
||||
"authority": "authorities:view",
|
||||
"checked": 0,
|
||||
"updateTime": "2018/07/21 13:55:56",
|
||||
"isMenu": 1,
|
||||
"parentId": 13
|
||||
},
|
||||
{
|
||||
"authorityId": 15,
|
||||
"authorityName": "添加权限",
|
||||
"orderNumber": 15,
|
||||
"menuUrl": "",
|
||||
"menuIcon": "",
|
||||
"createTime": "2018/06/29 11:05:41",
|
||||
"authority": "authorities:add",
|
||||
"checked": 0,
|
||||
"updateTime": "2018/06/29 11:05:41",
|
||||
"isMenu": 1,
|
||||
"parentId": 13
|
||||
},
|
||||
{
|
||||
"authorityId": 16,
|
||||
"authorityName": "修改权限",
|
||||
"orderNumber": 16,
|
||||
"menuUrl": "",
|
||||
"menuIcon": "",
|
||||
"createTime": "2018/07/13 09:13:42",
|
||||
"authority": "authorities:edit",
|
||||
"checked": 0,
|
||||
"updateTime": "2018/07/13 09:13:42",
|
||||
"isMenu": 1,
|
||||
"parentId": 13
|
||||
},
|
||||
{
|
||||
"authorityId": 17,
|
||||
"authorityName": "删除权限",
|
||||
"orderNumber": 17,
|
||||
"menuUrl": "",
|
||||
"menuIcon": "",
|
||||
"createTime": "2018/06/29 11:05:41",
|
||||
"authority": "authorities:delete",
|
||||
"checked": 0,
|
||||
"updateTime": "2018/06/29 11:05:41",
|
||||
"isMenu": 1,
|
||||
"parentId": 13
|
||||
},
|
||||
{
|
||||
"authorityId": 18,
|
||||
"authorityName": "登录日志",
|
||||
"orderNumber": 18,
|
||||
"menuUrl": "system/loginRecord",
|
||||
"menuIcon": null,
|
||||
"createTime": "2018/06/29 11:05:41",
|
||||
"authority": null,
|
||||
"checked": 0,
|
||||
"updateTime": "2018/06/29 11:05:41",
|
||||
"isMenu": 0,
|
||||
"parentId": 1
|
||||
},
|
||||
{
|
||||
"authorityId": 19,
|
||||
"authorityName": "查询登录日志",
|
||||
"orderNumber": 19,
|
||||
"menuUrl": "",
|
||||
"menuIcon": "",
|
||||
"createTime": "2018/07/21 13:56:43",
|
||||
"authority": "loginRecord:view",
|
||||
"checked": 0,
|
||||
"updateTime": "2018/07/21 13:56:43",
|
||||
"isMenu": 1,
|
||||
"parentId": 18
|
||||
}
|
||||
]
|
||||
}
|
||||
10
sec-beidou/src/main/resources/static/api/upload.json
Normal file
10
sec-beidou/src/main/resources/static/api/upload.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"code": 1,
|
||||
"msg": "上传成功",
|
||||
"data": {
|
||||
"url": [
|
||||
"../images/logo.png",
|
||||
"../images/captcha.jpg"
|
||||
]
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,582 @@
|
||||
/**
|
||||
* date:2020/02/27
|
||||
* author:Mr.Chung
|
||||
* version:2.0
|
||||
* description:layuimini tab框架扩展
|
||||
*/
|
||||
layui.define(["element", "layer", "jquery"], function (exports) {
|
||||
var element = layui.element,
|
||||
layer = layui.layer,
|
||||
$ = layui.$;
|
||||
|
||||
|
||||
var miniTab = {
|
||||
|
||||
/**
|
||||
* 初始化tab
|
||||
* @param options
|
||||
*/
|
||||
render: function (options) {
|
||||
options.filter = options.filter || null;
|
||||
options.multiModule = options.multiModule || false;
|
||||
options.urlHashLocation = options.urlHashLocation || false;
|
||||
options.maxTabNum = options.maxTabNum || 20;
|
||||
options.menuList = options.menuList || []; // todo 后期菜单想改为不操作dom, 而是直接操作初始化传过来的数据
|
||||
options.homeInfo = options.homeInfo || {};
|
||||
options.listenSwichCallback = options.listenSwichCallback || function () {
|
||||
};
|
||||
miniTab.listen(options);
|
||||
miniTab.listenRoll();
|
||||
miniTab.listenSwitch(options);
|
||||
miniTab.listenHash(options);
|
||||
},
|
||||
|
||||
/**
|
||||
* 新建tab窗口
|
||||
* @param options.tabId
|
||||
* @param options.href
|
||||
* @param options.title
|
||||
* @param options.isIframe
|
||||
* @param options.maxTabNum
|
||||
*/
|
||||
create: function (options) {
|
||||
options.tabId = options.tabId || null;
|
||||
options.href = options.href || null;
|
||||
options.title = options.title || null;
|
||||
options.isIframe = options.isIframe || false;
|
||||
options.maxTabNum = options.maxTabNum || 20;
|
||||
if ($(".layuimini-tab .layui-tab-title li").length >= options.maxTabNum) {
|
||||
layer.msg('Tab窗口已达到限定数量,请先关闭部分Tab');
|
||||
return false;
|
||||
}
|
||||
var ele = element;
|
||||
if (options.isIframe) ele = parent.layui.element;
|
||||
ele.tabAdd('layuiminiTab', {
|
||||
title: '<span class="layuimini-tab-active"></span><span>' + options.title + '</span><i class="layui-icon layui-unselect layui-tab-close">ဆ</i>' //用于演示
|
||||
, content: '<iframe width="100%" height="100%" frameborder="no" border="0" marginwidth="0" marginheight="0" src="' + options.href + '"></iframe>'
|
||||
, id: options.tabId
|
||||
});
|
||||
$('.layuimini-menu-left').attr('layuimini-tab-tag', 'add');
|
||||
sessionStorage.setItem('layuiminimenu_' + options.tabId, options.title);
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 切换选项卡
|
||||
* @param tabId
|
||||
*/
|
||||
change: function (tabId) {
|
||||
element.tabChange('layuiminiTab', tabId);
|
||||
},
|
||||
|
||||
/**
|
||||
* 删除tab窗口
|
||||
* @param tabId
|
||||
* @param isParent
|
||||
*/
|
||||
delete: function (tabId, isParent) {
|
||||
// todo 未知BUG,不知道是不是layui问题,必须先删除元素
|
||||
$(".layuimini-tab .layui-tab-title .layui-unselect.layui-tab-bar").remove();
|
||||
|
||||
if (isParent === true) {
|
||||
parent.layui.element.tabDelete('layuiminiTab', tabId);
|
||||
} else {
|
||||
element.tabDelete('layuiminiTab', tabId);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 在iframe层打开新tab方法
|
||||
*/
|
||||
openNewTabByIframe: function (options) {
|
||||
options.href = options.href || null;
|
||||
options.title = options.title || null;
|
||||
var loading = parent.layer.load(0, {shade: false, time: 2 * 1000});
|
||||
if (options.href === null || options.href === undefined) options.href = new Date().getTime();
|
||||
var checkTab = miniTab.check(options.href, true);
|
||||
if (!checkTab) {
|
||||
miniTab.create({
|
||||
tabId: options.href,
|
||||
href: options.href,
|
||||
title: options.title,
|
||||
isIframe: true,
|
||||
});
|
||||
}
|
||||
parent.layui.element.tabChange('layuiminiTab', options.href);
|
||||
parent.layer.close(loading);
|
||||
},
|
||||
|
||||
/**
|
||||
* 在iframe层关闭当前tab方法
|
||||
*/
|
||||
deleteCurrentByIframe: function () {
|
||||
var ele = $(".layuimini-tab .layui-tab-title li.layui-this", parent.document);
|
||||
if (ele.length > 0) {
|
||||
var layId = $(ele[0]).attr('lay-id');
|
||||
miniTab.delete(layId, true);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 判断tab窗口
|
||||
*/
|
||||
check: function (tabId, isIframe) {
|
||||
// 判断选项卡上是否有
|
||||
var checkTab = false;
|
||||
if (isIframe === undefined || isIframe === false) {
|
||||
$(".layui-tab-title li").each(function () {
|
||||
var checkTabId = $(this).attr('lay-id');
|
||||
if (checkTabId != null && checkTabId === tabId) {
|
||||
checkTab = true;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
parent.layui.$(".layui-tab-title li").each(function () {
|
||||
var checkTabId = $(this).attr('lay-id');
|
||||
if (checkTabId != null && checkTabId === tabId) {
|
||||
checkTab = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
return checkTab;
|
||||
},
|
||||
|
||||
/**
|
||||
* 开启tab右键菜单
|
||||
* @param tabId
|
||||
* @param left
|
||||
*/
|
||||
openTabRignMenu: function (tabId, left) {
|
||||
miniTab.closeTabRignMenu();
|
||||
var menuHtml = '<div class="layui-unselect layui-form-select layui-form-selected layuimini-tab-mousedown layui-show" data-tab-id="' + tabId + '" style="left: ' + left + 'px!important">\n' +
|
||||
'<dl>\n' +
|
||||
'<dd><a href="javascript:;" layuimini-tab-menu-close="current">关 闭 当 前</a></dd>\n' +
|
||||
'<dd><a href="javascript:;" layuimini-tab-menu-close="other">关 闭 其 他</a></dd>\n' +
|
||||
'<dd><a href="javascript:;" layuimini-tab-menu-close="all">关 闭 全 部</a></dd>\n' +
|
||||
'</dl>\n' +
|
||||
'</div>';
|
||||
var makeHtml = '<div class="layuimini-tab-make"></div>';
|
||||
$('.layuimini-tab .layui-tab-title').after(menuHtml);
|
||||
$('.layuimini-tab .layui-tab-content').after(makeHtml);
|
||||
},
|
||||
|
||||
/**
|
||||
* 关闭tab右键菜单
|
||||
*/
|
||||
closeTabRignMenu: function () {
|
||||
$('.layuimini-tab-mousedown').remove();
|
||||
$('.layuimini-tab-make').remove();
|
||||
},
|
||||
|
||||
/**
|
||||
* 查询菜单信息
|
||||
* @param href
|
||||
* @param menuList
|
||||
*/
|
||||
searchMenu: function (href, menuList) {
|
||||
var menu;
|
||||
for (key in menuList) {
|
||||
var item = menuList[key];
|
||||
if (item.href === href) {
|
||||
menu = item;
|
||||
break;
|
||||
}
|
||||
if (item.child) {
|
||||
newMenu = miniTab.searchMenu(href, item.child);
|
||||
if (newMenu) {
|
||||
menu = newMenu;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return menu;
|
||||
},
|
||||
|
||||
/**
|
||||
* 监听
|
||||
* @param options
|
||||
*/
|
||||
listen: function (options) {
|
||||
options = options || {};
|
||||
options.maxTabNum = options.maxTabNum || 20;
|
||||
|
||||
/**
|
||||
* 打开新窗口
|
||||
*/
|
||||
$('body').on('click', '[layuimini-href]', function () {
|
||||
var loading = layer.load(0, {shade: false, time: 2 * 1000});
|
||||
var tabId = $(this).attr('layuimini-href'),
|
||||
href = $(this).attr('layuimini-href'),
|
||||
title = $(this).text(),
|
||||
target = $(this).attr('target');
|
||||
|
||||
var el = $("[layuimini-href='" + href + "']", ".layuimini-menu-left");
|
||||
layer.close(window.openTips);
|
||||
if (el.length) {
|
||||
$(el).closest(".layui-nav-tree").find(".layui-this").removeClass("layui-this");
|
||||
$(el).parent().addClass("layui-this");
|
||||
}
|
||||
|
||||
if (target === '_blank') {
|
||||
layer.close(loading);
|
||||
window.open(href, "_blank");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (tabId === null || tabId === undefined) tabId = new Date().getTime();
|
||||
var checkTab = miniTab.check(tabId);
|
||||
if (!checkTab) {
|
||||
miniTab.create({
|
||||
tabId: tabId,
|
||||
href: href,
|
||||
title: title,
|
||||
isIframe: false,
|
||||
maxTabNum: options.maxTabNum,
|
||||
});
|
||||
}
|
||||
element.tabChange('layuiminiTab', tabId);
|
||||
layer.close(loading);
|
||||
});
|
||||
|
||||
/**
|
||||
* 在iframe子菜单上打开新窗口
|
||||
*/
|
||||
$('body').on('click', '[layuimini-content-href]', function () {
|
||||
var loading = parent.layer.load(0, {shade: false, time: 2 * 1000});
|
||||
var tabId = $(this).attr('layuimini-content-href'),
|
||||
href = $(this).attr('layuimini-content-href'),
|
||||
title = $(this).attr('data-title'),
|
||||
target = $(this).attr('target');
|
||||
if (target === '_blank') {
|
||||
parent.layer.close(loading);
|
||||
window.open(href, "_blank");
|
||||
return false;
|
||||
}
|
||||
if (tabId === null || tabId === undefined) tabId = new Date().getTime();
|
||||
var checkTab = miniTab.check(tabId, true);
|
||||
if (!checkTab) {
|
||||
miniTab.create({
|
||||
tabId: tabId,
|
||||
href: href,
|
||||
title: title,
|
||||
isIframe: true,
|
||||
maxTabNum: options.maxTabNum,
|
||||
});
|
||||
}
|
||||
parent.layui.element.tabChange('layuiminiTab', tabId);
|
||||
parent.layer.close(loading);
|
||||
});
|
||||
|
||||
/**
|
||||
* 关闭选项卡
|
||||
**/
|
||||
$('body').on('click', '.layuimini-tab .layui-tab-title .layui-tab-close', function () {
|
||||
var loading = layer.load(0, {shade: false, time: 2 * 1000});
|
||||
var $parent = $(this).parent();
|
||||
var tabId = $parent.attr('lay-id');
|
||||
if (tabId !== undefined || tabId !== null) {
|
||||
miniTab.delete(tabId);
|
||||
}
|
||||
layer.close(loading);
|
||||
});
|
||||
|
||||
/**
|
||||
* 选项卡操作
|
||||
*/
|
||||
$('body').on('click', '[layuimini-tab-close]', function () {
|
||||
var loading = layer.load(0, {shade: false, time: 2 * 1000});
|
||||
var closeType = $(this).attr('layuimini-tab-close');
|
||||
$(".layuimini-tab .layui-tab-title li").each(function () {
|
||||
var tabId = $(this).attr('lay-id');
|
||||
var id = $(this).attr('id');
|
||||
var isCurrent = $(this).hasClass('layui-this');
|
||||
if (id !== 'layuiminiHomeTabId') {
|
||||
if (closeType === 'all') {
|
||||
miniTab.delete(tabId);
|
||||
} else {
|
||||
if (closeType === 'current' && isCurrent) {
|
||||
miniTab.delete(tabId);
|
||||
} else if (closeType === 'other' && !isCurrent) {
|
||||
miniTab.delete(tabId);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
layer.close(loading);
|
||||
});
|
||||
|
||||
/**
|
||||
* 禁用网页右键
|
||||
*/
|
||||
$(".layuimini-tab .layui-tab-title").unbind("mousedown").bind("contextmenu", function (e) {
|
||||
e.preventDefault();
|
||||
return false;
|
||||
});
|
||||
|
||||
/**
|
||||
* 注册鼠标右键
|
||||
*/
|
||||
$('body').on('mousedown', '.layuimini-tab .layui-tab-title li', function (e) {
|
||||
var left = $(this).offset().left - $('.layuimini-tab ').offset().left + ($(this).width() / 2),
|
||||
tabId = $(this).attr('lay-id');
|
||||
if (e.which === 3) {
|
||||
miniTab.openTabRignMenu(tabId, left);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* 关闭tab右键菜单
|
||||
*/
|
||||
$('body').on('click', '.layui-body,.layui-header,.layuimini-menu-left,.layuimini-tab-make', function () {
|
||||
miniTab.closeTabRignMenu();
|
||||
});
|
||||
|
||||
/**
|
||||
* tab右键选项卡操作
|
||||
*/
|
||||
$('body').on('click', '[layuimini-tab-menu-close]', function () {
|
||||
var loading = layer.load(0, {shade: false, time: 2 * 1000});
|
||||
var closeType = $(this).attr('layuimini-tab-menu-close'),
|
||||
currentTabId = $('.layuimini-tab-mousedown').attr('data-tab-id');
|
||||
$(".layuimini-tab .layui-tab-title li").each(function () {
|
||||
var tabId = $(this).attr('lay-id');
|
||||
var id = $(this).attr('id');
|
||||
if (id !== 'layuiminiHomeTabId') {
|
||||
if (closeType === 'all') {
|
||||
miniTab.delete(tabId);
|
||||
} else {
|
||||
if (closeType === 'current' && currentTabId === tabId) {
|
||||
miniTab.delete(tabId);
|
||||
} else if (closeType === 'other' && currentTabId !== tabId) {
|
||||
miniTab.delete(tabId);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
miniTab.closeTabRignMenu();
|
||||
layer.close(loading);
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 监听tab切换
|
||||
* @param options
|
||||
*/
|
||||
listenSwitch: function (options) {
|
||||
options.filter = options.filter || null;
|
||||
options.multiModule = options.multiModule || false;
|
||||
options.urlHashLocation = options.urlHashLocation || false;
|
||||
options.listenSwichCallback = options.listenSwichCallback || function () {
|
||||
|
||||
};
|
||||
element.on('tab(' + options.filter + ')', function (data) {
|
||||
var tabId = $(this).attr('lay-id');
|
||||
if (options.urlHashLocation) {
|
||||
location.hash = '/' + tabId;
|
||||
}
|
||||
if (typeof options.listenSwichCallback === 'function') {
|
||||
options.listenSwichCallback();
|
||||
}
|
||||
// 判断是否为新增窗口
|
||||
if ($('.layuimini-menu-left').attr('layuimini-tab-tag') === 'add') {
|
||||
$('.layuimini-menu-left').attr('layuimini-tab-tag', 'no')
|
||||
} else {
|
||||
$("[layuimini-href]").parent().removeClass('layui-this');
|
||||
if (options.multiModule) {
|
||||
miniTab.listenSwitchMultiModule(tabId);
|
||||
} else {
|
||||
miniTab.listenSwitchSingleModule(tabId);
|
||||
}
|
||||
}
|
||||
miniTab.rollPosition();
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 监听hash变化
|
||||
* @param options
|
||||
* @returns {boolean}
|
||||
*/
|
||||
listenHash: function (options) {
|
||||
options.urlHashLocation = options.urlHashLocation || false;
|
||||
options.maxTabNum = options.maxTabNum || 20;
|
||||
options.homeInfo = options.homeInfo || {};
|
||||
options.menuList = options.menuList || [];
|
||||
if (!options.urlHashLocation) return false;
|
||||
var tabId = location.hash.replace(/^#\//, '');
|
||||
if (tabId === null || tabId === undefined || tabId ==='') return false;
|
||||
|
||||
// 判断是否为首页
|
||||
if(tabId ===options.homeInfo.href) return false;
|
||||
|
||||
// 判断是否为右侧菜单
|
||||
var menu = miniTab.searchMenu(tabId, options.menuList);
|
||||
if (menu !== undefined) {
|
||||
miniTab.create({
|
||||
tabId: tabId,
|
||||
href: tabId,
|
||||
title: menu.title,
|
||||
isIframe: false,
|
||||
maxTabNum: options.maxTabNum,
|
||||
});
|
||||
$('.layuimini-menu-left').attr('layuimini-tab-tag', 'no');
|
||||
element.tabChange('layuiminiTab', tabId);
|
||||
return false;
|
||||
}
|
||||
|
||||
// 判断是否为快捷菜单
|
||||
var isSearchMenu = false;
|
||||
$("[layuimini-content-href]").each(function () {
|
||||
if ($(this).attr("layuimini-content-href") === tabId) {
|
||||
var title = $(this).attr("data-title");
|
||||
miniTab.create({
|
||||
tabId: tabId,
|
||||
href: tabId,
|
||||
title: title,
|
||||
isIframe: false,
|
||||
maxTabNum: options.maxTabNum,
|
||||
});
|
||||
$('.layuimini-menu-left').attr('layuimini-tab-tag', 'no');
|
||||
element.tabChange('layuiminiTab', tabId);
|
||||
isSearchMenu = true;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
if (isSearchMenu) return false;
|
||||
|
||||
// 既不是右侧菜单、快捷菜单,就直接打开
|
||||
var title = sessionStorage.getItem('layuiminimenu_' + tabId) === null ? tabId : sessionStorage.getItem('layuiminimenu_' + tabId);
|
||||
miniTab.create({
|
||||
tabId: tabId,
|
||||
href: tabId,
|
||||
title: title,
|
||||
isIframe: false,
|
||||
maxTabNum: options.maxTabNum,
|
||||
});
|
||||
element.tabChange('layuiminiTab', tabId);
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* 监听滚动
|
||||
*/
|
||||
listenRoll: function () {
|
||||
$(".layuimini-tab-roll-left").click(function () {
|
||||
miniTab.rollClick("left");
|
||||
});
|
||||
$(".layuimini-tab-roll-right").click(function () {
|
||||
miniTab.rollClick("right");
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 单模块切换
|
||||
* @param tabId
|
||||
*/
|
||||
listenSwitchSingleModule: function (tabId) {
|
||||
$("[layuimini-href]").each(function () {
|
||||
if ($(this).attr("layuimini-href") === tabId) {
|
||||
// 自动展开菜单栏
|
||||
var addMenuClass = function ($element, type) {
|
||||
if (type === 1) {
|
||||
$element.addClass('layui-this');
|
||||
if ($element.hasClass('layui-nav-item') && $element.hasClass('layui-this')) {
|
||||
$(".layuimini-header-menu li").attr('class', 'layui-nav-item');
|
||||
} else {
|
||||
addMenuClass($element.parent().parent(), 2);
|
||||
}
|
||||
} else {
|
||||
$element.addClass('layui-nav-itemed');
|
||||
if ($element.hasClass('layui-nav-item') && $element.hasClass('layui-nav-itemed')) {
|
||||
$(".layuimini-header-menu li").attr('class', 'layui-nav-item');
|
||||
} else {
|
||||
addMenuClass($element.parent().parent(), 2);
|
||||
}
|
||||
}
|
||||
};
|
||||
addMenuClass($(this).parent(), 1);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 多模块切换
|
||||
* @param tabId
|
||||
*/
|
||||
listenSwitchMultiModule: function (tabId) {
|
||||
$("[layuimini-href]").each(function () {
|
||||
if ($(this).attr("layuimini-href") === tabId) {
|
||||
|
||||
// 自动展开菜单栏
|
||||
var addMenuClass = function ($element, type) {
|
||||
if (type === 1) {
|
||||
$element.addClass('layui-this');
|
||||
if ($element.hasClass('layui-nav-item') && $element.hasClass('layui-this')) {
|
||||
var moduleId = $element.parent().attr('id');
|
||||
$(".layuimini-header-menu li").attr('class', 'layui-nav-item');
|
||||
$("#" + moduleId + "HeaderId").addClass("layui-this");
|
||||
$(".layuimini-menu-left .layui-nav.layui-nav-tree").attr('class', 'layui-nav layui-nav-tree layui-hide');
|
||||
$("#" + moduleId).attr('class', 'layui-nav layui-nav-tree layui-this');
|
||||
} else {
|
||||
addMenuClass($element.parent().parent(), 2);
|
||||
}
|
||||
} else {
|
||||
$element.addClass('layui-nav-itemed');
|
||||
if ($element.hasClass('layui-nav-item') && $element.hasClass('layui-nav-itemed')) {
|
||||
var moduleId = $element.parent().attr('id');
|
||||
$(".layuimini-header-menu li").attr('class', 'layui-nav-item');
|
||||
$("#" + moduleId + "HeaderId").addClass("layui-this");
|
||||
$(".layuimini-menu-left .layui-nav.layui-nav-tree").attr('class', 'layui-nav layui-nav-tree layui-hide');
|
||||
$("#" + moduleId).attr('class', 'layui-nav layui-nav-tree layui-this');
|
||||
} else {
|
||||
addMenuClass($element.parent().parent(), 2);
|
||||
}
|
||||
}
|
||||
};
|
||||
addMenuClass($(this).parent(), 1);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 自动定位
|
||||
*/
|
||||
rollPosition: function () {
|
||||
var $tabTitle = $('.layuimini-tab .layui-tab-title');
|
||||
var autoLeft = 0;
|
||||
$tabTitle.children("li").each(function () {
|
||||
if ($(this).hasClass('layui-this')) {
|
||||
return false;
|
||||
} else {
|
||||
autoLeft += $(this).outerWidth();
|
||||
}
|
||||
});
|
||||
$tabTitle.animate({
|
||||
scrollLeft: autoLeft - $tabTitle.width() / 3
|
||||
}, 200);
|
||||
},
|
||||
|
||||
/**
|
||||
* 点击滚动
|
||||
* @param direction
|
||||
*/
|
||||
rollClick: function (direction) {
|
||||
var $tabTitle = $('.layuimini-tab .layui-tab-title');
|
||||
var left = $tabTitle.scrollLeft();
|
||||
if ('left' === direction) {
|
||||
$tabTitle.animate({
|
||||
scrollLeft: left - 450
|
||||
}, 200);
|
||||
} else {
|
||||
$tabTitle.animate({
|
||||
scrollLeft: left + 450
|
||||
}, 200);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
exports("miniTab", miniTab);
|
||||
});
|
||||
File diff suppressed because one or more lines are too long
@ -0,0 +1 @@
|
||||
html #layuicss-skincodecss{display:none;position:absolute;width:1989px}.layui-code-h3,.layui-code-view{position:relative;font-size:12px}.layui-code-view{display:block;margin:10px 0;padding:0;border:1px solid #eee;border-left-width:6px;background-color:#FAFAFA;color:#333;font-family:Courier New}.layui-code-h3{padding:0 10px;height:40px;line-height:40px;border-bottom:1px solid #eee}.layui-code-h3 a{position:absolute;right:10px;top:0;color:#999}.layui-code-view .layui-code-ol{position:relative;overflow:auto}.layui-code-view .layui-code-ol li{position:relative;margin-left:45px;line-height:20px;padding:0 10px;border-left:1px solid #e2e2e2;list-style-type:decimal-leading-zero;*list-style-type:decimal;background-color:#fff}.layui-code-view .layui-code-ol li:first-child{padding-top:10px}.layui-code-view .layui-code-ol li:last-child{padding-bottom:10px}.layui-code-view pre{margin:0}.layui-code-notepad{border:1px solid #0C0C0C;border-left-color:#3F3F3F;background-color:#0C0C0C;color:#C2BE9E}.layui-code-notepad .layui-code-h3{border-bottom:none}.layui-code-notepad .layui-code-ol li{background-color:#3F3F3F;border-left:none}.layui-code-demo .layui-code{visibility:visible!important;margin:-15px;border-top:none;border-right:none;border-bottom:none}.layui-code-demo .layui-tab-content{padding:15px;border-top:none}
|
||||
File diff suppressed because one or more lines are too long
Binary file not shown.
|
After Width: | Height: | Size: 5.8 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
File diff suppressed because one or more lines are too long
Binary file not shown.
|
After Width: | Height: | Size: 5.7 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 701 B |
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
Binary file not shown.
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 299 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user