From b4bf43b8e1db0ec70f637ed455c6d38043cc7f22 Mon Sep 17 00:00:00 2001 From: ndbs Date: Wed, 9 Aug 2023 09:19:02 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=9A=E6=94=BF=E5=8A=9E=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/PartyManageController.cs | 21 +++----- .../Views/PartyManage/Form.cshtml | 18 +++++-- .../Views/PartyManage/Form.js | 22 ++++++-- .../Views/PartyManage/Index.cshtml | 22 ++++++++ .../Views/PartyManage/Index.js | 52 +++++++++++++------ .../PartyManage/PartyManageBLL.cs | 6 +-- .../PartyManage/PartyManageEntity.cs | 8 +++ .../PartyManage/PartyManageIBLL.cs | 4 +- .../PartyManage/PartyManageService.cs | 49 +++++++++++------ 9 files changed, 143 insertions(+), 59 deletions(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Controllers/PartyManageController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Controllers/PartyManageController.cs index f1c44308d..bdad1fee1 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Controllers/PartyManageController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Controllers/PartyManageController.cs @@ -26,7 +26,7 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers [HttpGet] public ActionResult Index() { - return View(); + return View(); } /// /// 表单页 @@ -35,7 +35,7 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers [HttpGet] public ActionResult Form() { - return View(); + return View(); } #endregion @@ -71,11 +71,10 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers [AjaxOnly] public ActionResult GetFormData(string keyValue) { - var PartyCateData = partyManageIBLL.GetPartyCateEntity( keyValue ); - var PartyManageData = partyManageIBLL.GetPartyManageEntity( PartyCateData.ID ); - var jsonData = new { + var PartyManageData = partyManageIBLL.GetPartyManageEntity(keyValue); + var jsonData = new + { PartyManage = PartyManageData, - PartyCate = PartyCateData, }; return Success(jsonData); } @@ -116,14 +115,10 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers [HttpPost] [ValidateAntiForgeryToken] [AjaxOnly] - public ActionResult SaveForm(string keyValue, string strEntity, string strpartyManageEntity) + public ActionResult SaveForm(string keyValue, string strEntity) { - PartyCateEntity entity = strEntity.ToObject(); - PartyManageEntity partyManageEntity = strpartyManageEntity.ToObject(); - partyManageIBLL.SaveEntity(keyValue,entity,partyManageEntity); - if (string.IsNullOrEmpty(keyValue)) - { - } + PartyManageEntity entity = strEntity.ToObject(); + partyManageIBLL.SaveEntity(keyValue, entity); return Success("保存成功!"); } #endregion diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/PartyManage/Form.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/PartyManage/Form.cshtml index 391cf7119..3414cfe58 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/PartyManage/Form.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/PartyManage/Form.cshtml @@ -3,17 +3,25 @@ Layout = "~/Views/Shared/_Form.cshtml"; }
-
+
+
学年*
+
+
+
+
学期
+
+
+
所属分类*
-
+
-
+
标题*
-
+
附件上传
-
+
@Html.AppendJsFile("/Areas/PersonnelManagement/Views/PartyManage/Form.js") diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/PartyManage/Form.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/PartyManage/Form.js index ec7df247e..8a8902995 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/PartyManage/Form.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/PartyManage/Form.js @@ -15,6 +15,22 @@ var bootstrap = function ($, learun) { page.initData(); }, bind: function () { + $('#Year').lrselect({ + placeholder: "学年", + allowSearch: false, + url: top.$.rootUrl + '/EducationalAdministration/EADateArrange/GetAcademicYearNo', + value: 'value', + text: 'text', + maxHeight: 200, + }); + //学期 + $('#Semester').lrselect({ + placeholder: "学期", + allowSearch: false, + url: top.$.rootUrl + '/EducationalAdministration/EADateArrange/GetSemester', + value: 'value', + text: 'text' + }); $('#CateId').lrDataSourceSelect({ code: 'partycate',value: 'id',text: 'name' }); $('#Filepath').lrUploader(); }, @@ -38,9 +54,9 @@ var bootstrap = function ($, learun) { if (!$('body').lrValidform()) { return false; } - var postData = {}; - postData.strpartyManageEntity = JSON.stringify($('[data-table="PartyManage"]').lrGetFormData()); - postData.strEntity = JSON.stringify($('[data-table="PartyCate"]').lrGetFormData()); + var postData = { + strEntity: JSON.stringify($('body').lrGetFormData()) + }; $.lrSaveForm(top.$.rootUrl + '/PersonnelManagement/PartyManage/SaveForm?keyValue=' + keyValue, postData, function (res) { // 保存成功后才回调 if (!!callBack) { diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/PartyManage/Index.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/PartyManage/Index.cshtml index 4326e55de..6fb61cb4f 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/PartyManage/Index.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/PartyManage/Index.cshtml @@ -19,6 +19,28 @@
+
+
+
+
+
标题
+ +
+ @*
+
创建人
+
+
*@ +
+
学年
+
+
+
+
学期
+
+
+
+
+
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/PartyManage/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/PartyManage/Index.js index 66dd6cfa8..671c15b28 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/PartyManage/Index.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/PartyManage/Index.js @@ -67,6 +67,22 @@ var bootstrap = function ($, learun) { page.search(queryJson); } }, 220, 400); + $('#Year').lrselect({ + placeholder: "学年", + allowSearch: false, + url: top.$.rootUrl + '/EducationalAdministration/EADateArrange/GetAcademicYearNo', + value: 'value', + text: 'text', + maxHeight: 200, + }); + //学期 + $('#Semester').lrselect({ + placeholder: "学期", + allowSearch: false, + url: top.$.rootUrl + '/EducationalAdministration/EADateArrange/GetSemester', + value: 'value', + text: 'text' + }); // 新增 $('#lr_add').on('click', function () { learun.layerForm({ @@ -102,7 +118,7 @@ var bootstrap = function ($, learun) { if (learun.checkrow(keyValue)) { learun.layerConfirm('是否确认删除该项!', function (res) { if (res) { - learun.deleteForm(top.$.rootUrl + '/PersonnelManagement/PartyManage/DeleteForm', { keyValue: keyValue}, function () { + learun.deleteForm(top.$.rootUrl + '/PersonnelManagement/PartyManage/DeleteForm', { keyValue: keyValue }, function () { refreshGirdData(); }); } @@ -128,7 +144,7 @@ var bootstrap = function ($, learun) { //访问情况统计 $("#lr_statistics").on('click', function () { - var keyValue = $('#gridtable').jfGridValue('FFile'); + var keyValue = $('#gridtable').jfGridValue('Filepath'); if (learun.checkrow(keyValue)) { learun.layerFormForPercent({ id: 'form', @@ -150,18 +166,22 @@ var bootstrap = function ($, learun) { $('#gridtable').jfGrid({ url: top.$.rootUrl + '/PersonnelManagement/PartyManage/GetPageList', headData: [ - { label: "所属分类", name: "CateId", width: 200, align: "left", - formatterAsync: function (callback, value, row, op,$cell) { - learun.clientdata.getAsync('custmerData', { - url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'partycate', - key: value, - keyId: 'id', - callback: function (_data) { - callback(_data['name']); - } - }); - }}, - { label: "标题", name: "Title", width: 200, align: "left"}, + { + label: "所属分类", name: "CateId", width: 200, align: "left", + formatterAsync: function (callback, value, row, op, $cell) { + learun.clientdata.getAsync('custmerData', { + url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'partycate', + key: value, + keyId: 'id', + callback: function (_data) { + callback(_data['name']); + } + }); + } + }, + { label: "学年", name: "Year", width: 200, align: "left" }, + { label: "学期", name: "Semester", width: 200, align: "left" }, + { label: "标题", name: "Title", width: 200, align: "left" }, { label: "附件上传", name: "Filepath", width: 200, align: "left" , formatterAsync: function (callback, value, row, op, $cell) { @@ -181,7 +201,7 @@ var bootstrap = function ($, learun) { } }, ], - mainId:'ID', + mainId: 'ID', isPage: true }); }, @@ -189,7 +209,7 @@ 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 () { diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/PartyManage/PartyManageBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/PartyManage/PartyManageBLL.cs index c84fc8364..13221646a 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/PartyManage/PartyManageBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/PartyManage/PartyManageBLL.cs @@ -24,7 +24,7 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement /// 分页参数 /// 查询参数 /// - public IEnumerable GetPageList(Pagination pagination, string queryJson) + public IEnumerable GetPageList(Pagination pagination, string queryJson) { try { @@ -163,11 +163,11 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement /// 主键 /// 实体 /// - public void SaveEntity(string keyValue, PartyCateEntity entity,PartyManageEntity partyManageEntity) + public void SaveEntity(string keyValue, PartyManageEntity entity) { try { - partyManageService.SaveEntity(keyValue, entity,partyManageEntity); + partyManageService.SaveEntity(keyValue, entity); } catch (Exception ex) { diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/PartyManage/PartyManageEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/PartyManage/PartyManageEntity.cs index 383ee7e8d..f464658cc 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/PartyManage/PartyManageEntity.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/PartyManage/PartyManageEntity.cs @@ -51,6 +51,12 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement public string Filepath { get; set; } [Column("CTYPE")] public string CType { get; set; } + [Column("YEAR")] + public string Year { get; set; } + + [Column("SEMESTER")] + public string Semester { get; set; } + #endregion #region 扩展操作 @@ -60,6 +66,8 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement public void Create() { this.ID = Guid.NewGuid().ToString(); + this.Createtime = DateTime.Now; + this.Creator = LoginUserInfo.Get().userId; } /// /// 编辑调用 diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/PartyManage/PartyManageIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/PartyManage/PartyManageIBLL.cs index 838bc9af9..3f92140b6 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/PartyManage/PartyManageIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/PartyManage/PartyManageIBLL.cs @@ -20,7 +20,7 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement /// /// 查询参数 /// - IEnumerable GetPageList(Pagination pagination, string queryJson); + IEnumerable GetPageList(Pagination pagination, string queryJson); /// /// 获取PartyManage表实体数据 /// @@ -50,7 +50,7 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement ///
/// 主键 /// 实体 - void SaveEntity(string keyValue, PartyCateEntity entity,PartyManageEntity partyManageEntity); + void SaveEntity(string keyValue, PartyManageEntity entity); #endregion } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/PartyManage/PartyManageService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/PartyManage/PartyManageService.cs index 964253513..3088e069f 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/PartyManage/PartyManageService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/PartyManage/PartyManageService.cs @@ -25,7 +25,7 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement /// 查询参数 /// 查询参数 /// - public IEnumerable GetPageList(Pagination pagination, string queryJson) + public IEnumerable GetPageList(Pagination pagination, string queryJson) { try { @@ -37,7 +37,33 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement var queryParam = queryJson.ToJObject(); // 虚拟参数 var dp = new DynamicParameters(new { }); - return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(), dp, pagination); + if (!queryParam["Year"].IsEmpty()) + { + dp.Add("Year", queryParam["Year"].ToString(), DbType.String); + strSql.Append(" AND t.Year = @Year "); + } + if (!queryParam["Semester"].IsEmpty()) + { + dp.Add("Semester", queryParam["Semester"].ToString(), DbType.String); + strSql.Append(" AND t.Semester = @Semester "); + } + if (!queryParam["Creator"].IsEmpty()) + { + dp.Add("Creator", queryParam["Creator"].ToString(), DbType.String); + strSql.Append(" AND t.Creator = @Creator "); + } + if (!queryParam["CateId"].IsEmpty()) + { + dp.Add("CateId", queryParam["CateId"].ToString(), DbType.String); + strSql.Append(" AND t.CateId = @CateId "); + } + if (!queryParam["StartTime"].IsEmpty() && !queryParam["EndTime"].IsEmpty()) + { + dp.Add("startTime", queryParam["StartTime"].ToDate(), DbType.DateTime); + dp.Add("endTime", queryParam["EndTime"].ToDate(), DbType.DateTime); + strSql.Append(" AND ( t.Createtime >= @startTime AND t.Createtime <= @endTime ) "); + } + return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(), dp, pagination); } catch (Exception ex) { @@ -61,7 +87,7 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement { try { - return this.BaseRepository("CollegeMIS").FindEntity(t => t.CateId == keyValue); + return this.BaseRepository("CollegeMIS").FindEntity(keyValue); } catch (Exception ex) { @@ -159,34 +185,23 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement /// /// 主键 /// 实体 - public void SaveEntity(string keyValue, PartyCateEntity entity, PartyManageEntity partyManageEntity) + public void SaveEntity(string keyValue, PartyManageEntity entity) { - var db = this.BaseRepository("CollegeMIS").BeginTrans(); try { if (!string.IsNullOrEmpty(keyValue)) { - var partyCateEntityTmp = GetPartyCateEntity(keyValue); entity.Modify(keyValue); - db.Update(entity); - db.Delete(t => t.CateId == partyCateEntityTmp.ID); - partyManageEntity.Create(); - partyManageEntity.CateId = partyCateEntityTmp.ID; - db.Insert(partyManageEntity); + this.BaseRepository("CollegeMIS").Update(entity); } else { entity.Create(); - db.Insert(entity); - partyManageEntity.Create(); - partyManageEntity.CateId = entity.ID; - db.Insert(partyManageEntity); + this.BaseRepository("CollegeMIS").Insert(entity); } - db.Commit(); } catch (Exception ex) { - db.Rollback(); if (ex is ExceptionEx) { throw;