diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Controllers/ADR_RestrictionController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Controllers/ADR_RestrictionController.cs index c6aab7c23..7854787e5 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Controllers/ADR_RestrictionController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Controllers/ADR_RestrictionController.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,8 +71,9 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers [AjaxOnly] public ActionResult GetFormData(string keyValue) { - var ADR_RestrictionData = aDR_RestrictionIBLL.GetADR_RestrictionEntity( keyValue ); - var jsonData = new { + var ADR_RestrictionData = aDR_RestrictionIBLL.GetADR_RestrictionEntity(keyValue); + var jsonData = new + { ADR_Restriction = ADR_RestrictionData, }; return Success(jsonData); @@ -94,6 +95,18 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers return Success("删除成功!"); } /// + /// 启用限制 + /// + /// 主键 + /// + [HttpPost] + [AjaxOnly] + public ActionResult Enable(string keyValue) + { + aDR_RestrictionIBLL.Enable(keyValue); + return Success("启用成功!"); + } + /// /// 保存实体数据(新增、修改) /// /// 主键 @@ -105,7 +118,7 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers public ActionResult SaveForm(string keyValue, string strEntity) { ADR_RestrictionEntity entity = strEntity.ToObject(); - aDR_RestrictionIBLL.SaveEntity(keyValue,entity); + aDR_RestrictionIBLL.SaveEntity(keyValue, entity); if (string.IsNullOrEmpty(keyValue)) { } diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/ADR_Restriction/Index.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/ADR_Restriction/Index.cshtml index 0bf69441e..bcfbbe1a1 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/ADR_Restriction/Index.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/ADR_Restriction/Index.cshtml @@ -16,6 +16,7 @@  新增  编辑  删除 +  启用 diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/ADR_Restriction/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/ADR_Restriction/Index.js index 2105d76c0..20f62d7cd 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/ADR_Restriction/Index.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/ADR_Restriction/Index.js @@ -52,56 +52,79 @@ var bootstrap = function ($, learun) { if (learun.checkrow(keyValue)) { learun.layerConfirm('是否确认删除该项!', function (res) { if (res) { - learun.deleteForm(top.$.rootUrl + '/PersonnelManagement/ADR_Restriction/DeleteForm', { keyValue: keyValue}, function () { + learun.deleteForm(top.$.rootUrl + '/PersonnelManagement/ADR_Restriction/DeleteForm', { keyValue: keyValue }, function () { refreshGirdData(); }); } }); } }); + // 启用 + $('#lr_enable').on('click', function () { + var keyValue = $('#gridtable').jfGridValue('ID'); + if (learun.checkrow(keyValue)) { + learun.layerConfirm('是否确认启用!', function (res) { + if (res) { + learun.postForm(top.$.rootUrl + '/PersonnelManagement/ADR_Restriction/Enable', { keyValue: keyValue }, function () { + refreshGirdData(); + }); + } + }); + } + }); + }, // 初始化列表 initGird: function () { $('#gridtable').lrAuthorizeJfGrid({ url: top.$.rootUrl + '/PersonnelManagement/ADR_Restriction/GetPageList', headData: [ - { label: "上班时间", name: "WorkTime", width: 100, align: "left"}, - { label: "下班时间", name: "CloseTime", width: 100, align: "left"}, + { label: "上班时间", name: "WorkTime", width: 100, align: "left" }, + { label: "下班时间", name: "CloseTime", width: 100, align: "left" }, //{ label: "签到有效时间", name: "SignInStartTime", width: 100, align: "left"}, //{ label: "-", name: "SignInEndTime", width: 100, align: "left"}, //{ label: "签退有效时间", name: "SignOutStartTime", width: 100, align: "left"}, //{ label: "-", name: "SignOutEndTime", width: 100, align: "left"}, - { label: "允许迟到范围(分)", name: "LateOvertime", width: 100, align: "left"}, - { label: "允许早退范围(分)", name: "LeaveOverTime", width: 100, align: "left"}, - { label: "未签到,记为", name: "NoSignIn", width: 100, align: "left", - formatterAsync: function (callback, value, row, op,$cell) { - learun.clientdata.getAsync('dataItem', { - key: value, - code: 'ADStatus', - callback: function (_data) { - callback(_data.text); - } - }); - }}, - { label: "未签退,记为", name: "NoSignOut", width: 100, align: "left", - formatterAsync: function (callback, value, row, op,$cell) { - learun.clientdata.getAsync('dataItem', { - key: value, - code: 'ADStatus', - callback: function (_data) { - callback(_data.text); - } - }); - }}, + { label: "允许迟到范围(分)", name: "LateOvertime", width: 100, align: "left" }, + { label: "允许早退范围(分)", name: "LeaveOverTime", width: 100, align: "left" }, + { + label: "未签到,记为", name: "NoSignIn", width: 100, align: "left", + formatterAsync: function (callback, value, row, op, $cell) { + learun.clientdata.getAsync('dataItem', { + key: value, + code: 'ADStatus', + callback: function (_data) { + callback(_data.text); + } + }); + } + }, + { + label: "未签退,记为", name: "NoSignOut", width: 100, align: "left", + formatterAsync: function (callback, value, row, op, $cell) { + learun.clientdata.getAsync('dataItem', { + key: value, + code: 'ADStatus', + callback: function (_data) { + callback(_data.text); + } + }); + } + }, + { + label: "是否启用", name: "REnable", width: 100, align: "left", formatter: function (val) { + return val ? "" : ""; + } + }, ], - mainId:'ID', + mainId: 'ID', isPage: true }); page.search(); }, search: function (param) { param = param || {}; - $('#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/ADR_Restriction/ADR_RestrictionBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ADR_Restriction/ADR_RestrictionBLL.cs index f7fd1301a..9fb2465f9 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ADR_Restriction/ADR_RestrictionBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ADR_Restriction/ADR_RestrictionBLL.cs @@ -93,6 +93,28 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement } } } + /// + /// 启用限制 + /// + /// 主键 + public void Enable(string keyValue) + { + try + { + aDR_RestrictionService.Enable(keyValue); + } + 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.TwoDevelopment/PersonnelManagement/ADR_Restriction/ADR_RestrictionIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ADR_Restriction/ADR_RestrictionIBLL.cs index a2255542b..67e6c66a2 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ADR_Restriction/ADR_RestrictionIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ADR_Restriction/ADR_RestrictionIBLL.cs @@ -37,6 +37,11 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement /// 主键 void DeleteEntity(string keyValue); /// + /// 启用限制 + /// + /// 主键 + void Enable(string keyValue); + /// /// 保存实体数据(新增、修改) /// /// 主键 diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ADR_Restriction/ADR_RestrictionService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ADR_Restriction/ADR_RestrictionService.cs index 6aaf40df7..da393765d 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ADR_Restriction/ADR_RestrictionService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ADR_Restriction/ADR_RestrictionService.cs @@ -42,6 +42,7 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement t.LateOvertime, t.LeaveOverTime, t.NoSignIn, + t.REnable, t.NoSignOut "); strSql.Append(" FROM ADR_Restriction t "); @@ -49,7 +50,7 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement var queryParam = queryJson.ToJObject(); // 虚拟参数 var dp = new DynamicParameters(new { }); - return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(),dp, pagination); + return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(), dp, pagination); } catch (Exception ex) { @@ -100,7 +101,7 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement { try { - this.BaseRepository("CollegeMIS").Delete(t=>t.ID == keyValue); + this.BaseRepository("CollegeMIS").Delete(t => t.ID == keyValue); } catch (Exception ex) { @@ -114,6 +115,35 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement } } } + /// + /// 启用限制 + /// + /// 主键 + public void Enable(string keyValue) + { + var db = this.BaseRepository("CollegeMIS").BeginTrans(); + try + { + var sql = "UPDATE dbo.ADR_Restriction SET REnable='false'"; + db.ExecuteBySql(sql); + var entity = db.FindEntity(a => a.ID == keyValue); + entity.REnable = true; + db.Update(entity); + db.Commit(); + } + catch (Exception ex) + { + db.Rollback(); + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } /// /// 保存实体数据(新增、修改) @@ -154,7 +184,7 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement { try { - return this.BaseRepository("CollegeMIS").FindEntity(m=>m.REnable==true); + return this.BaseRepository("CollegeMIS").FindEntity(m => m.REnable == true); } catch (Exception ex) {