Przeglądaj źródła

未读数刷新

黑艺新账号
hwh2023 1 rok temu
rodzic
commit
467eeb8c68
2 zmienionych plików z 120 dodań i 0 usunięć
  1. +93
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Controllers/MessageRindController.cs
  2. +27
    -0
      Learun.Framework.Ultimate V7/Learun.Application.Web/Views/Home/AdminDesktop/Index.js

+ 93
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_Desktop/Controllers/MessageRindController.cs Wyświetl plik

@@ -6,6 +6,9 @@ using System.Collections.Generic;
using System.Collections;
using System;
using System.Linq;
using Learun.Application.OA;
using Learun.Application.TwoDevelopment.EducationalAdministration;
using Learun.Application.WorkFlow;

namespace Learun.Application.Web.Areas.LR_Desktop.Controllers
{
@@ -91,6 +94,96 @@ namespace Learun.Application.Web.Areas.LR_Desktop.Controllers

return Success(count);
}


private SYS_ReceiveMessageIBLL sYS_ReceiveMessageIBLL = new SYS_ReceiveMessageBLL();
private NWFProcessIBLL nWFProcessIBLL = new NWFProcessBLL();
private NoticeIBLL newsIBLL = new NoticeBLL();
private Sys_ReceiveFileIBLL sys_ReceiveFileIBLL = new Sys_ReceiveFileBLL();
/// <summary>
/// 获取未读的消息的数量
/// </summary>
/// <param name="pagination">分页参数</param>
/// <param name="queryJson">查询参数</param>
/// <returns></returns>
[HttpGet]
[AjaxOnly]
public ActionResult GetCountFortotalUnread()
{
int totalcount = 0;
#region 待办
var userinfo = LoginUserInfo.Get();
Pagination paginationobj = new Pagination() { rows = 100, page = 1, sidx = "readflag asc,SENDTIME desc ", sord = "desc" };
//未读邮件
int UnreadMail = sYS_ReceiveMessageIBLL.GetPageList(paginationobj, "{\"userId\":\"" + userinfo.userId + "\"}").Count(m => m.READFLAG == 0);
//办公事项
paginationobj.sidx = "F_CreateDate";
int UnreadTask = nWFProcessIBLL.GetMyTaskPageList(userinfo, paginationobj, "{}").Count();
//公告
List<NewsEntity> outnewslist = new List<NewsEntity>();
var newsList = newsIBLL.GetPageList(paginationobj, "");
foreach (var newsitemEntity in newsList)
{
if (!string.IsNullOrEmpty(newsitemEntity.F_SendPostId))
{
if (!string.IsNullOrEmpty(userinfo.postIds))
{
if (userinfo.postIds.Contains(","))
{
foreach (var postid in userinfo.postIds.Split(','))
{
if (newsitemEntity.F_SendPostId.Contains(postid))
{
outnewslist.Add(newsitemEntity);
break;
}
}
}
else
{
if (newsitemEntity.F_SendPostId.Contains(userinfo.postIds))
{
outnewslist.Add(newsitemEntity);
}
}
}
}
else
{
if (!string.IsNullOrEmpty(newsitemEntity.F_SendDeptId))
{
if (userinfo.departmentId != null && newsitemEntity.F_SendDeptId.Contains(userinfo.departmentId))
{
outnewslist.Add(newsitemEntity);
}
}
else
{
outnewslist.Add(newsitemEntity);
}
}
}
var readnewslist = newsIBLL.GetList("", userinfo.userId).Where(m => !string.IsNullOrEmpty(m.RNewsId)).Select(m => m.F_NewsId);
int UnreadNews = outnewslist.Count(m => !readnewslist.Contains(m.F_NewsId));
paginationobj.sidx = "SendTime";
int UnreadFile = sys_ReceiveFileIBLL.GetPageListBySenderId(userinfo.userId).Count();
//普通教师请假-未归档数
int UnfileLeave = 0;
//中层领导请假-未归档数
int UnfileLeaveZC = 0;

totalcount = UnreadFile + UnreadNews + UnreadTask + UnreadMail + UnfileLeave + UnfileLeaveZC;
#endregion
var data = new
{
UnreadTask= UnreadTask,
UnreadNews= UnreadNews,
UnfileLeave= UnfileLeave,
UnfileLeaveZC= UnfileLeaveZC,
totalcount = totalcount
};
return Success(data);
}
/// <summary>
/// 获取未读的消息
/// </summary>


+ 27
- 0
Learun.Framework.Ultimate V7/Learun.Application.Web/Views/Home/AdminDesktop/Index.js Wyświetl plik

@@ -328,4 +328,31 @@
}
});
};

window.setInterval(gettotalunread, 10000);
//未读消息totalcount
function gettotalunread() {
$.ajax({
url: top.$.rootUrl + '/LR_Desktop/MessageRind/GetCountFortotalUnread',
type: "get",
dataType: "json",
async: false,
success: function (data) {
if (data.data != 0) {
//document.getElementsByClassName("lr-im-bell2")[0].children[0].children[2].innerText = data.data;

//UnreadTask = UnreadTask,
// UnreadNews = UnreadNews,
// UnfileLeave = UnfileLeave,
// UnfileLeaveZC = UnfileLeaveZC,
// totalcount = totalcount
$('#btn_daiban').html("<i class='fa fa-comment'></i>待办事项 " + data.data.UnreadTask + " 条")
$('#btn_tonggao').html("<i class='fa fa-paper-plane'></i>通告 " + data.data.UnreadNews + " 条")
//$('#btn_gongwen').text(data.totalcount)
$('body > div.lr-im-bell2.open > ul > li:nth-child(5)').html("共 " + data.data.totalcount+" 条")
$('body > div.lr-im-bell2 > a > span:nth-child(3)').html(data.data.totalcount)
}
}
});
};
});

Ładowanie…
Anuluj
Zapisz