@@ -36,6 +36,7 @@ namespace Learun.Application.Web.Areas.LR_Desktop.Controllers | |||
[HttpGet] | |||
public ActionResult UnreadIndex() | |||
{ | |||
ViewBag.Name = (LoginUserInfo.Get()).realName; | |||
return View(); | |||
} | |||
/// <summary> | |||
@@ -17,10 +17,11 @@ | |||
</div> | |||
<div class=" btn-group btn-group-sm" learun-authorize="yes"> | |||
@*<a id="lr_add" class="btn btn-default"><i class="fa fa-plus"></i> 新增</a> | |||
<a id="lr_edit" class="btn btn-default"><i class="fa fa-pencil-square-o"></i> 编辑</a> | |||
<a id="lr_delete" class="btn btn-default"><i class="fa fa-trash-o"></i> 删除</a>*@ | |||
<a id="lr_print" class="btn btn-default"><i class="fa fa-print"></i> 打印</a> | |||
<a id="lr_edit" class="btn btn-default"><i class="fa fa-pencil-square-o"></i> 编辑</a> | |||
<a id="lr_delete" class="btn btn-default"><i class="fa fa-trash-o"></i> 删除</a>*@ | |||
<a id="lr_view" class="btn btn-default"><i class="fa fa-trash-o"></i> 查看</a> | |||
<a id="lr_print" class="btn btn-default"><i class="fa fa-print"></i> 打印</a> | |||
</div> | |||
<div class="layui-btn-container"> | |||
@@ -30,61 +31,64 @@ | |||
<div class="lr-layout-body" id="gridtable"></div> | |||
</div> | |||
</div> | |||
<div id="winpop"> | |||
@*<div id="winpop"> | |||
<div class="title">您有新的未读消息<span class="close" onclick="tips_pop()">x</span></div> | |||
<div id="notifications"> | |||
</div> | |||
</div> | |||
</div>*@ | |||
</div> | |||
@Html.AppendJsFile("/Areas/LR_Desktop/Views/MessageRind/Index.js"); | |||
<script> | |||
function tips_pop() { | |||
var MsgPop = document.getElementById("winpop"); | |||
var popH = parseInt(MsgPop.style.height); | |||
if (popH == 0) { | |||
MsgPop.style.Height = "block"; | |||
show = setInterval("changeH('up')", 2); | |||
} else { | |||
hide = setInterval("changeH('down')", 2); | |||
} | |||
} | |||
//function tips_pop() { | |||
// var MsgPop = document.getElementById("winpop"); | |||
// var popH = parseInt(MsgPop.style.height); | |||
// if (popH == 0) { | |||
// MsgPop.style.Height = "block"; | |||
// show = setInterval("changeH('up')", 2); | |||
// } else { | |||
// hide = setInterval("changeH('down')", 2); | |||
// } | |||
//} | |||
function changeH(str) { | |||
var magPop = document.getElementById("winpop"); | |||
var popH = parseInt(MsgPop.style.Height); | |||
if (str == "up") { | |||
if (popH <= 100) { | |||
msgPop.style.height = (popH + 4).toString() + "px"; | |||
} else { | |||
clearInterval(show); | |||
} | |||
} | |||
if (str == "down") { | |||
if (popH >= 4) { | |||
MsgPop.style.Height = (popH - 4).toString() + "px"; | |||
} else { | |||
clearInterval(hide); | |||
MsgPop.style.display = "none"; | |||
} | |||
} | |||
window.onload = function() { | |||
document.getElementById('winpop').style.height = '0px'; | |||
setTimeout("tips_pop()", 800); | |||
} | |||
//function changeH(str) { | |||
// var magPop = document.getElementById("winpop"); | |||
// var popH = parseInt(MsgPop.style.Height); | |||
// if (str == "up") { | |||
// if (popH <= 100) { | |||
// msgPop.style.height = (popH + 4).toString() + "px"; | |||
// } else { | |||
// clearInterval(show); | |||
// } | |||
// } | |||
// if (str == "down") { | |||
// if (popH >= 4) { | |||
// MsgPop.style.Height = (popH - 4).toString() + "px"; | |||
// } else { | |||
// clearInterval(hide); | |||
// MsgPop.style.display = "none"; | |||
// } | |||
// } | |||
// window.onload = function() { | |||
// document.getElementById('winpop').style.height = '0px'; | |||
// setTimeout("tips_pop()", 800); | |||
// } | |||
} | |||
function Winpop() { | |||
var state = '0'; | |||
$.get(${ ctx } / sys / msGetUserMedia / getMsgList ? state + "&t=" + new Date().getTime(),function(data) { | |||
$("#notifications").html(data); | |||
}), | |||
} | |||
//} | |||
//function Winpop() { | |||
// var state = '0'; | |||
// //$.get(${ ctx }/ sys /msGetUserMedia/getMsgList?state + "&t=" + new Date().getTime(),function(data) { | |||
// // $("#notifications").html(data); | |||
// //}), | |||
// $.get(${ ctx } / sys / msGetUserMedia / getMsgList ? state + "&t=" + new Date().getTime(), function (data) { | |||
// $("#notifications").html(data); | |||
// }); | |||
//} | |||
winpop(); | |||
setInterval(function() { | |||
$("#winpop").load(Winpop(), ""); | |||
}, | |||
1000); | |||
//winpop(); | |||
//setInterval(function() { | |||
// $("#winpop").load(Winpop(), ""); | |||
// }, | |||
// 1000); | |||
</script> |
@@ -81,7 +81,7 @@ var bootstrap = function ($, learun) { | |||
if (learun.checkrow(keyValue)) { | |||
learun.layerConfirm('是否确认删除该项!', function (res) { | |||
if (res) { | |||
learun.deleteForm(top.$.rootUrl + '/LR_Desktop/MessageRind/DeleteForm', { keyValue: keyValue}, function () { | |||
learun.deleteForm(top.$.rootUrl + '/LR_Desktop/MessageRind/DeleteForm', { keyValue: keyValue }, function () { | |||
refreshGirdData(); | |||
}); | |||
} | |||
@@ -92,21 +92,38 @@ var bootstrap = function ($, learun) { | |||
$('#lr_print').on('click', function () { | |||
$('#gridtable').jqprintTable(); | |||
}); | |||
// 查看 | |||
$('#lr_view').on('click', function () { | |||
var title = $('#gridtable').jfGridValue('TheTitle'); | |||
var keyValue = $('#gridtable').jfGridValue('InstanceId'); | |||
//var MessageId = $('#gridtable').jfGridValue('MessageId'); | |||
var ConnectionUrl = $('#gridtable').jfGridValue('ConnectionUrl'); | |||
var url = top.$.rootUrl + ConnectionUrl + keyValue; | |||
learun.layerForm({ | |||
id: 'formview', | |||
title: title, | |||
url: url, | |||
width: 1000, | |||
height: 650, | |||
maxmin: true, | |||
btn: null, | |||
}); | |||
}); | |||
}, | |||
// 初始化列表 | |||
initGird: function () { | |||
$('#gridtable').lrAuthorizeJfGrid({ | |||
url: top.$.rootUrl + '/LR_Desktop/MessageRind/GetPageList', | |||
headData: [ | |||
//{ label: "收件人ID", name: "ReceiptId", width: 100, align: "left"}, | |||
{ label: "收件人姓名", name: "ReceiptName", width: 100, align: "left"}, | |||
{ label: "收件人姓名", name: "ReceiptName", width: 100, align: "left" }, | |||
//{ label: "发件人ID", name: "SenderId", width: 100, align: "left"}, | |||
{ label: "发件人姓名", name: "SenderName", width: 100, align: "left"}, | |||
{ label: "发送时间", name: "SendTime", width: 100, align: "left"}, | |||
{ label: "标题", name: "TheTitle", width: 100, align: "left"}, | |||
{ label: "发件人姓名", name: "SenderName", width: 100, align: "left" }, | |||
{ label: "发送时间", name: "SendTime", width: 100, align: "left" }, | |||
{ label: "标题", name: "TheTitle", width: 100, align: "left" }, | |||
{ label: "内容", name: "TheContent", width: 400, align: "left" }, | |||
{ | |||
label: "状态", name: "ReadSigns", width: 100, align: "left", formatter: function (cellvalue) { | |||
@@ -114,7 +131,7 @@ var bootstrap = function ($, learun) { | |||
} | |||
}, | |||
], | |||
mainId:'MessageId', | |||
mainId: 'MessageId', | |||
isPage: true | |||
}); | |||
}, | |||
@@ -122,12 +139,12 @@ var bootstrap = function ($, learun) { | |||
param = param || {}; | |||
param.StartTime = startTime; | |||
param.EndTime = endTime; | |||
$('#gridtable').jfGridSet('reload',{ queryJson: JSON.stringify(param) }); | |||
$('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) }); | |||
} | |||
}; | |||
refreshGirdData = function () { | |||
$('#gridtable').jfGridSet('reload'); | |||
}; | |||
page.init(); | |||
} |
@@ -40,112 +40,103 @@ | |||
) | |||
<script type='text/javascript'> | |||
$(document).ready(function () { | |||
getdata(); | |||
function getdata() { | |||
$.ajax({ | |||
url: top.$.rootUrl + '/LR_Desktop/MessageRind/GetListForUnread', | |||
type: "get", | |||
dataType: "json", | |||
async: false, | |||
success: function (data) { | |||
//console.log(data); | |||
var content = ""; | |||
if (data.length > 0) { | |||
content += "<ul id='uldata'>"; | |||
for (var i = 0; i < data.length; i++) { | |||
content += "<li>" + " " + data[i]["SenderName"] + "的消息:" + "</li>"; | |||
var theContent = data[i]["TheContent"]; | |||
//可显示的最长长度 | |||
var maxlen = 50; | |||
if (theContent.length > maxlen) { | |||
theContent = theContent.substring(0, maxlen - 3) + "..."; | |||
} | |||
var param = data[i]["TheTitle"] + "、" + data[i]["InstanceId"] + "、" + data[i]["MessageId"] + "、" + data[i]["ConnectionUrl"]; | |||
content += "<li>"; | |||
content += " 【" + data[i]["TheTitle"] + "】" + theContent + " "; | |||
content += '<a id="' + param + '" href="javascript:void(0);" class="lr-item" style="color:blue;textDecoration:underline">点击查看>>'; | |||
content += "</a>"; | |||
content += "</li>"; | |||
var name = '@(ViewBag.Name)'; | |||
$(document).ready(function () { | |||
getdata(); | |||
function getdata() { | |||
$.ajax({ | |||
url: top.$.rootUrl + '/LR_Desktop/MessageRind/GetListForUnread', | |||
type: "get", | |||
dataType: "json", | |||
async: false, | |||
success: function (data) { | |||
var content = ""; | |||
if (data.length > 0) { | |||
content += "<ul id='uldata'>"; | |||
for (var i = 0; i < data.length; i++) { | |||
//data[i]["SenderName"] | |||
//content += "<li>" + " " + name + "的消息:" + "</li>"; | |||
var theContent = data[i]["TheContent"]; | |||
//可显示的最长长度 | |||
var maxlen = 50; | |||
if (theContent.length > maxlen) { | |||
theContent = theContent.substring(0, maxlen - 3) + "..."; | |||
} | |||
content += "</ul>"; | |||
} | |||
else { | |||
content = "暂无未读消息"; | |||
var param = data[i]["TheTitle"] + "、" + data[i]["InstanceId"] + "、" + data[i]["MessageId"] + "、" + data[i]["ConnectionUrl"]; | |||
content += "<li>"; | |||
content += " 【" + data[i]["TheTitle"] + "】" + theContent + " "; | |||
content += '<a id="' + param + '" href="javascript:void(0);" class="lr-item" style="color:blue;textDecoration:underline">点击查看>>'; | |||
content += "</a>"; | |||
content += "</li>"; | |||
} | |||
$("#content").html(content); | |||
content += "</ul>"; | |||
} | |||
}); | |||
} | |||
$('#uldata .lr-item').on('click', function () { | |||
var $obj = $(this); | |||
var params = ($obj.attr('id')).split('、'); | |||
//更改状态为已读 | |||
var MessageId = params[2]; | |||
if (top.learun.checkrow(MessageId)) { | |||
$.ajax({ | |||
url: top.$.rootUrl + '/LR_Desktop/MessageRind/SaveReadSigns', | |||
type: "post", | |||
data: { keyValue: MessageId }, | |||
dataType: "json", | |||
async: false, | |||
success: function (data) { | |||
console.log(data); | |||
//弹窗查看详情 | |||
var keyValue = params[1]; | |||
var ConnectionUrl = params[3]; | |||
var title = params[0]; | |||
if (title == "流程通知") { | |||
top.learun.frameTab.open({ | |||
F_ModuleId: keyValue + "_homeopen", | |||
F_Icon: 'fa magic', | |||
F_FullName: '审核流程', | |||
F_UrlAddress: '/LR_NewWorkFlow/NWFProcess/Index' | |||
//F_UrlAddress: '/LR_WorkFlowModule/WfMyTask/CustmerWorkFlowForm?tabIframeId=' + p.f_id + '&type=' + p.f_tasktype + '' + "&processId=" + p.f_processid + "&taskId=" + p.f_id | |||
}); | |||
} else { | |||
if (top.learun.checkrow(keyValue)) { | |||
top.learun.layerForm({ | |||
id: 'formview', | |||
title: title, | |||
url: top.$.rootUrl + ConnectionUrl + keyValue, | |||
width: 1000, | |||
height: 650, | |||
maxmin: true, | |||
btn: null, | |||
}); | |||
} | |||
} | |||
} | |||
}) | |||
else { | |||
content = "暂无未读消息"; | |||
} | |||
$("#content").html(content); | |||
} | |||
}); | |||
}); | |||
//function funLook(param) { | |||
// var id = "433d5658-40b0-4e2d-b736-c4e8561d017e";//$obj.attr('id'); | |||
// var _module = top.learun.clientdata.get(['modulesMap', id]); | |||
// switch (_module.F_Target) { | |||
// case 'iframe':// 窗口 | |||
// if (top.learun.validator.isNotNull(_module.F_UrlAddress).code) { | |||
// top.learun.frameTab.open(_module); | |||
// } | |||
// break; | |||
// case 'open':// 窗口 | |||
// var newWin = window.open(_module.F_UrlAddress); | |||
// newWin.location.replace(_module.F_UrlAddress); | |||
// break; | |||
// } | |||
} | |||
$('#uldata .lr-item').on('click', function () { | |||
var $obj = $(this); | |||
var params = ($obj.attr('id')).split('、'); | |||
//更改状态为已读 | |||
var MessageId = params[2]; | |||
if (top.learun.checkrow(MessageId)) { | |||
$.ajax({ | |||
url: top.$.rootUrl + '/LR_Desktop/MessageRind/SaveReadSigns', | |||
type: "post", | |||
data: { keyValue: MessageId }, | |||
dataType: "json", | |||
async: false, | |||
success: function(data) { | |||
//弹窗查看详情 | |||
var keyValue = params[1]; | |||
var ConnectionUrl = params[3]; | |||
var title = params[0]; | |||
if (!!ConnectionUrl) { | |||
var url = top.$.rootUrl + ConnectionUrl; | |||
if (!!keyValue && keyValue != 'null' && keyValue != 'undefined') { | |||
url += keyValue; | |||
} | |||
top.learun.layerForm({ | |||
id: 'formview', | |||
title: title, | |||
url: url, | |||
width: 1000, | |||
height: 650, | |||
maxmin: true, | |||
btn: null, | |||
}); | |||
} | |||
//} | |||
} | |||
}) | |||
} | |||
}); | |||
}); | |||
//function funLook(param) { | |||
// var id = "433d5658-40b0-4e2d-b736-c4e8561d017e";//$obj.attr('id'); | |||
// var _module = top.learun.clientdata.get(['modulesMap', id]); | |||
// switch (_module.F_Target) { | |||
// case 'iframe':// 窗口 | |||
// if (top.learun.validator.isNotNull(_module.F_UrlAddress).code) { | |||
// top.learun.frameTab.open(_module); | |||
// } | |||
// break; | |||
// case 'open':// 窗口 | |||
// var newWin = window.open(_module.F_UrlAddress); | |||
// newWin.location.replace(_module.F_UrlAddress); | |||
// break; | |||
// } | |||
//} | |||
</script> | |||
</body> | |||
@@ -4,24 +4,24 @@ using System.Data.Entity.ModelConfiguration; | |||
namespace Learun.Application.Mapping | |||
{ | |||
/// <summary> | |||
/// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园 | |||
/// Copyright (c) 2013-2018 北京泉江科技有限公司 | |||
/// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 | |||
/// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 | |||
/// 创 建:超级管理员 | |||
/// 日 期:2018-09-25 11:32 | |||
/// 日 期:2021-04-23 16:58 | |||
/// 描 述:消息提醒 | |||
/// </summary> | |||
public class MessageRemindMap : EntityTypeConfiguration<MessageRemindEntity> | |||
{ | |||
public MessageRemindMap() | |||
{ | |||
#region 表、主键 | |||
#region 表、主键 | |||
//表 | |||
this.ToTable("MESSAGEREMIND"); | |||
//主键 | |||
this.HasKey(t => t.MessageId); | |||
#endregion | |||
#region 配置关系 | |||
#region 配置关系 | |||
#endregion | |||
} | |||
} | |||
@@ -32,15 +32,7 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop | |||
var strSql = new StringBuilder(); | |||
strSql.Append("SELECT "); | |||
strSql.Append(@" | |||
t.MessageId, | |||
t.ReceiptId, | |||
t.ReceiptName, | |||
t.SenderId, | |||
t.SenderName, | |||
t.SendTime, | |||
t.TheTitle, | |||
t.TheContent, | |||
t.ReadSigns | |||
t.* | |||
"); | |||
strSql.Append(" FROM MessageRemind t "); | |||
strSql.Append(" WHERE 1=1 "); | |||
@@ -76,7 +68,8 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop | |||
{ | |||
try | |||
{ | |||
return this.BaseRepository().FindList<MessageRemindEntity>(x => x.ReadSigns == false); | |||
var userInfo = LoginUserInfo.Get(); | |||
return this.BaseRepository().FindList<MessageRemindEntity>(x => x.ReadSigns == false && x.ReceiptId == userInfo.userId); | |||
} | |||
catch (Exception ex) | |||
{ | |||
@@ -101,7 +94,9 @@ namespace Learun.Application.TwoDevelopment.LR_Desktop | |||
{ | |||
var userInfo = LoginUserInfo.Get(); | |||
string sql = "select count(1) from MessageRemind where ReadSigns=0 "; | |||
sql += $" and ReceiptId='{userInfo.userId}'"; | |||
var obj = this.BaseRepository().FindObject(sql); | |||
if (obj == null) | |||
return 0; | |||