From d284c284fc0d9e5d8f06cde531814da8de6dbd7d Mon Sep 17 00:00:00 2001 From: liangkun Date: Mon, 12 Apr 2021 18:20:30 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=9A=E7=9F=A5=E5=85=AC=E5=91=8A=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=9B=9E=E6=94=B6=E7=AB=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/NoticeController.cs | 28 ++++++ .../LR_OAModule/Views/Notice/IndexFlow.cshtml | 1 + .../LR_OAModule/Views/Notice/IndexFlow.js | 13 +++ .../Views/Notice/IndexRecycle.cshtml | 31 +++++++ .../LR_OAModule/Views/Notice/IndexRecycle.js | 86 +++++++++++++++++++ .../Learun.Application.Web.csproj | 2 + .../Learun.Application.OA/Notice/NoticeBLL.cs | 38 ++++++++ .../Notice/NoticeIBLL.cs | 2 + .../Notice/NoticeService.cs | 59 ++++++++++++- 9 files changed, 258 insertions(+), 2 deletions(-) create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Views/Notice/IndexRecycle.cshtml create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Views/Notice/IndexRecycle.js diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Controllers/NoticeController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Controllers/NoticeController.cs index ad7935c92..a5043c015 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Controllers/NoticeController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Controllers/NoticeController.cs @@ -124,6 +124,19 @@ namespace Learun.Application.Web.Areas.LR_OAModule.Controllers }; return JsonResult(jsonData); } + public ActionResult GetPageListRevert(string pagination, string keyword) + { + Pagination paginationobj = pagination.ToObject(); + var data = noticeIBLL.GetPageListRevert(paginationobj, keyword); + var jsonData = new + { + rows = data, + total = paginationobj.total, + page = paginationobj.page, + records = paginationobj.records, + }; + return JsonResult(jsonData); + } /// /// 查看通知公告 /// @@ -407,6 +420,21 @@ namespace Learun.Application.Web.Areas.LR_OAModule.Controllers noticeIBLL.DeleteEntity(keyValue); return Success("删除成功!"); } + + [HttpPost] + [AjaxOnly] + public ActionResult RecycleForm(string keyValue) + { + noticeIBLL.RecycleForm(keyValue,"-1"); + return Success("操作成功!"); + } + [HttpPost] + [AjaxOnly] + public ActionResult RevertForm(string keyValue) + { + noticeIBLL.RecycleForm(keyValue, "0"); + return Success("操作成功!"); + } public void PushWeixin(List needpostuserlist, string title) { var WeChatConfigentity = weChatConfigIbll.GetEnableEntity(); diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Views/Notice/IndexFlow.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Views/Notice/IndexFlow.cshtml index 738d300c5..73331bcf5 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Views/Notice/IndexFlow.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Views/Notice/IndexFlow.cshtml @@ -24,6 +24,7 @@  查看  提交  删除 +  放入回收站 diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Views/Notice/IndexFlow.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Views/Notice/IndexFlow.js index b18f486c8..d0d4213f2 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Views/Notice/IndexFlow.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Views/Notice/IndexFlow.js @@ -112,6 +112,19 @@ var bootstrap = function ($, learun) { } } }); + //放入回收站 + $('#lr_recycle').on('click', function () { + var keyValue = $('#gridtable').jfGridValue('F_NewsId'); + if (learun.checkrow(keyValue)) { + learun.layerConfirm('是否确认放入回收站!', function (res) { + if (res) { + learun.deleteForm(top.$.rootUrl + '/LR_OAModule/Notice/RecycleForm', { keyValue: keyValue }, function () { + refreshGirdData(); + }); + } + }); + } + }); //  提交 $('#lr_submit').on('click', function () { var keyValue = $('#gridtable').jfGridValue('F_NewsId'); diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Views/Notice/IndexRecycle.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Views/Notice/IndexRecycle.cshtml new file mode 100644 index 000000000..0b0a67d02 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Views/Notice/IndexRecycle.cshtml @@ -0,0 +1,31 @@ +@{ + ViewBag.Title = "通知公告"; + Layout = "~/Views/Shared/_Index.cshtml"; +} +
+
+
+
+
+
+ +
+
+  查询 +
+
+
+
+ +
+
+  还原 +
+
+
+
+
+
+
+@Html.AppendJsFile("/Areas/LR_OAModule/Views/Notice/IndexRecycle.js") + diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Views/Notice/IndexRecycle.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Views/Notice/IndexRecycle.js new file mode 100644 index 000000000..6c69bb4ed --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_OAModule/Views/Notice/IndexRecycle.js @@ -0,0 +1,86 @@ +/* + * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn) + * Copyright (c) 2013-2018 北京泉江科技有限公司 + * 创建人:陈彬彬 + * 日 期:2017.07.11 + * 描 述:公告通知 + */ +var refreshGirdData; // 更新数据 +var bootstrap = function ($, learun) { + "use strict"; + var page = { + init: function () { + page.initGrid(); + page.bind(); + }, + bind: function () { + // 查询 + $('#btn_Search').on('click', function () { + var keyword = $('#txt_Keyword').val(); + page.search({ keyword: keyword }); + }); + // 刷新 + $('#lr_refresh').on('click', function () { + location.reload(); + }); + //还原 + $('#lr_revert').on('click', function () { + var keyValue = $('#gridtable').jfGridValue('F_NewsId'); + if (learun.checkrow(keyValue)) { + learun.layerConfirm('是否确认还原该项!', function (res) { + if (res) { + learun.deleteForm(top.$.rootUrl + '/LR_OAModule/Notice/RevertForm', { keyValue: keyValue }, function () { + refreshGirdData(); + }); + } + }); + } + }); + }, + initGrid: function () { + $('#gridtable').jfGrid({ + url: top.$.rootUrl + '/LR_OAModule/Notice/GetPageListRevert', + headData: [ + { label: '公告标题', name: 'F_FullHead', index: 'F_FullHead', width: 600, align: 'left' }, + { label: '发布人员', name: 'F_CreateUserName', index: 'F_CreateUserName', width: 100, align: 'left' }, + { label: '公告类别', name: 'F_Category', index: 'F_Category', width: 100, align: 'center' }, + { + label: "发布时间", name: "F_ReleaseTime", index: "F_ReleaseTime", width: 140, align: "center", + formatter: function (cellvalue) { + return learun.formatDate(cellvalue, 'yyyy-MM-dd hh:mm'); + } + }, + { label: '信息来源', name: 'F_SourceName', index: 'F_SourceName', width: 100, align: 'center' }, + { label: '阅读次数', name: 'F_PV', index: 'F_PV', width: 80, align: 'center' }, + { + label: "发布状态", name: "F_EnabledMark", index: "F_EnabledMark", width: 80, align: "center", autowidth: false, + formatter: function (cellvalue) { + if (cellvalue == 1) { + return "已发布"; + } else { + return "未发布"; + } + } + }, + { label: "创建时间", name: "F_CreateDate", index: "F_CreateDate", width: 130, align: "center" } + ], + mainId: 'F_NewsId', + isMultiselect: true, + isPage: true, + sidx: 'F_CreateDate', + sord: 'desc' + }); + page.search(); + }, + search: function (param) { + $('#gridtable').jfGridSet('reload', param); + } + }; + // 保存数据后回调刷新 + refreshGirdData = function () { + page.search(); + } + page.init(); +} + + diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj b/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj index 798ea8a6f..ae6e8de91 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj @@ -1279,6 +1279,7 @@ + @@ -6897,6 +6898,7 @@ + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/Notice/NoticeBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/Notice/NoticeBLL.cs index 5f56621d9..64777dae7 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/Notice/NoticeBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/Notice/NoticeBLL.cs @@ -40,6 +40,25 @@ namespace Learun.Application.OA } } } + + public IEnumerable GetPageListRevert(Pagination pagination, string keyword) + { + try + { + return noticeService.GetPageListRevert(pagination, keyword); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } /// /// 公告实体 /// @@ -88,6 +107,25 @@ namespace Learun.Application.OA } } } + + public void RecycleForm(string keyValue,string status) + { + try + { + noticeService.RecycleForm(keyValue,status); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } /// /// 保存(新增、修改) /// diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/Notice/NoticeIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/Notice/NoticeIBLL.cs index c42b9fa5a..01c6de29f 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/Notice/NoticeIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/Notice/NoticeIBLL.cs @@ -20,6 +20,7 @@ namespace Learun.Application.OA /// 关键词 /// IEnumerable GetPageList(Pagination pagination, string keyword); + IEnumerable GetPageListRevert(Pagination pagination, string keyword); /// /// 公告实体 /// @@ -55,5 +56,6 @@ namespace Learun.Application.OA void ChangeStatusById(string keyValue, int i, string processId); NewsEntity GetEntityByProcessId(string processId); + void RecycleForm(string keyValue,string status); } } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/Notice/NoticeService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/Notice/NoticeService.cs index f387aaaab..1099c51ae 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/Notice/NoticeService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.OA/Notice/NoticeService.cs @@ -27,7 +27,31 @@ namespace Learun.Application.OA try { var strSql = new StringBuilder(); - strSql.Append("SELECT * FROM LR_OA_News t WHERE t.F_TypeId = 2 "); + strSql.Append("SELECT * FROM LR_OA_News t WHERE t.F_TypeId = 2 and F_Status<>'-1' "); + if (!string.IsNullOrEmpty(keyword)) + { + strSql.Append(" AND F_FullHead like @keyword"); + } + return this.BaseRepository().FindList(strSql.ToString(), new { keyword = "%" + keyword + "%" }, pagination); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + public IEnumerable GetPageListRevert(Pagination pagination, string keyword) + { + try + { + var strSql = new StringBuilder(); + strSql.Append("SELECT * FROM LR_OA_News t WHERE t.F_TypeId = 2 and F_Status='-1' "); if (!string.IsNullOrEmpty(keyword)) { strSql.Append(" AND F_FullHead like @keyword"); @@ -106,6 +130,37 @@ namespace Learun.Application.OA } } } + + public void RecycleForm(string keyValue,string status) + { + var db = this.BaseRepository().BeginTrans(); + try + { + var list = keyValue.Split(','); + foreach (var item in list) + { + var entity = db.FindEntity(x => x.F_NewsId == item); + if (entity != null) + { + entity.F_Status = status; + db.Update(entity); + } + } + db.Commit(); + } + catch (Exception ex) + { + db.Rollback(); + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } /// /// 保存(新增、修改) /// @@ -156,7 +211,7 @@ namespace Learun.Application.OA 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(" WHERE t.F_TypeId = 2 "); + strSql.Append(" WHERE t.F_TypeId = 2 and F_Status<>'-1' "); if (!string.IsNullOrEmpty(categoryId)) { strSql.Append($" AND F_CategoryId = '{categoryId}'");