提交 410aaa2d 编写于 作者: Skyeye云's avatar Skyeye云

添加二级菜单展示30%

上级 c1e00acf
...@@ -398,6 +398,52 @@ public class ToolUtil { ...@@ -398,6 +398,52 @@ public class ToolUtil {
return treeNode; return treeNode;
} }
/**
* 使用递归建树
* @param deskTops
* @return
*/
public static List<Map<String, Object>> deskTopsTree(List<Map<String, Object>> deskTops){
List<Map<String, Object>> resultList = new ArrayList<>();
for(Map<String, Object> bean : deskTops){
if ("0".equals(bean.get("parentId").toString())) {
resultList.add(findChildren(bean, deskTops, 0));
}
}
for(Map<String, Object> bean : deskTops){
if(!findChildren(resultList, bean.get("id").toString())){
resultList.add(bean);
}
}
return resultList;
}
/**
* 递归判断id是否在集合中存在
* @param treeNode
* @param id
* @return
*/
@SuppressWarnings("unchecked")
public static boolean findChildren(List<Map<String, Object>> treeNode, String id){
List<Map<String, Object>> child = null;
for(Map<String, Object> bean : treeNode){
if(id.equals(bean.get("id").toString())){
return true;
}else{
child = (List<Map<String, Object>>) bean.get("childs");
if(child != null){
boolean in = findChildren(child, id);
if(in){
return in;
}
}
}
}
return false;
}
/** /**
* 获取ip.properties路径 * 获取ip.properties路径
* @return * @return
......
...@@ -155,6 +155,7 @@ public class SysEveUserServiceImpl implements SysEveUserService{ ...@@ -155,6 +155,7 @@ public class SysEveUserServiceImpl implements SysEveUserService{
List<Map<String, Object>> deskTops = sysEveUserDao.queryDeskTopsMenuByUserId(userMation);//桌面菜单列表 List<Map<String, Object>> deskTops = sysEveUserDao.queryDeskTopsMenuByUserId(userMation);//桌面菜单列表
List<Map<String, Object>> allMenu = sysEveUserDao.queryAllMenuByUserId(userMation); List<Map<String, Object>> allMenu = sysEveUserDao.queryAllMenuByUserId(userMation);
allMenu = ToolUtil.allMenuToTree(allMenu); allMenu = ToolUtil.allMenuToTree(allMenu);
deskTops = ToolUtil.deskTopsTree(deskTops);
jedisClient.set("userMation:" + userMation.get("id").toString(), JSON.toJSONString(userMation)); jedisClient.set("userMation:" + userMation.get("id").toString(), JSON.toJSONString(userMation));
jedisClient.expire("userMation:" + userMation.get("id").toString(), 1800);//时间为30分钟 jedisClient.expire("userMation:" + userMation.get("id").toString(), 1800);//时间为30分钟
jedisClient.set("deskTopsMation:" + userMation.get("id").toString(), JSON.toJSONString(deskTops)); jedisClient.set("deskTopsMation:" + userMation.get("id").toString(), JSON.toJSONString(deskTops));
......
...@@ -128,7 +128,9 @@ ...@@ -128,7 +128,9 @@
c.open_type openType, c.open_type openType,
'-1' maxOpen, '-1' maxOpen,
'false' extend, 'false' extend,
'' childs null childs,
c.menu_parent_id parentId,
c.menu_level menuLevel
FROM FROM
sys_eve_user a, sys_eve_user a,
sys_eve_role_menu b, sys_eve_role_menu b,
......
...@@ -312,12 +312,12 @@ button{ ...@@ -312,12 +312,12 @@ button{
height: 40px; height: 40px;
position: fixed; position: fixed;
bottom: 0; bottom: 0;
z-index: 201704011157; z-index: 9998;
} }
.winui-taskbar > * { .winui-taskbar > * {
display: inline-block; display: inline-block;
} }
/*开始按钮*/ /*开始按钮*/
...@@ -330,20 +330,20 @@ button{ ...@@ -330,20 +330,20 @@ button{
position: absolute; position: absolute;
} }
.winui-taskbar-start:hover { .winui-taskbar-start:hover {
color: #1E91EA; color: #1E91EA;
} }
/*开始按钮选中*/ /*开始按钮选中*/
.winui-taskbar-start.winui-this { .winui-taskbar-start.winui-this {
/*background: #004275;*/ /*background: #004275;*/
} }
.winui-taskbar-start i { .winui-taskbar-start i {
font-size: 18px; font-size: 18px;
} }
/*任务栏任务*/ /*任务栏任务*/
...@@ -2424,6 +2424,28 @@ body .layer-ext-winconfirm { ...@@ -2424,6 +2424,28 @@ body .layer-ext-winconfirm {
cursor: pointer; cursor: pointer;
} }
.icon-drawer {
width: 35px;
height: 35px;
margin: 0px auto;
border: 1px solid rgba(255, 255, 255, 0.5);
overflow: hidden;
padding: 4px;
position: relative;
background-color: rgba(255, 255, 255, 0.19);
}
.icon-drawer-icon{
width: 50%;
height: 50%;
float: left;
margin-top: 2px;
}
.icon-child{
display: none;
}
/*** 小程序页面管理start ***/ /*** 小程序页面管理start ***/
.smpro{ .smpro{
height: calc(100vh - 45px); height: calc(100vh - 45px);
......
...@@ -20,20 +20,55 @@ layui.define(['jquery', 'layer', 'winui'], function (exports) { ...@@ -20,20 +20,55 @@ layui.define(['jquery', 'layer', 'winui'], function (exports) {
if (this.data === null) return; if (this.data === null) return;
var html = ''; var html = '';
$(this.data).each(function (index, item) { $(this.data).each(function (index, item) {
var id = (item.id == '' || item.id == undefined) ? '' : 'win-id="' + item.id + '"', var id = (item.id == '' || item.id == undefined) ? '' : 'win-id="' + item.id + '"',
url = (item.pageURL == '' || item.pageURL == undefined) ? '' : 'win-url="' + item.pageURL + '"', url = (item.pageURL == '' || item.pageURL == undefined) ? '' : 'win-url="' + item.pageURL + '"',
title = (item.title == '' || item.title == undefined) ? '' : 'win-title="' + item.title + '"', title = (item.title == '' || item.title == undefined) ? '' : 'win-title="' + item.title + '"',
opentype = (item.openType == '' || item.openType == undefined) ? '' : 'win-opentype="' + item.openType + '"', opentype = (item.openType == '' || item.openType == undefined) ? '' : 'win-opentype="' + item.openType + '"',
maxOpen = (item.maxOpen == '' || item.maxOpen == undefined) ? '' : 'win-maxOpen="' + item.maxOpen + '"', maxOpen = (item.maxOpen == '' || item.maxOpen == undefined) ? '' : 'win-maxOpen="' + item.maxOpen + '"',
//icon的算法存在纰漏,但出现错误几率较小 //icon的算法存在纰漏,但出现错误几率较小
isFaIcon = (item.icon.indexOf('fa-') != -1 && item.icon.indexOf('.') == -1), isFaIcon = (item.icon.indexOf('fa-') != -1 && item.icon.indexOf('.') == -1),
icon = isFaIcon ? '<i class="fa ' + item.icon + ' fa-fw"></i>' : '<img src="' + item.icon + '" />'; icon = isFaIcon ? '<i class="fa ' + item.icon + ' fa-fw"></i>' : '<img src="' + item.icon + '" />';
html += '<div class="winui-desktop-item" ' + id + ' ' + url + ' ' + title + ' ' + opentype + ' ' + maxOpen + '>'; if(isNull(item.childs)){
html += '<div class="winui-icon ' + (isFaIcon ? 'winui-icon-font' : 'winui-icon-img') + '">'; html += '<div class="winui-desktop-item" ' + id + ' ' + url + ' ' + title + ' ' + opentype + ' ' + maxOpen + '>';
html += icon; html += '<div class="winui-icon ' + (isFaIcon ? 'winui-icon-font' : 'winui-icon-img') + '">';
html += '</div>'; html += icon;
html += '<p>' + item.name + '</p>'; html += '</div>';
html += '</div>'; html += '<p>' + item.name + '</p>';
html += '</div>';
}else{
html += '<div class="winui-desktop-item" ' + id + ' ' + url + ' ' + title + ' ' + opentype + ' ' + maxOpen + '>';
html += '<div class="winui-icon ' + (isFaIcon ? 'winui-icon-font' : 'winui-icon-img') + '">';
html += '<div class="icon-drawer">';
var childsIconContent = '';
var childsHtml = '';
$(item.childs).each(function (index, bean) {
var childsid = (bean.id == '' || bean.id == undefined) ? '' : 'win-id="' + bean.id + '"',
childsurl = (bean.pageURL == '' || bean.pageURL == undefined) ? '' : 'win-url="' + bean.pageURL + '"',
childstitle = (bean.title == '' || bean.title == undefined) ? '' : 'win-title="' + bean.title + '"',
childsopentype = (bean.openType == '' || bean.openType == undefined) ? '' : 'win-opentype="' + bean.openType + '"',
childsmaxOpen = (bean.maxOpen == '' || bean.maxOpen == undefined) ? '' : 'win-maxOpen="' + bean.maxOpen + '"',
//icon的算法存在纰漏,但出现错误几率较小
childsisFaIcon = (bean.icon.indexOf('fa-') != -1 && bean.icon.indexOf('.') == -1),
childsicon = childsisFaIcon ? '<i class="fa ' + bean.icon + ' fa-fw"></i>' : '<img src="' + bean.icon + '" />',
childsiconsmall = childsisFaIcon ? '<i class="fa ' + bean.icon + ' fa-fw icon-drawer-icon"></i>' : '<img src="' + bean.icon + '" />';
childsIconContent += childsiconsmall;
childsHtml += '<div class="winui-desktop-item" ' + childsid + ' ' + childsurl + ' ' + childstitle + ' ' + childsopentype + ' ' + childsmaxOpen + '>';
childsHtml += '<div class="winui-icon ' + (childsisFaIcon ? 'winui-icon-font' : 'winui-icon-img') + '">';
childsHtml += childsicon;
childsHtml += '</div>';
childsHtml += '<p>' + bean.name + '</p>';
childsHtml += '</div>';
});
html += childsIconContent;
html += '</div>';
html += '<div class="icon-child">';
html += childsHtml;
html += '</div>';
html += '</div>';
html += '<p>' + item.name + '</p>';
html += '</div>';
}
}); });
$('.winui-desktop').html(html); $('.winui-desktop').html(html);
//定位应用 //定位应用
......
...@@ -45,6 +45,19 @@ layui.define(['layer', 'winui'], function (exports) { ...@@ -45,6 +45,19 @@ layui.define(['layer', 'winui'], function (exports) {
if (!winui.taskAuto()) { if (!winui.taskAuto()) {
return; return;
} }
if(isNull(options.shadeClose)){
options.shadeClose = false;
}
if(isNull(options.skin)){
options.skin = 'winui-window';
}
if(isNull(options.closeBtn) && options.closeBtn != 0){
options.closeBtn = '1';
}
if(isNull(options.maxmin) && options.maxmin != false){
options.maxmin = true;
}
//打开窗口 //打开窗口
var windowIndex = layer.open({ var windowIndex = layer.open({
id: options.id || winui.guid(), id: options.id || winui.guid(),
...@@ -56,10 +69,13 @@ layui.define(['layer', 'winui'], function (exports) { ...@@ -56,10 +69,13 @@ layui.define(['layer', 'winui'], function (exports) {
anim: options.anim || this.settings.anim, anim: options.anim || this.settings.anim,
move: MOVE, move: MOVE,
shade: options.shade || 0, shade: options.shade || 0,
maxmin: true, //允许最大最小化 maxmin: options.maxmin, //允许最大最小化
moveOut: true, //允许拖出窗外 moveOut: true, //允许拖出窗外
skin: 'winui-window', //窗口皮肤 skin: options.skin, //窗口皮肤
zIndex: layer.zIndex, zIndex: layer.zIndex,
shadeClose: options.shadeClose, //点击空白处关闭
scrollbar: false,
closeBtn: options.closeBtn,
//销毁回调 //销毁回调
end: options.end || function () { end: options.end || function () {
...@@ -127,91 +143,93 @@ layui.define(['layer', 'winui'], function (exports) { ...@@ -127,91 +143,93 @@ layui.define(['layer', 'winui'], function (exports) {
common.setWindowBody(window); common.setWindowBody(window);
} }
}); });
//重新获取window
var windowDom = common.getWindow(options.id); var windowDom = common.getWindow(options.id);
if (((options.type || this.settings.type) == 2) && (options.refresh === undefined ? this.settings.refresh : options.refresh)) { if(!isNull(windowDom)){
$(windowDom).find('.layui-layer-setwin').prepend('<a class="layui-layer-ico layui-layer-refresh"><i class="layui-icon" style="font-size:14px;left:17px;font-weight:600;">&#x1002;<i></a>'); //重新获取window
$(windowDom).find('.layui-layer-refresh').on('click', function (e) { if (((options.type || this.settings.type) == 2) && (options.refresh === undefined ? this.settings.refresh : options.refresh)) {
var $iframe = $(windowDom).find('iframe'); $(windowDom).find('.layui-layer-setwin').prepend('<a class="layui-layer-ico layui-layer-refresh"><i class="layui-icon" style="font-size:14px;left:17px;font-weight:600;">&#x1002;<i></a>');
try { $(windowDom).find('.layui-layer-refresh').on('click', function (e) {
$iframe.attr('src', $iframe[0].contentWindow.location.href); var $iframe = $(windowDom).find('iframe');
} catch (e) { try {
$iframe.attr('src', $iframe.attr('src')); $iframe.attr('src', $iframe[0].contentWindow.location.href);
} } catch (e) {
}); $iframe.attr('src', $iframe.attr('src'));
} }
$(windowDom).find('.layui-layer-max').html('<i class="layui-icon" style="font-size:12px;left:18px;" >&#xe626;<i>'); });
$(windowDom).find('.layui-layer-close').html('<i class="layui-icon">&#x1006;<i>'); }
//打开最大化 $(windowDom).find('.layui-layer-max').html('<i class="layui-icon" style="font-size:12px;left:18px;" >&#xe626;<i>');
switch ((options.maxOpen || this.settings.maxOpen)) { $(windowDom).find('.layui-layer-close').html('<i class="layui-icon">&#x1006;<i>');
case 1: //打开最大化
if ((options.anim || this.settings.anim) !== -1) { switch ((options.maxOpen || this.settings.maxOpen)) {
$(windowDom).one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function () { case 1:
if ((options.anim || this.settings.anim) !== -1) {
$(windowDom).one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function () {
$(windowDom).find('.layui-layer-max').trigger('click');
});
} else {
$(windowDom).find('.layui-layer-max').trigger('click'); $(windowDom).find('.layui-layer-max').trigger('click');
}
break;
case 2:
var top;
//根据任务栏模式调整位置
switch (winui.settings.taskbarMode) {
case 'top':
top = taskbarHeight + 'px';
break;
case 'bottom':
top = '0';
break;
case 'left':
break;
case 'right':
break;
default:
}
layer.style(windowIndex, {
'top': top,
'left': '0',
'width': $(window).width() + 'px',
'height': $(window).height() - taskbarHeight + 'px'
}); });
} else { break;
default:
};
//去除最小化按钮
if (!(options.min === undefined ? this.settings.min : options.min))
$(windowDom).find('.layui-layer-min').remove();
//去除最大化按钮
if (!(options.max === undefined ? this.settings.max : options.max))
$(windowDom).find('.layui-layer-max').remove();
//增加任务项
var taskItem = common.addTaskItem(options.id, options.title);
//选中任务项
common.selectDom(taskItem);
//绑定任务项mouseup事件
common.resetMouseUp(taskItem, call.taskItemMouseUp);
//双击窗口标题栏最大化(由于不明原因,标题栏的拖动好像阻碍了标题栏的双击事件,所以这里用mousedown模拟双击)
var lastTime = 0;
$(windowDom).find(MOVE).on('mousedown', function () {
$('.layui-layer-move').css('cursor', 'default');
var thisTime = new Date().getTime();
if (thisTime - lastTime < 300) {
$(windowDom).find('.layui-layer-max').trigger('click'); $(windowDom).find('.layui-layer-max').trigger('click');
} }
break; lastTime = thisTime;
case 2: });
var top; //移除最小化最大化关闭按钮a标签的href属性
//根据任务栏模式调整位置 $(windowDom).find('.layui-layer-setwin').children('a').removeAttr('href');
switch (winui.settings.taskbarMode) { //点击置顶
case 'top': layer.setTop($(windowDom));
top = taskbarHeight + 'px'; //手动置顶windowDom
break; windowfunc.setTop(windowDom);
case 'bottom': //鼠标按下窗口时选中对应任务栏
top = '0'; $(windowDom).on('mousedown', function () {
break; var taskItem = common.getTaskItemByWindowDom(this);
case 'left': common.selectDom(taskItem);
break; });
case 'right': }
break;
default:
}
layer.style(windowIndex, {
'top': top,
'left': '0',
'width': $(window).width() + 'px',
'height': $(window).height() - taskbarHeight + 'px'
});
break;
default:
};
//去除最小化按钮
if (!(options.min === undefined ? this.settings.min : options.min))
$(windowDom).find('.layui-layer-min').remove();
//去除最大化按钮
if (!(options.max === undefined ? this.settings.max : options.max))
$(windowDom).find('.layui-layer-max').remove();
//增加任务项
var taskItem = common.addTaskItem(options.id, options.title);
//选中任务项
common.selectDom(taskItem);
//绑定任务项mouseup事件
common.resetMouseUp(taskItem, call.taskItemMouseUp);
//双击窗口标题栏最大化(由于不明原因,标题栏的拖动好像阻碍了标题栏的双击事件,所以这里用mousedown模拟双击)
var lastTime = 0;
$(windowDom).find(MOVE).on('mousedown', function () {
$('.layui-layer-move').css('cursor', 'default');
var thisTime = new Date().getTime();
if (thisTime - lastTime < 300) {
$(windowDom).find('.layui-layer-max').trigger('click');
}
lastTime = thisTime;
});
//移除最小化最大化关闭按钮a标签的href属性
$(windowDom).find('.layui-layer-setwin').children('a').removeAttr('href');
//点击置顶
layer.setTop($(windowDom));
//手动置顶windowDom
windowfunc.setTop(windowDom);
//鼠标按下窗口时选中对应任务栏
$(windowDom).on('mousedown', function () {
var taskItem = common.getTaskItemByWindowDom(this);
common.selectDom(taskItem);
});
//隐藏开始菜单 //隐藏开始菜单
$('.winui-start').addClass('layui-hide'); $('.winui-start').addClass('layui-hide');
//移除开始按钮的选中样式 //移除开始按钮的选中样式
......
...@@ -57,7 +57,12 @@ ...@@ -57,7 +57,12 @@
}, //可以为{} 默认 请求 json/desktopmenu.json }, //可以为{} 默认 请求 json/desktopmenu.json
done: function (desktopApp) { done: function (desktopApp) {
desktopApp.ondblclick(function (id, elem) { desktopApp.ondblclick(function (id, elem) {
OpenWindow(elem); var item = $(elem);
if(item.find(".icon-drawer").length > 0){
showBigWin(elem);
}else{
OpenWindow(elem);
}
}); });
desktopApp.contextmenu({ desktopApp.contextmenu({
item: ["打开", "删除", '右键菜单可自定义'], item: ["打开", "删除", '右键菜单可自定义'],
...@@ -187,19 +192,40 @@ ...@@ -187,19 +192,40 @@
id: id, id: id,
type: type, type: type,
title: title, title: title,
content: content content: content,
//,area: ['70vw','80vh'] //,area: ['70vw','80vh']
//,offset: ['10vh', '15vw'] //,offset: ['10vh', '15vw']
, maxOpen: maxOpen maxOpen: maxOpen,
//, max: false //, max: false
//, min: false //, min: false
, refresh:true refresh:true
}); });
}else{ }else{
location.href = "login.html"; location.href = "login.html";
} }
}}); }});
} }
function showBigWin(menuItem){
var menu = $(menuItem);
winui.window.config({
anim: 0,
miniAnim: 0,
maxOpen: -1
}).open({
id: '1',
type: 1,
title: false,
closeBtn: 0,
content: '1111',
area: ['30vw', '40vh'],
shadeClose: true,
skin: 'demo-class',
scrollbar: false,
shade: 0.5,
maxmin: false
});
}
//注销登录 //注销登录
$('.logout').on('click', function () { $('.logout').on('click', function () {
......
useLoop(); 检查数组是否包含某个值的方法 useLoop(); 检查数组是否包含某个值的方法
getUrlParams(); 将url参数转换成map getUrlParams(); 将url参数转换成map
isBlank(); 判断字符串是否为空 isBlank(); 判断字符串是否为空
isNumeric(); 判断是不是数字 isNumeric(); 判断是不是数字
isPhone(); 检测手机号是否合格 isPhone(); 检测手机号是否合格
isEmail(); 验证邮箱 isEmail(); 验证邮箱
isIP(); 验证IP地址 isIP(); 验证IP地址
isDate(); 验证日期时间 isDate(); 验证日期时间
isUrl(); 验证网址Url isUrl(); 验证网址Url
isPostalcode(); 验证输入邮政编号 isPostalcode(); 验证输入邮政编号
match(); 如果str 符合 regex的正则表达式格式,返回true, 否则返回 false; match(); 如果str 符合 regex的正则表达式格式,返回true, 否则返回 false;
isIDcard(); 验证输入身份证号 isIDcard(); 验证输入身份证号
containsBoolean(); 请求xml参数判断 containsBoolean(); 请求xml参数判断
getTimeAndToString(); 获取当前日期(2016-12-29 11:23:09) getTimeAndToString(); 获取当前日期(2016-12-29 11:23:09)
getProperties(); 读取.properties 结尾的配置文件用,getP, getParam getProperties(); 读取.properties 结尾的配置文件用,getP, getParam
getSurFaceId(); 获取ID getSurFaceId(); 获取ID
MD5(); 加密 MD5(); 加密
allMenuToTree(); 使用递归方法建树 allMenuToTree(); 使用递归方法建树
findChildren(); 递归查找子节点 findChildren(Map<String, Object> treeNode, List<Map<String, Object>> treeNodes, int level); 递归查找子节点
getIPPropertiesPath(); 获取ip.properties路径 deskTopsTree(); 使用递归建树
deleteFile(); 删除单个文件 findChildren(List<Map<String, Object>> treeNode, String id); 递归判断id是否在集合中存在
card(); 随机不重复的6-8位 getIPPropertiesPath(); 获取ip.properties路径
replaceUnderLineAndUpperCase(); 将表名转为Java经常使用的名字,如code_model转CodeModel deleteFile(); 删除单个文件
toLowerCaseFirstOne(); 字符串首字母转小写 card(); 随机不重复的6-8位
writeTxtFile(); 写入内容到文件 replaceUnderLineAndUpperCase(); 将表名转为Java经常使用的名字,如code_model转CodeModel
toLowerCaseFirstOne(); 字符串首字母转小写
writeTxtFile(); 写入内容到文件
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册