@@ -215,6 +215,13 @@ namespace Learun.Application.Web.Areas.LR_OAModule.Controllers | |||
return JsonResult(newsList); | |||
} | |||
public ActionResult GetListOfSelfForView(string queryJson) | |||
{ | |||
var newsList = noticeIBLL.GetListOfSelf(queryJson); | |||
return JsonResult(newsList); | |||
} | |||
/// <summary> | |||
/// 查看通知公告 | |||
/// </summary> | |||
@@ -10,6 +10,9 @@ | |||
<div class="lr-layout-tool-item"> | |||
<input id="txt_Keyword" type="text" class="form-control" placeholder="请输入标题" /> | |||
</div> | |||
<div class="lr-layout-tool-item"> | |||
<div id='IsRead' class="form-control"></div> | |||
</div> | |||
<div class="lr-layout-tool-item"> | |||
<a id="btn_Search" class="btn btn-primary btn-sm"><i class="fa fa-search"></i> <span class="lrlt">查询</span></a> | |||
</div> | |||
@@ -15,10 +15,17 @@ var bootstrap = function ($, learun) { | |||
page.bind(); | |||
}, | |||
bind: function () { | |||
$('#IsRead').lrselect({ | |||
placeholder: '请选择阅读状态', | |||
data: [{ id: '1', text: '已阅读' }, { id: '0', text: '未阅读' }], | |||
value: "id", | |||
text: "text" | |||
}); | |||
// 查询 | |||
$('#btn_Search').on('click', function () { | |||
var keyword = $('#txt_Keyword').val(); | |||
page.search({ keyword: keyword }); | |||
var IsRead = $('#IsRead').lrselectGet(); | |||
page.search({ keyword: keyword, IsRead: IsRead }); | |||
}); | |||
// 刷新 | |||
$('#lr_refresh').on('click', function () { | |||
@@ -42,7 +49,7 @@ var bootstrap = function ($, learun) { | |||
}, | |||
initGrid: function () { | |||
$('#gridtable').jfGrid({ | |||
url: top.$.rootUrl + '/LR_OAModule/Notice/GetListOfSelf', | |||
url: top.$.rootUrl + '/LR_OAModule/Notice/GetListOfSelfForView', | |||
headData: [ | |||
{ label: '公告标题', name: 'F_FullHead', index: 'F_FullHead', width: 600, align: 'left' }, | |||
{ label: '公告类别', name: 'F_Category', index: 'F_Category', width: 100, align: 'center' }, | |||
@@ -78,12 +85,11 @@ var bootstrap = function ($, learun) { | |||
page.search(); | |||
}, | |||
search: function (param) { | |||
param = param || {}; | |||
if (category) { | |||
param.categoryId = category; | |||
} | |||
$('#gridtable').jfGridSet('reload', param); | |||
$('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) }); | |||
} | |||
}; | |||
// 保存数据后回调刷新 | |||
@@ -179,6 +179,25 @@ namespace Learun.Application.OA | |||
} | |||
} | |||
public IEnumerable<NewsEntity> GetListOfSelf(string queryJson) | |||
{ | |||
try | |||
{ | |||
return noticeService.GetListOfSelf(queryJson); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowBusinessException(ex); | |||
} | |||
} | |||
} | |||
#endregion | |||
#region 流程 | |||
@@ -51,6 +51,7 @@ namespace Learun.Application.OA | |||
/// <param name="keyword">关键词</param> | |||
/// <returns></returns> | |||
IEnumerable<NewsEntity> GetList(string keyword,string categoryId=null); | |||
IEnumerable<NewsEntity> GetListOfSelf(string queryJson); | |||
#endregion | |||
@@ -387,6 +387,92 @@ SELECT ruserid from [dbo].[LR_OA_NewsShouldRead] where newsid='{news.F_NewsId}' | |||
} | |||
} | |||
public IEnumerable<NewsEntity> GetListOfSelf(string queryJson) | |||
{ | |||
try | |||
{ | |||
var userinfo = LoginUserInfo.Get(); | |||
var userId = userinfo.userId; | |||
var deptId = userinfo.departmentId; | |||
var postIds = userinfo.postIds; | |||
var strSql = new StringBuilder(); | |||
strSql.Append("SELECT t.*,r.RNewsId,r.RTime FROM LR_OA_News t "); | |||
strSql.Append(" left join LR_OA_NewsRead r on t.F_NewsId = r.NewsId and r.RUserId=@userId "); | |||
strSql.Append(" left join lr_base_user u on u.F_UserId=@userId "); | |||
strSql.Append(" WHERE t.F_TypeId = 2 and t.F_DeleteMark=0 and t.F_EnabledMark=1 "); | |||
if (userinfo.account.Contains("20")) | |||
{ | |||
strSql.Append(" and t.F_ReleaseTime>CONVERT(datetime,SUBSTRING(u.F_Account,1,4)+'-08-31',120) "); | |||
} | |||
strSql.Append($@" and ( | |||
((t.F_SendDeptId is null or len(t.F_SendDeptId)=0) and (t.F_SendPostId is null or len(t.F_SendPostId)=0)) | |||
"); | |||
if (!string.IsNullOrEmpty(deptId)) | |||
{ | |||
strSql.Append($" or (t.F_SendDeptId is not null and t.F_SendDeptId like '%{deptId}%')"); | |||
} | |||
if (!string.IsNullOrEmpty(postIds)) | |||
{ | |||
strSql.Append(" or (t.F_SendPostId is not null and "); | |||
if (postIds.Contains(",")) | |||
{ | |||
string postidSql = " ("; | |||
foreach (var postId in postIds) | |||
{ | |||
postidSql += $" t.F_SendPostId like '%{postId}%' or"; | |||
} | |||
postidSql = postidSql.Substring(0, postidSql.LastIndexOf("or")) + ")"; | |||
strSql.Append(postidSql); | |||
} | |||
else | |||
{ | |||
strSql.Append($" t.F_SendPostId like '%{postIds}%'"); | |||
} | |||
strSql.Append(")"); | |||
} | |||
strSql.Append(") "); | |||
var queryParam = queryJson.ToJObject(); | |||
// 虚拟参数 | |||
var dp = new DynamicParameters(new { }); | |||
if (!queryParam["keyword"].IsEmpty()) | |||
{ | |||
strSql.Append($" AND t.F_FullHead Like '{queryParam["keyword"].ToString()}' "); | |||
} | |||
if (!queryParam["categoryId"].IsEmpty()) | |||
{ | |||
strSql.Append($" AND t.F_CategoryId = '{queryParam["categoryId"].ToString()}'"); | |||
} | |||
if (!queryParam["IsRead"].IsEmpty()) | |||
{ | |||
var IsRead = queryParam["IsRead"].ToString().Trim(); | |||
if (IsRead == "1") | |||
{ | |||
strSql.Append($" AND (r.RNewsId is not null and len(r.RNewsId)>0)"); | |||
} | |||
else | |||
{ | |||
strSql.Append($" AND (r.RNewsId is null or len(r.RNewsId)=0)"); | |||
} | |||
} | |||
strSql.Append(" ORDER BY t.F_ReleaseTime DESC "); | |||
return this.BaseRepository().FindList<NewsEntity>(strSql.ToString(), new { userId = userId }); | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowServiceException(ex); | |||
} | |||
} | |||
} | |||
#endregion | |||
public void ChangeStatusById(string keyValue, int status, string processId) | |||