diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Organization/User/UserBLL.cs b/Learun.Framework.Ultimate V7/Learun.Application.Organization/User/UserBLL.cs index dc2182b7e..d86188c5b 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Organization/User/UserBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Organization/User/UserBLL.cs @@ -407,6 +407,31 @@ namespace Learun.Application.Organization } } } + /// + /// 获取实体,通过用户名 + /// + /// 用户账号 + /// + public UserEntity GetEntityByName(string name) + { + try + { + UserEntity userEntity; + userEntity = userService.GetEntityByName(name); + return userEntity; + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } public void UpdateIp(string ip, string id) { diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Organization/User/UserIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Application.Organization/User/UserIBLL.cs index 1472103c9..d3638ade7 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Organization/User/UserIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Organization/User/UserIBLL.cs @@ -76,6 +76,12 @@ namespace Learun.Application.Organization /// UserEntity GetEntityByAccount(string account); /// + /// 获取实体,通过用户名 + /// + /// 用户账号 + /// + UserEntity GetEntityByName(string account); + /// /// 获取用户数据 /// /// 用户主键 diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Organization/User/UserService.cs b/Learun.Framework.Ultimate V7/Learun.Application.Organization/User/UserService.cs index 4cc8bce5b..c3bd4ab11 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Organization/User/UserService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Organization/User/UserService.cs @@ -55,6 +55,30 @@ namespace Learun.Application.Organization } } /// + /// 获取实体,通过用户账号 + /// + /// 用户账号 + /// + public UserEntity GetEntityByName(string name) + { + try + { + return this.BaseRepository() + .FindEntity(a => a.F_RealName.Equals(name) && a.F_DeleteMark == 0); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + /// /// 用户列表(根据公司主键) /// /// 公司主键 @@ -81,7 +105,7 @@ namespace Learun.Application.Organization } } } - internal bool GetStuAny() + internal bool GetStuAny() { try { @@ -557,7 +581,7 @@ namespace Learun.Application.Organization { try { - return this.BaseRepository().FindList(a=>a.F_DepartmentId==departmentId).ToList(); + return this.BaseRepository().FindList(a => a.F_DepartmentId == departmentId).ToList(); } catch (Exception ex) { @@ -576,7 +600,7 @@ namespace Learun.Application.Organization try { var ids = departmentId.Split(','); - return this.BaseRepository().FindList(a=> ids.Contains(a.F_DepartmentId)).ToList(); + return this.BaseRepository().FindList(a => ids.Contains(a.F_DepartmentId)).ToList(); } catch (Exception ex) { @@ -590,7 +614,7 @@ namespace Learun.Application.Organization } } } - + /// @@ -798,14 +822,14 @@ namespace Learun.Application.Organization string path = ""; try { - var userentity=BaseRepository().FindEntity("select a.*,b.Photo from LR_Base_User a " + - "left join "+BaseRepository("CollegeMIS").getDbConnection().Database+ - ".dbo.empinfo b on a.F_Account=b.empno where a.F_UserId='"+userid+"'", null); - if (userentity!=null&&!string.IsNullOrEmpty(userentity.Photo)) + var userentity = BaseRepository().FindEntity("select a.*,b.Photo from LR_Base_User a " + + "left join " + BaseRepository("CollegeMIS").getDbConnection().Database + + ".dbo.empinfo b on a.F_Account=b.empno where a.F_UserId='" + userid + "'", null); + if (userentity != null && !string.IsNullOrEmpty(userentity.Photo)) { //获取图片 - var LR_Base_AnnexesFile = BaseRepository().FindEntity("select * from LR_Base_AnnexesFile where F_FolderId='"+ userentity.Photo + "'", null); - if (LR_Base_AnnexesFile!=null) + var LR_Base_AnnexesFile = BaseRepository().FindEntity("select * from LR_Base_AnnexesFile where F_FolderId='" + userentity.Photo + "'", null); + if (LR_Base_AnnexesFile != null) { path = LR_Base_AnnexesFile.F_FilePath; } diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Controllers/ExcelImportController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Controllers/ExcelImportController.cs index 24c0d8cc3..7e7159e5f 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Controllers/ExcelImportController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Controllers/ExcelImportController.cs @@ -226,6 +226,36 @@ namespace Learun.Application.Web.Areas.LR_SystemModule.Controllers return Fail("导入数据失败!"); } } + /// + /// 工资导入 + /// + /// 模板Id + /// 文件主键 + /// 分片数 + /// 文件扩展名 + /// + [HttpPost] + [ValidateAntiForgeryToken] + public ActionResult ExecuteImportSaralExcel(string fileId, int chunks,string ext) + { + UserInfo userInfo = LoginUserInfo.Get(); + string path = annexesFileIBLL.SaveAnnexes(fileId, fileId + "."+ ext, chunks, userInfo); + if (!string.IsNullOrEmpty(path)) + { + DataTable dt = ExcelHelper.ExcelImport(path); + string res = excelImportIBLL.ImportSalaryInfo(dt,fileId); + var data = new + { + Success = res.Split('|')[0], + Fail = res.Split('|')[1] + }; + return JsonResult(data); + } + else + { + return Fail("导入数据失败!"); + } + } /// /// 下载文件(导入文件未被导入的数据) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/ExcelExport/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/ExcelExport/Index.js index b0e741e6c..ada65c5bb 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/ExcelExport/Index.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Views/ExcelExport/Index.js @@ -24,6 +24,7 @@ var bootstrap = function ($, learun) { } else { moduleId = item.id; + page.search(); } $('#titleinfo').text(item.text); } diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Controllers/Sal_UserSalaryController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Controllers/Sal_UserSalaryController.cs index df439a7a6..b6df361d8 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Controllers/Sal_UserSalaryController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Controllers/Sal_UserSalaryController.cs @@ -4,6 +4,7 @@ using System.Data; using Learun.Application.TwoDevelopment.PersonnelManagement; using System.Web.Mvc; using System.Collections.Generic; +using System.Drawing; using System.Linq; namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers @@ -42,6 +43,15 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers return View(); } /// + /// 工资导入 + /// + /// + [HttpGet] + public ActionResult ImportForm() + { + return View(); + } + /// /// 表单页 /// /// @@ -256,5 +266,47 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers } #endregion + #region 获取模板 + + /// + /// 下载工资导入模板 + /// + [HttpPost] + [ValidateAntiForgeryToken] + public void DownTemplate() + { + //设置导出格式 + ExcelConfig excelConfig=new ExcelConfig(); + excelConfig.FileName = "工资导入模板.xls"; + excelConfig.IsAllSizeColumn = true; + excelConfig.ColumnEntity=new List(); + //获取工资列 + var itemList = sal_UserSalaryIBLL.GetAllTemplateInfo(); + //表头 + DataTable dt=new DataTable(); + excelConfig.ColumnEntity.Add(new ColumnModel() + { + Column = "姓名", + ExcelColumn = "姓名", + Alignment = "center", + Background = new Color() + }); + dt.Columns.Add("姓名", typeof(string)); + foreach (var item in itemList) + { + excelConfig.ColumnEntity.Add(new ColumnModel() + { + Column = item.STIName, + ExcelColumn = item.STIName, + Alignment = "center", + Background = new Color() + }); + dt.Columns.Add(item.STIName, typeof(string)); + } + ExcelHelper.ExcelDownload(dt, excelConfig); + + } + #endregion + } } diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/Sal_UserSalary/ImportForm.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/Sal_UserSalary/ImportForm.cshtml new file mode 100644 index 000000000..75bc4f7e7 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/Sal_UserSalary/ImportForm.cshtml @@ -0,0 +1,25 @@ +@{ + ViewBag.Title = "Form"; + Layout = "~/Views/Shared/_Form.cshtml"; +} + + +@Html.AppendCssFile("/Areas/PersonnelManagement/Views/Sal_UserSalary/ImportForm.css") + +
+
+
上传文件
+
下载模板
+
+
+
+
+ +
+
+

试试将电脑里的文件拖拽到此上传

+
+
+
+
+@Html.AppendJsFile("/Areas/PersonnelManagement/Views/Sal_UserSalary/ImportForm.js") diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/Sal_UserSalary/ImportForm.css b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/Sal_UserSalary/ImportForm.css new file mode 100644 index 000000000..04b556b7a --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/Sal_UserSalary/ImportForm.css @@ -0,0 +1,136 @@ +.lr-form-layout-body { + padding:0 5px 5px 5px; +} +.lr-form-file-queue-wrap { + position:relative; + width:100%; + height:100%; + border:1px solid #ddd; + border-radius:4px; +} +.lr-form-file-queue { + position:relative; +} +.lr-form-file-queue { + position:relative; +} +.lr-form-file-queue-item { + position:relative; + width:100%; + height:50px; + border-bottom:1px solid #ddd; + padding-left:60px; + +} +.lr-file-image { + position:absolute; + top:5px; + left:5px; +} +.lr-file-image img { + width:40px; + height:40px; +} +.lr-file-name{ + line-height:50px; + +} +.lr-msg { + position:absolute; + top:0; + right:5px; + font-size: 25px; + line-height:50px; +} +.lr-msg .fa-check-circle{ + color: #5cb85c; +} +.lr-msg .fa-exclamation-circle { + color: #b94a48; +} +.lr-msg2 { + position:absolute; + top:0; + right:5px; + line-height:50px; +} +.lr-msg2 span { + color:#333; + font-size:14px; + margin-right:5px; +} + +.lr-tool-bar { + position:absolute; + top:0; + right:35px; + font-size: 25px; + line-height:50px; + color:#666; + cursor:pointer; +} +.lr-tool-bar > i { + margin-left:8px; +} + +.lr-tool-bar .fa-minus-circle { + color: #b94a48; +} +.lr-tool-bar .fa-cloud-download { + color: #3498db; +} + +.lr-uploader-progress { + position:absolute; + bottom:2px; + left:60px; + height:4px; + width:500px; + width:calc(100% - 90px); +} +.lr-uploader-progress-bar { + position:relative; + height:100%; + background-color:#039cfd; + border-radius:4px; +} + + +.lr-form-file-queue-bg { + position:absolute; + top:50%; + left:50%; + width:300px; + height:30px; + line-height:30px; + + margin:-15px 0 0 -150px; +} +.lr-form-file-queue-bg h1 { + color: #666; + font-size: 20px; + font-family: Microsoft Yahei; + padding-bottom: 2px; + margin: 0; +} +#lr_down_file_btn { + position:absolute; + right:5px; + background:#fff; + border:1px solid #ddd; + color:#333; +} +#lr_down_file_btn:hover { + color:#337ab7; +} +/*对百度插件的样式重写*/ +.webuploader-container { + position:absolute; +} +.webuploader-pick { + padding:8px 15px; + background-color:#039cfd; +} +.webuploader-pick-hover { + background-color:#027dcb; +} \ No newline at end of file diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/Sal_UserSalary/ImportForm.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/Sal_UserSalary/ImportForm.js new file mode 100644 index 000000000..50fa7e312 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/Sal_UserSalary/ImportForm.js @@ -0,0 +1,242 @@ +/* + * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn) + * Copyright (c) 2013-2018 北京泉江科技有限公司 + * 创建人:陈彬彬 + * 日 期:2017.04.11 + * 描 述:导入Excel + */ +var id = request('id'); + +var keyVaule = ''; + +var bootstrap = function ($, learun) { + "use strict"; + + var page1 = { + init: function () { + page.bind(); + page.initData(); + }, + bind: function () { + $('#lr_add_format').on('click', function () { + currentColRow = null; + learun.layerForm({ + id: 'FormatForm', + title: '添加', + url: top.$.rootUrl + '/LR_SystemModule/CodeRule/FormatForm', + width: 450, + height: 310, + callBack: function (id) { + return top[id].acceptClick(function (data) { + $('#gridtable').jfGridSet('addRow', { row: data }); + }); + } + }); + }); + $('#lr_edit_format').on('click', function () { + currentColRow = $('#gridtable').jfGridGet('rowdata'); + var _id = currentColRow ? currentColRow.itemTypeName : ''; + if (learun.checkrow(_id)) { + learun.layerForm({ + id: 'FormatForm', + title: '修改', + url: top.$.rootUrl + '/LR_SystemModule/CodeRule/FormatForm', + width: 450, + height: 310, + callBack: function (id) { + return top[id].acceptClick(function (data) { + $('#gridtable').jfGridSet('updateRow', { row: data }); + }); + } + }); + } + + }); + $('#lr_delete_format').on('click', function () { + currentColRow = null; + var row = $('#gridtable').jfGridGet('rowdata'); + var _id = row ? row.itemTypeName : ''; + if (learun.checkrow(_id)) { + learun.layerConfirm('是否确认删除该项!', function (res, index) { + if (res) { + $('#gridtable').jfGridSet('removeRow'); + top.layer.close(index); //再执行关闭 + } + }); + } + }); + + $('#gridtable').jfGrid({ + headData: [ + { label: "前缀", name: "itemTypeName", width: 120, align: "left" }, + { label: "格式", name: "formatStr", width: 120, align: "left" }, + { label: "步长", name: "stepValue", width: 100, align: "left" }, + { label: "初始值", name: "initValue", width: 120, align: "left" }, + { label: "说明", name: "description", width: 180, align: "left" } + ] + }); + + /*检测重复项*/ + $('#F_EnCode').on('blur', function () { + $.lrExistField(keyValue, 'F_EnCode', top.$.rootUrl + '/LR_SystemModule/CodeRule/ExistEnCode'); + }); + $('#F_FullName').on('blur', function () { + $.lrExistField(keyValue, 'F_FullName', top.$.rootUrl + '/LR_SystemModule/CodeRule/ExistFullName'); + }); + }, + initData: function () { + if (!!selectedRow) { + keyValue = selectedRow.F_RuleId; + $('#form').lrSetFormData(selectedRow); + var formatdata = JSON.parse(selectedRow.F_RuleFormatJson); + $('#gridtable').jfGridSet('refreshdata', formatdata); + } + } + }; + + var fileInfo = {}; + + // 触发合并文件碎片 + var mergeFileChunks = function (file) { + + + var param = {}; + param['__RequestVerificationToken'] = $.lrToken; + param['fileId'] = fileInfo[file.id].fileGuid; + param['chunks'] = fileInfo[file.id].chunks; + param['ext'] = file.ext; + param['templateId'] = id; + learun.httpAsyncPost(top.$.rootUrl + "/LR_SystemModule/ExcelImport/ExecuteImportSaralExcel", param, function (res) { + var $fileItem = $('#lr_form_file_queue_list').find('#lr_filequeue_' + file.id); + $fileItem.find('.lr-uploader-progress').remove(); + if (res.code == learun.httpCode.success) { + if (res.data.Success != '0') { + learun.alert.success('导入成功' + res.data.Success + '条'); + } + // 文件保存成功后 + $fileItem.append('
' + res.data.Success + '/' + res.data.Fail + '
'); + // 如果有失败 + if (res.data.Fail != '0') + { + learun.download({ url: top.$.rootUrl + '/LR_SystemModule/ExcelImport/DownImportErrorFile', param: { fileId: fileInfo[file.id].fileGuid, fileName: fileInfo[file.id].name, __RequestVerificationToken: $.lrToken }, method: 'POST' }); + } + } + else { + $fileItem.append('
'); + } + }); + } + // 触发清楚文件碎片 + var reomveFileChunks = function (file) { + var param = {}; + param['__RequestVerificationToken'] = $.lrToken; + param['fileGuid'] = fileInfo[file.id].fileGuid; + param['chunks'] = fileInfo[file.id].chunks; + learun.httpAsyncPost(top.$.rootUrl + "/LR_SystemModule/Annexes/MergeAnnexesFile", param, function (res) { }); + var $fileItem = $('#lr_form_file_queue_list').find('#lr_filequeue_' + file.id); + $fileItem.find('.lr-uploader-progress').remove(); + $fileItem.append('
'); + } + + var page = { + uploader: null, + init: function () { + /*模板下载*/ + $('#lr_down_file_btn').on('click', function () { + learun.download({ url: top.$.rootUrl + '/PersonnelManagement/Sal_UserSalary/DownTemplate', param: { keyValue: id, __RequestVerificationToken: $.lrToken }, method: 'POST' }); + }); + + + if (!WebUploader.Uploader.support()) { + alert('Web Uploader 不支持您的浏览器!如果你使用的是IE浏览器,请尝试升级 flash 播放器'); + throw new Error('WebUploader does not support the browser you are using.'); + } + + page.uploader = WebUploader.create({ + auto: true, + swf: top.$.rootUrl + '/Content/webuploader/Uploader.swf', + // 文件接收服务端。 + server: top.$.rootUrl + "/LR_SystemModule/Annexes/UploadAnnexesFileChunk", + // 选择文件的按钮。可选。 + // 内部根据当前运行是创建,可能是input元素,也可能是flash. + pick: '#lr_add_file_btn', + dnd: '#lr_form_file_queue', + paste: 'document.body', + disableGlobalDnd: true, + accept: { + extensions: "xls,xlsx" + }, + multiple: true, + // 不压缩image, 默认如果是jpeg,文件上传前会压缩一把再上传! + resize: false, + // 文件分片上传 + chunked: true, + chunkRetry: 3, + prepareNextFile: true, + chunkSize: '1048576', + // 上传参数 + formData: { + __RequestVerificationToken: $.lrToken + } + }); + page.uploader.on('fileQueued', page.fileQueued); + page.uploader.on('uploadStart', page.uploadStart); + page.uploader.on('uploadBeforeSend', page.uploadBeforeSend); + page.uploader.on('uploadProgress', page.uploadProgress); + page.uploader.on('uploadSuccess', page.uploadSuccess); + page.uploader.on('uploadError', page.uploadError); + page.uploader.on('uploadComplete', page.uploadComplete); + page.uploader.on('error', page.error); + + $('#lr_form_file_queue').lrscroll(); + + }, + fileQueued: function (file) {// 文件加载到队列 + fileInfo[file.id] = { name: file.name }; + $('#lr_form_file_queue .lr-form-file-queue-bg').hide(); + // 添加一条文件记录 + var $item = $('
'); + $item.append('
'); + $item.append('' + file.name + '(' + learun.countFileSize(file.size) + ')'); + + $('#lr_form_file_queue_list').append($item); + }, + uploadStart: function (file) { + var $fileItem = $('#lr_form_file_queue_list').find('#lr_filequeue_' + file.id); + $fileItem.append('
'); + }, + uploadBeforeSend: function (object, data, headers) { + data.chunk = data.chunk || 0; + data.chunks = data.chunks || 1; + fileInfo[data.id].fileGuid = fileInfo[data.id].fileGuid || WebUploader.Base.guid(); + data.fileGuid = fileInfo[data.id].fileGuid; + fileInfo[data.id].chunks = data.chunks; + }, + uploadProgress: function (file, percentage) { + var $fileItem = $('#lr_form_file_queue_list').find('#lr_filequeue_' + file.id); + $fileItem.find('.lr-uploader-progress-bar').css('width', (percentage * 100 + '%')); + }, + uploadSuccess: function (file, res) { + if (res.code == 200) {// 上传成功 + mergeFileChunks(file); + } + else {// 上传失败 + reomveFileChunks(file); + } + }, + uploadError: function (file, code) { + reomveFileChunks(file); + }, + uploadComplete: function (file) { + }, + error: function (type) { + switch (type) { + case 'Q_TYPE_DENIED': + learun.alert.error('当前文件类型不允许上传'); + break; + }; + } + }; + page.init(); + +} \ No newline at end of file diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/Sal_UserSalary/Index.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/Sal_UserSalary/Index.cshtml index ce7d4451a..bb14df0c5 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/Sal_UserSalary/Index.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/Sal_UserSalary/Index.cshtml @@ -7,6 +7,19 @@
+
+
+
+
+
+
+
+
单位组织
+
+
+
+
+
@@ -17,6 +30,7 @@  编辑  查看  删除 +  导入
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/Sal_UserSalary/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/Sal_UserSalary/Index.js index b84d17809..b2a5bbc2a 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/Sal_UserSalary/Index.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/Sal_UserSalary/Index.js @@ -7,12 +7,48 @@ var refreshGirdData; var bootstrap = function ($, learun) { "use strict"; + var startTime; + var endTime; var page = { init: function () { page.initGird(); page.bind(); }, bind: function () { + // 时间搜索框 + $('#datesearch').lrdate({ + dfdata: [ + { name: '今天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00') }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } }, + { name: '近7天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'd', -6) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } }, + { name: '近1个月', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'm', -1) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } }, + { name: '近3个月', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'm', -3) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } } + ], + // 月 + mShow: false, + premShow: false, + // 季度 + jShow: false, + prejShow: false, + // 年 + ysShow: false, + yxShow: false, + preyShow: false, + yShow: false, + // 默认 + dfvalue: '1', + selectfn: function (begin, end) { + startTime = begin; + endTime = end; + page.search(); + } + }); + + $('#multiple_condition_query').lrMultipleQuery(function (queryJson) { + page.search(queryJson); + }, 220, 400); + + $('#F_UserId').lrUserSelect(0); + // 刷新 $('#lr_refresh').on('click', function () { location.reload(); @@ -46,6 +82,18 @@ var bootstrap = function ($, learun) { }); } }); + $('#lr_import').on('click',function() { + learun.layerForm({ + id: 'form', + title: '导入', + url: top.$.rootUrl + '/PersonnelManagement/Sal_UserSalary/ImportForm', + width: 400, + height: 300, + callBack: function (id) { + return top[id].acceptClick(refreshGirdData); + } + }); + }) //查看 $('#lr_view').on('click', function () { var keyValue = $('#gridtable').jfGridValue('USId'); @@ -87,7 +135,7 @@ var bootstrap = function ($, learun) { { label: "人员", name: "F_UserId", width: 100, align: "left", formatterAsync: function (callback, value, row, op, $cell) { - learun.clientdata.getAsync('user', { + learun.clientdata.getAsyncReal('user', { key: value, callback: function (_data) { callback(_data.name); diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/Sal_UserSalary/IndexOfMy.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/Sal_UserSalary/IndexOfMy.cshtml index 17cd47c3d..738e454ca 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/Sal_UserSalary/IndexOfMy.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/Sal_UserSalary/IndexOfMy.cshtml @@ -7,6 +7,10 @@
+
+
+
+
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/Sal_UserSalary/IndexOfMy.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/Sal_UserSalary/IndexOfMy.js index 617815bf4..8abcd970b 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/Sal_UserSalary/IndexOfMy.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/Sal_UserSalary/IndexOfMy.js @@ -7,12 +7,42 @@ var refreshGirdData; var bootstrap = function ($, learun) { "use strict"; + var startTime; + var endTime; var page = { init: function () { page.initGird(); page.bind(); }, bind: function () { + // 时间搜索框 + $('#datesearch').lrdate({ + dfdata: [ + { name: '今天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00') }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } }, + { name: '近7天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'd', -6) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } }, + { name: '近1个月', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'm', -1) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } }, + { name: '近3个月', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'm', -3) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } } + ], + // 月 + mShow: false, + premShow: false, + // 季度 + jShow: false, + prejShow: false, + // 年 + ysShow: false, + yxShow: false, + preyShow: false, + yShow: false, + // 默认 + dfvalue: '1', + selectfn: function (begin, end) { + startTime = begin; + endTime = end; + page.search(); + } + }); + // 刷新 $('#lr_refresh').on('click', function () { location.reload(); 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 4ad27cb59..58dce53c2 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 @@ -1323,6 +1323,8 @@ + + @@ -6836,6 +6838,7 @@ + diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/script/lr-clientdata.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/script/lr-clientdata.js index 0e1a5ee34..f0f8a5e68 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/script/lr-clientdata.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/LR_Content/script/lr-clientdata.js @@ -99,6 +99,10 @@ }, update: function (name) { clientAsyncData[name].update && clientAsyncData[name].update(); + }, + getAsyncReal:function(name, op) { + clientAsyncData[name].states = 1; + return clientAsyncData[name].get(op); } }; diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Excel/Import/ExcelImportBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Excel/Import/ExcelImportBLL.cs index b5b49b70d..df3e70990 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Excel/Import/ExcelImportBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Excel/Import/ExcelImportBLL.cs @@ -8,7 +8,9 @@ using System; using System.Collections.Generic; using System.Data; using System.Linq; +using Learun.Application.Organization; using Learun.Application.TwoDevelopment.LogisticsManagement; +using Learun.Application.TwoDevelopment.PersonnelManagement; namespace Learun.Application.Excel @@ -30,6 +32,9 @@ namespace Learun.Application.Excel private DataItemIBLL dataItemIBLL = new DataItemBLL(); private StuEnrollIBLL stuEnrollIBLL = new StuEnrollBLL(); private DataSourceIBLL dataSourceIBLL = new DataSourceBLL(); + private Sal_UserSalaryIBLL sal_UserSalaryIBLL = new Sal_UserSalaryBLL(); + private Sal_UserSalaryItemIBLL sal_UserSalaryItemIBLL=new Sal_UserSalaryItemBLL(); + private UserIBLL userIBLL = new UserBLL(); #region 缓存定义 private ICache cache = CacheFactory.CaChe(); @@ -668,6 +673,105 @@ namespace Learun.Application.Excel + } + // 写入缓存如果有未导入的数据 + if (failDt.Rows.Count > 0) + { + string errordt = failDt.ToJson(); + + cache.Write(cacheKey + fileId, errordt, CacheId.excel); + } + + return snum + "|" + fnum; + } + + + /// + /// 导入工资条 + /// + /// + /// + /// + public string ImportSalaryInfo(DataTable dt, string fileId) + { + int snum = 0; + int fnum = 0; + decimal stall = 0; + decimal stactual = 0; + // 创建一个datatable容器用于保存导入失败的数据 + DataTable failDt = new DataTable(); + dt.Columns.Add("导入错误", typeof(string)); + foreach (DataColumn dc in dt.Columns) + { + failDt.Columns.Add(dc.ColumnName, dc.DataType); + } + + + + var data = accommodationIBLL.GetAllList().ToList(); + //获取工资条列 + var templateItemList = sal_UserSalaryIBLL.GetAllTemplateInfo(); + foreach (DataRow dr in dt.Rows) + { + try + { + //录入工资条信息 + Sal_UserSalaryEntity sal_UserSalaryEntity = new Sal_UserSalaryEntity(); + sal_UserSalaryEntity.Create(); + sal_UserSalaryEntity.F_UserId = userIBLL.GetEntityByName(dr["姓名"].ToString())?.F_UserId; + sal_UserSalaryEntity.USDate = DateTime.Now; + stall = 0;//重置应发合计 + stactual = 0;//重置实发合计 + foreach (var templateItem in templateItemList) + { + var stiValue = Convert.ToDecimal(dr[templateItem.STIName].ToString()); + //工资详细添加 + Sal_UserSalaryItemEntity sal_UserSalaryItemEntity=new Sal_UserSalaryItemEntity + { + USIId = Guid.NewGuid().ToString(), + USId=sal_UserSalaryEntity.USId, + STIId=templateItem.STIId, + STIValue = Convert.ToDecimal(stiValue) + }; + sal_UserSalaryItemIBLL.SaveEntity("", sal_UserSalaryItemEntity); + + //计算应发合计和实发合计 + if (templateItem.STIParticipation == "true") + { + if (templateItem.STIAdd == "true") + { + stactual += stiValue; + } + else + { + stactual -= stiValue; + } + } + if (templateItem.STIAdd == "true") + { + stall += stiValue; + } + else + { + stall -= stiValue; + } + } + + sal_UserSalaryEntity.STAll = stall; + sal_UserSalaryEntity.STActual = stactual; + sal_UserSalaryIBLL.SaveEntity("",sal_UserSalaryEntity); + snum++; + } + catch (Exception e) + { + dr["导入错误"] = dr["姓名"] + "导入错误"; + fnum++; + failDt.Rows.Add(dr.ItemArray); + continue; + } + + + } // 写入缓存如果有未导入的数据 if (failDt.Rows.Count > 0) diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Excel/Import/ExcelImportIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Excel/Import/ExcelImportIBLL.cs index 4a75c9c7d..2068039c1 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Excel/Import/ExcelImportIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Excel/Import/ExcelImportIBLL.cs @@ -72,6 +72,7 @@ namespace Learun.Application.Excel /// 导入数据 /// string ImportTable(string templateId, string fileId, DataTable dt); + string ImportSalaryInfo(DataTable dt, string fileId); /// /// 获取excel导入的错误数据 /// diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Excel/Learun.Application.Excel.csproj b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Excel/Learun.Application.Excel.csproj index 0267da1bd..caec095a0 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Excel/Learun.Application.Excel.csproj +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Excel/Learun.Application.Excel.csproj @@ -80,6 +80,10 @@ + + {E9877A25-801B-4605-AD35-E6306916513C} + Learun.Application.Organization + {975f2cb8-605c-4add-b365-b97bf844f0fe} Learun.Cache.Base diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/Sal_UserSalary/Sal_UserSalaryService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/Sal_UserSalary/Sal_UserSalaryService.cs index 0d7afb2de..88ab28822 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/Sal_UserSalary/Sal_UserSalaryService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/Sal_UserSalary/Sal_UserSalaryService.cs @@ -43,6 +43,12 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement var queryParam = queryJson.ToJObject(); // 虚拟参数 var dp = new DynamicParameters(new { }); + 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.USDate >= @startTime AND t.USDate <= @endTime ) "); + } if (!queryParam["F_UserId"].IsEmpty()) { dp.Add("F_UserId", queryParam["F_UserId"].ToString(), DbType.String);