Browse Source

[feat] 新增:首页新增消息提醒,新增待办事项图标和页面内容。

dev
zhangsiqi 3 months ago
parent
commit
950ef390e5
  1. 488
      ruoyi-admin/src/main/resources/templates/index.html

488
ruoyi-admin/src/main/resources/templates/index.html

@ -9,6 +9,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- <link th:href="@{favicon.ico}" rel="shortcut icon"/>-->
<link rel="icon" href="../static/img/favicon.ico" type="image/x-icon" th:href="@{/img/favicon.ico}">
<link href="/css/font-awesome.min.css" th:href="@{/css/font-awesome.min.css}" rel="stylesheet"/>
<link href="../static/css/bootstrapv4/bootstrap.min.css" th:href="@{/css/bootstrapv4/bootstrap.min.css}"
rel="stylesheet"/>
<link th:href="@{/css/jquery.contextMenu.min.css}" rel="stylesheet"/>
@ -126,62 +127,57 @@
</a>
</div>
<div class="collapse navbar-collapse">
<span class="header-title" style="padding: 0 0 0 30px ;font-size: 24px">
东莞万材智能设备有限公司
</span>
<span class="header-title" style="padding: 0 0 0 30px ;font-size: 24px">东莞万材智能设备有限公司</span>
<ul class="navbar-nav ml-auto">
<li>
<div class="dropdown">
<a class="dropdown-toggle" href="javascript:" data-toggle="dropdown"><i
class="icon feather icon-bell"></i></a>
<a href="javascript:;" class="dropdown-toggle" data-toggle="dropdown"
data-hover="dropdown" data-close-others="true">
<!-- 小圆点 -->
<i class="fa fa-rocket"></i>
<!-- 数量 -->
<span class="badge badge-default" id="todoBadge"></span>
</a>
<div class="dropdown-menu dropdown-menu-right notification">
<div class="noti-head">
<h6 class="d-inline-block m-b-0">Notifications</h6>
<h6 class="d-inline-block m-b-0">待办任务</h6>
<div class="float-right">
<a href="javascript:" class="m-r-10">mark as read</a>
<a href="javascript:">clear all</a>
<h8>你有<strong id="todoSize"></strong>任务</h8>
<!-- <a href="javascript:;" onclick="viewAllTasks();">查看全部</a>-->
</div>
</div>
<ul class="noti-body">
<li class="n-title">
<p class="m-b-0">NEW</p>
</li>
<!-- <li class="notification">-->
<!-- <div class="media">-->
<!-- <img class="img-radius" th:src="@{/img/user/avatar-2.jpg}" alt="Generic placeholder image">-->
<!-- <div class="media-body">-->
<!-- <p><strong>John Doe</strong><span class="n-time text-muted"><i class="icon feather icon-clock m-r-10"></i>30 min</span></p>-->
<!-- <p>New ticket Added</p>-->
<!-- </div>-->
<!-- </div>-->
<!-- </li>-->
<li class="n-title">
<p class="m-b-0">EARLIER</p>
</li>
<li class="notification" th:each="remind : ${reminds}" th:value="${remind.id}">
<div class="media">
<div class="media-body">
<p><strong th:text="${remind.remind}"></strong><span
class="n-time text-muted"><i
class="icon feather icon-clock m-r-10"></i><span
th:text="${remind.remindDate}"></span></span></p>
<p th:text="${remind.remindContent}"></p>
</div>
</div>
</li>
<!-- <li class="notification">-->
<!-- <div class="media">-->
<!-- <img class="img-radius" th:src="@{/img/user/avatar-2.jpg}" alt="Generic placeholder image">-->
<!-- <div class="media-body">-->
<!-- <p><strong>Sara Soudein</strong><span class="n-time text-muted"><i class="icon feather icon-clock m-r-10"></i>30 min</span></p>-->
<!-- <p>currently login</p>-->
<!-- </div>-->
<!-- </div>-->
<!-- </li>-->
<ul class="noti-body" id="todoItemList" style="height: 300px;overflow-y: scroll">
<li class="n-title"><p class="m-b-0">新的待办</p></li>
<!-- <li class="n-title"><p class="m-b-0">更早时候</p></li>-->
</ul>
<div class="noti-footer">
<a href="javascript:" onclick="viewAllTasks();">查看全部</a>
</div>
</div>
</div>
</li>
<li>
<div class="dropdown">
<a class="dropdown-toggle" href="javascript:" data-toggle="dropdown">
<i class="icon feather icon-bell"></i>
<span class="badge badge-default" id="remindBadge"></span>
</a>
<div class="dropdown-menu dropdown-menu-right notification">
<div class="noti-head">
<h6 class="d-inline-block m-b-0">消息提醒</h6>
<div class="float-right">
<h8>你有<strong id="remindSize"></strong>提醒</h8>
<!-- <a href="javascript:" class="m-r-10">已读</a>-->
<!-- <a href="javascript:">清除全部</a>-->
</div>
</div>
<ul class="noti-body" id="remindList">
<li class="n-title"><p class="m-b-0">新的提醒</p></li>
<!-- <li class="n-title"><p class="m-b-0">更早之前</p></li>-->
</ul>
<div class="noti-footer">
<a href="javascript:">show all</a>
<a href="javascript:">查看全部</a>
</div>
</div>
</div>
@ -202,14 +198,12 @@
</a>
</div>
<ul class="pro-body">
<li><a href="javascript:" class="dropdown-item menuItem"><i
class="feather icon-settings"></i> 个人中心</a></li>
<li><a href="javascript:" class="dropdown-item menuItem"><i
class="feather icon-user"></i> Profile</a></li>
<li><a href="javascript:" class="dropdown-item menuItem"><i
class="feather icon-mail"></i> 我的消息</a></li>
<li><a href="auth-signin.html" class="dropdown-item menuItem"><i
class="feather icon-lock"></i> 我的待办</a></li>
<!--<li><a href="javascript:" class="dropdown-item menuItem"><i class="feather icon-settings"></i>个人中心</a></li>-->
<li><a href="javascript:" onclick="viewMyProfile()" class="dropdown-item menuItem"><i class="feather icon-user"></i>个人中心</a></li>
<li><a href="javascript:" onclick="viewAllRequestItem()" class="dropdown-item menuItem"><i class="feather icon-mail"></i>我的请求</a></li>
<li><a href="javascript:" onclick="viewAllRemind()" class="dropdown-item menuItem"><i class="feather icon-bell"></i>我的提醒</a></li>
<li><a href="javascript:;" onclick="viewAllTasks()" class="dropdown-item menuItem" id="todoBadge2"><i class="feather icon-rocket"></i>我的待办</a></li>
<li><a href="javascript:;" onclick="viewAllDoneTasks()" class="dropdown-item menuItem" id="todoBadge3"><i class="feather icon-rocket"></i>我的已办</a></li>
</ul>
</div>
</div>
@ -242,7 +236,7 @@
<a id="ax_close_max" class="ax_close_max" href="#" title="关闭全屏"> <i class="fa fa-times-circle-o"></i> </a>
<div class="row mainContent" id="content-main">
<iframe class="RuoYi_iframe" name="iframe0" width="100%" height="100%" data-id="/system/main"
<iframe id="erpFrame" class="RuoYi_iframe" name="iframe0" width="100%" height="100%" data-id="/system/main"
th:src="@{/system/main}" frameborder="0" seamless></iframe>
</div>
@ -264,14 +258,12 @@
<script th:src="@{/js/bootstrapv4/js/bootstrap.min.js}"></script>
<script th:src="@{/js/pcoded.min.js}"></script>
<script th:src="@{/ruoyi/index.js?v=20201208}"></script>
<script th:inline="javascript">var loginName = [[${user.loginName}]]</script>
<script th:inline="javascript">
window.history.forward(1);
var ctx = [[@{/}]];
var lockscreen = [[${session.lockscreen}]];
if (lockscreen) {
window.top.location = ctx + "lockscreen";
}
if (lockscreen) {window.top.location = ctx + "lockscreen";}
// 皮肤缓存
var skin = storage.get("skin");
// history(表示去掉地址的#)否则地址以"#"形式展示
@ -368,21 +360,387 @@
});
}
$("[data-toggle='tooltip']").tooltip();
// if (loginName != "admin") {
getTodoItem();
getRemind();
// self.setInterval("getTodoItem()", 1000 * 20);
// self.setInterval("getRemind()", 1000 * 20);
// }
});
function getTodoItem() {
$.ajax({
url: ctx + 'process/todoitem/getTodoItemListNoPaging',//地址
success: function (data, status) {
if (status == 'success') {
$("#todoItemList").empty();
if (data.length > 0) {
$("#todoBadge").text(data.length);
$("#todoBadge2").append("<span class=\"badge badge-danger\">" + data.length + "</span>")
} else if (data.length == 0) {
$("#todoBadge").text('');
$("#todoBadge2 span").remove();
}
$("#todoSize").text(data.length + "项待办");
for (var i = 0; i < data.length; i++) {
var obj = data[i];
//console.log(obj);
var offset = transDate(obj.todoTime)
//$("#todoItemList").append("<li><a href="+ctx+obj.moduleUrl+"/edit/"+obj.keyNo+"> <span class=\"time\">"+transDate(obj.todoTime)+"</span> <span class=\"details\"> <span class=\"label label-sm label-icon label-info\"> <i class=\"fa fa-bullhorn\"></i></span>"+obj.itemName+"</span></a></li>");
var url = ctx + obj.moduleUrl + "/edit/" + obj.itemContent;
$("#todoItemList").append("<li class=\"todoItemLi\"><a href=\"javascript:;\" data-url="+url+"> <span class=\"time\">"+transDate(obj.todoTime)+"</span> <span class=\"details\"> <span class=\"label label-sm label-icon label-info\"> <i class=\"fa fa-bullhorn\"></i></span>"+obj.itemName+"</span></a></li>");
// $("#todoItemList").append(
// "<li class=\"todoItemLi notification \">" +
// "<div class='media'>" +
// "<div class='media-body'>"+
// "<a href=" + url + "><span class=\"time\">" + transDate(obj.todoTime) +"</span> " +
// "<span class=\"details\"><span class=\"label label-sm label-icon label-info\"><i class=\"fa fa-bullhorn\"></i>" + "</span>" + obj.itemName + "" + "</span></a></div></div></li>"
// );
}
}
}
})
}
//获取我的提醒
function getRemind() {
$.ajax({
url: ctx + 'remind/getRemindListNoPaging',//地址
success: function (data, status) {
//alert(data);
if (status == 'success') {
$("#remindList").empty();
if (data.length > 0) {
if (data.length > 10) {$("#remindBadge").text('10+');}
else {$("#remindSize").text(data.length + "项新");}
$("#remindBadge2").append("<span class=\"badge badge-danger\">" + data.length + "</span>")
} else if (data.length == 0) {
$("#remindBadge").text('');
$("#remindBadge2 span").remove();
}
if (data.length > 10) {
$("#remindSize").text('10+' + "项新");
} else {$("#remindSize").text(data.length + "项新");}
for (var i = 0; i < data.length; i++) {
var obj = data[i];
var offset = transDate(obj.remindDate)
var url = ctx + "remind/view/" + obj.id;
$("#remindList").append(
"<li class=\"remindLi\">" +
"<a href=" + url + "> " +
"<span class=\"time\">" + offset + "</span> " +
"<span class=\"details\"> " +
"<span class=\"label label-sm label-icon label-info\"> <i class=\"fa fa-bolt\"></i></span>" +
obj.formName +
"</span>" +
"</a>" +
"</li>");
}
}
}
})
}
//解决frame高度问题
function reinitIframe() {
var iframe = document.getElementById("erpFrame");
try {
//var bHeight = iframe.contentWindow.document.body.scrollHeight;
/* var dHeight = iframe.contentWindow.document.documentElement.scrollHeight;
var height = Math.max(bHeight, dHeight);
iframe.height = height; */
// iframe.height = bHeight;
/* var iframeWin = iframe.contentWindow || iframe.contentDocument.parentWindow;
if (iframeWin.document.body) {
iframe.height = iframeWin.document.documentElement.scrollHeight || iframeWin.document.body.scrollHeight;
} */
//var bHeight = iframe.contentWindow.document.body.scrollHeight;
//var dHeight = iframe.contentWindow.document.documentElement.scrollHeight;
//var height = Math.min(bHeight, dHeight);
//iframe.height = height;
//iframe.height = iframe.document.body.scrollHeight;
//该方法有白边
/* var bHeight = iframe.contentWindow.document.body.scrollHeight;
var dHeight = iframe.contentWindow.document.documentElement.scrollHeight;
var height = Math.min(bHeight, dHeight);
iframe.height = height+50; */
/* var idoc = iframe.contentWindow && iframe.contentWindow.document || iframe.contentDocument;
var iheight = Math.min(idoc.body.scrollHeight, idoc.documentElement.scrollHeight); //取得其高
iframe.height = iheight+50; */
//有多余部分出现
// iframe.height=document.documentElement.clientHeight;
//显示不全
//iframe.height = iframe.document.body.scrollHeight;
//有多余部分出现
/* var iframeWin = iframe.contentWindow || iframe.contentDocument.parentWindow;
if (iframeWin.document.body) {
iframe.height = iframeWin.document.documentElement.scrollHeight || iframeWin.document.body.scrollHeight;
} */
//显示不全
/* if (document.getElementById)
{
if (iframe && !window.opera)
{
if (iframe.contentDocument && iframe.contentDocument.body.offsetHeight)
iframe.height = iframe.contentDocument.body.offsetHeight;
else if(iframe.Document && iframe.Document.body.scrollHeight)
iframe.height = iframe.Document.body.scrollHeight;
}
} */
/* alert(iframe.contentWindow.document.documentElement.scrollHeight);
alert(iframe.contentDocument.body.offsetHeight);
alert(iframe.contentWindow.document.body.scrollHeight); */
} catch (ex) {
}
}
//下拉项设置
$('.menuItem').click(function () {
var dataUrl = $(this).attr('href');
var itemText = $(this).text();
//console.log(dataUrl);
//console.log(itemText);
//设置frame路径
$('#erpFrame').attr("src", dataUrl);
//取消悬浮
$('.menu-dropdown').removeClass('open');
//修改导航条下面的内容
$('.page-title').find("h1").html(itemText + "<small></small>");
//修改菜单选中
//清除选中
clearActive();
//清除面包屑
$('.page-breadcrumb>li').remove();
//设置选中
$(this).parent().addClass("active");
//alert($(this).parent().parent().parent("li").length);
if ($(this).parent().parent().parent("li").length != 0) {
$(this).parent().parent().parent().addClass("active");
if ($(this).parent().parent().parent().parent().parent("li").length != 0) {
$(this).parent().parent().parent().parent().parent().addClass("active");
//alert($(this).parent().parent().parent().children("a").text().trim());
if ($(this).parent().parent().parent().parent().parent().parent().parent("li").length != 0) {
$(this).parent().parent().parent().parent().parent().parent().parent().addClass("active");
/* $('.page-breadcrumb').append(
'<li><a href='+ctx+'index>Home</a><i class="fa fa-circle"></i></li><li><a href="#">'
+ $(this).parent().parent().parent().parent().parent().children("a").text().trim() + '</a> <i class="fa fa-circle"></i></li><li class="active">'
+ itemText + '</li>'); */
$('.page-breadcrumb').append(
'<li><a href=' + ctx + 'index>Home</a><i class="fa fa-circle"></i></li><li><a href="#">'
+ $(this).parent().parent().parent().parent().parent().parent().parent().children("a").text().trim() + '</a> <i class="fa fa-circle"></i></li><li><a href="#">'
+ $(this).parent().parent().parent().parent().parent().children("a").text().trim() + '</a> <i class="fa fa-circle"></i></li><li><a href="#">'
+ $(this).parent().parent().parent().children("a").text().trim() + '</a> <i class="fa fa-circle"></i></li><li class="active">'
+ itemText + '</li>');
} else {
$('.page-breadcrumb').append(
'<li><a href=' + ctx + 'index>Home</a><i class="fa fa-circle"></i></li><li><a href="#">'
+ $(this).parent().parent().parent().parent().parent().children("a").text().trim() + '</a> <i class="fa fa-circle"></i></li><li><a href="#">'
+ $(this).parent().parent().parent().children("a").text().trim() + '</a> <i class="fa fa-circle"></i></li><li class="active">'
+ itemText + '</li>');
}
} else {
$('.page-breadcrumb').append(
'<li><a href=' + ctx + 'index>Home</a><i class="fa fa-circle"></i></li><li><a href="#">'
+ $(this).parent().parent().parent().children("a").text().trim() + '</a> <i class="fa fa-circle"></i></li><li class="active">'
+ itemText + '</li>');
}
} else {
//home和自己
$('.page-breadcrumb').append('<li><a href=' + ctx + 'index>Home</a><i class="fa fa-circle"></i></li><li class="active">' + itemText + '</li>');
}
$(".page-header .menu-toggler").click();
return false;
})
//查看所有待办任务
function viewAllTasks() {
//控制iframe跳转
$('#erpFrame').attr("src", ctx + "process/todoitem");
$('.page-title').find("h1").html("我的待办" + "<small></small>");
//清除面包屑
$('.page-breadcrumb>li').remove();
$('.page-breadcrumb').append(
'<li>' +'<a href=' + ctx + 'index' + '>Home</a><i class="fa fa-circle"></i></li>' +
' <li>' +'<a href="#">我的待办</a> ' +' <i class= "fa fa-circle"></i>' +'</li>' +'<li class="active">我的待办</li>'
);
//清除选中
clearActive();
//控制选中
/* $('#flowManager').addClass("active");
$('#myTodoParent').addClass("active");
$('#myTodo').addClass("active");*/
}
//查看所有提醒
function viewAllRemind() {
//控制iframe跳转
$('#erpFrame').attr("src", ctx + "remind");
$('.page-title').find("h1").html("我的提醒" + "<small></small>");
//清除面包屑
$('.page-breadcrumb>li').remove();
$('.page-breadcrumb').append(
'<li><a href=' + ctx + 'index>Home</a><i class="fa fa-circle"></i></li><li><a href="#">我的提醒</a> <i class="fa fa-circle"></i></li><li class="active">我的提醒</li>');
//清除选中
clearActive();
//控制选中
$('#flowManager').addClass("active");
$('#myRemindParent').addClass("active");
$('#myRemind').addClass("active");
}
//所需单据绑定回车键
$('#allSearch').bind('keydown', function (event) {
if (event.keyCode == "13") {
viewAllselect();
}
});
//查看所有提醒
function viewAllselect() {
//控制iframe跳转
var value = $('#allSearch').val();
$('#erpFrame').attr("src", ctx + "remind/");
$('.page-title').find("h1").html("我的提醒" + "<small></small>");
//清除面包屑
$('.page-breadcrumb>li').remove();
$('.page-breadcrumb').append(
'<li><a href='+ctx+'index>Home</a><i class="fa fa-circle"></i></li><li><a href="#">我的提醒</a> <i class="fa fa-circle"></i></li><li class="active">我的提醒</li>');
//清除选中
clearActive();
//控制选中
/*$('#flowManager').addClass("active");
$('#myRemindParent').addClass("active");
$('#myRemind').addClass("active"); */
}
//查看个人资料
function viewMyProfile() {
//控制iframe跳转
$('#erpFrame').attr("src", ctx + "system/user/profile");
$('.page-title').find("h1").html("我的个人资料" + "<small></small>");
//清除面包屑
$('.page-breadcrumb>li').remove();
$('.page-breadcrumb').append(
'<li><a href=' + ctx + 'index>Home</a><i class="fa fa-circle"></i></li><li><a href="#">我的个人资料</a> <i class="fa fa-circle"></i></li><li class="active">我的个人资料</li>');
//清除选中
clearActive();
}
//新建流程
//我的请求
function viewAllRequestItem() {
//控制iframe跳转
$('#erpFrame').attr("src", ctx + "process/requestitem");
$('.page-title').find("h1").html("我的请求" + "<small></small>");
//清除面包屑
$('.page-breadcrumb>li').remove();
$('.page-breadcrumb').append(
'<li><a href=' + ctx + 'index>Home</a><i class="fa fa-circle"></i></li><li><a href="#">我的请求</a> <i class="fa fa-circle"></i></li><li class="active">我的请求</li>');
//清除选中
clearActive();
//控制选中
/*$('#flowManager').addClass("active");
$('#myTodoParent').addClass("active");
$('#myTodo').addClass("active");*/
}
//我的已办
function viewAllDoneTasks() {
//控制iframe跳转
$('#erpFrame').attr("src", ctx + "process/doneitemView");
$('.page-title').find("h1").html("我的已办" + "<small></small>");
//清除面包屑
$('.page-breadcrumb>li').remove();
$('.page-breadcrumb').append(
'<li><a href=' + ctx + 'index>Home</a><i class="fa fa-circle"></i></li><li><a href="#">我的已办</a> <i class="fa fa-circle"></i></li><li class="active">我的已办</li>');
//清除选中
clearActive();
//控制选中
/*$('#flowManager').addClass("active");
$('#myTodoParent').addClass("active");
$('#myTodo').addClass("active");*/
}
//清除选中
function clearActive() {
$('.menuItem').parent().removeClass("active");
if ($('.menuItem').parent().parent().parent("li").length != 0) {
$('.menuItem').parent().parent().parent().removeClass("active");
if ($('.menuItem').parent().parent().parent().parent().parent("li").length != 0) {
$('.menuItem').parent().parent().parent().parent().parent().removeClass("active");
if ($('.menuItem').parent().parent().parent().parent().parent().parent().parent("li").length != 0) {
$('.menuItem').parent().parent().parent().parent().parent().parent().parent().removeClass("active");
}
}
}
}
// 计算耗时
function transDate(todoTime) {
date = new Date(todoTime);
var tt = date;
var days = parseInt((new Date().getTime() - date) / 86400000);
var today = new Date().getDate();
var year = tt.getFullYear();
var mouth = tt.getMonth() + 1;
var day = tt.getDate();
var time = tt.getHours() < 10 ? "0" + tt.getHours() : tt.getHours();
var min = tt.getMinutes() < 10 ? "0" + tt.getMinutes() : tt.getMinutes();
var result, offset;
offset = Math.abs(today - day);
if (days < 4 && offset < 4) {
if (offset === 0) {
result = "今天" + time + ":" + min;
} else if (offset === 1) {
result = "昨天" + time + ":" + min;
} else if (offset === 2) {
result = "前天" + time + ":" + min;
} else if (offset === 3) {
result = "3天前" + time + ":" + min;
}
} else {
// result = year + "-" + mouth + "-" + day + " " + time + ":" + min;
result = "3天以前";
}
return result;
}
$('#todoItemList').on('click', 'li', function (e) {
var dataUrl = $(this).children('a').attr('href');
//console.log(aa);
$('#erpFrame').attr("src", dataUrl);
return false;
});
$('#remindList').on('click', 'li', function (e) {
var dataUrl = $(this).children('a').attr('href');
//console.log(aa);
$('#erpFrame').attr("src", dataUrl);
return false;
});
$(".notification").on("click", function () {
let id = $(this).val();
$.ajax({
url: ctx + "buyorderHead/buyOrderList/changeView",
url: ctx + "remind/getRemindListNoPaging",
type: "post",
dataType: "json",
data: {"id": id},
success: function (resp) {
if (resp.code === 1) {
$.modal.msgError("阅读失败!");
}else {
$("li[value='"+id+"']").css("display","none")
}
$("li[value='"+id+"']").css("display","none")
},
error: function () {
$.modal.msgError("出错了!");

Loading…
Cancel
Save