username@email.com
2022-11-25 d67cb0c9792e23be7ccf655675cb32ac1a236b7b
在人事管理页面增加查看员工考勤记录功能
2个文件已修改
1个文件已添加
147 ■■■■■ 已修改文件
zhengcaioa/zhengcaioa/Controllers/AdmManagement/SigninController.cs 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhengcaioa/zhengcaioa/Views/Signin/SigninAll.cshtml 84 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zhengcaioa/zhengcaioa/Views/User/Index.cshtml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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"));
zhengcaioa/zhengcaioa/Views/Signin/SigninAll.cshtml
New file
@@ -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>&nbsp;&nbsp;&nbsp;&nbsp;' +
            //            '<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>
}
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 },