From d67cb0c9792e23be7ccf655675cb32ac1a236b7b Mon Sep 17 00:00:00 2001 From: username@email.com <yzy2002yzy@163.com> Date: 星期五, 25 十一月 2022 09:49:22 +0800 Subject: [PATCH] 在人事管理页面增加查看员工考勤记录功能 --- zhengcaioa/zhengcaioa/Controllers/AdmManagement/SigninController.cs | 57 ++++++++++++++++++ zhengcaioa/zhengcaioa/Views/Signin/SigninAll.cshtml | 84 ++++++++++++++++++++++++++++ zhengcaioa/zhengcaioa/Views/User/Index.cshtml | 6 ++ 3 files changed, 146 insertions(+), 1 deletions(-) diff --git a/zhengcaioa/zhengcaioa/Controllers/AdmManagement/SigninController.cs b/zhengcaioa/zhengcaioa/Controllers/AdmManagement/SigninController.cs index bac4408..61c2aed 100644 --- a/zhengcaioa/zhengcaioa/Controllers/AdmManagement/SigninController.cs +++ b/zhengcaioa/zhengcaioa/Controllers/AdmManagement/SigninController.cs @@ -204,9 +204,64 @@ search.userId = curentuser.Id; return JsonConvert.SerializeObject(_signinService.SearchByPaging(search)); } + + + + /// <summary> + /// 鎴戠殑鑰冨嫟璁板綍 + /// </summary> + /// <returns></returns> + [CheckLogin] + public IActionResult SigninAll(string id) + { + JArray jar = new JArray(); + for (var i = 1; i <= 12; i++) + { + var jo = string.Format("\"code\":{0}, \"label\":\"{1}鏈圽" ", i, i); + jar.Add(JObject.Parse("{" + jo + "}")); + + } + ViewBag.month = jar; + JArray Year = new JArray(); + for (var i = -1; i < 2; i++) + { + var jo = string.Format("\"code\":{0}, \"label\":\"{0}骞碶" ", DateTime.Now.Year + i); + Year.Add(JObject.Parse("{" + jo + "}")); + } + ViewBag.year = Year; + ViewBag.userid = id; + List<ActionEntity> actionlist = new List<ActionEntity>(); + ActionEntity actionEntity = new ActionEntity(); + actionEntity.OpenType = 0; + actionEntity.ActionUrl = ""; + actionEntity.ActionFun = "Search"; + actionEntity.PageIco = "fa fa-search"; + actionEntity.ActionName = "鏌ヨ"; + actionlist.Add(actionEntity); + ViewData["ActionInfo"] = actionlist; + + return View(); + } + + + + /// <summary> + /// 鍙栧緱鑰冨嫟璁板綍 + /// </summary> + /// <returns></returns> + + [CheckLogin] + public string GetSigninListAll(AdmSignInDTOSearch search) + { + //var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User")); + //search.userId = curentuser.Id; + return JsonConvert.SerializeObject(_signinService.SearchByPaging(search)); + } + + #endregion #region 璇峰亣涓庨攢鍋� - public IActionResult AskLeave(string id="", string StratTimeName = "", string EndTimeName = "") + public IActionResult AskLeave(string id="", string StratTimeName = "", string EndTimeName = "") { var curentuser = JsonConvert.DeserializeObject<PltUser>(HttpContext.Session.GetString("User")); diff --git a/zhengcaioa/zhengcaioa/Views/Signin/SigninAll.cshtml b/zhengcaioa/zhengcaioa/Views/Signin/SigninAll.cshtml new file mode 100644 index 0000000..173bdf5 --- /dev/null +++ b/zhengcaioa/zhengcaioa/Views/Signin/SigninAll.cshtml @@ -0,0 +1,84 @@ +锘緻model DTO.AdmSignInDTO; +@using DTO; +@using zhengcaioa.Models; + +@{ + ViewBag.Title = "鎴戠殑鍑哄嫟璁板綍"; + Layout = "~/Views/Shared/_Layout_Search.cshtml"; +} +@section headerStyle{ + <script type="text/javascript"> + var year = '@Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(ViewBag.year))'; + var month = '@Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(ViewBag.month))'; + var userid = '@Html.Raw(ViewBag.userid)'; + var myDate = new Date(); + //鑾峰彇褰撳墠骞� + var searchyear = myDate.getFullYear(); + //鑾峰彇褰撳墠鏈� + var searchmonth = myDate.getMonth() + 1; + + dataCol = [ + { label: 'id', name: 'Id', labtype: 'txt', hidden: true }, + { + label: '鏃ユ湡', name: 'SgninDate', labtype: 'txt', hidden: false, + formatter: function (cellvalue, options, rowObject) { + return new Date(cellvalue).Format("yyyy-MM-dd");// dateFtt("yyyy-MM-dd",cellvalue) ; + } + }, + { label: '閮ㄩ棬', name: 'DeptName', labtype: 'txt', hidden: false }, + { label: '濮撳悕', name: 'UserName', labtype: 'txt', hidden: false }, + { label: '涓婂崍', name: 'Morning', labtype: 'txt', hidden: false }, + { label: '涓嬪崍', name: 'Afternoon', labtype: 'txt', hidden: false }, + { label: '鍔犵彮', name: 'Overtime', labtype: 'txt', hidden: false }, + //{ + // label: '璇峰亣', name: 'id', align: "center", sortable: false, editable: true,// labtype: 'txt', hidden: false + // formatter: function (cellvalue, options, rowObject) { + // return '<a href="javascript:void(0)" onclick="AskLeave(\'\',\'' + new Date(rowObject.SgninDate).Format("yyyy-MM-dd") + '\',\'' + new Date(rowObject.SgninDate).Format("yyyy-MM-dd") + '\');"><span style="background: #ECF3FF;">璇峰亣</span></a> ' + + // '<a href="javascript:void(0)" onclick="AskLeaveOff(\'\',\'' + new Date(rowObject.SgninDate).Format("yyyy-MM-dd") + '\',\'' + new Date(rowObject.SgninDate).Format("yyyy-MM-dd") + '\');"><span style="background: #ECF3FF;">閿�鍋�</span></a>'; + // } + //}, + + { label: '鐘舵��', name: 'RecStatus', labtype: 'txt', hidden: true }, + { label: '鍒涘缓浜�', name: 'Creater', labtype: 'txt', hidden: true }, + { label: '鍒涘缓鏃堕棿', name: 'Createtime', labtype: 'txt', hidden: true }, + { label: '淇敼浜�', name: 'Modifier', labtype: 'txt', hidden: true }, + { label: '淇敼鏃堕棿', name: 'Modifytime', labtype: 'txt', hidden: true } + + ]; + dataUrl = "/Signin/GetSigninListAll?userId=" + userid; + //?userId=" + "@ViewBag.userId"; + searchCol = [ + + { label: '鏌ヨ鏃堕棿锛氬勾', name: 'Year', labtype: 'combox', hidden: false, defultvalue: searchyear , data: JSON.parse(year), cwidth: '5%', cccwidth: '9%' }, + { label: '鏈�', name: 'Month', labtype: 'combox', hidden: false, defultvalue: searchmonth ,data: JSON.parse(month), cwidth: '1%', cccwidth: '7%' } + + ]; + + + function AskLeave(id, StratTimeName, EndTimeName) { + OpenWindow("璇峰亣鐢宠", "500px", "800px", "/Signin/AskLeave?id=&StratTimeName=" + StratTimeName + "&EndTimeName=" + EndTimeName); + + } + + function AskLeaveOff(id, StratTimeName, EndTimeName) { + OpenWindow("閿�鍋囩敵璇�", "500px", "800px", "/Signin/AskLeaveOff?id=&StratTimeName=" + StratTimeName + "&EndTimeName=" + EndTimeName); + } + var _afterSave = function (result) { + if (result) { + toastr.success("淇濆瓨鎴愬姛"); + } else { + toastr.error("淇濆瓨澶辫触"); + } + } + + var _afterDel = function (result) { + if (result) { + toastr.success("鍒犻櫎鎴愬姛"); + } else { + /**/ + toastr.error("鍒犻櫎鎴愬姛"); + /**/ + } + } + </script> +} diff --git a/zhengcaioa/zhengcaioa/Views/User/Index.cshtml b/zhengcaioa/zhengcaioa/Views/User/Index.cshtml index 2cc3698..dec9729 100644 --- a/zhengcaioa/zhengcaioa/Views/User/Index.cshtml +++ b/zhengcaioa/zhengcaioa/Views/User/Index.cshtml @@ -116,6 +116,12 @@ return "<a class=\"Dayin\" style=\"display: none;\" onclick=\"OpenWindow('鎵撳嵃绠�鍘�','98%','100%', '/User/Print?id=" + rowObject.Id + "')\" > 鎵撳嵃 </a>"; } }, + { + label: '鑰冨嫟璁板綍', name: 'Daka', labtype: 'txt', hidden: false, width: 100, + formatter: function (cellvalue, options, rowObject) { + return "<a class=\"Daka\" style=\"display: none;\" onclick=\"OpenWindow('" + rowObject.UserName + "','98%','100%', '/Signin/SigninAll?id=" + rowObject.Id + "')\" > 鑰冨嫟璁板綍 </a>"; + } + }, { label: '鐘舵��', name: 'RecStatus', labtype: 'txt', hidden: true }, { label: '鍒涘缓浜�', name: 'Creater', labtype: 'txt', hidden: true }, -- Gitblit v1.9.1